diff options
Diffstat (limited to 'jsf/plugins/org.eclipse.jst.jsf.core/src/org')
462 files changed, 0 insertions, 71240 deletions
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/IJSFCoreConstants.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/IJSFCoreConstants.java deleted file mode 100644 index 7e2d9c84b..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/IJSFCoreConstants.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core; - -/** - * JSF Core framework constants - * - * <p><b>Provisional API - subject to change</b></p> - * - * @author cbateman - * - */ -public final class IJSFCoreConstants -{ - /** - * The global id for the JSF facet - * TODO: align with extensioin point through plugin.properties - */ - public static final String JSF_CORE_FACET_ID = "jst.jsf"; //$NON-NLS-1$ - /** - * The facet version for a JSF 1.0 project - * TODO: align with extensioin point through plugin.properties - */ - public final static String FACET_VERSION_1_0 = "1.0"; //$NON-NLS-1$ - /** - * The constant id for a JSF 1.0 project - */ - public final static String JSF_VERSION_1_0 = FACET_VERSION_1_0; - /** - * The facet version for a JSF 1.1 project - * TODO: align with extensioin point through plugin.properties - */ - public final static String FACET_VERSION_1_1 = "1.1"; //$NON-NLS-1$ - /** - * The constant id for a JSF 1.1 project - */ - public final static String JSF_VERSION_1_1 = FACET_VERSION_1_1; - /** - * The facet version for a JSF 1.2 project - * TODO: align with extensioin point through plugin.properties - */ - public final static String FACET_VERSION_1_2 = "1.2";//$NON-NLS-1$ - /** - * The constant id for a JSF 1.2 project - */ - public final static String JSF_VERSION_1_2 = FACET_VERSION_1_2; - - private IJSFCoreConstants() - { - // no instantiation - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/JSFVersion.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/JSFVersion.java deleted file mode 100644 index e1d3aaf81..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/JSFVersion.java +++ /dev/null @@ -1,80 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core; - -/** - * @author gekessle - * - */ -public enum JSFVersion { - - /** - * Unknown version support - */ - UNKNOWN, - /** - * Supports JSF Version 1.0 - */ - V1_0, - /** - * Supports JSF Version 1.1 - */ - V1_1, - /** - * Supports JSF Version 1.1 - */ - V1_2; - - @Override - public String toString() { - switch(this) - { - case V1_0: - return IJSFCoreConstants.JSF_VERSION_1_0; - case V1_1: - return IJSFCoreConstants.JSF_VERSION_1_1; - case V1_2: - return IJSFCoreConstants.JSF_VERSION_1_2; - case UNKNOWN: - return "unknown"; - default: - throw new IllegalStateException("Missing string conversion: "+this.name()); - } - } - - /** - * @param valueAsString - * @return the reverse mapping to an enum from toString() returns - */ - public static JSFVersion valueOfString(String valueAsString) - { - if (IJSFCoreConstants.JSF_VERSION_1_0.equals(valueAsString)) - { - return V1_0; - } - else if (IJSFCoreConstants.JSF_VERSION_1_1.equals(valueAsString)) - { - return V1_1; - } - else if (IJSFCoreConstants.JSF_VERSION_1_2.equals(valueAsString)) - { - return V1_2; - } - else if ("unknown".equals(valueAsString)) - { - return UNKNOWN; - } - else - { - return null; - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/CompositeJSFPreferenceModel.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/CompositeJSFPreferenceModel.java deleted file mode 100644 index 08dabf945..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/CompositeJSFPreferenceModel.java +++ /dev/null @@ -1,118 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.internal; - -import java.util.List; - -import org.eclipse.core.runtime.preferences.IScopeContext; -import org.eclipse.jface.preference.IPreferenceStore; - -/** - * Composite of preference models - * - * @author cbateman - * - */ -public class CompositeJSFPreferenceModel implements IJSFPreferenceModel -{ - private final List<IJSFPreferenceModel> _models; - - /** - * @param models - */ - public CompositeJSFPreferenceModel(final List<IJSFPreferenceModel> models) - { - _models = models; - } - - /* - * Commits all child instances - */ - public void commit(final IPreferenceStore prefStore) - { - for (final IJSFPreferenceModel model : _models) - { - model.commit(prefStore); - } - } - - /** - * Searches each child until it finds the value associated with key. - * @return null if not found. - */ - public Object getStoredValueByKey(final IScopeContext context, final String key) - { - Object value = null; - - SEARCH: for (final IJSFPreferenceModel model : _models) - { - value = model.getStoredValueByKey(context, key); - if (value != null) - { - break SEARCH; - } - } - return value; - } - - /** - * Same as getStoredValueByKey but using getValueByKey instead - */ - public Object getValueByKey(final IScopeContext context, final String key) - { - Object value = null; - - SEARCH: for (final IJSFPreferenceModel model : _models) - { - value = model.getValueByKey(context, key); - if (value != null) - { - break SEARCH; - } - } - return value; - } - - /** - * Calls load on all children with prefStore - */ - public void load(final IPreferenceStore prefStore) - { - for (final IJSFPreferenceModel model : _models) - { - model.load(prefStore); - } - } - - /** - * Calls set defaults on all children - */ - public void setDefaults() - { - for (final IJSFPreferenceModel model : _models) - { - model.setDefaults(); - } - } - - public Object setValueByKey(final IScopeContext context, final String key, final Object value) - { - for (final IJSFPreferenceModel model : _models) - { - if (model.getValueByKey(context, key) != null) - { - return model.setValueByKey(context, key, value); - } - } - return null; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/CompositeTagRegistryFactory.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/CompositeTagRegistryFactory.java deleted file mode 100644 index a7112b033..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/CompositeTagRegistryFactory.java +++ /dev/null @@ -1,202 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.internal; - -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Map; -import java.util.Set; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.content.IContentType; -import org.eclipse.jst.jsf.common.internal.policy.CanonicallyOrderedIteratorPolicy; -import org.eclipse.jst.jsf.common.internal.policy.IIteratorPolicy; -import org.eclipse.jst.jsf.common.internal.strategy.IIdentifiableStrategy; -import org.eclipse.jst.jsf.common.internal.strategy.IteratorPolicyBasedStrategyComposite; -import org.eclipse.jst.jsf.designtime.internal.view.model.ITagRegistry; -import org.eclipse.jst.jsf.designtime.internal.view.model.TagRegistryFactory.TagRegistryFactoryException; - -/** - * Employs a policy-based strategy to construct a TagRegistry for a particular - * content-type in a particular project. - * - * @author cbateman - * - */ -public final class CompositeTagRegistryFactory -{ - private static CompositeTagRegistryFactory INSTANCE; - - /** - * @return the single instance of the registry factory - */ - public static synchronized CompositeTagRegistryFactory getInstance() - { - if (INSTANCE == null) - { - INSTANCE = new CompositeTagRegistryFactory(); - } - return INSTANCE; - } - - private final Map<IContentType, Set<TagRegistryFactoryInfo>> _cachedExtensionsByType = - new HashMap<IContentType, Set<TagRegistryFactoryInfo>>(4); - - private CompositeTagRegistryFactory() - { - // singleton: no external instantiation - } - - - /** - * @param id - * @return a tag registry for the id or null if there isn't one. - */ - public final ITagRegistry getRegistry(final TagRegistryIdentifier id) - { - final Set<TagRegistryFactoryInfo> handlers = TagLibraryRegistryLoader - .getAllHandlers(); - - final Set<TagRegistryFactoryInfo> matchingHandlers = findMatchingExtensions( - id, handlers); - - if (matchingHandlers.size() > 0) - { - // optimize: if there is only one handler, no need for strategy - if (matchingHandlers.size() == 1) - { - try - { - return matchingHandlers.iterator().next().getTagRegistryFactory() - .createTagRegistry(id.getProject()); - } - catch (TagRegistryFactoryException e) - { - JSFCorePlugin.log(e, "While trying to acquire a registry"); - } - } - else - { - // for now, we will order by the canonical name of the extension - // id in ascending order. Later, we may make this preference - // based. - final TagRegistrySelectionStrategy selectionStrategy = new TagRegistrySelectionStrategy( - new CanonicallyOrderedIteratorPolicy<String>()); - - for (final Iterator<TagRegistryFactoryInfo> it = matchingHandlers - .iterator(); it.hasNext();) - { - selectionStrategy.addStrategy(it.next().getTagRegistryFactory()); - } - return selectionStrategy.perform(id.getProject()); - } - } - - return null; - } - - /** - * @return get all tag registry factories - */ - public Set<TagRegistryFactoryInfo> getAllTagRegistryFactories() - { - return TagLibraryRegistryLoader.getAllHandlers(); - } - - private Set<TagRegistryFactoryInfo> findMatchingExtensions( - TagRegistryIdentifier id, Set<TagRegistryFactoryInfo> handlers) - { - Set<TagRegistryFactoryInfo> matching = _cachedExtensionsByType.get(id - .getContentType()); - - if (matching == null) - { - matching = new HashSet<TagRegistryFactoryInfo>(4); - - for (final TagRegistryFactoryInfo handler : handlers) - { - if (handler.getContentTypes().contains(id.getContentType())) - { - matching.add(handler); - } - } - - // if there is nothing matching, just store the empty set and - // discard - // the extra memory - if (matching.size() > 0) - { - _cachedExtensionsByType.put(id.getContentType(), matching); - } - else - { - _cachedExtensionsByType.put(id.getContentType(), - Collections.EMPTY_SET); - } - } - return matching; - } - - /** - * Identifies a content type/project context in which to request a tag - * registry. - * - * @author cbateman - * - */ - public final static class TagRegistryIdentifier - { - private final IProject _project; - private final IContentType _contentType; - - /** - * @param project - * @param contentType - */ - public TagRegistryIdentifier(final IProject project, - final IContentType contentType) - { - _project = project; - _contentType = contentType; - } - - IProject getProject() - { - return _project; - } - - IContentType getContentType() - { - return _contentType; - } - - } - - private static class TagRegistrySelectionStrategy - extends - IteratorPolicyBasedStrategyComposite<IProject, ITagRegistry, String, IIdentifiableStrategy<IProject, ITagRegistry, String>> - { - private static final ITagRegistry NO_RESULT = null; - - protected TagRegistrySelectionStrategy(IIteratorPolicy<String> policy) - { - super(policy); - } - - @Override - public ITagRegistry getNoResult() - { - return NO_RESULT; - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/IJSFPreferenceModel.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/IJSFPreferenceModel.java deleted file mode 100644 index 13af43b10..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/IJSFPreferenceModel.java +++ /dev/null @@ -1,68 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman - initial implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.core.internal; - -import org.eclipse.core.runtime.preferences.IScopeContext; -import org.eclipse.jface.preference.IPreferenceStore; - -/** - * Defines a generic JSF preferences model - * - * @author cbateman - * - */ -public interface IJSFPreferenceModel -{ - /** - * Loads the object from the preference store provided - * - * @param prefStore - */ - public void load(IPreferenceStore prefStore); - - /** - * Copies the object into the preference store but DOES NOT SAVE IT - * - * @param prefStore - */ - public void commit(IPreferenceStore prefStore); - - /** - * Reverts the model to it's defaults. Does not commit to pref store. - */ - public void setDefaults(); - - /** - * @param context - * @param key - * @return the preference value in context with using key as the id - */ - public Object getValueByKey(final IScopeContext context, final String key); - - /** - * @param context - * @param key - * @return the preference value in context using key as the id and drawing - * it directly from the preference store - */ - public Object getStoredValueByKey(final IScopeContext context, final String key); - - /** - * Set the preference value indicated by key in context to value. May - * throw ClassCastException if value is not the type expected for the key - * @param context - * @param key - * @param value - * @return the old value - */ - public Object setValueByKey(final IScopeContext context, final String key, final Object value); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/JSFCorePlugin.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/JSFCorePlugin.java deleted file mode 100644 index bfb3aea5e..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/JSFCorePlugin.java +++ /dev/null @@ -1,370 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler - initial API and implementation - * Ian Trimble - JSFLibraryRegistry work - *******************************************************************************/ -package org.eclipse.jst.jsf.core.internal; - -import java.util.Collections; -import java.util.List; - -import org.eclipse.core.runtime.IExtensionPoint; -import org.eclipse.core.runtime.ILog; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.preferences.InstanceScope; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jst.jsf.context.IDelegatingFactory; -import org.eclipse.jst.jsf.context.resolver.structureddocument.internal.IStructuredDocumentContextResolverFactory2; -import org.eclipse.jst.jsf.designtime.context.AbstractDTExternalContextFactory; -import org.eclipse.jst.jsf.designtime.el.AbstractDTMethodResolver; -import org.eclipse.jst.jsf.designtime.el.AbstractDTPropertyResolver; -import org.eclipse.jst.jsf.designtime.el.AbstractDTVariableResolver; -import org.eclipse.jst.jsf.designtime.internal.BasicExtensionFactory; -import org.eclipse.jst.jsf.designtime.internal.DecoratableExtensionFactory; -import org.eclipse.jst.jsf.designtime.internal.BasicExtensionFactory.ExtensionData; -import org.eclipse.jst.jsf.designtime.internal.resolver.ViewBasedTaglibResolverFactory; -import org.eclipse.jst.jsf.designtime.internal.view.AbstractDTViewHandler; -import org.eclipse.ui.preferences.ScopedPreferenceStore; -import org.eclipse.wst.common.frameworks.internal.WTPPlugin; -import org.osgi.framework.BundleContext; - -/** - * JSF Core plugin. - * - * @author Gerry Kessler - Oracle, Ian Trimble - Oracle - */ -public class JSFCorePlugin extends WTPPlugin -{ - /** - * The plugin id - */ - public static final String PLUGIN_ID = "org.eclipse.jst.jsf.core"; // org.eclipse.jst.jsf.core.internal.JSFCorePlugin"; - // //$NON-NLS-1$ - - // The shared instance. - private static JSFCorePlugin plugin; - - private IPreferenceStore preferenceStore; - - private ViewBasedTaglibResolverFactory _tagLibResolverFactory; - - /** - * The constructor. - */ - public JSFCorePlugin() - { - plugin = this; - } - - /** - * This method is called upon plug-in activation - * - * @param context - * @throws Exception - */ - @Override - public void start(final BundleContext context) throws Exception - { - super.start(context); - final IStructuredDocumentContextResolverFactory2 factory = IStructuredDocumentContextResolverFactory2.INSTANCE; - if (factory instanceof IDelegatingFactory) - { - _tagLibResolverFactory = new ViewBasedTaglibResolverFactory(); - ((IDelegatingFactory) factory) - .addFactoryDelegate(_tagLibResolverFactory); - } - else - { - log("Error adding tag resolver delegate", new Throwable()); - } - } - - /** - * This method is called when the plug-in is stopped - * - * @param context - * @throws Exception - */ - @Override - public void stop(final BundleContext context) throws Exception - { - super.stop(context); - - final IStructuredDocumentContextResolverFactory2 factory = IStructuredDocumentContextResolverFactory2.INSTANCE; - - if (factory instanceof IDelegatingFactory - && _tagLibResolverFactory != null) - { - ((IDelegatingFactory) factory) - .removeFactoryDelegate(_tagLibResolverFactory); - } - plugin = null; - } - - /** - * Returns the shared instance. - * - * @return the shared instance - */ - public static JSFCorePlugin getDefault() - { - return plugin; - } - - /** - * @param e - * @param msg - */ - public static void log(final Exception e, final String msg) - { - final ILog log = getDefault().getLog(); - - log.log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, msg, e)); - } - - /** - * Logs using the default ILog implementation provided by getLog(). - * - * @param severity - * Severity (IStatus constant) of log entry - * @param message - * Human-readable message describing log entry - * @param ex - * Throwable instance (can be null) - */ - public static void log(final int severity, final String message, - final Throwable ex) - { - getDefault().getLog().log( - new Status(severity, PLUGIN_ID, IStatus.OK, message, ex)); - } - - /** - * Logs using the default ILog implementation provided by getLog(). - * - * @param severity - * Severity (IStatus constant) of log entry - * @param message - * Human-readable message describing log entry - */ - public static void log(final int severity, final String message) - { - log(severity, message, null); - } - - /** - * Logs a message for this plugin - * - * @param message - * @param t - */ - public static void log(final String message, final Throwable t) - { - final ILog log = plugin.getLog(); - log.log(new Status(IStatus.ERROR, plugin.getBundle().getSymbolicName(), - 0, message, t)); - } - - @Override - public String getPluginID() - { - return PLUGIN_ID; - } - - /** - * @param id - * @return all registered symbol source providers - */ - public synchronized static ExtensionData<AbstractDTVariableResolver> getVariableResolvers(final String id) - { - checkAndInitVariableResolverFactory(); - return _variableResolverFactory.getExtensions().get(id); - } - - /** - * @param forName - * @return the ids of variable resolvers for 'forName'. - */ - public synchronized static List<String> getVariableResolversForName( - final String forName) - { - checkAndInitVariableResolverFactory(); - return Collections.unmodifiableList(_variableResolverFactory - .getIdsForName(forName)); - } - - /** - * @return true if there any decorative resolvers in the system. This - * is provided so that decorative variable resolvers can avoid expensive - * calculations looking for these resolvers when there are none. - */ - public synchronized static boolean hasDecorativeVariableResolvers() - { - checkAndInitVariableResolverFactory(); - return _variableResolverFactory.getNumDecorativeResolvers() > 0; - } - - private synchronized static void checkAndInitVariableResolverFactory() - { - if (_variableResolverFactory == null) - { - _variableResolverFactory = new DecoratableExtensionFactory<AbstractDTVariableResolver>( - getDefault().getBundle(), VARIABLE_RESOLVER_EXT_POINT_NAME, - VARIABLE_RESOLVER_ELEMENT_NAME, false); - } - } - - private static DecoratableExtensionFactory<AbstractDTVariableResolver> _variableResolverFactory; - private final static String VARIABLE_RESOLVER_EXT_POINT_NAME = "variableresolver"; //$NON-NLS-1$ - private final static String VARIABLE_RESOLVER_ELEMENT_NAME = "variableresolver"; //$NON-NLS-1$ - - /** - * @param id - * @return a map of all registered property resolvers by id - */ - public synchronized static ExtensionData<AbstractDTPropertyResolver> getPropertyResolver(final String id) - { - checkAndInitPropertyFactory(); - return _propertyResolverFactory.getExtensions().get(id); - } - - private synchronized static void checkAndInitPropertyFactory() - { - if (_propertyResolverFactory == null) - { - _propertyResolverFactory = new DecoratableExtensionFactory<AbstractDTPropertyResolver>( - getDefault().getBundle(), PROPERTY_RESOLVER_EXT_POINT_NAME, - PROPERTY_RESOLVER_ELEMENT_NAME, false); - } - } - - /** - * @param forName - * @return the ids of variable resolvers for 'forName'. - */ - public synchronized static List<String> getPropertyResolversForName( - final String forName) - { - checkAndInitVariableResolverFactory(); - return Collections.unmodifiableList(_propertyResolverFactory - .getIdsForName(forName)); - } - - /** - * @return true if there an decorating resolvers - */ - public synchronized static boolean hasDecorativePropertyResolvers() - { - checkAndInitVariableResolverFactory(); - return _propertyResolverFactory.getNumDecorativeResolvers() > 0; - } - - private static DecoratableExtensionFactory<AbstractDTPropertyResolver> _propertyResolverFactory; - private final static String PROPERTY_RESOLVER_EXT_POINT_NAME = "propertyresolver"; //$NON-NLS-1$ - private final static String PROPERTY_RESOLVER_ELEMENT_NAME = "propertyresolver"; //$NON-NLS-1$ - - /** - * @param id - * @return a map of all registered method resolvers by id - */ - public synchronized static ExtensionData<AbstractDTMethodResolver> getMethodResolvers(final String id) - { - checkAndInitMethodResolverFactory(); - return _methodResolverFactory.getExtensions().get(id); - } - - private synchronized static void checkAndInitMethodResolverFactory() - { - if (_methodResolverFactory == null) - { - _methodResolverFactory = new BasicExtensionFactory<AbstractDTMethodResolver>( - getDefault().getBundle(), METHOD_RESOLVER_EXT_POINT_NAME, - METHOD_RESOLVER_ELEMENT_NAME, false); - } - } - private static BasicExtensionFactory<AbstractDTMethodResolver> _methodResolverFactory; - private final static String METHOD_RESOLVER_EXT_POINT_NAME = "methodresolver"; //$NON-NLS-1$ - private final static String METHOD_RESOLVER_ELEMENT_NAME = "methodresolver"; //$NON-NLS-1$ - - /** - * @param id - * @return a map of all registered external context providers by id - */ - public synchronized static ExtensionData<AbstractDTExternalContextFactory> getExternalContextProviders(final String id) - { - checkAndInitExternalContextFactory(); - return _externalContextResolverFactory.getExtensions().get(id); - } - - private synchronized static void checkAndInitExternalContextFactory() - { - if (_externalContextResolverFactory == null) - { - _externalContextResolverFactory = new BasicExtensionFactory<AbstractDTExternalContextFactory>( - getDefault().getBundle(), EXTERNAL_CONTEXT_EXT_POINT_NAME, - EXTERNAL_CONTEXT_ELEMENT_NAME, false); - } - } - - private static BasicExtensionFactory<AbstractDTExternalContextFactory> _externalContextResolverFactory; - private final static String EXTERNAL_CONTEXT_EXT_POINT_NAME = "externalcontext"; //$NON-NLS-1$ - private final static String EXTERNAL_CONTEXT_ELEMENT_NAME = "externalcontext"; //$NON-NLS-1$ - - /** - * @param id - * @return a map of all registered external context providers by id - */ - public synchronized static ExtensionData<AbstractDTViewHandler> getViewHandlers(final String id) - { - checkAndInitViewHandler(); - return _viewHandlerFactory.getExtensions().get(id); - } - - private synchronized static void checkAndInitViewHandler() - { - if (_viewHandlerFactory == null) - { - _viewHandlerFactory = new BasicExtensionFactory<AbstractDTViewHandler>( - getDefault().getBundle(), VIEWHANDLER_EXT_POINT_NAME, - VIEWHANDLER_ELEMENT_NAME, true); - } - } - - private static BasicExtensionFactory<AbstractDTViewHandler> _viewHandlerFactory; - private final static String VIEWHANDLER_EXT_POINT_NAME = "viewhandler"; //$NON-NLS-1$ - private final static String VIEWHANDLER_ELEMENT_NAME = "viewhandler"; //$NON-NLS-1$ - - /** - * @return the preference store for this bundle TODO: this is copied from - * AbstractUIPlugin; need to upgrade to new IPreferencesService - */ - public synchronized IPreferenceStore getPreferenceStore() - { - // Create the preference store lazily. - if (this.preferenceStore == null) - { - this.preferenceStore = new ScopedPreferenceStore( - new InstanceScope(), getBundle().getSymbolicName()); - - } - return this.preferenceStore; - } - - /** - * @param name - * @return the extension point called name for this bundle - */ - public IExtensionPoint getExtension(final String name) - { - return Platform.getExtensionRegistry().getExtensionPoint( - plugin.getBundle().getSymbolicName(), name); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/JSFCoreTraceOptions.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/JSFCoreTraceOptions.java deleted file mode 100644 index 0f2731721..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/JSFCoreTraceOptions.java +++ /dev/null @@ -1,145 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.internal; - -import org.eclipse.osgi.framework.debug.FrameworkDebugOptions; -import org.eclipse.osgi.service.debug.DebugOptions; - -/** - * Defines that standard runtime trace options for debugging. See .options file - * for definitions. - * - * @author cbateman - * - */ -public final class JSFCoreTraceOptions -{ - /** - * True if debug tracing is enabled. Other tracing cannot be enabled unless - * this is enabled. - */ - public static final boolean ENABLED; - - /** - * True if tag introspector tracing is enabled - */ - public static final boolean TRACE_JSPTAGINTROSPECTOR; - /** - * True if tag introspector performance tracing is enabled - */ - public static final boolean TRACE_JSPTAGINTROSPECTOR_PERF; - - /** - * True if the JSP tag registry tracing is enabled - */ - public static final boolean TRACE_JSPTAGREGISTRY; - - /** - * True if handling of JSP TagIndex changes are being traced - */ - public static final boolean TRACE_JSPTAGREGISTRY_CHANGES; - - /** - * True if the JSP persistent jsp tag resolver strategy is being traced. - */ - public static final boolean TRACE_JSPTAGPERSISTENCE; - - /** - * True if the TLD registry manager tracing is enabled - */ - public static final boolean TRACE_TLDREGISTRYMANAGER; - - - /** - * True if the TLD registry performance tracing is enabled - */ - public static final boolean TRACE_JSPTAGREGISTRY_PERF; - - private static final String KEY_DEBUG_ENABLED = "/debug"; - private static final String KEY_DESIGNTIME = "/designtime"; - private static final String KEY_DESIGNTIME_VIEW = KEY_DESIGNTIME + "/view"; - private static final String KEY_VIEW_JSPTAGINTROSPECTOR = KEY_DESIGNTIME_VIEW - + "/jsptagintrospection"; - private static final String KEY_VIEW_JSPTAGINTROSPECTOR_PERF = - KEY_VIEW_JSPTAGINTROSPECTOR + "/perf"; - private static final String KEY_VIEW_JSPTAGREGISTRY = KEY_DESIGNTIME_VIEW - + "/jsptagregistry"; - private static final String KEY_VIEW_JSPTAGPERSISTENCE = KEY_DESIGNTIME_VIEW - + "/jsptagpersistence"; - private static final String KEY_VIEW_JSPTAGREGISTRY_CHANGES = - KEY_VIEW_JSPTAGREGISTRY + "/changes"; - private static final String KEY_VIEW_JSPTAGREGISTRY_PERF = - KEY_VIEW_JSPTAGREGISTRY + "/perf"; - private static final String KEY_VIEW_TLDREGISTRYMANAGER = - KEY_DESIGNTIME_VIEW + "/tldregistrymanager"; - - - static - { - final DebugOptions debugOptions = FrameworkDebugOptions.getDefault(); - - ENABLED = debugOptions != null - && debugOptions.getBooleanOption(JSFCorePlugin.PLUGIN_ID - + KEY_DEBUG_ENABLED, false); - - if (ENABLED) - { - TRACE_JSPTAGINTROSPECTOR = debugOptions.getBooleanOption( - JSFCorePlugin.PLUGIN_ID + KEY_VIEW_JSPTAGINTROSPECTOR, false); - TRACE_JSPTAGREGISTRY = debugOptions.getBooleanOption( - JSFCorePlugin.PLUGIN_ID + KEY_VIEW_JSPTAGREGISTRY, false); - TRACE_JSPTAGREGISTRY_CHANGES = debugOptions.getBooleanOption( - JSFCorePlugin.PLUGIN_ID + KEY_VIEW_JSPTAGREGISTRY_CHANGES, false); - TRACE_TLDREGISTRYMANAGER = debugOptions.getBooleanOption( - JSFCorePlugin.PLUGIN_ID + KEY_VIEW_TLDREGISTRYMANAGER, false); - TRACE_JSPTAGREGISTRY_PERF = debugOptions.getBooleanOption( - JSFCorePlugin.PLUGIN_ID + KEY_VIEW_JSPTAGREGISTRY_PERF, false); - TRACE_JSPTAGINTROSPECTOR_PERF = debugOptions.getBooleanOption( - JSFCorePlugin.PLUGIN_ID + KEY_VIEW_JSPTAGINTROSPECTOR_PERF, false); - TRACE_JSPTAGPERSISTENCE = debugOptions.getBooleanOption( - JSFCorePlugin.PLUGIN_ID + KEY_VIEW_JSPTAGPERSISTENCE, false); - } - else - { - TRACE_JSPTAGINTROSPECTOR = false; - TRACE_JSPTAGREGISTRY = false; - TRACE_JSPTAGREGISTRY_CHANGES = false; - TRACE_TLDREGISTRYMANAGER = false; - TRACE_JSPTAGREGISTRY_PERF = false; - TRACE_JSPTAGINTROSPECTOR_PERF = false; - TRACE_JSPTAGPERSISTENCE = false; - } - } - - /** - * @param message - */ - public static void log(final String message) - { - System.out.println(message); - } - - /** - * @param msg A short label placed before the trace of t to show the source - * @param t - */ - public static void log(final String msg, final Throwable t) - { - System.out.printf("%s: Exception Trace:\n\n",msg); - t.printStackTrace(System.out); - System.out.print("\n\n\n"); - } - - private JSFCoreTraceOptions() - { - // no instantiation - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/JSFLibrariesContainerInitializer.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/JSFLibrariesContainerInitializer.java deleted file mode 100644 index d8d443c0f..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/JSFLibrariesContainerInitializer.java +++ /dev/null @@ -1,89 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.internal; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.jdt.core.ClasspathContainerInitializer; -import org.eclipse.jdt.core.IClasspathContainer; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jst.jsf.core.internal.jsflibraryconfig.JSFLibraryRegistryUtil; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary; -import org.eclipse.jst.jsf.core.jsflibraryconfiguration.JSFLibraryConfigurationHelper; - -/** - * Initialize JSF Libraries as classpath containers - */ -public class JSFLibrariesContainerInitializer extends - ClasspathContainerInitializer { - - private static final String MISSING_LIBRARY = Messages.JSFLibrariesContainerInitializer_missing_library; - - /** - * Constructor - */ - public JSFLibrariesContainerInitializer() { - super(); - } - - /* (non-Javadoc) - * @see org.eclipse.jdt.core.ClasspathContainerInitializer#initialize(org.eclipse.core.runtime.IPath, org.eclipse.jdt.core.IJavaProject) - */ - public void initialize(IPath containerPath, IJavaProject project) throws CoreException { - if (isJSFLibraryContainer(containerPath)) { - String libId= containerPath.lastSegment(); - - JSFLibrary ref= JSFLibraryRegistryUtil.getInstance().getJSFLibraryRegistry().getJSFLibraryByID(libId); - if (ref != null) { - JSFLibraryClasspathContainer container= new JSFLibraryClasspathContainer(ref); - JavaCore.setClasspathContainer(containerPath, new IJavaProject[] { project }, new IClasspathContainer[] { container }, null); - } - } - } - - private boolean isJSFLibraryContainer(IPath path) { - return path != null && path.segmentCount() == 2 && JSFLibraryConfigurationHelper.JSF_LIBRARY_CP_CONTAINER_ID.equals(path.segment(0)); - } - - /* (non-Javadoc) - * @see org.eclipse.jdt.core.ClasspathContainerInitializer#canUpdateClasspathContainer(org.eclipse.core.runtime.IPath, org.eclipse.jdt.core.IJavaProject) - */ - public boolean canUpdateClasspathContainer(IPath containerPath, IJavaProject project) { - return isJSFLibraryContainer(containerPath); - } - - /** - * @see org.eclipse.jdt.core.ClasspathContainerInitializer#getDescription(org.eclipse.core.runtime.IPath, org.eclipse.jdt.core.IJavaProject) - */ - public String getDescription(IPath containerPath, IJavaProject project) { - if (isJSFLibraryContainer(containerPath)) { - String id = containerPath.lastSegment(); - JSFLibrary libref = JSFLibraryRegistryUtil.getInstance().getJSFLibraryRegistry().getJSFLibraryByID(id); - String displayText = id; - - if (libref == null){ - displayText = displayText + " " + MISSING_LIBRARY; //$NON-NLS-1$ - } - - return displayText; - } - return super.getDescription(containerPath, project); - } - - /* (non-Javadoc) - * @see org.eclipse.jdt.core.ClasspathContainerInitializer#getComparisonID(org.eclipse.core.runtime.IPath, org.eclipse.jdt.core.IJavaProject) - */ - public Object getComparisonID(IPath containerPath, IJavaProject project) { - return containerPath; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/JSFLibraryClasspathContainer.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/JSFLibraryClasspathContainer.java deleted file mode 100644 index ab3d50c0c..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/JSFLibraryClasspathContainer.java +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.internal; - -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.jdt.core.IClasspathContainer; -import org.eclipse.jdt.core.IClasspathEntry; -import org.eclipse.jst.jsf.core.internal.jsflibraryconfig.JSFLibraryRegistryUtil; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary; -import org.eclipse.jst.jsf.core.jsflibraryconfiguration.JSFLibraryConfigurationHelper; - - -/** - * JSF Library classpath container - */ -public class JSFLibraryClasspathContainer implements IClasspathContainer { - private static final String NON_IMPL_DESC = Messages.JSFLibraryClasspathContainer_NON_IMPL_LIBRARY; - private static final String IMPL_DESC = Messages.JSFLibraryClasspathContainer_IMPL_LIBRARY; - - private JSFLibrary lib; - - /** - * @param lib - */ - public JSFLibraryClasspathContainer(JSFLibrary lib) { - this.lib = lib; - } - - /* (non-Javadoc) - * @see org.eclipse.jdt.core.IClasspathContainer#getClasspathEntries() - */ - public IClasspathEntry[] getClasspathEntries() { - return JSFLibraryRegistryUtil.getInstance().getClasspathEntries(lib); - } - - /* (non-Javadoc) - * @see org.eclipse.jdt.core.IClasspathContainer#getDescription() - */ - public String getDescription() { - StringBuffer buf = new StringBuffer(lib.getLabel()); - buf.append(" "); //$NON-NLS-1$ - if (lib.isImplementation()) - buf.append(IMPL_DESC); - else - buf.append(NON_IMPL_DESC); - - return buf.toString(); - } - - /* (non-Javadoc) - * @see org.eclipse.jdt.core.IClasspathContainer#getKind() - */ - public int getKind() { - return IClasspathContainer.K_APPLICATION; - } - - /* (non-Javadoc) - * @see org.eclipse.jdt.core.IClasspathContainer#getPath() - */ - public IPath getPath() { - return new Path(JSFLibraryConfigurationHelper.JSF_LIBRARY_CP_CONTAINER_ID).append(this.lib.getID()); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/JSFRegistryVersionInfo.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/JSFRegistryVersionInfo.java deleted file mode 100644 index 19fa69644..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/JSFRegistryVersionInfo.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.internal; - -import org.osgi.framework.Version; - -/** - * A value object the describes the current and expected state of the JSF Library - * Registry - * - * @author cbateman - * - */ -final class JSFRegistryVersionInfo -{ - private Version _curVersion; // the version of the current registry on disk - private Version _expectedVersion; // the expected or required version of the registry - - JSFRegistryVersionInfo(Version oldVersion, Version expectedVersion) - { - super(); - _curVersion = oldVersion; - _expectedVersion = expectedVersion; - } - - /** - * @return the version of the registry found in the current workspace - */ - public Version getCurVersion() { - return _curVersion; - } - - /** - * @return the version of the registry that is expected - */ - public Version getExpectedVersion() { - return _expectedVersion; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/Messages.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/Messages.java deleted file mode 100644 index 872fa9611..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/Messages.java +++ /dev/null @@ -1,264 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler - initial API and implementation - * Ian Trimble - changed to work correctly with org.eclipse.osgi.util.NLS - *******************************************************************************/ -package org.eclipse.jst.jsf.core.internal; - -import org.eclipse.osgi.util.NLS; - -/** - * String resource handler. - * - * @author Gerry Kessler - Oracle, Ian Trimble - Oracle - */ -public class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.jst.jsf.core.internal.messages"; //$NON-NLS-1$ - - /** - * see messages.properties - */ - public static String JSFFacetInstallDataModelProvider_DupeJarValidation; - - /** - * see messages.properties - */ - public static String JSFFacetInstallDataModelProvider_INITIAL_VALIDATION_IMPL_TYPE; - - - /** - * see messages.properties - */ - public static String JSFLibCfgDialogSettingData_Sticky_Component_Lib_Not_Exist; - - /** - * see messages.properties - */ - public static String JSFLibrariesContainerInitializer_missing_library; - - /** - * see messages.properties - */ - public static String JSFLibraryClasspathContainer_IMPL_LIBRARY; - - /** - * see messages.properties - */ - public static String JSFLibraryClasspathContainer_NON_IMPL_LIBRARY; - - /** - * see messages.properties - */ - public static String JSFLibraryConfigModel_Null_Data_Source; - - /** - * see messages.properties - */ - public static String JSFLibraryConfigPersistData_SAVED_COMPLIB_NOT_FOUND; - - /** - * see messages.properties - */ - public static String JSFLibraryConfigPersistData_SAVED_IMPLLIB_NOT_FOUND; - - /** - * see messages.properties - */ - public static String JSFLibraryRegistry_ErrorCreatingURL; - /** - * see messages.properties - */ - public static String JSFLibraryRegistry_NoLoadCreatingNew; - /** - * see messages.properties - */ - public static String JSFLibraryRegistry_ErrorSaving; - /** - * see messages.properties - */ - public static String JSFLibraryRegistry_DEFAULT_IMPL_LABEL; - /** - * see messages.properties - */ - public static String JSFLibraryRegistry_ErrorLoadingFromExtPt; - - /** - * see messages.properties - */ - public static String JSFFacetInstallDataModelProvider_ValidateServletName; - /** - * see messages.properties - */ - public static String JSFFacetInstallDataModelProvider_ValidateConfigFileEmpty; - /** - * see messages.properties - */ - public static String JSFFacetInstallDataModelProvider_ValidateConfigFilePath; - /** - * see messages.properties - */ - public static String JSFFacetInstallDataModelProvider_ValidateConfigFileRelative1; - /** - * see messages.properties - */ - public static String JSFFacetInstallDataModelProvider_ValidateConfigFileRelative2; - /** - * see messages.properties - */ - public static String JSFFacetInstallDataModelProvider_ValidateConfigFileXML; - /** - * see messages.properties - */ - public static String JSFFacetInstallDataModelProvider_ValidateConfigFileSlashes; - - /** - * see messages.properties - */ - public static String ArchiveFileImpl_CannotCopyFile; - /** - * see messages.properties - */ - public static String ArchiveFileImpl_CannotCloseFile; - /** - * see messages.properties - */ - public static String ArchiveFileImpl_CannotLocatePluginRelativeFile; - - /** - * see messages.properties - */ - public static String JSFUtils_MissingJAR; - - /** - * see messages.properties - */ - public static String PluginProvidedJSFLibraryCreationHelper_ErrorCreating; - /** - * see messages.properties - */ - public static String PluginProvidedJSFLibraryCreationHelper_ErrorMultipleDefinition; - - /** - * see messages.properties - */ - public static String JSFUtils_ErrorCreatingConfigFile; - /** - * see messages.properties - */ - public static String JSFUtils_ErrorClosingConfigFile; - - /** - * see messages.properties - */ - public static String JSFAppConfigUtils_ErrorOpeningJarFile; - - /** - * see messages.properties - */ - public static String JARFileJSFAppConfigProvider_ErrorLoadingModel; - - /** - * see messages.properties - */ - public static String J2EEModuleDependencyDelegate_UpdatingJ2EEModuleDependencies; - /** - * see messages.properties - */ - public static String J2EEModuleDependencyDelegate_UpdatingJ2EEModuleDependenciesForProject; - - /** - * see messages.properties - */ - public static String JSFRegistryMigration05_to_10_title; - /** - * see messages.properties - */ - public static String JSFRegistryMigration05_to_10_message; - - /** - * see messages.properties - */ - public static String JSFRegistryMigration05_to_10_customMessage; - - - /** - * see messages.properties - */ - public static String JSFRegistryMigrationCannot05_to_10_title; - /** - * see messages.properties - */ - public static String JSFRegistryMigrationCannot05_to_10_message; - - /** - * see messages.properties - */ - public static String JSFRegistryMigrationCannot05_to_10_customMessage; - - - /** - * see messages.properties - */ - public static String RegistryMigrationStartupHandler_Dialog_Abort_And_Exit_Migration; - - /** - * see messages.properties - */ - public static String RegistryMigrationStartupHandler_Dialog_Confirm_Migration; - - /** - * see messages.properties - */ - public static String RegistryMigrationStartupHandler_Error_committing_migration; - - /** - * see messages.properties - */ - public static String RegistryMigrationStartupHandler_Error_Rolling_Back_Migration; - - /** - * see messages.properties - */ - public static String RegistryMigrationStartupHandler_Launch_Migration_Doc_On_Confirm; - - /** - * see messages.properties - */ - public static String JSFFacet11_presetLabel; - - /** - * see messages.properties - */ - public static String JSFFacet11_presetDescription; - - /** - * see messages.properties - */ - public static String JSFFacetInstallDelegate_InternalErr; - /** - * see messages.properties - */ - public static String JSFFacetInstallDelegate_ConfigErr; - /** - * see messages.properties - */ - public static String JSFFacetInstallDelegate_NonUpdateableWebXML; - /** - * see messages.properties - */ - public static String JSFFacetUninstallDelegate_ConfigErr; - /** - * see messages.properties - */ - public static String JSFFacetUninstallDelegate_NonUpdateableWebXML; - - static { - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/RegistryUpgradeCommitHandler.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/RegistryUpgradeCommitHandler.java deleted file mode 100644 index 8e3f0f711..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/RegistryUpgradeCommitHandler.java +++ /dev/null @@ -1,170 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.internal; - -import java.net.MalformedURLException; -import java.net.URL; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.util.JSFLibraryRegistryUpgradeUtil; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.util.UpgradeStatus; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.browser.IWorkbenchBrowserSupport; - -/** - * Commits registry migration - * @author cbateman - * - */ -public class RegistryUpgradeCommitHandler -{ - - /** - * handle migration - */ - public static void commitMigrationIfNecessary() - { - JSFLibraryRegistryUpgradeUtil upgradeUtil = - JSFLibraryRegistryUpgradeUtil.getInstance(); - - UpgradeStatus status = upgradeUtil.getUpgradeStatus(); - - if (status.getSeverity() == IStatus.OK) - { - if (status.isUpgradeOccurred()) - { - handle05_to_10(status); - } - } - else - { - handleErrorInMigration(status); - } - } - - private static void handle05_to_10(UpgradeStatus status) - { - PlatformUI.getWorkbench().getDisplay().asyncExec(new Handle05_to_10_migration(status)); - } - - private static void handleErrorInMigration(UpgradeStatus status) - { - PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() - { - public void run() - { - final Shell shell = PlatformUI.getWorkbench().getDisplay().getActiveShell(); - MessageDialog.openError(shell, "Serious Error Encountered!", "An unrecoverable error occurred while trying to migrate your JSF Library Registry to a newer version. This may cause your library references to be broken in your JSF projects."); - } - }); - } - - private static class Handle05_to_10_migration implements Runnable - { - private final UpgradeStatus _status; - - Handle05_to_10_migration(UpgradeStatus status) - { - _status = status; - } - - public void run() - { - // no prompting necessary. just commit. - doConfirmed(false); - } - - private void doConfirmed(boolean userWantsMigrationDocLaunch) { - // delete V1 registry, leave backup file - IStatus result = _status.commit(); - - if (result.getSeverity() != IStatus.OK) - { - final Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); - MessageDialog.openError(shell, Messages.RegistryMigrationStartupHandler_Error_committing_migration, result.getMessage()); - } - - // if user confirmed, launch migration doc - if (userWantsMigrationDocLaunch) - try { - IWorkbenchBrowserSupport browserSupport = - PlatformUI.getWorkbench().getBrowserSupport(); - URL url = new URL("http://wiki.eclipse.org/index.php/JSF_Library_Migration"); //$NON-NLS-1$ - browserSupport.createBrowser("JSFMigrationDoc").openURL(url); //$NON-NLS-1$ - } catch (PartInitException e) { - JSFCorePlugin.log(e,"Error handling migration"); //$NON-NLS-1$ - } catch (MalformedURLException e) { - JSFCorePlugin.log(e,"Error handling migration"); //$NON-NLS-1$ - } - } - -// private void doAbortAndExit() -// { -// // rollback -// IStatus result = _status.rollback(); -// -// if (result.getSeverity() != IStatus.OK) -// { -// final Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); -// MessageDialog.openError(shell, Messages.RegistryMigrationStartupHandler_Error_Rolling_Back_Migration, result.getMessage()); -// } -// // close workbench -// PlatformUI.getWorkbench().close(); -// } -// } -// -// private static class ConfirmDialog extends MessageDialogWithToggle -// { -// final static int CONFIRMED = 0; -// final static int ABORT_AND_EXIT = 1; -// -// /** -// * @param parentShell -// * @param dialogTitle -// * @param dialogMessage -// */ -// public ConfirmDialog(Shell parentShell, String dialogTitle, -// String dialogMessage) { -// super(parentShell -// , dialogTitle -// , null -// , dialogMessage -// , WARNING -// , new String[] { Messages.RegistryMigrationStartupHandler_Dialog_Confirm_Migration, Messages.RegistryMigrationStartupHandler_Dialog_Abort_And_Exit_Migration } -// , ABORT_AND_EXIT -// , Messages.RegistryMigrationStartupHandler_Launch_Migration_Doc_On_Confirm, true); -// } -// -// /** -// * Override so that the button ids line up with the constants -// * expected -// * @param parent -// */ -// protected void createButtonsForButtonBar(Composite parent) { -// final String[] buttonLabels = getButtonLabels(); -// final Button[] buttons = new Button[buttonLabels.length]; -// final int defaultButtonIndex = getDefaultButtonIndex(); -// -// for (int i = 0; i < buttonLabels.length; i++) { -// String label = buttonLabels[i]; -// Button button = createButton(parent, i, label, -// defaultButtonIndex == i); -// buttons[i] = button; -// -// } -// setButtons(buttons); -// } -// - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/TagLibraryRegistryLoader.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/TagLibraryRegistryLoader.java deleted file mode 100644 index 8acca06dd..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/TagLibraryRegistryLoader.java +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.internal; - -import java.util.Collections; -import java.util.HashSet; -import java.util.Set; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtension; -import org.eclipse.core.runtime.IExtensionPoint; - -/** - * Loads and caches extension for the tagRegistry extension point. - * - * @author cbateman - * - */ -/* package */class TagLibraryRegistryLoader -{ - private final static String EXTENSION_ID = "tagregistry"; - private final static String ELEMENT_NAME = "tagRegistry"; - - private static Set<TagRegistryFactoryInfo> _extensions; - - /** - * @return the list of handlers. The list is not modifiable and will throw - * exceptions if it is attempted. - */ - public static synchronized Set<TagRegistryFactoryInfo> getAllHandlers() - { - if (_extensions == null) - { - _extensions = readAllHandlers(); - } - return Collections.unmodifiableSet(_extensions); - - } - - private static Set<TagRegistryFactoryInfo> readAllHandlers() - { - Set<TagRegistryFactoryInfo> result = new HashSet<TagRegistryFactoryInfo>(); - IExtensionPoint extensionPoint = JSFCorePlugin.getDefault() - .getExtension(EXTENSION_ID); - IExtension[] extensions = extensionPoint.getExtensions(); - - for (int i = 0; i < extensions.length; i++) - { - IExtension ext = extensions[i]; - IConfigurationElement[] configElements = ext - .getConfigurationElements(); - - for (int j = 0; j < configElements.length; j++) - { - final IConfigurationElement element = configElements[j]; - if (ELEMENT_NAME.equals(element.getName())) - { - try - { - final TagRegistryFactoryInfo extension = new TagRegistryFactoryInfo( - element); - result.add(extension); - } - catch (CoreException e) - { - JSFCorePlugin.log(e, - "Error loading tag registry extension: " - + element.getContributor().getName() - + "." + element.getAttribute("id")); - } - } - } - } - return result; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/TagRegistryFactoryInfo.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/TagRegistryFactoryInfo.java deleted file mode 100644 index ba2901b18..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/TagRegistryFactoryInfo.java +++ /dev/null @@ -1,101 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.internal; - -import java.util.Collections; -import java.util.HashSet; -import java.util.Set; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.content.IContentType; -import org.eclipse.core.runtime.content.IContentTypeManager; -import org.eclipse.jst.jsf.designtime.internal.view.model.TagRegistryFactory; - -/** - * Encapsulates information about tag registry extensions - * - */ -public final class TagRegistryFactoryInfo -{ - private final String _description; - private final String _id; - private final TagRegistryFactory _tagRegistry; - private final Set<IContentType> _contentTypes; - - /** - * @param element - * @throws CoreException - */ - TagRegistryFactoryInfo(IConfigurationElement element) - throws CoreException - { - // do this first since it has highest potential to fail - _tagRegistry = (TagRegistryFactory) element - .createExecutableExtension("class"); - - final String localId = element.getAttribute("id"); - _id = element.getContributor().getName() + "." + localId; - - _description = element.getAttribute("description"); - - final IConfigurationElement[] contentTypes = element - .getChildren("content-type"); - - final IContentTypeManager typeManager = Platform - .getContentTypeManager(); - _contentTypes = new HashSet<IContentType>(); - for (IConfigurationElement contentTypeElement : contentTypes) - { - final String contentTypeId = contentTypeElement - .getAttribute("contentTypeId"); - - final IContentType contentType = typeManager - .getContentType(contentTypeId); - _contentTypes.add(contentType); - } - } - - /** - * @return the user displyable description - */ - public String getDescription() - { - return _description; - } - - /** - * @return the unique of the extension - */ - public String getId() - { - return _id; - } - - /** - * @return the registry - */ - public TagRegistryFactory getTagRegistryFactory() - { - return _tagRegistry; - } - - /** - * Set is immutable. - * - * @return the content types this registry is registered against. - */ - public Set<IContentType> getContentTypes() - { - return Collections.unmodifiableSet(_contentTypes); - } -}
\ No newline at end of file diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/contentassist/el/ContentAssistParser.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/contentassist/el/ContentAssistParser.java deleted file mode 100644 index c13b0e805..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/contentassist/el/ContentAssistParser.java +++ /dev/null @@ -1,378 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.core.internal.contentassist.el; - -import org.eclipse.jface.text.Region; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext; -import org.eclipse.jst.jsf.context.symbol.ISymbol; -import org.eclipse.jst.jsp.core.internal.java.jspel.ASTAddExpression; -import org.eclipse.jst.jsp.core.internal.java.jspel.ASTAndExpression; -import org.eclipse.jst.jsp.core.internal.java.jspel.ASTChoiceExpression; -import org.eclipse.jst.jsp.core.internal.java.jspel.ASTEqualityExpression; -import org.eclipse.jst.jsp.core.internal.java.jspel.ASTExpression; -import org.eclipse.jst.jsp.core.internal.java.jspel.ASTFunctionInvocation; -import org.eclipse.jst.jsp.core.internal.java.jspel.ASTLiteral; -import org.eclipse.jst.jsp.core.internal.java.jspel.ASTMultiplyExpression; -import org.eclipse.jst.jsp.core.internal.java.jspel.ASTOrExpression; -import org.eclipse.jst.jsp.core.internal.java.jspel.ASTRelationalExpression; -import org.eclipse.jst.jsp.core.internal.java.jspel.ASTUnaryExpression; -import org.eclipse.jst.jsp.core.internal.java.jspel.ASTValue; -import org.eclipse.jst.jsp.core.internal.java.jspel.ASTValuePrefix; -import org.eclipse.jst.jsp.core.internal.java.jspel.ASTValueSuffix; -import org.eclipse.jst.jsp.core.internal.java.jspel.JSPELParser; -import org.eclipse.jst.jsp.core.internal.java.jspel.JSPELParserConstants; -import org.eclipse.jst.jsp.core.internal.java.jspel.JSPELParserVisitor; -import org.eclipse.jst.jsp.core.internal.java.jspel.ParseException; -import org.eclipse.jst.jsp.core.internal.java.jspel.SimpleNode; -import org.eclipse.jst.jsp.core.internal.java.jspel.Token; - -/** - * Consumes an EL expression and converts into a completion prefix - * - * @author cbateman - * - */ -public final class ContentAssistParser -{ - /** - * @param relativePosition -- 1-based position in elText (first position is 1) - * @param elText - * @return a content assist strategy for the given position and el expression - * or null if one cannot be determined - */ - public static ContentAssistStrategy getPrefix(final int relativePosition, final String elText) - { - if (elText == null) - { - return null; - } - else if ("".equals(elText.trim())) //$NON-NLS-1$ - { - return new IdCompletionStrategy("", ""); //$NON-NLS-1$//$NON-NLS-2$ - } - - PrefixVisitor visitor = getVisitorForPosition(relativePosition, elText); - return visitor != null? visitor.getPrefix() : null; - } - - /** - * Get symbol and symbol region at given position in el string - * @param context - IStructuredDocumentContext - * @param relativePosition - position in el string - * @param elText - el string - * @return SymbolInfo. May be null. - */ - public static SymbolInfo getSymbolInfo(IStructuredDocumentContext context, final int relativePosition, final String elText) { - if (elText == null || "".equals(elText.trim())) //$NON-NLS-1$ - { - return null; - } - PrefixVisitor visitor = getVisitorForPosition(relativePosition, elText); - if (visitor != null) { - SymbolInfo symbolInfo = visitor.getSymbolInfo(context); - if (symbolInfo != null) { - Region r = symbolInfo.getRelativeRegion(); - if (relativePosition > r.getOffset() && relativePosition <= r.getOffset() + r.getLength()) { - return symbolInfo; - } - } - } - return null; - } - - private static PrefixVisitor getVisitorForPosition(final int relativePosition, - final String elText) { - final java.io.StringReader reader = new java.io.StringReader(elText); - final JSPELParser parser = new JSPELParser(reader); - - try - { - final ASTExpression expr = parser.Expression(); - final PrefixVisitor visitor = new PrefixVisitor(relativePosition, elText); - expr.jjtAccept(visitor, null); - return visitor; - } - catch (ParseException pe) - { - // TODO: handle parser by using current and expected tokens - return null; - } - } - - private static String substring(String s, Region r) { - return s.substring(r.getOffset(), r.getOffset() + r.getLength()); - } - - private static class PrefixVisitor implements JSPELParserVisitor - { - private final int _relativePos; - private final String _fullText; - - private String _symbolPrefix; // = null; initialized as tree is visited - private int _prefixType; - private boolean _prefixResolved; // = false; set to true when the prefix is resolved - private int _symbolStartPos = 1; // first char has position 1 - private int _symbolEndPos = 0; - - PrefixVisitor(final int relativePos, final String fullText) - { - _relativePos = relativePos; - _fullText = fullText; - } - - /** - * @return the prefix if resolved or null if not resolved - */ - public ContentAssistStrategy getPrefix() - { - if (_prefixResolved) - { - switch(_prefixType) - { - case ContentAssistStrategy.PREFIX_TYPE_DOT_COMPLETION: - return new FunctionCompletionStrategy(_symbolPrefix, getProposalStart()); - - case ContentAssistStrategy.PREFIX_TYPE_ID_COMPLETION: - return new IdCompletionStrategy(_symbolPrefix, getProposalStart()); - - case ContentAssistStrategy.PREFIX_TYPE_EMPTY_EXPRESSION: - return new IdCompletionStrategy("", getProposalStart()); //$NON-NLS-1$ - - default: - // do nothing; fall-through to return null - } - } - - return null; - } - - /** - * @param context - IStructuredDocumentContext - * @return symbol and symbol region if resolved, null otherwise - */ - public SymbolInfo getSymbolInfo(IStructuredDocumentContext context) { - if (_prefixResolved && _symbolStartPos < _symbolEndPos) { - Region region = new Region(_symbolStartPos - 1, _symbolEndPos - _symbolStartPos + 1); - ISymbol symbol = null; - switch (_prefixType) { - case ContentAssistStrategy.PREFIX_TYPE_ID_COMPLETION: - symbol = SymbolResolveUtil.getSymbolForVariable(context, substring(_fullText, region)); - break; - case ContentAssistStrategy.PREFIX_TYPE_DOT_COMPLETION: - symbol = SymbolResolveUtil.getSymbolForVariableSuffixExpr(context, _symbolPrefix + "." + substring(_fullText, region), _symbolEndPos == _fullText.length()); //$NON-NLS-1$ - break; - } - if (symbol != null) { - return new SymbolInfo(symbol, region); - } - } - return null; - } - - private String getProposalStart() { - if (_symbolStartPos <= _relativePos) { - return _fullText.substring(_symbolStartPos - 1, _relativePos - 1); - } - return ""; //$NON-NLS-1$ - } - - public Object visit(ASTAddExpression node, Object data) - { - return node.childrenAccept(this, data); - } - - public Object visit(ASTAndExpression node, Object data) - { - return node.childrenAccept(this, data); - } - - public Object visit(ASTChoiceExpression node, Object data) - { - return node.childrenAccept(this, data); - } - - public Object visit(ASTEqualityExpression node, Object data) - { - return node.childrenAccept(this, data); - } - - public Object visit(ASTExpression node, Object data) - { - return node.childrenAccept(this, data); - } - - public Object visit(ASTFunctionInvocation node, Object data) - { - return node.childrenAccept(this, data); - } - - public Object visit(ASTLiteral node, Object data) - { - return node.childrenAccept(this, data); - } - - public Object visit(ASTMultiplyExpression node, Object data) - { - return node.childrenAccept(this, data); - } - - public Object visit(ASTOrExpression node, Object data) - { - return node.childrenAccept(this, data); - } - - public Object visit(ASTRelationalExpression node, Object data) - { - return node.childrenAccept(this, data); - } - - public Object visit(ASTUnaryExpression node, Object data) - { - return node.childrenAccept(this, data); - } - - public Object visit(ASTValue node, Object data) - { - // we're only in this value expr if it contains the cursor - if (testContainsCursor(node)) - { - return node.childrenAccept(this, data); - } - - return null; - } - - public Object visit(ASTValuePrefix node, Object data) - { - // for now, only concern ourselves with simple (identifier) prefixes - if (!_prefixResolved - && node.jjtGetNumChildren() == 0 - && node.getFirstToken().kind == JSPELParserConstants.IDENTIFIER) - { - _symbolPrefix = node.getFirstToken().image; - - if (testContainsCursor(node)) - { - // if the cursor is on this id, we don't need to visit - // further since we know both the prefix -- the id -- and - // the type -- it's an id completion - _prefixType = ContentAssistStrategy.PREFIX_TYPE_ID_COMPLETION; - _symbolStartPos = node.getFirstToken().beginColumn; - _symbolEndPos = node.getFirstToken().endColumn; - _prefixResolved = true; - } - } - return node.childrenAccept(this, data); - } - - public Object visit(ASTValueSuffix node, Object data) - { - // for now, only deal with the simple .id suffix - Token lastToken = node.getLastToken(); - if (node.jjtGetNumChildren() == 0) - { - if (!_prefixResolved - && node.getFirstToken().kind == JSPELParserConstants.DOT) - { - if (lastToken.kind == JSPELParserConstants.IDENTIFIER) - { - if (testContainsCursor(node)) - { - _prefixType = ContentAssistStrategy.PREFIX_TYPE_DOT_COMPLETION; - int proposalStartLength = _relativePos - lastToken.beginColumn; - if (proposalStartLength < 0) { // Cursor after firstToken start but before lastToken start? - proposalStartLength = 0; - } - _symbolStartPos = lastToken.beginColumn; - _symbolEndPos = lastToken.endColumn; - _prefixResolved = true; - } - // only include this suffix on the path if the cursor is - // further to the right. Thus for x.^y we get a prefix "x" - // and for x.y.^z we get "x.y" since this the part we must - // resolve the prefix for - else - { - _symbolPrefix += node.getFirstToken().image + lastToken.image; - } - } - else if (lastToken == node.getFirstToken()) - { - if (testCursorImmediatelyAfter(node)) - { - _prefixType = ContentAssistStrategy.PREFIX_TYPE_DOT_COMPLETION; - _symbolStartPos = lastToken.endColumn + 1; - _symbolEndPos = lastToken.endColumn; - _prefixResolved = true; - } - } - } - - return null; - } - - if (node.getFirstToken().kind == JSPELParserConstants.LBRACKET) - { - // try to support ca inside the brackets - node.childrenAccept(this, data); - } - - Object retValue = node.childrenAccept(this, data); - - if (!_prefixResolved) - { - // if we haven't resolved the prefix yet, then we need - // to append this suffix value - _symbolPrefix += _fullText.substring(node.getFirstToken().beginColumn-1, node.getLastToken().endColumn); - } - - return retValue; - } - - public Object visit(SimpleNode node, Object data) - { - return node.childrenAccept(this, data); - } - - private boolean testCursorImmediatelyAfter(SimpleNode node) - { - return node.getLastToken().endColumn == _relativePos-1; - } - - /** - * "Containing a cursor" here is deemed to mean that current cursor - * position as indicated by _relativePos, is either directly before, on or - * directly after an expression. For example, in a Value expression like - * - * x x x . y y y . z z z - * ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ - * 1 2 3 4 5 6 7 8 9 0 1 2 - * - * Position's 1-4 are on xxx, 5-8 are on yyy and 9-12 are on zzz - * - * @param node - * @return true if the node "contains the cursor" (see above) - */ - private boolean testContainsCursor(SimpleNode node) - { - return (node.getFirstToken().beginColumn <= _relativePos - && node.getLastToken().endColumn+1 >= _relativePos); - - } - } - - private ContentAssistParser() - { - // utility class; not instantiable - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/contentassist/el/ContentAssistStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/contentassist/el/ContentAssistStrategy.java deleted file mode 100644 index 1e7d43c20..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/contentassist/el/ContentAssistStrategy.java +++ /dev/null @@ -1,104 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.core.internal.contentassist.el; - -import java.util.List; - -import org.eclipse.jface.text.contentassist.ICompletionProposal; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext; - -/** - * Encapsulates an EL content assist completion prefix - * - * @author cbateman - * - */ -public abstract class ContentAssistStrategy -{ - /** - * ContentAssistStrategy type for a dot content assist completion - */ - public final static int PREFIX_TYPE_DOT_COMPLETION = 0; - /** - * ContentAssistStrategy type for an id content assist completion - */ - public final static int PREFIX_TYPE_ID_COMPLETION = 1; - /** - * Completions for an empty expression - */ - public final static int PREFIX_TYPE_EMPTY_EXPRESSION = 2; - - private final int type; - private final String value; - private final String proposalStart; - - /** - * @param type - * @param value - * @param proposalStart - */ - public ContentAssistStrategy(final int type, final String value, final String proposalStart) - { - super(); - this.type = type; - this.value = value; - this.proposalStart = proposalStart; - } - - /** - * @return the type of this completion prefix as defined by - * one of the PREFIX_TYPE constants - */ - public final int getType() - { - return type; - } - - /** - * @return the token which this prefix is for - */ - public final String getValue() - { - return value; - } - - /** - * @param context - * @return the list of proposals for this strategy. Contents of the list - * must be of type ICompletionProposal. List should be considered immutable. - */ - public abstract List<ICompletionProposal> getProposals(IStructuredDocumentContext context); - - /** - * @return the part of the proposal which was already typed when user invoked autocomplete - */ - public String getProposalStart() { - return proposalStart; - } - - /** - * @param completionList - * @param proposal - */ - protected void addProposalsMatchingProposalStart(final List completionList, final ICompletionProposal[] proposal) { - final String start = getProposalStart(); - for (int j = 0; j < proposal.length; j++) { - final String proposalString = proposal[j].getDisplayString(); - //TODO Should use "real" proposal replacement instead of displayString: - if (proposalString.length() >= start.length() && - proposalString.substring(0, start.length()).equalsIgnoreCase(start)) - { - completionList.add(proposal[j]); - } - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/contentassist/el/FunctionCompletionStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/contentassist/el/FunctionCompletionStrategy.java deleted file mode 100644 index 1be8de4a7..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/contentassist/el/FunctionCompletionStrategy.java +++ /dev/null @@ -1,239 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.core.internal.contentassist.el; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.emf.edit.provider.ComposedAdapterFactory; -import org.eclipse.jface.text.contentassist.ICompletionProposal; -import org.eclipse.jst.jsf.context.resolver.structureddocument.IStructuredDocumentContextResolverFactory; -import org.eclipse.jst.jsf.context.resolver.structureddocument.internal.ITextRegionContextResolver; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext; -import org.eclipse.jst.jsf.context.symbol.IMethodSymbol; -import org.eclipse.jst.jsf.context.symbol.IObjectSymbol; -import org.eclipse.jst.jsf.context.symbol.ISymbol; -import org.eclipse.jst.jsf.context.symbol.provider.IContentProposalProvider; -import org.eclipse.jst.jsf.context.symbol.provider.ProposalCreationFactoryAdapter; -import org.eclipse.jst.jsf.context.symbol.provider.IContentProposalProvider.IProposalCreationFactory; -import org.eclipse.jst.jsf.designtime.resolver.ISymbolContextResolver; -import org.eclipse.jst.jsf.designtime.resolver.StructuredDocumentSymbolResolverFactory; -import org.eclipse.jst.jsp.core.internal.regions.DOMJSPRegionContexts; -import org.eclipse.swt.graphics.Image; - -/** - * A completion strategy for function completions like: - * - * v a r . - * ^ - * - * @author cbateman - * - */ -public class FunctionCompletionStrategy extends ContentAssistStrategy -{ - /** - * @param value - * @param proposalStart - */ - public FunctionCompletionStrategy(final String value, final String proposalStart) - { - super(ContentAssistStrategy.PREFIX_TYPE_DOT_COMPLETION, value, proposalStart); - } - - @Override - public List<ICompletionProposal> getProposals(final IStructuredDocumentContext context) - { - List<ICompletionProposal> completionList = Collections.EMPTY_LIST; - final ISymbolContextResolver symbolResolver = - StructuredDocumentSymbolResolverFactory.getInstance(). - getSymbolContextResolver(context); - - final ISymbol symbol = SymbolResolveUtil.getSymbolForVariableSuffixExpr(context, getValue(), false); - - // if we get a completion symbol, get it's proposals - if (symbol instanceof IObjectSymbol) - { - final List expectedMethodBindings = new ArrayList(); - final ISymbol[] suffixes = getSymbols((IObjectSymbol) symbol, - context, - symbolResolver, - expectedMethodBindings); - - final ComposedAdapterFactory factory = - new ComposedAdapterFactory( - ComposedAdapterFactory.Descriptor.Registry.INSTANCE); - final IProposalCreationFactory creationInfo = - new MyProposalFactory(context, getProposalStart().length(), - expectedMethodBindings); - - completionList = new ArrayList<ICompletionProposal>(); - for (final ISymbol propSymbol : suffixes) { - final Object provider = - factory.adapt(propSymbol, IContentProposalProvider.class); - - if (provider instanceof IContentProposalProvider) - { - final ICompletionProposal[] proposal = - ((IContentProposalProvider) provider). - getProposals(propSymbol, creationInfo); - if (proposal != null) - { - addProposalsMatchingProposalStart(completionList, - proposal); - } - } - } - } - - return Collections.unmodifiableList(completionList); - } - - private ISymbol[] getSymbols(final IObjectSymbol symbol, - final IStructuredDocumentContext context, - final ISymbolContextResolver symbolResolver, - final List expectedMethodBindings) - { - final List symbols = new ArrayList(); - - if (SymbolResolveUtil.isMethodBindingExpected(context, expectedMethodBindings)) - { - symbols.addAll(Arrays.asList( - symbolResolver.getMethods(symbol))); - } - - symbols.addAll(Arrays.asList(symbolResolver.getProperties(symbol))); - - return (ISymbol[]) symbols.toArray(ISymbol.EMPTY_SYMBOL_ARRAY); - } - - private static class MyProposalFactory extends ProposalCreationFactoryAdapter - { - private final static int DEFAULT_RELEVANCE = 1; - - private final static int HIGH_RELEVANCE = 2; - private final static int NORMAL_RELEVANCE = 1; - private final static int LOW_RELEVANCE = 0; - - private final List _expectedMethodBindings; - private final IStructuredDocumentContext _context; - - /** - * @param context - * @param replacementLength - * @param expectedMethodBindings - */ - public MyProposalFactory(final IStructuredDocumentContext context, final int replacementLength, - final List expectedMethodBindings) { - super(context.getDocumentPosition() - replacementLength, replacementLength); - _context = context; - _expectedMethodBindings = expectedMethodBindings; - } - - @Override - public ICompletionProposal createProposal(final String replacementText, - final String displayText, - final String additionalText, - final Image displayImage, - final Object target) - { - int replacementOffset = _replacementOffset; - int replacementLength = _replacementLength; - - // TODO: I regard this as a bit of hack, but until we write our - // proposal implementation, it's basically the only way I can - // see to do this - // if it's an array, we must check if we need to replace a - // preceding '.' - if (replacementText.startsWith("[")) - { - ITextRegionContextResolver textResolver = - IStructuredDocumentContextResolverFactory.INSTANCE.getTextRegionResolver(_context); - - if (textResolver.getRegionType().equals(DOMJSPRegionContexts.JSP_VBL_CLOSE)) - { - textResolver = - IStructuredDocumentContextResolverFactory. - INSTANCE.getTextRegionResolver(textResolver.getPreviousContext()); - } - - final String regionText = textResolver.getRegionText(); - final int regionStart = textResolver.getStartOffset(); - - if (DOMJSPRegionContexts.JSP_VBL_CONTENT.equals(textResolver.getRegionType()) - && regionText != null - && regionStart != -1 - && regionStart < _context.getDocumentPosition()) - { - final int relativeOffset = _context.getDocumentPosition() - regionStart - 1; - - if (regionText.charAt(relativeOffset) == '.') - { - // we must replace a length of 1 (the dot) - // at an offset on prior - replacementOffset--; - replacementLength = 1; - } - } - } - - return createDefaultProposal(replacementText, - replacementOffset, - replacementLength, - replacementText.length(), - displayImage, - displayText, - null, - additionalText, - getRelevance(target, DEFAULT_RELEVANCE)); - } - - private int getRelevance(final Object target, final int defaultRelevance) - { - // if method bindings are expected, then list exact signature - // matches top most. Still list non-matching methods, but put - // them at the bottom - if (_expectedMethodBindings.size() > 0) - { - if (target instanceof IMethodSymbol) - { - final IMethodSymbol methodSymbol = (IMethodSymbol) target; - - for (final Iterator it = _expectedMethodBindings.iterator(); - it.hasNext();) - { - final String methodType = (String) it.next(); - - // we have a match, so push to the top - if (methodType.equals(methodSymbol.getSignature())) - { - return HIGH_RELEVANCE; - } - } - - // if we get out of the loop, then this method doesn't - // match the expected signature - return LOW_RELEVANCE; - } - - // non-method targets have normal relevance when mb expected - return NORMAL_RELEVANCE; - } - - // otherwise, simply return the default for all - return defaultRelevance; - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/contentassist/el/IdCompletionStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/contentassist/el/IdCompletionStrategy.java deleted file mode 100644 index f965d8ce5..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/contentassist/el/IdCompletionStrategy.java +++ /dev/null @@ -1,169 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.core.internal.contentassist.el; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.eclipse.emf.edit.provider.ComposedAdapterFactory; -import org.eclipse.jface.text.contentassist.ICompletionProposal; -import org.eclipse.jst.jsf.context.resolver.structureddocument.IStructuredDocumentContextResolverFactory; -import org.eclipse.jst.jsf.context.resolver.structureddocument.IWorkspaceContextResolver; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext; -import org.eclipse.jst.jsf.context.symbol.ERuntimeSource; -import org.eclipse.jst.jsf.context.symbol.IInstanceSymbol; -import org.eclipse.jst.jsf.context.symbol.ISymbol; -import org.eclipse.jst.jsf.context.symbol.provider.IContentProposalProvider; -import org.eclipse.jst.jsf.context.symbol.provider.ProposalCreationFactoryAdapter; -import org.eclipse.jst.jsf.context.symbol.provider.IContentProposalProvider.IProposalCreationFactory; -import org.eclipse.jst.jsf.designtime.resolver.ISymbolContextResolver; -import org.eclipse.jst.jsf.designtime.resolver.StructuredDocumentSymbolResolverFactory; -import org.eclipse.swt.graphics.Image; - -/** - * A strategy for getting completions for EL id completions like: - * - * var - * ^ - * - * @author cbateman - * - */ -class IdCompletionStrategy extends ContentAssistStrategy -{ - - /** - * Construct a strategy for completing an ID completion - * - * @param prefixValue - * @param proposalStart - the part of the proposal which was already typed when user invoked autocomplete - */ - public IdCompletionStrategy(final String prefixValue, String proposalStart) - { - super(ContentAssistStrategy.PREFIX_TYPE_ID_COMPLETION, prefixValue, proposalStart); - } - - /** - * @see org.eclipse.jst.jsf.core.internal.contentassist.el.ContentAssistStrategy#getProposals(org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext) - */ - public List<ICompletionProposal> getProposals(IStructuredDocumentContext context) - { - final List<ICompletionProposal> completionList = new ArrayList<ICompletionProposal>(); - final IWorkspaceContextResolver workspaceResolver = - IStructuredDocumentContextResolverFactory.INSTANCE. - getWorkspaceContextResolver(context); - - final IFile iFile = (IFile) workspaceResolver.getResource(); - - ISymbol[] symbols = null; - - if (iFile != null) - { - final ISymbolContextResolver symbolResolver = - StructuredDocumentSymbolResolverFactory.getInstance(). - getSymbolContextResolver(context); - - symbols = symbolResolver.getAllVariables(); - } - - final ComposedAdapterFactory factory = - new ComposedAdapterFactory(ComposedAdapterFactory. - Descriptor.Registry.INSTANCE); - - final IProposalCreationFactory creationInfo = - new MyProposalFactory(context.getDocumentPosition(), getProposalStart().length()); - - for (int i = 0; symbols != null && i < symbols.length; i++) - { - final ISymbol symbol = symbols[i]; - - final Object adapter = - factory.adapt(symbol, IContentProposalProvider.class); - - if (adapter instanceof IContentProposalProvider) - { - final IContentProposalProvider provider = - (IContentProposalProvider) adapter; - final ICompletionProposal[] proposal = - provider.getProposals(symbol, creationInfo); - if (proposal != null) - { - addProposalsMatchingProposalStart(completionList, proposal); - } - } - } - - return Collections.unmodifiableList(completionList); - } - - private static class MyProposalFactory extends ProposalCreationFactoryAdapter - { - private final static int HIGH_RELEVANCE = 2; - private final static int NORMAL_RELEVANCE = 1; - private final static int LOW_RELEVANCE = 0; - - /** - * @param replacementOffset - * @param replacementLength - */ - public MyProposalFactory(int replacementOffset, int replacementLength) - { - /*TODO I changed the meaning of "replacementLength" from "number of chars AFTER cursor to be - * replaced" to "number of chars BEFORE cursor to be replaced. Since "replacementLength" - * has always been 0 (constructor is only called by IdCompletionStrategy.getProposals()), - * this should not change anything, but I don't know if there have been different plans - * for "replacementLength". - * TODO Maybe this change should be done in the super class instead? - */ - super(replacementOffset - replacementLength, replacementLength); - } - - public ICompletionProposal createProposal(final String replacementText, - final String displayText, - final String additionalText, - final Image displayImage, - final Object targetObject) - { - return createDefaultProposal(replacementText, _replacementOffset, - _replacementLength, - replacementText.length(), displayImage, - displayText, null, additionalText, - getRelevance(targetObject)); - } - - private int getRelevance(Object target) - { - // put tag vars at top, followed by beans, then implicits and other - if (target instanceof IInstanceSymbol) - { - final IInstanceSymbol symbol = (IInstanceSymbol) target; - - switch (symbol.getRuntimeSource().getValue()) - { - case ERuntimeSource.TAG_INSTANTIATED_SYMBOL: - return HIGH_RELEVANCE; - case ERuntimeSource.MANAGED_BEAN_SYMBOL: - return NORMAL_RELEVANCE; - case ERuntimeSource.BUILT_IN_SYMBOL: - case ERuntimeSource.OTHER: - return LOW_RELEVANCE; - } - } - - // if none of the above, return low relevance - return LOW_RELEVANCE; - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/contentassist/el/SymbolInfo.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/contentassist/el/SymbolInfo.java deleted file mode 100644 index dc7652bd8..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/contentassist/el/SymbolInfo.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.internal.contentassist.el; - -import org.eclipse.jface.text.Region; -import org.eclipse.jst.jsf.context.symbol.ISymbol; - -/** - * class contains a symbol and it's region - * - */ -public class SymbolInfo { - - private final ISymbol symbol; - private final Region relativeRegion; - - /** - * @param symbol - * @param relativeRegion - */ - public SymbolInfo(ISymbol symbol, Region relativeRegion) { - super(); - this.symbol = symbol; - this.relativeRegion = relativeRegion; - } - - /** - * @return the symbol - */ - public ISymbol getSymbol() { - return symbol; - } - - /** - * @return the relative region - */ - public Region getRelativeRegion() { - return relativeRegion; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/contentassist/el/SymbolResolveUtil.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/contentassist/el/SymbolResolveUtil.java deleted file mode 100644 index 29b151853..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/contentassist/el/SymbolResolveUtil.java +++ /dev/null @@ -1,189 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.internal.contentassist.el; - -import java.util.Arrays; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.jst.jsf.common.internal.types.CompositeType; -import org.eclipse.jst.jsf.common.internal.types.IAssignable; -import org.eclipse.jst.jsf.context.resolver.structureddocument.IDOMContextResolver; -import org.eclipse.jst.jsf.context.resolver.structureddocument.IStructuredDocumentContextResolverFactory; -import org.eclipse.jst.jsf.context.resolver.structureddocument.ITaglibContextResolver; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext; -import org.eclipse.jst.jsf.context.symbol.IInstanceSymbol; -import org.eclipse.jst.jsf.context.symbol.IObjectSymbol; -import org.eclipse.jst.jsf.context.symbol.ISymbol; -import org.eclipse.jst.jsf.designtime.resolver.ISymbolContextResolver; -import org.eclipse.jst.jsf.designtime.resolver.StructuredDocumentSymbolResolverFactory; -import org.eclipse.jst.jsf.metadataprocessors.MetaDataEnabledProcessingFactory; -import org.eclipse.jst.jsf.metadataprocessors.features.ELIsNotValidException; -import org.eclipse.jst.jsf.metadataprocessors.features.IValidELValues; -import org.w3c.dom.Attr; -import org.w3c.dom.Element; -import org.w3c.dom.Node; - -/** - * Utility class for resolving symbols for a IStructuredDocumentContext. - */ -public class SymbolResolveUtil { - - private SymbolResolveUtil() { - // utility class; not instantiable - } - - /** - * Get symbol for a variable (managed bean name, bundle name) - * - * @param context - * @param name - * @return ISymbol - */ - public static ISymbol getSymbolForVariable( - final IStructuredDocumentContext context, final String name) { - final ISymbolContextResolver symbolResolver = StructuredDocumentSymbolResolverFactory - .getInstance().getSymbolContextResolver(context); - - return symbolResolver.getVariable(name); - } - - /** - * Get symbol for a variable suffix (e. g. bean property/method, bundle - * property). Takes into account whether method bindings are expected for - * the given context. - * - * @param context - - * the IStructuredDocumentContext - * @param fullName - - * full name of the suffix (e. g. bean.property1.property2) - * @param isLastSuffix - - * set true if there follows no other suffix. Method names will - * only be considered if true - * @return ISymbol. May be null. - */ - public static ISymbol getSymbolForVariableSuffixExpr( - final IStructuredDocumentContext context, final String fullName, - final boolean isLastSuffix) { - String[] ids = fullName.split("\\."); //$NON-NLS-1$ - - // if no suffixes, only one id - if (ids.length < 1) { - ids = new String[] { fullName }; - } - - final ISymbolContextResolver symbolResolver = StructuredDocumentSymbolResolverFactory - .getInstance().getSymbolContextResolver(context); - if (symbolResolver != null) { - ISymbol symbol = symbolResolver.getVariable(ids[0]); - if (symbol instanceof IInstanceSymbol - && ((IInstanceSymbol) symbol).isTypeResolved()) { - for (int curSuffixIdx = 1; curSuffixIdx < ids.length; curSuffixIdx++) { - if (isLastSuffix && curSuffixIdx == ids.length - 1 - && isMethodBindingExpected(context)) { - /* - * TODO Take into acount required method signature, - * since there may be different methods with the same - * name - */ - return symbolResolver.getMethod((IObjectSymbol) symbol, - ids[curSuffixIdx]); - } - - final ISymbol property = symbolResolver.getProperty(symbol, - ids[curSuffixIdx]); - - if (property == null) { - return null; - } - symbol = property; - } - return symbol; - } - } - return null; - } - - /** - * Tells whether method bindings are expected for the given context. - * - * @param context - - * the IStructuredDocumentContext - * @return true, if method bindings expected - */ - public static boolean isMethodBindingExpected( - final IStructuredDocumentContext context) { - return isMethodBindingExpected(context, null); - } - - /** - * Tells whether method bindings are expected for the given context. Will - * add signatures of expected method bindings to a given list. - * - * @param context - - * the IStructuredDocumentContext - * @param expectedBindings - - * a list. If not null, signatures of expected method bindings - * will be appended to this list. - * @return true, if method bindings expected - */ - public static boolean isMethodBindingExpected( - final IStructuredDocumentContext context, - final List expectedBindings) { - final IDOMContextResolver domResolver = IStructuredDocumentContextResolverFactory.INSTANCE - .getDOMContextResolver(context); - - final Node curNode = domResolver.getNode(); - - if (curNode instanceof Attr) { - final Attr attr = (Attr) curNode; - final Element element = attr.getOwnerElement(); - - final ITaglibContextResolver taglibResolver = IStructuredDocumentContextResolverFactory.INSTANCE - .getTaglibContextResolver(context); - - final String uri = taglibResolver.getTagURIForNodeName(element); - - final List elVals = MetaDataEnabledProcessingFactory.getInstance() - .getAttributeValueRuntimeTypeFeatureProcessors( - IValidELValues.class, context, uri, - element.getLocalName(), attr.getLocalName()); - - boolean methodBindingExpected = false; - for (final Iterator it = elVals.iterator(); it.hasNext();) { - final IValidELValues validValues = (IValidELValues) it.next(); - - try { - final CompositeType type = validValues - .getExpectedRuntimeType(); - if (type != null - && type.getAssignmentTypeMask() == IAssignable.ASSIGNMENT_TYPE_NONE) { - methodBindingExpected = true; - if (expectedBindings != null) { - expectedBindings.addAll(Arrays.asList(validValues - .getExpectedRuntimeType().getSignatures())); - } else { - // if we don't need the method signatures, *one* - // expected method binding is sufficient. - return true; - } - } - } catch (final ELIsNotValidException e) { - // do nothing - } - } - return methodBindingExpected; - } - // default condition is no method binding - return false; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jem/BeanProxyUtil.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jem/BeanProxyUtil.java deleted file mode 100644 index 4a0a24cfb..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jem/BeanProxyUtil.java +++ /dev/null @@ -1,505 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.internal.jem; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jdt.core.IField; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jem.internal.proxy.core.IBeanProxy; -import org.eclipse.jem.internal.proxy.core.IBeanTypeProxy; -import org.eclipse.jem.internal.proxy.core.IFieldProxy; -import org.eclipse.jem.internal.proxy.core.IIntegerBeanProxy; -import org.eclipse.jem.internal.proxy.core.IMethodProxy; -import org.eclipse.jem.internal.proxy.core.IStringBeanProxy; -import org.eclipse.jem.internal.proxy.core.ThrowableProxy; -import org.eclipse.jst.jsf.common.util.TypeUtil; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; - -/** - * Convenience methods for using bean proxies - * - * @author cbateman - * - */ -public final class BeanProxyUtil -{ - - /** - * A convenience wrapper for manipulating JEM proxy types - * - */ - public static class BeanProxyWrapper - { - private final static IBeanProxy[] NO_ARGS = new IBeanProxy[0]; - private final static IBeanTypeProxy[] NO_ARG_TYPES = new IBeanTypeProxy[0]; - - private final IBeanTypeProxy _typeProxy; - private final IProject _project; - private IBeanProxy _instance; - - /** - * @param project - * @param typeProxy - */ - public BeanProxyWrapper(final IProject project, final IBeanTypeProxy typeProxy) - { - super(); - _typeProxy = typeProxy; - _project = project; - } - - /** - * Initialize a proxied instance of the type referred to by typeProxy. - * - * @throws ProxyException - */ - public void init() throws ProxyException - { - if (_instance == null) - { - try - { - _instance = _typeProxy.newInstance(); - } - catch (final ThrowableProxy e) - { - throw new ProxyException(e); - } - catch (final NoClassDefFoundError ndfe) - { - throw new ProxyException(ndfe); - } - catch (final ExceptionInInitializerError e) - { - throw new ProxyException(e); - } - } - } - - /** - * Re-initialize the proxied instance of typeProxy. - * - * @throws ProxyException - */ - public void reinit() throws ProxyException - { - _instance = null; - init(); - } - - /** - * @return the instance proxy - */ - public IBeanProxy getInstance() - { - return _instance; - } - - /** - * <p> - * Call the method called methodName on the proxied instance. If - * args.length is 0 then the zero-argument method is found and called. - * </p> - * - * @param methodName - * @param args - * @param argTypes - * @return the result of calling the method or null if there is no such - * method. - * @throws ProxyException - */ - public IBeanProxy call(final String methodName, - final IBeanProxy[] args, final IBeanTypeProxy[] argTypes) - throws ProxyException - { - try - { - final IMethodProxy method = getMethodProxy(methodName, argTypes); - /*(argTypes.length == 0) ? _typeProxy - .getMethodProxy(methodName) : _typeProxy - .getMethodProxy(methodName, argTypes);*/ - - if (method != null) - { - method.setAccessible(true); - return method.invoke(_instance, args); - } - } - catch (final ThrowableProxy tp) - { - throw new ProxyException(tp); - } - catch (final NoClassDefFoundError ndfe) - { - throw new ProxyException(ndfe); - } - - return null; - } - - /** - * Convenience method for call(methodName, new {@link IBeanProxy}[0], - * new {@link IBeanTypeProxy}[0]) - * - * @param methodName - * @return the proxied return value - * @throws ProxyException - */ - public IBeanProxy call(final String methodName) throws ProxyException - { - return call(methodName, NO_ARGS, NO_ARG_TYPES); - } - - /** - * <p> - * Calls the zero-argument method called 'methodName' on the proxied - * instance and if it results in a String return value, returns it. If - * the method does not return a String value, then null is returned. - * </p> - * - * @param methodName - * @return the string value or null. - * @throws ProxyException - */ - public String callStringMethod(final String methodName) - throws ProxyException - { - final IBeanProxy result = call(methodName); - - if (result instanceof IStringBeanProxy) - { - return ((IStringBeanProxy) result).stringValue(); - } - - return null; - } - - /** - * <p> - * Calls the zero-argument method called 'methodName' on the proxied - * instance and if it results in an Integer value, returns it. If the - * method does not return an integer value, then null is returned. - * </p> - * - * @param methodName - * @return the integer value or null. - * @throws ProxyException - */ - public Integer callIntMethod(final String methodName) - throws ProxyException - { - final IBeanProxy result = call(methodName, NO_ARGS, NO_ARG_TYPES); - - if (result instanceof IIntegerBeanProxy) - { - return Integer.valueOf(((IIntegerBeanProxy) result).intValue()); - } - - return null; - } - - /** - * Use the typeProxy for the proxied instance to try to acquire the - * field called fieldName of type String. Note that this won't find - * private fields on supertypes. - * - * Equivalent to getStringFieldValue(fieldName, _typeProxy); - * - * @param fieldName - * @return the String value of fieldName on the proxied instance or - * null. - * @throws ProxyException - */ - public String getStringFieldValue(final String fieldName) - throws ProxyException - { - return getStringFieldValue(fieldName, _typeProxy); - } - - /** - * Use the provided typeProxy to acquire the field proxy for the field - * proxy called fieldName. Normally, you would use the type proxy of the - * instance bean, however there are cases such as acquiring the value a - * private field on a supertype where you need the type proxy for the - * super type. - * - * @param fieldName - * @param typeProxy - * @return the string value or null. - * @throws ProxyException - */ - public String getStringFieldValue(final String fieldName, - final IBeanTypeProxy typeProxy) throws ProxyException - { - final IBeanProxy value = getFieldValue(fieldName, typeProxy); - - if (value instanceof IStringBeanProxy) - { - return ((IStringBeanProxy) value).stringValue(); - } - - return null; - } - - /** - * @param fieldName - * @param typeProxy - * @return the declared field value on the proxied instance called - * fieldName or null. - * @throws ProxyException - */ - public IBeanProxy getFieldValue(final String fieldName, - final IBeanTypeProxy typeProxy) throws ProxyException - { - // avoid having JEM log a warning if we can prove the call to find - // the field will fail - if (!hasField(fieldName)) - { - return null; - } - - try - { - final IFieldProxy fieldProxy = typeProxy - .getDeclaredFieldProxy(fieldName); - - if (fieldProxy != null) - { - fieldProxy.setAccessible(true); - return fieldProxy.get(_instance); - } - } - catch (final ThrowableProxy e) - { - throw new ProxyException(e); - } - catch (final NoClassDefFoundError ndfe) - { - throw new ProxyException(ndfe); - } - - return null; - } - - /** - * Same as {@link #getFieldValue(String, IBeanTypeProxy)} except it will - * climb the parent hierarchy looking for the first field called - * fieldName. - * - * @param fieldName - * @param typeProxy - * @return the proxied value or null - * @throws ProxyException - */ - public IBeanProxy getFieldValueIncludeParents(final String fieldName, - final IBeanTypeProxy typeProxy) throws ProxyException - { - IBeanTypeProxy curType = typeProxy; - - PARENT_LOOP: while (curType != null) - { - final IBeanProxy field = getFieldValue(fieldName, curType); - if (field != null) - { - return field; - } - - try - { - IBeanTypeProxy oldType = curType; - curType = curType.getSuperBeanTypeProxy(); - // avoid infinite loop: if the parent of curType can't - // be resolved, JEM returns the same type, so curType - // never becomes null - if (oldType == curType) - { - break PARENT_LOOP; - } - } - catch (final NullPointerException npe) - { - // suppress npe caused by getSuperBeanTypeProxy - // not doing a null check on getSuperType() - curType = null; - } - } - - // have got to the top of hierarchy and not found the field - return null; - } - - /** - * @return the proxied instance - */ - public final IBeanProxy getBeanProxy() - { - return _instance; - } - - private IMethodProxy getMethodProxy(final String methodName, final IBeanTypeProxy[] argTypes) - { - IBeanTypeProxy curType = _typeProxy; - - PARENT_LOOP: while (curType != null) - { - final IMethodProxy[] declaredMethods = curType.getDeclaredMethods(); - final IMethodProxy foundMethod = findMethodInList(methodName, argTypes, declaredMethods); - if (foundMethod != null) - { - return foundMethod; - } - // avoid infinite loop: if the parent of curType can't - // be resolved, JEM returns the same type, so curType - // never becomes null - IBeanTypeProxy oldType = curType; - curType = _typeProxy.getSuperBeanTypeProxy(); - if (oldType == curType) - { - break PARENT_LOOP; - } - } - return null; - } - - private IMethodProxy findMethodInList(final String methodName, final IBeanTypeProxy[] argTypes, - final IMethodProxy[] listOfMethods) - { - METHODS_LOOP: for (final IMethodProxy methodProxy : listOfMethods) - { - if (methodName.equals(methodProxy.getName())) - { - final IBeanTypeProxy[] parameterTypes = - methodProxy.getParameterTypes(); - if (argTypes.length == parameterTypes.length) - { - for (int i = 0; i < argTypes.length; i++) - { - if (!argTypes[i].getTypeName().equals(parameterTypes[i].getTypeName())) - { - // if we find a parameter type mismatch, then - // skip this method; it's not it - continue METHODS_LOOP; - } - } - // if we get to here, we have a method with right name - // and parameters - return methodProxy; - } - } - } - return null; - } - - private boolean hasField(final String fieldName) - { - final IType type = lazilyCalculateType(); - if (type != null) - { - final IField field = type.getField(fieldName); - return field.exists(); - } - return false; - } - - private IType _type; - private boolean _checkedType; - private IType lazilyCalculateType() - { - if (!_checkedType) - { - _checkedType = true; - final String typeName = _typeProxy.getTypeName(); - final IJavaProject javaProject = JavaCore.create(_project); - if (typeName != null && typeName.startsWith("L")) - { - _type = TypeUtil.resolveType(javaProject, typeName); - } - else - { - try - { - _type = javaProject.findType(typeName); - } - catch (JavaModelException e) - { - JSFCorePlugin.log(e, "While loading type: "+typeName); - } - } - } - return _type; - } - -// private Map<String, List<IMethod>> _methods; -// -// private Map<String, List<IMethod>> lazilyCalculateMethods(final IType type) -// { -// if (_methods == null) -// { -// _methods = new HashMap<String, List<IMethod>>(); -// final JDTBeanIntrospector introspector = new JDTBeanIntrospector(type); -// final IMethod[] methods = introspector.getAllMethods(); -// -// for (final IMethod method : methods) -// { -// List<IMethod> byName = _methods.get(method.getElementName()); -// if (byName == null) -// { -// byName = new ArrayList<IMethod>(); -// _methods.put(method.getElementName(), byName); -// } -// -// try { -// if (method.exists() -// && Flags.isPublic(method.getFlags())) -// { -// byName.add(method); -// } -// } catch (JavaModelException e) { -// JSFCorePlugin.log(e, "While getting flags on method: "+method.getElementName()); -// } -// } -// } -// return _methods; -// } - - } - - /** - * Checked exception the wraps problems thrown by JEM proxying into a single - * exception - * - */ - public static class ProxyException extends Exception - { - private static final long serialVersionUID = -1526057761795574331L; - - /** - * @param message - * @param cause - */ - public ProxyException(final String message, final Throwable cause) - { - super(message, cause); - } - - /** - * @param cause - */ - public ProxyException(final Throwable cause) - { - super(cause); - } - - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryconfig/JSFLibraryConfigDialogSettingData.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryconfig/JSFLibraryConfigDialogSettingData.java deleted file mode 100644 index 2b7f26379..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryconfig/JSFLibraryConfigDialogSettingData.java +++ /dev/null @@ -1,121 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Justin Chen - *******************************************************************************/ -package org.eclipse.jst.jsf.core.internal.jsflibraryconfig; - -import java.util.ArrayList; -import java.util.List; - -/** - * To construct implementation library and component libraries from sticky values - * in DialogSettings as saved libraries. - * - * @author Justin Chen - Oracle - * @deprecated - */ -public class JSFLibraryConfigDialogSettingData { - /** - * Delimintor for parsing a persistent property string. - */ - final protected static String SEPARATOR =":"; //$NON-NLS-1$ - - /** - * Parsing delimnitor for elements in a tuple. - */ - final protected static String SPTR_TUPLE = ":"; //$NON-NLS-1$ - /** - * Parsing delimintor for tuples in a persistent property string. - */ - final protected static String EO_TUPLE = ";"; //$NON-NLS-1$ - - final private JSFLibraryRegistryUtil jsfLibReg; - private String[] savedCompLibs; - private List selJSFLibComp; // lazy initialized - - - /** - * Constructor where implementation type was chosen to be USER_SPECIFIED. Created for backwards compatibilty when server supplied was not an option. - * @param compLibs - */ - public JSFLibraryConfigDialogSettingData( String[] compLibs) { - this.jsfLibReg = JSFLibraryRegistryUtil.getInstance(); - this.savedCompLibs = compLibs; - - // Verify and log a message if a saved component library no longer exists. - verifySavedLibAvailability(); - } - - /** - * Return the list of saved component libraries and their deployment settings. - * - * @return selJSFLibComp List - */ - public List getJSFComponentLibraries() { - if (selJSFLibComp == null) { - selJSFLibComp = new ArrayList(); - - if (savedCompLibs != null && savedCompLibs.length > 0) { - JSFLibraryInternalReference lib = null; - String item; - String[] attributes; - String id; - boolean deploy = false; - - for (int i = 0; i < savedCompLibs.length; i++) { - item = savedCompLibs[i]; - attributes = item.split(SEPARATOR); - - id = attributes[0]; - deploy = Boolean.valueOf(attributes[1]).booleanValue(); - - lib = jsfLibReg.getJSFLibraryReferencebyID(id); - if (lib != null) { - selJSFLibComp.add(new JSFLibraryInternalReference(lib.getLibrary(), true, deploy)); - } /*else { - // already logged if a saved component library is no longer available. - }*/ - } - } - } - return selJSFLibComp; - } - - /** - * Only need to verify component library availability from sticky settings. - */ - private void verifySavedLibAvailability() { - List validLibs = new ArrayList(); - if (savedCompLibs != null && savedCompLibs.length > 0) { - String item = null; - String[] attributes; - boolean invalidRefs = false; - for (int i = 0; i < savedCompLibs.length; i++) { - item = savedCompLibs[i]; - attributes = item.split(SEPARATOR); - - if (jsfLibReg.getJSFLibraryReferencebyID(attributes[0]) != null) { - validLibs.add(item); - } else { - invalidRefs = true; -// JSFCorePlugin.log(IStatus.INFO, Messages.JSFLibCfgDialogSettingData_Sticky_Component_Lib_Not_Exist); - } - } - if (invalidRefs){ - String [] validCompLibs = (String[])validLibs.toArray(new String[validLibs.size()]); - if (validCompLibs.length > 0) - System.arraycopy(validCompLibs, 0, savedCompLibs, 0, validCompLibs.length); - else - savedCompLibs = new String[]{}; - } - } - - - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryconfig/JSFLibraryConfigModel.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryconfig/JSFLibraryConfigModel.java deleted file mode 100644 index 3d1e7e674..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryconfig/JSFLibraryConfigModel.java +++ /dev/null @@ -1,161 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: Oracle - *******************************************************************************/ -package org.eclipse.jst.jsf.core.internal.jsflibraryconfig; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.jst.jsf.core.internal.Messages; - -/** - * Model for the custom control <b>JSFLibraryConfigControl</b>. - * A JSFLibraryConfigModel object is initialized from a source and updated with - * selected implementation and component libraries when selections are changed. - * - * @author Justin Chen - Oracle - * @deprecated - */ -public class JSFLibraryConfigModel { - final private JSFLibraryConfigDialogSettingData data; - final private JSFLibraryRegistryUtil jsfLibReg; - private List colJSFCompLib; - - /** - * Private constructor. - * @param data - */ - private JSFLibraryConfigModel(JSFLibraryConfigDialogSettingData data) { - this.data = data; - this.jsfLibReg = JSFLibraryRegistryUtil.getInstance(); - } - - /** - * Return JSF component libraries. - * - * This list is initialized from JSF library registry and updated with persistent - * configuration data. - * - * @return List - * see also org.eclipse.jst.jsf.ui.properties.IJSFLibraryDecoratorProvider#getProjectJSFComponentLibraries() - */ - public List getJSFComponentLibraries() { - if (colJSFCompLib == null) { - /* To initialize a component library list from registry and then - * update list with saved component libraries. - */ - colJSFCompLib = jsfLibReg.getJSFComponentLibraries(); - Iterator it = data.getJSFComponentLibraries().iterator(); - JSFLibraryInternalReference targetItem = null; - JSFLibraryInternalReference srcItem = null; - while (it.hasNext()) { - targetItem = (JSFLibraryInternalReference) it.next(); - srcItem = jsfLibReg.getJSFLibraryReferencebyID(targetItem.getID()); - if (srcItem != null) { - srcItem.setSelected(true); - srcItem.setToBeDeployed(targetItem.isCheckedToBeDeployed()); - } - } - } - return colJSFCompLib; - } - - /** - * Return the selected JSF component libraries currently. - * An empty list is returned when no component libraries are selected. - * - * @return list List - */ - public List getCurrentJSFComponentLibrarySelection() { - List list = new ArrayList(); - - Iterator it = getJSFComponentLibraries().iterator(); - JSFLibraryInternalReference crtItem = null; - while (it.hasNext()) { - crtItem = (JSFLibraryInternalReference) it.next(); - if (crtItem.isSelected()) { - list.add(crtItem); - } - } - return list; - } - - /** - * Returned saved component libraries which were persisted as - * DialogSettings or project persistent properties. - * - * @return List - */ - public List getSavedJSFComponentLibraries() { - return data.getJSFComponentLibraries(); - } - - /** - * Update the JSF library component libraries selection. - * - * @param libraries List - */ - public void setCurrentJSFComponentLibrarySelection(final List libraries) { - if (libraries != null) { - /* Reset all item in component library list to unselect first. - * Then, update each item in cmponent libraries to the provided list. - */ - setJSFLibrariesSelection(getJSFComponentLibraries(), false); - - Iterator it = libraries.iterator(); - JSFLibraryInternalReference crtItem; - JSFLibraryInternalReference srcItem = null; - while (it.hasNext()) { - crtItem = (JSFLibraryInternalReference) it.next(); - srcItem = jsfLibReg.getJSFLibraryReferencebyID(crtItem.getID()); - - if (srcItem != null) { - srcItem.setSelected(true); - srcItem.setToBeDeployed(crtItem.isCheckedToBeDeployed()); - } - } - } - } - - /** - * Set selection state to given state to each libray in the collection. - * - * @param libs List - * @param state boolean - */ - private void setJSFLibrariesSelection(final List libs, final boolean state) { - Iterator it = libs.iterator(); - JSFLibraryInternalReference crtjsflib; - while (it.hasNext()) { - crtjsflib = (JSFLibraryInternalReference) it.next(); - crtjsflib.setSelected(state); - } - } - - /** - * Factory class to create new JSFLibraryConfigModel instances - */ - public static final class JSFLibraryConfigModelFactory { - /** - * To create a new instance of JSFLibraryConfigModel object. - * A NullPointerException is raised if source is null. - * - * @param source JSFLibraryConfiglModelSource - * @return JSFLibraryConfigModel - */ - public static JSFLibraryConfigModel createInstance(final JSFLibraryConfigDialogSettingData source) { - if (source == null) { - throw new NullPointerException(Messages.JSFLibraryConfigModel_Null_Data_Source); - } - return new JSFLibraryConfigModel(source); - } - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryconfig/JSFLibraryInternalReference.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryconfig/JSFLibraryInternalReference.java deleted file mode 100644 index 8c8481b1f..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryconfig/JSFLibraryInternalReference.java +++ /dev/null @@ -1,148 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: Oracle - *******************************************************************************/ -package org.eclipse.jst.jsf.core.internal.jsflibraryconfig; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary; - -/** - * Attach additonal attributes such as selection and deployment - * to a JSF library when it is referenced by a project. - * - * @author Justin Chen - Oracle - * @deprecated - */ -public class JSFLibraryInternalReference { - final private JSFLibrary jsfLib; - private boolean check4Deploy; // Initialized from default in workspace - private boolean selected; // selected for project - - /** - * Constructor - * @param jsfLib JSFLibrary instance embedded inside. - * @param selected boolean true if selected, otherwise, not selected. - * @param deploy boolean true if needs to be deployed, otherwise, won't be deployed. - */ - public JSFLibraryInternalReference(JSFLibrary jsfLib, boolean selected, boolean deploy) { - this.jsfLib = jsfLib; - this.selected = selected; - this.check4Deploy = deploy; - } - - /** - * Return the embedded JSFLibrary instance. - * - * @return jsfLib JSFLibrary - */ - public JSFLibrary getLibrary() { - return jsfLib; - } - - /** - * Set the to be deployed flag. - * - * @param deploy boolean - */ - public void setToBeDeployed(final boolean deploy) { - check4Deploy = deploy; - } - - /** - * Return true if the JSF library needs to be deployed. - * Otheriwse, return false. - * - * @return boolean - */ - public boolean isCheckedToBeDeployed() { - return check4Deploy; - } - - /** - * Set the selected attribute to a JSFLibraryLibraryReference object. - * - * @param selected boolean - */ - public void setSelected(final boolean selected) { - this.selected = selected; - } - - /** - * Return true if the JSF library is referenced by a project. - * Otherwise, return false. - * - * @return selected boolean - */ - public boolean isSelected() { - return selected; - } - - /** - * To generate a string that represents the JSFLibraryLibraryReference - * object for persistence. - * - * @return String - */ - protected String generatePersistString() { - return (getID() + JSFLibraryConfigDialogSettingData.SPTR_TUPLE + - String.valueOf(isSelected()) + JSFLibraryConfigDialogSettingData.SPTR_TUPLE + - String.valueOf(isCheckedToBeDeployed())); - } - - /** - * Helper method to return the library ID from the embedded - * JSFLibrary instance. - * - * @return id String - */ - public String getID() { - return jsfLib.getID(); - } - - /** - * Helper method to return the library name from the embedded - * JSFLibrary instance. - * - * @return name String - */ - public String getName() { - return jsfLib.getName(); - } - - /** - * Helper method to return the label for the library from the embedded - * JSFLibrary instance. - * - * @return name String - */ - public String getLabel() { - return jsfLib.getLabel(); - } - - /** - * Return true if the embedded JSF library instance i implementation. - * Otherwise, return false. - * - * @return boolean - */ - public boolean isImplementation() { - return jsfLib.isImplementation(); - } - - /** - * Help method to return a list of Archive files from - * the embedded JSFLibrary instance. - * - * @return boolean - */ - public EList getArchiveFiles() { - return jsfLib.getArchiveFiles(); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryconfig/JSFLibraryRegistryUtil.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryconfig/JSFLibraryRegistryUtil.java deleted file mode 100644 index c1a722187..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryconfig/JSFLibraryRegistryUtil.java +++ /dev/null @@ -1,549 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: Oracle - *******************************************************************************/ -package org.eclipse.jst.jsf.core.internal.jsflibraryconfig; - -import java.io.IOException; -import java.net.MalformedURLException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.resources.IWorkspaceRoot; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IExtension; -import org.eclipse.core.runtime.IExtensionPoint; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.InvalidRegistryObjectException; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Platform; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.xmi.XMLResource; -import org.eclipse.jdt.core.IClasspathContainer; -import org.eclipse.jdt.core.IClasspathEntry; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.core.internal.JSFLibraryClasspathContainer; -import org.eclipse.jst.jsf.core.internal.Messages; -import org.eclipse.jst.jsf.core.internal.RegistryUpgradeCommitHandler; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.ArchiveFile; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistry; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistryFactory; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.adapter.MaintainDefaultImplementationAdapter; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.impl.JSFLibraryRegistryPackageImpl; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.util.JSFLibraryRegistryResourceFactoryImpl; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.util.JSFLibraryRegistryResourceImpl; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.util.JSFLibraryRegistryUpgradeUtil; -import org.eclipse.jst.jsf.core.jsflibraryconfiguration.JSFLibraryConfigurationHelper; -import org.eclipse.jst.jsf.core.jsflibraryregistry.PluginProvidedJSFLibraryCreationHelper; -import org.eclipse.jst.jsf.core.jsflibraryregistry.internal.PluginProvidedJSFLibraryCreationHelper2; - -/** - * A singleton maintains lists of implementation and component libraries - * in registry. - * - * Each item in the lists contains a workingcopy of a JSF library and - * decorates with usage information such selection and deployment. - * - * The lists are updated when there are changes in JSF library registry. - * - * @author Justin Chen, etc. - Oracle - * @deprecated - */ -@SuppressWarnings("deprecation") -public class JSFLibraryRegistryUtil { - private static JSFLibraryRegistryUtil instance = null; - - private List implLibs = null; - private List compLibs = null; - - - // The NS URI of the JSF Library Registry's Ecore package. (Must match - // setting on package in Ecore model.) - private static final String JSF_LIBRARY_REGISTRY_NSURI = "http://www.eclipse.org/webtools/jsf/schema/jsflibraryregistry.xsd"; //$NON-NLS-1$ - - private static final String LIB_EXT_PT = "pluginProvidedJsfLibraries"; //$NON-NLS-1$ - //deprecated ext-pt - private static final String OLD_LIB_EXT_PT = "jsfLibraries"; //$NON-NLS-1$ - - // The JSF Library Registry EMF resource instance. - private static JSFLibraryRegistryResourceImpl jsfLibraryRegistryResource = null; - - //JSFLibraryRegistry singleton - private JSFLibraryRegistry jsfLibraryRegistry; - - /** - * Private constructor - */ - private JSFLibraryRegistryUtil() { - //nothing to do - } - - /** - * Return the singleton instance of JSFLibraryRegistryUtil. - * - * @return JSFLibraryRegistryUtil - */ - public synchronized static JSFLibraryRegistryUtil getInstance() { - if ( instance == null ) { - instance = new JSFLibraryRegistryUtil(); - instance.loadJSFLibraryRegistry(); - } - return instance; - } - - /** - * Convenience method to return the JSFLibraryRegistry instance. - * - * @return jsfLibReg JSFLibraryRegistry - */ - public JSFLibraryRegistry getJSFLibraryRegistry() { - return jsfLibraryRegistry; - } - - /** - * Get the default JSF implementation library instance. - * A null is returned when there is no libraries in the registry. - * - * @return JSFLibraryInternalReference - */ - public JSFLibraryInternalReference getDefaultJSFImplementationLibrary() { - JSFLibrary dftImplLib = getJSFLibraryRegistry().getDefaultImplementation(); - - return ((dftImplLib != null) ? - getJSFLibraryReferencebyID(dftImplLib.getID()) : - null); - } - - /** - * Get the working copy of JSF implementation libraries. - * The list is updated when there are changes in registry. - * - * @return List - */ - List getJSFImplementationLibraries() { - if (implLibs == null) { - implLibs = wrapJSFLibraries(getJSFLibraryRegistry().getImplJSFLibraries()); - } else { - if (implLibs.size() != getJSFLibraryRegistry().getImplJSFLibraries().size() || - isAnyLibraryChanged(implLibs)) { - implLibs.clear(); - implLibs = wrapJSFLibraries(getJSFLibraryRegistry().getImplJSFLibraries()); - } - } - return implLibs; - } - - /** - * Get the working copy of JSF component libraries. - * The list is updated when there are changes in registry. - * - * @return List - */ - List getJSFComponentLibraries() { - if (compLibs == null) { - compLibs = wrapJSFLibraries(getJSFLibraryRegistry().getNonImplJSFLibraries()); - } else { - if (compLibs.size() != getJSFLibraryRegistry().getNonImplJSFLibraries().size() || - isAnyLibraryChanged(compLibs)) { - compLibs.clear(); - compLibs = wrapJSFLibraries(getJSFLibraryRegistry().getNonImplJSFLibraries()); - } - } - return compLibs; - } - - /** - * Get the JSFLibraryDecorator object from the provided ID. - * A null is returned no library matches the ID. - * - * @param id String - * @return JSFLibraryDecorator - */ - public JSFLibraryInternalReference getJSFLibraryReferencebyID(final String id) { - Iterator it = getJSFImplementationLibraries().iterator(); - JSFLibraryInternalReference crtItem = null; - - // search implementation libraries - while(it.hasNext()) { - crtItem = (JSFLibraryInternalReference)it.next(); - if (id.equals(crtItem.getID())) { - return crtItem; - } - } - // search component libraries - it = getJSFComponentLibraries().iterator(); - while(it.hasNext()) { - crtItem = (JSFLibraryInternalReference)it.next(); - if (id.equals(crtItem.getID())) { - return crtItem; - } - } - return null; - } - - /** - * Add a JSF Library into collection for either - * JSF implementation libraries or component libraries. - * The decision is based on if a JSF library is an implementation. - * - * @param library JSFLibraryLibraryReference - */ - public void addJSFLibrary(final JSFLibraryInternalReference library) { - // Library is added only if it does not exist in registry - if (library != null && getJSFLibraryRegistry().getJSFLibraryByID(library.getID()) == null) { - // Add the library working copy into workspace registry. - JSFLibrary jsfLib = library.getLibrary(); - getJSFLibraryRegistry().addJSFLibrary(jsfLib.getWorkingCopy()); - - // Add library into the collection depends on its type. - List list = (library.isImplementation() ? - getJSFImplementationLibraries() : - getJSFComponentLibraries()); - list.add(library); - } - } - - private List wrapJSFLibraries(final EList libs) { - List list = new ArrayList(); - if (libs != null) { - JSFLibrary jsfLib; - JSFLibraryInternalReference jsfLibDctr; - - Iterator it = libs.iterator(); - while (it.hasNext()) { - jsfLib = (JSFLibrary) it.next(); - // Set unselected and undeployed initially. - jsfLibDctr = new JSFLibraryInternalReference(jsfLib, //.getWorkingCopy(), - false, - false); - list.add(jsfLibDctr); - } - } - return list; - } - - private boolean isAnyLibraryChanged(final List list) { - Iterator it = list.iterator(); - JSFLibraryInternalReference wclib = null; // working copy library - JSFLibrary lib = null; - - while(it.hasNext()) { - wclib = (JSFLibraryInternalReference)it.next(); - lib = getJSFLibraryRegistry().getJSFLibraryByID(wclib.getID()); - if (lib == null) { // removed. Hence, changed. - return true; - } - if (wclib.getArchiveFiles().size() != - lib.getArchiveFiles().size()) { // Archives changed.. - return true; - } - if (isAnyArchiveFileChanged(wclib.getArchiveFiles(), - lib.getArchiveFiles())) { // Check archive file changes. I.e., name and location - return true; - } - } - return false; - } - - private boolean isAnyArchiveFileChanged(final EList source, EList target) { - ArchiveFile arSrc = null; - Iterator it = source.iterator(); - while (it.hasNext()) { - arSrc = (ArchiveFile) it.next(); - if (!findMatchedArchive(arSrc, target)) { - return true; - } - } - return false; - } - - private boolean findMatchedArchive(ArchiveFile source, EList list) { - ArchiveFile target = null; - Iterator it = list.iterator(); - while (it.hasNext()) { - target = (ArchiveFile) it.next(); - if (target.equals(source)) { - return true; - } - } - return false; - } - - /** - * Get the classpath entries for a JSF Library - * @param lib - * @return IClasspathEntry[] - */ - public IClasspathEntry[] getClasspathEntries(JSFLibrary lib){ - //TODO: cache to optimize. probably belongs inside JSFLibrary model. - ArrayList res= new ArrayList(lib.getArchiveFiles().size()); - for (Iterator it=lib.getArchiveFiles().iterator();it.hasNext();) { - ArchiveFile jar= (ArchiveFile)it.next(); - if (jar != null && jar.exists()) { - IClasspathEntry entry = getClasspathEntry(jar); - if (entry != null) - res.add(entry); - } - } - IClasspathEntry[] entries= (IClasspathEntry[]) res.toArray(new IClasspathEntry[res.size()]); - return entries; - } - - /** - * Create IClasspathEntry for ArchiveFile - * @param jar - * @return IClasspathEntry - */ - public IClasspathEntry getClasspathEntry(ArchiveFile jar){ - IClasspathEntry entry = null; - if (jar !=null && jar.exists()){ - entry = JavaCore.newLibraryEntry(new Path(jar.getResolvedSourceLocation()), null, null);//, nu, sourceAttachRoot, accessRules, extraAttributes, false/*not exported*/); - } - return entry; - } - - /** - * Binds JSF Libraries to classpath containers when the library changes. - * - * This method will deal with library/cp container renames by removing the old classpath container and then adding. - * - * @param oldId - * @param newId - * @param monitor - * @throws JavaModelException - */ - public static void rebindClasspathContainerEntries(String oldId, String newId, IProgressMonitor monitor) throws JavaModelException { - IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot(); - IJavaProject[] projects= JavaCore.create(root).getJavaProjects(); - IPath containerPath= new Path(JSFLibraryConfigurationHelper.JSF_LIBRARY_CP_CONTAINER_ID).append(newId); - IPath oldContainerPath = new Path(JSFLibraryConfigurationHelper.JSF_LIBRARY_CP_CONTAINER_ID).append(oldId); - - JSFLibrary lib = JSFLibraryRegistryUtil.getInstance().getJSFLibraryRegistry().getJSFLibraryByID(newId); - List affectedProjects= new ArrayList(); - boolean removeAndAddBecauseOfRename = (!oldId.equals(newId)); - // find all projects using the old container name... - for (int i= 0; i < projects.length; i++) { - IJavaProject project= projects[i]; - IClasspathEntry[] entries= project.getRawClasspath(); - for (int k= 0; k < entries.length; k++) { - IClasspathEntry curr= entries[k]; - if (curr.getEntryKind() == IClasspathEntry.CPE_CONTAINER) { - if (oldContainerPath.equals(curr.getPath())) { - affectedProjects.add(project); - break; - } - } - } - } - - if (!affectedProjects.isEmpty()) { - IJavaProject[] affected= (IJavaProject[]) affectedProjects.toArray(new IJavaProject[affectedProjects.size()]); - IClasspathContainer[] containers= new IClasspathContainer[affected.length]; - removeAndAddBecauseOfRename = (!oldId.equals(newId)); - if (removeAndAddBecauseOfRename){//not very pretty... remove and add new container - IClasspathEntry newEntry = JavaCore.newContainerEntry(containerPath); - for (int i= 0; i < affected.length; i++) { - IJavaProject project= affected[i]; - IClasspathEntry[] entries= project.getRawClasspath(); - List keptEntries = new ArrayList(); - //keep all entries except the old one - for (int k= 0; k < entries.length; k++) { - IClasspathEntry curr= entries[k]; - if (curr.getEntryKind() == IClasspathEntry.CPE_CONTAINER){ - if( ! oldContainerPath.equals(curr.getPath())) - keptEntries.add(curr); - } - else { - keptEntries.add(curr); - } - } - // add new container entry - keptEntries.add(newEntry); - setRawClasspath(project, keptEntries, monitor); - } - - } - else {//rebind - - JSFLibraryClasspathContainer container= new JSFLibraryClasspathContainer(lib); - containers[0] = container; - - JavaCore.setClasspathContainer(containerPath, affected, containers, monitor); - } - } else { - if (monitor != null) { - monitor.done(); - } - } - } - - /** - * Sets the raw classpath on a project and logs an error if it when a JavaModelException occurs - * @param project - * @param cpEntries - * @param monitor - */ - public static void setRawClasspath(IJavaProject project, List cpEntries, IProgressMonitor monitor) { - IClasspathEntry[] entries = (IClasspathEntry[])cpEntries.toArray(new IClasspathEntry[0]); - try { - project.setRawClasspath(entries, monitor); - } catch (JavaModelException e) { - JSFCorePlugin.log(e, "Unable to set classpath for: "+project.getProject().getName()); - } - } - - /** - * Loads the JSFLibraryRegistry EMF object from plugin-specfic workspace - * settings location. - */ - private void loadJSFLibraryRegistry() { - try { - - EPackage.Registry.INSTANCE.put(JSF_LIBRARY_REGISTRY_NSURI, JSFLibraryRegistryPackageImpl.init()); - URI jsfLibRegURI = JSFLibraryRegistryUpgradeUtil.getRegistryURI(JSFLibraryRegistryUpgradeUtil.JSF_LIBRARY_REGISTRY_LATESTVERSION_URL); - JSFLibraryRegistryUpgradeUtil.getInstance().upgradeRegistryIfNecessary(JSFLibraryRegistryUpgradeUtil.LATESTVERSION); - - JSFLibraryRegistryResourceFactoryImpl resourceFactory = new JSFLibraryRegistryResourceFactoryImpl(); - jsfLibraryRegistryResource = (JSFLibraryRegistryResourceImpl)resourceFactory.createResource(jsfLibRegURI); - try { - Map options = new HashMap(); - //disable notifications during load to avoid changing stored default implementation - options.put(XMLResource.OPTION_DISABLE_NOTIFY, Boolean.TRUE); - jsfLibraryRegistryResource.load(options); - jsfLibraryRegistry = (JSFLibraryRegistry)jsfLibraryRegistryResource.getContents().get(0); - - loadJSFLibraryExtensions(); - loadDeprecatedJSFLibraryExtensions();//to be removed - - } catch(IOException ioe) { - //Create a new Registry instance - jsfLibraryRegistry = JSFLibraryRegistryFactory.eINSTANCE.createJSFLibraryRegistry(); - jsfLibraryRegistryResource = (JSFLibraryRegistryResourceImpl)resourceFactory.createResource(jsfLibRegURI); - jsfLibraryRegistryResource.getContents().add(jsfLibraryRegistry); - loadJSFLibraryExtensions(); - loadDeprecatedJSFLibraryExtensions();//to be removed - saveJSFLibraryRegistry(); - } - //add adapter to maintain default implementation - if (jsfLibraryRegistry != null) { - //check that a default impl is set. if not pick first one if available. - JSFLibrary defLib = jsfLibraryRegistry.getDefaultImplementation(); - if (defLib == null && jsfLibraryRegistry.getImplJSFLibraries().size() > 0){ - jsfLibraryRegistry.setDefaultImplementation((JSFLibrary)jsfLibraryRegistry.getImplJSFLibraries().get(0)); - saveJSFLibraryRegistry(); - } - jsfLibraryRegistry.eAdapters().add(MaintainDefaultImplementationAdapter.getInstance()); - - //commit - RegistryUpgradeCommitHandler.commitMigrationIfNecessary(); - } - } catch(MalformedURLException mue) { - JSFCorePlugin.log(IStatus.ERROR, Messages.JSFLibraryRegistry_ErrorCreatingURL, mue); - } - } -///////////////////////////////// Load and Save JSF Library Registry //////////////////////////////////////////////// - - /** - * Creates library registry items from extension points. - */ - private void loadJSFLibraryExtensions() { - try { - IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(JSFCorePlugin.PLUGIN_ID, LIB_EXT_PT); - IExtension[] extensions = point.getExtensions(); - for (int i=0;i < extensions.length;i++){ - IExtension ext = extensions[i]; - for (int j=0;j < ext.getConfigurationElements().length;j++){ - PluginProvidedJSFLibraryCreationHelper2 newLibCreator = new PluginProvidedJSFLibraryCreationHelper2(ext.getConfigurationElements()[j]); - JSFLibrary newLib = newLibCreator.create(); - - /** - * Additional check on if a plug-in contributes jsflibraries is an expanded folder. - * Fix related to bug 144954. - * - * It would be ideal to check if a plug-in is distributed as a JAR - * before a JSFLibrary is created. - * - * This is a temporary solution since JARs in a JAR case is not - * supported in this release. Bug 14496. - */ - if (newLib != null) //&& isJSFLibinExpandedFolder(newLib)) - jsfLibraryRegistry.addJSFLibrary(newLib); - } - } - } catch (InvalidRegistryObjectException e) { - JSFCorePlugin.log(IStatus.ERROR, Messages.JSFLibraryRegistry_ErrorLoadingFromExtPt, e); - } - } - - /** - * Creates deprecated library registry items from extension points. - * TO BE REMOVED - */ - private void loadDeprecatedJSFLibraryExtensions() { - try { - IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(JSFCorePlugin.PLUGIN_ID, OLD_LIB_EXT_PT); - IExtension[] extensions = point.getExtensions(); - for (int i=0;i < extensions.length;i++){ - IExtension ext = extensions[i]; - for (int j=0;j < ext.getConfigurationElements().length;j++){ - PluginProvidedJSFLibraryCreationHelper newLibCreator = new PluginProvidedJSFLibraryCreationHelper(ext.getConfigurationElements()[j]); - JSFLibrary newLib = newLibCreator.create(); - - /** - * Additional check on if a plug-in contributes jsflibraries is an expanded folder. - * Fix related to bug 144954. - * - * It would be ideal to check if a plug-in is distributed as a JAR - * before a JSFLibrary is created. - * - * This is a temporary solution since JARs in a JAR case is not - * supported in this release. Bug 14496. - */ - if (newLib != null ) //&& isJSFLibinExpandedFolder(newLib)) - jsfLibraryRegistry.addJSFLibrary(newLib); - } - } - } catch (InvalidRegistryObjectException e) { - JSFCorePlugin.log(IStatus.ERROR, Messages.JSFLibraryRegistry_ErrorLoadingFromExtPt, e); - } - } - - /** - * Saves the JSFLibraryRegistry EMF object from plugin-specfic workspace - * settings location. (Called from stop(BundleContext).) - * @return true if save is successful - */ - public boolean saveJSFLibraryRegistry() { - boolean saved = false; - if (jsfLibraryRegistryResource != null) { - try { - jsfLibraryRegistryResource.save(Collections.EMPTY_MAP); - saved = true; - } catch(IOException ioe) { - JSFCorePlugin.log(IStatus.ERROR, Messages.JSFLibraryRegistry_ErrorSaving, ioe); - } - } else { - JSFCorePlugin.log(IStatus.ERROR, Messages.JSFLibraryRegistry_ErrorSaving); - } - return saved; - } - - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/ArchiveFile.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/ArchiveFile.java deleted file mode 100644 index 6c20a955c..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/ArchiveFile.java +++ /dev/null @@ -1,222 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Ian Trimble - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.internal.jsflibraryregistry; - -import org.eclipse.emf.ecore.EObject; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Archive File</b></em>'. - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.ArchiveFile#isRelativeToWorkspace <em>Relative To Workspace</em>}</li> - * <li>{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.ArchiveFile#getSourceLocation <em>Source Location</em>}</li> - * <li>{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.ArchiveFile#getRelativeDestLocation <em>Relative Dest Location</em>}</li> - * <li>{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.ArchiveFile#getJSFLibrary <em>JSF Library</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistryPackage#getArchiveFile() - * @model - * @generated - * @deprecated - */ -public interface ArchiveFile extends EObject{ - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String copyright = "Copyright (c) 2005 Oracle Corporation"; - - /** - * Returns the value of the '<em><b>Source Location</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Source Location</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Source Location</em>' attribute. - * @see #setSourceLocation(String) - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistryPackage#getArchiveFile_SourceLocation() - * @model required="true" - * @generated - */ - String getSourceLocation(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.ArchiveFile#getSourceLocation <em>Source Location</em>}' attribute. - * <!-- begin-user-doc --> - * If the value passed is found to be relative to the workspace, a - * workspace-relative location is stored; to prevent this behaviour, call - * isRelativeToWorkspace(false) before calling this method. - * <!-- end-user-doc --> - * @param value the new value of the '<em>Source Location</em>' attribute. - * @see #getSourceLocation() - * @generated - */ - void setSourceLocation(String value); - - /** - * Returns the value of the '<em><b>Relative To Workspace</b></em>' attribute. - * The default value is <code>"true"</code>. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Relative To Workspace</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Relative To Workspace</em>' attribute. - * @see #setRelativeToWorkspace(boolean) - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistryPackage#getArchiveFile_RelativeToWorkspace() - * @model default="true" required="true" - * @generated - */ - boolean isRelativeToWorkspace(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.ArchiveFile#isRelativeToWorkspace <em>Relative To Workspace</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Relative To Workspace</em>' attribute. - * @see #isRelativeToWorkspace() - * @generated - */ - void setRelativeToWorkspace(boolean value); - - /** - * Returns the value of the '<em><b>Relative Dest Location</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Relative Dest Location</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Relative Dest Location</em>' attribute. - * @see #setRelativeDestLocation(String) - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistryPackage#getArchiveFile_RelativeDestLocation() - * @model required="true" - * @generated - */ - String getRelativeDestLocation(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.ArchiveFile#getRelativeDestLocation <em>Relative Dest Location</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Relative Dest Location</em>' attribute. - * @see #getRelativeDestLocation() - * @generated - */ - void setRelativeDestLocation(String value); - - /** - * Returns the value of the '<em><b>JSF Library</b></em>' container reference. - * It is bidirectional and its opposite is '{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary#getArchiveFiles <em>Archive Files</em>}'. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>JSF Library</em>' container reference isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>JSF Library</em>' container reference. - * @see #setJSFLibrary(JSFLibrary) - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistryPackage#getArchiveFile_JSFLibrary() - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary#getArchiveFiles - * @model opposite="ArchiveFiles" required="true" - * @generated - */ - JSFLibrary getJSFLibrary(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.ArchiveFile#getJSFLibrary <em>JSF Library</em>}' container reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>JSF Library</em>' container reference. - * @see #getJSFLibrary() - * @generated - */ - void setJSFLibrary(JSFLibrary value); - - /** - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Path</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * @return the path - * <!-- end-user-doc --> - * @model kind="operation" required="true" - * @generated - */ - String getPath(); - - /** - * <!-- begin-user-doc --> - * @return the name - * <!-- end-user-doc --> - * @model kind="operation" required="true" - * @generated - */ - String getName(); - - /** - * <!-- begin-user-doc --> - * @return true if exists - * <!-- end-user-doc --> - * @model required="true" - * @generated - */ - boolean exists(); - - /** - * <!-- begin-user-doc --> - * @param object - * @return true if equal - * <!-- end-user-doc --> - * @model required="true" objectRequired="true" - * @generated - */ - boolean equals(Object object); - - /** - * <!-- begin-user-doc --> - * @return the hashCode - * <!-- end-user-doc --> - * @model required="true" - * @generated - */ - int hashCode(); - - /** - * <!-- begin-user-doc --> - * @param baseDestLocation - * @return true if copied succeeds - * <!-- end-user-doc --> - * @model required="true" baseDestLocationRequired="true" - * @generated - */ - boolean copyTo(String baseDestLocation); - - /** - * <!-- begin-user-doc --> - * @return the resolved source location - * <!-- end-user-doc --> - * @model kind="operation" required="true" - * @generated - */ - String getResolvedSourceLocation(); - -} // ArchiveFile diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/JSFLibrary.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/JSFLibrary.java deleted file mode 100644 index 3de91afaa..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/JSFLibrary.java +++ /dev/null @@ -1,237 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Ian Trimble - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.internal.jsflibraryregistry; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>JSF Library</b></em>'. - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary#getID <em>ID</em>}</li> - * <li>{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary#getName <em>Name</em>}</li> - * <li>{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary#getJSFVersion <em>JSF Version</em>}</li> - * <li>{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary#isDeployed <em>Deployed</em>}</li> - * <li>{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary#isImplementation <em>Implementation</em>}</li> - * <li>{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary#getArchiveFiles <em>Archive Files</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistryPackage#getJSFLibrary() - * @model - * @generated - * @deprecated - */ -public interface JSFLibrary extends EObject{ - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String copyright = "Copyright (c) 2005 Oracle Corporation"; - - /** - * Returns the value of the '<em><b>ID</b></em>' attribute. - * The default value is <code>""</code>. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>ID</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>ID</em>' attribute. - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistryPackage#getJSFLibrary_ID() - * @model default="" transient="true" changeable="false" derived="true" - * @generated - */ - String getID(); - - /** - * Returns the value of the '<em><b>Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Name</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Name</em>' attribute. - * @see #setName(String) - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistryPackage#getJSFLibrary_Name() - * @model required="true" - * @generated - */ - String getName(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary#getName <em>Name</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Name</em>' attribute. - * @see #getName() - * @generated - */ - void setName(String value); - - /** - * Returns the value of the '<em><b>JSF Version</b></em>' attribute. - * The default value is <code>"UNKNOWN"</code>. - * The literals are from the enumeration {@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFVersion}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>JSF Version</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>JSF Version</em>' attribute. - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFVersion - * @see #setJSFVersion(JSFVersion) - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistryPackage#getJSFLibrary_JSFVersion() - * @model default="UNKNOWN" required="true" - * @generated - */ - JSFVersion getJSFVersion(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary#getJSFVersion <em>JSF Version</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>JSF Version</em>' attribute. - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFVersion - * @see #getJSFVersion() - * @generated - */ - void setJSFVersion(JSFVersion value); - - /** - * Returns the value of the '<em><b>Deployed</b></em>' attribute. - * The default value is <code>"true"</code>. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Deployed</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Deployed</em>' attribute. - * @see #setDeployed(boolean) - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistryPackage#getJSFLibrary_Deployed() - * @model default="true" required="true" - * @generated - */ - boolean isDeployed(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary#isDeployed <em>Deployed</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Deployed</em>' attribute. - * @see #isDeployed() - * @generated - */ - void setDeployed(boolean value); - - /** - * Returns the value of the '<em><b>Implementation</b></em>' attribute. - * The default value is <code>"false"</code>. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Implementation</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Implementation</em>' attribute. - * @see #setImplementation(boolean) - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistryPackage#getJSFLibrary_Implementation() - * @model default="false" required="true" - * @generated - */ - boolean isImplementation(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary#isImplementation <em>Implementation</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Implementation</em>' attribute. - * @see #isImplementation() - * @generated - */ - void setImplementation(boolean value); - - /** - * Returns the value of the '<em><b>Archive Files</b></em>' containment reference list. - * The list contents are of type {@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.ArchiveFile}. - * It is bidirectional and its opposite is '{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.ArchiveFile#getJSFLibrary <em>JSF Library</em>}'. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Archive Files</em>' containment reference list isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Archive Files</em>' containment reference list. - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistryPackage#getJSFLibrary_ArchiveFiles() - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.ArchiveFile#getJSFLibrary - * @model type="org.eclipse.jst.jsf.core.internal.jsflibraryregistry.ArchiveFile" opposite="JSFLibrary" containment="true" - * @generated - */ - EList getArchiveFiles(); - - /** - * <!-- begin-user-doc --> - * @param fullPath - * @return true if fullPath contains archive file - * <!-- end-user-doc --> - * @model required="true" fullPathRequired="true" - * @generated - */ - boolean containsArchiveFile(String fullPath); - - /** - * <!-- begin-user-doc --> - * @return the working copy - * <!-- end-user-doc --> - * @model kind="operation" required="true" - * @generated - */ - JSFLibrary getWorkingCopy(); - - /** - * <!-- begin-user-doc --> - * @param otherLibrary - * <!-- end-user-doc --> - * @model otherLibraryRequired="true" - * @generated - */ - void updateValues(JSFLibrary otherLibrary); - - /** - * <!-- begin-user-doc --> - * @param baseDestLocation - * @return true if copy succeeds - * <!-- end-user-doc --> - * @model required="true" baseDestLocationRequired="true" - * @generated - */ - boolean copyTo(String baseDestLocation); - - /** - * <!-- begin-user-doc --> - * @return label - * <!-- end-user-doc --> - * @model kind="operation" required="true" - * @generated - */ - String getLabel(); - -} // JSFLibrary diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/JSFLibraryRegistry.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/JSFLibraryRegistry.java deleted file mode 100644 index 6ba3bb6b9..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/JSFLibraryRegistry.java +++ /dev/null @@ -1,197 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Ian Trimble - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.internal.jsflibraryregistry; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jst.jsf.core.internal.Messages; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>JSF Library Registry</b></em>'. - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistry#getDefaultImplementationID <em>Default Implementation ID</em>}</li> - * <li>{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistry#getJSFLibraries <em>JSF Libraries</em>}</li> - * <li>{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistry#getPluginProvidedJSFLibraries <em>Plugin Provided JSF Libraries</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistryPackage#getJSFLibraryRegistry() - * @model - * @generated - * @deprecated - */ -public interface JSFLibraryRegistry extends EObject{ - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String copyright = "Copyright (c) 2005 Oracle Corporation"; - - /** - * Returns the value of the '<em><b>Default Implementation ID</b></em>' attribute. - * The default value is <code>""</code>. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Default Implementation ID</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Default Implementation ID</em>' attribute. - * @see #setDefaultImplementationID(String) - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistryPackage#getJSFLibraryRegistry_DefaultImplementationID() - * @model default="" - * @generated - */ - String getDefaultImplementationID(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistry#getDefaultImplementationID <em>Default Implementation ID</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Default Implementation ID</em>' attribute. - * @see #getDefaultImplementationID() - * @generated - */ - void setDefaultImplementationID(String value); - - /** - *The default implementation message string - */ - public static final String DEFAULT_IMPL_LABEL = Messages.JSFLibraryRegistry_DEFAULT_IMPL_LABEL; - - /** - * Returns the value of the '<em><b>JSF Libraries</b></em>' containment reference list. - * The list contents are of type {@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>JSF Libraries</em>' containment reference list isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>JSF Libraries</em>' containment reference list. - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistryPackage#getJSFLibraryRegistry_JSFLibraries() - * @model type="org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary" containment="true" - * @generated - */ - EList getJSFLibraries(); - - /** - * Returns the value of the '<em><b>Plugin Provided JSF Libraries</b></em>' containment reference list. - * The list contents are of type {@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.PluginProvidedJSFLibrary}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Plugin Provided JSF Libraries</em>' containment reference list isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Plugin Provided JSF Libraries</em>' containment reference list. - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistryPackage#getJSFLibraryRegistry_PluginProvidedJSFLibraries() - * @model type="org.eclipse.jst.jsf.core.internal.jsflibraryregistry.PluginProvidedJSFLibrary" containment="true" transient="true" - * @generated - */ - EList getPluginProvidedJSFLibraries(); - - /** - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Default Implementation</em>' reference isn't clear, - * there really should be more of a description here... - * </p> - * @return the default implementation - * <!-- end-user-doc --> - * @model kind="operation" required="true" - * @generated - */ - JSFLibrary getDefaultImplementation(); - - /** - * <!-- begin-user-doc --> - * @param implementation - * <!-- end-user-doc --> - * @model implementationRequired="true" - * @generated - */ - void setDefaultImplementation(JSFLibrary implementation); - - /** - * <!-- begin-user-doc --> - * @param ID - * @return the jsf library - * <!-- end-user-doc --> - * @model required="true" IDRequired="true" - * @generated - */ - JSFLibrary getJSFLibraryByID(String ID); - - /** - * <!-- begin-user-doc --> - * @param name - * @return the jsf libraries matching name - * <!-- end-user-doc --> - * @model required="true" many="false" nameRequired="true" - * @generated - */ - EList getJSFLibrariesByName(String name); - - /** - * <!-- begin-user-doc --> - * @return the implementation JSF libraries - * <!-- end-user-doc --> - * @model kind="operation" required="true" many="false" - * @generated - */ - EList getImplJSFLibraries(); - - /** - * <!-- begin-user-doc --> - * @return the non-implementation JSF libraries - * <!-- end-user-doc --> - * @model kind="operation" required="true" many="false" - * @generated - */ - EList getNonImplJSFLibraries(); - - /** - * <!-- begin-user-doc --> - * @return all the JSF libraries - * <!-- end-user-doc --> - * @model kind="operation" required="true" many="false" - * @generated - */ - EList getAllJSFLibraries(); - - /** - * <!-- begin-user-doc --> - * @param library - * @return true if add succeeds - * <!-- end-user-doc --> - * @model required="true" libraryRequired="true" - * @generated - */ - boolean addJSFLibrary(JSFLibrary library); - - /** - * <!-- begin-user-doc --> - * @param library - * @return true if remove succeeds - * <!-- end-user-doc --> - * @model required="true" libraryRequired="true" - * @generated - */ - boolean removeJSFLibrary(JSFLibrary library); - -} // JSFLibraryRegistry diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/JSFLibraryRegistryFactory.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/JSFLibraryRegistryFactory.java deleted file mode 100644 index d1ffab126..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/JSFLibraryRegistryFactory.java +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Ian Trimble - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.internal.jsflibraryregistry; - -import org.eclipse.emf.ecore.EFactory; - -/** - * <!-- begin-user-doc --> - * The <b>Factory</b> for the model. - * It provides a create method for each non-abstract class of the model. - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistryPackage - * @generated - * @deprecated - */ -public interface JSFLibraryRegistryFactory extends EFactory{ - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String copyright = "Copyright (c) 2005 Oracle Corporation"; - - /** - * The singleton instance of the factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - JSFLibraryRegistryFactory eINSTANCE = org.eclipse.jst.jsf.core.internal.jsflibraryregistry.impl.JSFLibraryRegistryFactoryImpl.init(); - - /** - * Returns a new object of class '<em>JSF Library Registry</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>JSF Library Registry</em>'. - * @generated - */ - JSFLibraryRegistry createJSFLibraryRegistry(); - - /** - * Returns a new object of class '<em>JSF Library</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>JSF Library</em>'. - * @generated - */ - JSFLibrary createJSFLibrary(); - - /** - * Returns a new object of class '<em>Archive File</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Archive File</em>'. - * @generated - */ - ArchiveFile createArchiveFile(); - - /** - * Returns a new object of class '<em>Plugin Provided JSF Library</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Plugin Provided JSF Library</em>'. - * @generated - */ - PluginProvidedJSFLibrary createPluginProvidedJSFLibrary(); - - /** - * Returns the package supported by this factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the package supported by this factory. - * @generated - */ - JSFLibraryRegistryPackage getJSFLibraryRegistryPackage(); - -} //JSFLibraryRegistryFactory diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/JSFLibraryRegistryPackage.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/JSFLibraryRegistryPackage.java deleted file mode 100644 index 0b00b7088..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/JSFLibraryRegistryPackage.java +++ /dev/null @@ -1,781 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Ian Trimble - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.internal.jsflibraryregistry; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EEnum; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; - -/** - * <!-- begin-user-doc --> - * The <b>Package</b> for the model. - * It contains accessors for the meta objects to represent - * <ul> - * <li>each class,</li> - * <li>each feature of each class,</li> - * <li>each enum,</li> - * <li>and each data type</li> - * </ul> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistryFactory - * @model kind="package" - * @generated - * @deprecated - */ -@SuppressWarnings("hiding") -public interface JSFLibraryRegistryPackage extends EPackage{ - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String copyright = "Copyright (c) 2005 Oracle Corporation"; - - /** - * The package name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNAME = "jsflibraryregistry"; - - /** - * The package namespace URI. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNS_URI = "http://www.eclipse.org/webtools/jsf/schema/jsflibraryregistry.xsd"; - - /** - * The package namespace name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNS_PREFIX = "jsflibreg"; - - /** - * The singleton instance of the package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - JSFLibraryRegistryPackage eINSTANCE = org.eclipse.jst.jsf.core.internal.jsflibraryregistry.impl.JSFLibraryRegistryPackageImpl.init(); - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.impl.JSFLibraryRegistryImpl <em>JSF Library Registry</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.impl.JSFLibraryRegistryImpl - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.impl.JSFLibraryRegistryPackageImpl#getJSFLibraryRegistry() - * @generated - */ - int JSF_LIBRARY_REGISTRY = 0; - - /** - * The feature id for the '<em><b>Default Implementation ID</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JSF_LIBRARY_REGISTRY__DEFAULT_IMPLEMENTATION_ID = 0; - - /** - * The feature id for the '<em><b>JSF Libraries</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JSF_LIBRARY_REGISTRY__JSF_LIBRARIES = 1; - - /** - * The feature id for the '<em><b>Plugin Provided JSF Libraries</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JSF_LIBRARY_REGISTRY__PLUGIN_PROVIDED_JSF_LIBRARIES = 2; - - /** - * The number of structural features of the '<em>JSF Library Registry</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JSF_LIBRARY_REGISTRY_FEATURE_COUNT = 3; - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.impl.JSFLibraryImpl <em>JSF Library</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.impl.JSFLibraryImpl - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.impl.JSFLibraryRegistryPackageImpl#getJSFLibrary() - * @generated - */ - int JSF_LIBRARY = 1; - - /** - * The feature id for the '<em><b>ID</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JSF_LIBRARY__ID = 0; - - /** - * The feature id for the '<em><b>Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JSF_LIBRARY__NAME = 1; - - /** - * The feature id for the '<em><b>JSF Version</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JSF_LIBRARY__JSF_VERSION = 2; - - /** - * The feature id for the '<em><b>Deployed</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JSF_LIBRARY__DEPLOYED = 3; - - /** - * The feature id for the '<em><b>Implementation</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JSF_LIBRARY__IMPLEMENTATION = 4; - - /** - * The feature id for the '<em><b>Archive Files</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JSF_LIBRARY__ARCHIVE_FILES = 5; - - /** - * The number of structural features of the '<em>JSF Library</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JSF_LIBRARY_FEATURE_COUNT = 6; - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.impl.ArchiveFileImpl <em>Archive File</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.impl.ArchiveFileImpl - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.impl.JSFLibraryRegistryPackageImpl#getArchiveFile() - * @generated - */ - int ARCHIVE_FILE = 3; - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.impl.PluginProvidedJSFLibraryImpl <em>Plugin Provided JSF Library</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.impl.PluginProvidedJSFLibraryImpl - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.impl.JSFLibraryRegistryPackageImpl#getPluginProvidedJSFLibrary() - * @generated - */ - int PLUGIN_PROVIDED_JSF_LIBRARY = 2; - - /** - * The feature id for the '<em><b>ID</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int PLUGIN_PROVIDED_JSF_LIBRARY__ID = JSF_LIBRARY__ID; - - /** - * The feature id for the '<em><b>Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int PLUGIN_PROVIDED_JSF_LIBRARY__NAME = JSF_LIBRARY__NAME; - - /** - * The feature id for the '<em><b>JSF Version</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int PLUGIN_PROVIDED_JSF_LIBRARY__JSF_VERSION = JSF_LIBRARY__JSF_VERSION; - - /** - * The feature id for the '<em><b>Deployed</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int PLUGIN_PROVIDED_JSF_LIBRARY__DEPLOYED = JSF_LIBRARY__DEPLOYED; - - /** - * The feature id for the '<em><b>Implementation</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int PLUGIN_PROVIDED_JSF_LIBRARY__IMPLEMENTATION = JSF_LIBRARY__IMPLEMENTATION; - - /** - * The feature id for the '<em><b>Archive Files</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int PLUGIN_PROVIDED_JSF_LIBRARY__ARCHIVE_FILES = JSF_LIBRARY__ARCHIVE_FILES; - - /** - * The feature id for the '<em><b>Plugin ID</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int PLUGIN_PROVIDED_JSF_LIBRARY__PLUGIN_ID = JSF_LIBRARY_FEATURE_COUNT + 0; - - /** - * The feature id for the '<em><b>Label</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int PLUGIN_PROVIDED_JSF_LIBRARY__LABEL = JSF_LIBRARY_FEATURE_COUNT + 1; - - /** - * The number of structural features of the '<em>Plugin Provided JSF Library</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int PLUGIN_PROVIDED_JSF_LIBRARY_FEATURE_COUNT = JSF_LIBRARY_FEATURE_COUNT + 2; - - /** - * The feature id for the '<em><b>Relative To Workspace</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ARCHIVE_FILE__RELATIVE_TO_WORKSPACE = 0; - - /** - * The feature id for the '<em><b>Source Location</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ARCHIVE_FILE__SOURCE_LOCATION = 1; - - /** - * The feature id for the '<em><b>Relative Dest Location</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ARCHIVE_FILE__RELATIVE_DEST_LOCATION = 2; - - /** - * The feature id for the '<em><b>JSF Library</b></em>' container reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ARCHIVE_FILE__JSF_LIBRARY = 3; - - /** - * The number of structural features of the '<em>Archive File</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ARCHIVE_FILE_FEATURE_COUNT = 4; - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFVersion <em>JSF Version</em>}' enum. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFVersion - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.impl.JSFLibraryRegistryPackageImpl#getJSFVersion() - * @generated - */ - int JSF_VERSION = 4; - - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistry <em>JSF Library Registry</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>JSF Library Registry</em>'. - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistry - * @generated - */ - EClass getJSFLibraryRegistry(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistry#getDefaultImplementationID <em>Default Implementation ID</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Default Implementation ID</em>'. - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistry#getDefaultImplementationID() - * @see #getJSFLibraryRegistry() - * @generated - */ - EAttribute getJSFLibraryRegistry_DefaultImplementationID(); - - /** - * Returns the meta object for the containment reference list '{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistry#getJSFLibraries <em>JSF Libraries</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the containment reference list '<em>JSF Libraries</em>'. - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistry#getJSFLibraries() - * @see #getJSFLibraryRegistry() - * @generated - */ - EReference getJSFLibraryRegistry_JSFLibraries(); - - /** - * Returns the meta object for the containment reference list '{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistry#getPluginProvidedJSFLibraries <em>Plugin Provided JSF Libraries</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the containment reference list '<em>Plugin Provided JSF Libraries</em>'. - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistry#getPluginProvidedJSFLibraries() - * @see #getJSFLibraryRegistry() - * @generated - */ - EReference getJSFLibraryRegistry_PluginProvidedJSFLibraries(); - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary <em>JSF Library</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>JSF Library</em>'. - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary - * @generated - */ - EClass getJSFLibrary(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary#getID <em>ID</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>ID</em>'. - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary#getID() - * @see #getJSFLibrary() - * @generated - */ - EAttribute getJSFLibrary_ID(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary#getName <em>Name</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Name</em>'. - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary#getName() - * @see #getJSFLibrary() - * @generated - */ - EAttribute getJSFLibrary_Name(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary#getJSFVersion <em>JSF Version</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>JSF Version</em>'. - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary#getJSFVersion() - * @see #getJSFLibrary() - * @generated - */ - EAttribute getJSFLibrary_JSFVersion(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary#isDeployed <em>Deployed</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Deployed</em>'. - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary#isDeployed() - * @see #getJSFLibrary() - * @generated - */ - EAttribute getJSFLibrary_Deployed(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary#isImplementation <em>Implementation</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Implementation</em>'. - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary#isImplementation() - * @see #getJSFLibrary() - * @generated - */ - EAttribute getJSFLibrary_Implementation(); - - /** - * Returns the meta object for the containment reference list '{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary#getArchiveFiles <em>Archive Files</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the containment reference list '<em>Archive Files</em>'. - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary#getArchiveFiles() - * @see #getJSFLibrary() - * @generated - */ - EReference getJSFLibrary_ArchiveFiles(); - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.ArchiveFile <em>Archive File</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Archive File</em>'. - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.ArchiveFile - * @generated - */ - EClass getArchiveFile(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.ArchiveFile#getSourceLocation <em>Source Location</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Source Location</em>'. - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.ArchiveFile#getSourceLocation() - * @see #getArchiveFile() - * @generated - */ - EAttribute getArchiveFile_SourceLocation(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.ArchiveFile#isRelativeToWorkspace <em>Relative To Workspace</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Relative To Workspace</em>'. - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.ArchiveFile#isRelativeToWorkspace() - * @see #getArchiveFile() - * @generated - */ - EAttribute getArchiveFile_RelativeToWorkspace(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.ArchiveFile#getRelativeDestLocation <em>Relative Dest Location</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Relative Dest Location</em>'. - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.ArchiveFile#getRelativeDestLocation() - * @see #getArchiveFile() - * @generated - */ - EAttribute getArchiveFile_RelativeDestLocation(); - - /** - * Returns the meta object for the container reference '{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.ArchiveFile#getJSFLibrary <em>JSF Library</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the container reference '<em>JSF Library</em>'. - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.ArchiveFile#getJSFLibrary() - * @see #getArchiveFile() - * @generated - */ - EReference getArchiveFile_JSFLibrary(); - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.PluginProvidedJSFLibrary <em>Plugin Provided JSF Library</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Plugin Provided JSF Library</em>'. - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.PluginProvidedJSFLibrary - * @generated - */ - EClass getPluginProvidedJSFLibrary(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.PluginProvidedJSFLibrary#getPluginID <em>Plugin ID</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Plugin ID</em>'. - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.PluginProvidedJSFLibrary#getPluginID() - * @see #getPluginProvidedJSFLibrary() - * @generated - */ - EAttribute getPluginProvidedJSFLibrary_PluginID(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.PluginProvidedJSFLibrary#getLabel <em>Label</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Label</em>'. - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.PluginProvidedJSFLibrary#getLabel() - * @see #getPluginProvidedJSFLibrary() - * @generated - */ - EAttribute getPluginProvidedJSFLibrary_Label(); - - /** - * Returns the meta object for enum '{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFVersion <em>JSF Version</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for enum '<em>JSF Version</em>'. - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFVersion - * @generated - */ - EEnum getJSFVersion(); - - /** - * Returns the factory that creates the instances of the model. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the factory that creates the instances of the model. - * @generated - */ - JSFLibraryRegistryFactory getJSFLibraryRegistryFactory(); - - /** - * <!-- begin-user-doc --> - * Defines literals for the meta objects that represent - * <ul> - * <li>each class,</li> - * <li>each feature of each class,</li> - * <li>each enum,</li> - * <li>and each data type</li> - * </ul> - * <!-- end-user-doc --> - * @generated - */ - interface Literals { - /** - * The meta object literal for the '{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.impl.JSFLibraryRegistryImpl <em>JSF Library Registry</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.impl.JSFLibraryRegistryImpl - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.impl.JSFLibraryRegistryPackageImpl#getJSFLibraryRegistry() - * @generated - */ -// @SuppressWarnings("hiding") - EClass JSF_LIBRARY_REGISTRY = eINSTANCE.getJSFLibraryRegistry(); - - /** - * The meta object literal for the '<em><b>Default Implementation ID</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -// @SuppressWarnings("hiding") - EAttribute JSF_LIBRARY_REGISTRY__DEFAULT_IMPLEMENTATION_ID = eINSTANCE.getJSFLibraryRegistry_DefaultImplementationID(); - - /** - * The meta object literal for the '<em><b>JSF Libraries</b></em>' containment reference list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -// @SuppressWarnings("hiding") - EReference JSF_LIBRARY_REGISTRY__JSF_LIBRARIES = eINSTANCE.getJSFLibraryRegistry_JSFLibraries(); - - /** - * The meta object literal for the '<em><b>Plugin Provided JSF Libraries</b></em>' containment reference list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -// @SuppressWarnings("hiding") - EReference JSF_LIBRARY_REGISTRY__PLUGIN_PROVIDED_JSF_LIBRARIES = eINSTANCE.getJSFLibraryRegistry_PluginProvidedJSFLibraries(); - - /** - * The meta object literal for the '{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.impl.JSFLibraryImpl <em>JSF Library</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.impl.JSFLibraryImpl - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.impl.JSFLibraryRegistryPackageImpl#getJSFLibrary() - * @generated - */ -// @SuppressWarnings("hiding") - EClass JSF_LIBRARY = eINSTANCE.getJSFLibrary(); - - /** - * The meta object literal for the '<em><b>ID</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -// @SuppressWarnings("hiding") - EAttribute JSF_LIBRARY__ID = eINSTANCE.getJSFLibrary_ID(); - - /** - * The meta object literal for the '<em><b>Name</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -// @SuppressWarnings("hiding") - EAttribute JSF_LIBRARY__NAME = eINSTANCE.getJSFLibrary_Name(); - - /** - * The meta object literal for the '<em><b>JSF Version</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -// @SuppressWarnings("hiding") - EAttribute JSF_LIBRARY__JSF_VERSION = eINSTANCE.getJSFLibrary_JSFVersion(); - - /** - * The meta object literal for the '<em><b>Deployed</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -// @SuppressWarnings("hiding") - EAttribute JSF_LIBRARY__DEPLOYED = eINSTANCE.getJSFLibrary_Deployed(); - - /** - * The meta object literal for the '<em><b>Implementation</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -// @SuppressWarnings("hiding") - EAttribute JSF_LIBRARY__IMPLEMENTATION = eINSTANCE.getJSFLibrary_Implementation(); - - /** - * The meta object literal for the '<em><b>Archive Files</b></em>' containment reference list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -// @SuppressWarnings("hiding") - EReference JSF_LIBRARY__ARCHIVE_FILES = eINSTANCE.getJSFLibrary_ArchiveFiles(); - - /** - * The meta object literal for the '{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.impl.ArchiveFileImpl <em>Archive File</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.impl.ArchiveFileImpl - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.impl.JSFLibraryRegistryPackageImpl#getArchiveFile() - * @generated - */ -// @SuppressWarnings("hiding") - EClass ARCHIVE_FILE = eINSTANCE.getArchiveFile(); - - /** - * The meta object literal for the '<em><b>Relative To Workspace</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -// @SuppressWarnings("hiding") - EAttribute ARCHIVE_FILE__RELATIVE_TO_WORKSPACE = eINSTANCE.getArchiveFile_RelativeToWorkspace(); - - /** - * The meta object literal for the '<em><b>Source Location</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -// @SuppressWarnings("hiding") - EAttribute ARCHIVE_FILE__SOURCE_LOCATION = eINSTANCE.getArchiveFile_SourceLocation(); - - /** - * The meta object literal for the '<em><b>Relative Dest Location</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -// @SuppressWarnings("hiding") - EAttribute ARCHIVE_FILE__RELATIVE_DEST_LOCATION = eINSTANCE.getArchiveFile_RelativeDestLocation(); - - /** - * The meta object literal for the '<em><b>JSF Library</b></em>' container reference feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -// @SuppressWarnings("hiding") - EReference ARCHIVE_FILE__JSF_LIBRARY = eINSTANCE.getArchiveFile_JSFLibrary(); - - /** - * The meta object literal for the '{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.impl.PluginProvidedJSFLibraryImpl <em>Plugin Provided JSF Library</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.impl.PluginProvidedJSFLibraryImpl - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.impl.JSFLibraryRegistryPackageImpl#getPluginProvidedJSFLibrary() - * @generated - */ -// @SuppressWarnings("hiding") - EClass PLUGIN_PROVIDED_JSF_LIBRARY = eINSTANCE.getPluginProvidedJSFLibrary(); - - /** - * The meta object literal for the '<em><b>Plugin ID</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -// @SuppressWarnings("hiding") - EAttribute PLUGIN_PROVIDED_JSF_LIBRARY__PLUGIN_ID = eINSTANCE.getPluginProvidedJSFLibrary_PluginID(); - - /** - * The meta object literal for the '<em><b>Label</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -// @SuppressWarnings("hiding") - EAttribute PLUGIN_PROVIDED_JSF_LIBRARY__LABEL = eINSTANCE.getPluginProvidedJSFLibrary_Label(); - - /** - * The meta object literal for the '{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFVersion <em>JSF Version</em>}' enum. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFVersion - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.impl.JSFLibraryRegistryPackageImpl#getJSFVersion() - * @generated - */ -// @SuppressWarnings("hiding") - EEnum JSF_VERSION = eINSTANCE.getJSFVersion(); - - } - -} //JSFLibraryRegistryPackage diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/JSFVersion.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/JSFVersion.java deleted file mode 100644 index c2fdda9b7..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/JSFVersion.java +++ /dev/null @@ -1,214 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Ian Trimble - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.internal.jsflibraryregistry; - -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -import org.eclipse.emf.common.util.AbstractEnumerator; - -/** - * <!-- begin-user-doc --> - * A representation of the literals of the enumeration '<em><b>JSF Version</b></em>', - * and utility methods for working with them. - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistryPackage#getJSFVersion() - * @model - * @generated - * @deprecated - */ -public final class JSFVersion extends AbstractEnumerator { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright (c) 2005 Oracle Corporation"; - - /** - * The '<em><b>UNKNOWN</b></em>' literal value. - * <!-- begin-user-doc --> - * <p> - * If the meaning of '<em><b>UNKNOWN</b></em>' literal object isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @see #UNKNOWN_LITERAL - * @model - * @generated - * @ordered - */ - public static final int UNKNOWN = -1; - - /** - * The '<em><b>V1 1</b></em>' literal value. - * <!-- begin-user-doc --> - * <p> - * If the meaning of '<em><b>V1 1</b></em>' literal object isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @see #V1_1_LITERAL - * @model name="v1_1" - * @generated - * @ordered - */ - public static final int V1_1 = 1; - - /** - * The '<em><b>V1 2</b></em>' literal value. - * <!-- begin-user-doc --> - * <p> - * If the meaning of '<em><b>V1 2</b></em>' literal object isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @see #V1_2_LITERAL - * @model name="v1_2" - * @generated - * @ordered - */ - public static final int V1_2 = 2; - - /** - * The '<em><b>UNKNOWN</b></em>' literal object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #UNKNOWN - * @generated - * @ordered - */ - public static final JSFVersion UNKNOWN_LITERAL = new JSFVersion(UNKNOWN, "UNKNOWN", "UNKNOWN"); - - /** - * The '<em><b>V1 1</b></em>' literal object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #V1_1 - * @generated - * @ordered - */ - public static final JSFVersion V1_1_LITERAL = new JSFVersion(V1_1, "v1_1", "v1_1"); - - /** - * The '<em><b>V1 2</b></em>' literal object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #V1_2 - * @generated - * @ordered - */ - public static final JSFVersion V1_2_LITERAL = new JSFVersion(V1_2, "v1_2", "v1_2"); - - /** - * An array of all the '<em><b>JSF Version</b></em>' enumerators. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private static final JSFVersion[] VALUES_ARRAY = - new JSFVersion[] { - UNKNOWN_LITERAL, - V1_1_LITERAL, - V1_2_LITERAL, - }; - - /** - * A public read-only list of all the '<em><b>JSF Version</b></em>' enumerators. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); - - /** - * Returns the '<em><b>JSF Version</b></em>' literal with the specified literal value. - * <!-- begin-user-doc --> - * @param literal value - * @return the JSF version for name value - * <!-- end-user-doc --> - * @generated - */ - public static JSFVersion get(String literal) { - for (int i = 0; i < VALUES_ARRAY.length; ++i) { - JSFVersion result = VALUES_ARRAY[i]; - if (result.toString().equals(literal)) { - return result; - } - } - return null; - } - - /** - * Returns the '<em><b>JSF Version</b></em>' literal with the specified name. - * <!-- begin-user-doc --> - * @param name - * @return JSFVersion - * <!-- end-user-doc --> - * @generated - */ - public static JSFVersion getByName(String name) { - for (int i = 0; i < VALUES_ARRAY.length; ++i) { - JSFVersion result = VALUES_ARRAY[i]; - if (result.getName().equals(name)) { - return result; - } - } - return null; - } - - /** - * Returns the '<em><b>JSF Version</b></em>' literal with the specified integer value. - * <!-- begin-user-doc --> - * @param value - * @return the JSFVersion for the integer 'value' - * <!-- end-user-doc --> - * @generated - */ - public static JSFVersion get(int value) { - switch (value) { - case UNKNOWN: return UNKNOWN_LITERAL; - case V1_1: return V1_1_LITERAL; - case V1_2: return V1_2_LITERAL; - } - return null; - } - - /** - * Only this class can construct instances. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private JSFVersion(int value, String name, String literal) { - super(value, name, literal); - } - - /** - * Returns the '<em><b>JSF Version</b></em>' literal with the specified - * name like the get(String) method does, but will return UNKNOWN instead - * of null if the name is not recognized. - * <!-- begin-user-doc --> - * @param name - * @return the JSFVersion - * <!-- end-user-doc --> - * @generated NOT - */ - public static JSFVersion getJSFVersion(String name) { - JSFVersion version = get(name); - if (version == null) { - version = UNKNOWN_LITERAL; - } - return version; - } - -} //JSFVersion diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/PluginProvidedJSFLibrary.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/PluginProvidedJSFLibrary.java deleted file mode 100644 index 471a6dc6e..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/PluginProvidedJSFLibrary.java +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Ian Trimble - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.internal.jsflibraryregistry; - - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Plugin Provided JSF Library</b></em>'. - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.PluginProvidedJSFLibrary#getPluginID <em>Plugin ID</em>}</li> - * <li>{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.PluginProvidedJSFLibrary#getLabel <em>Label</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistryPackage#getPluginProvidedJSFLibrary() - * @model - * @generated - * @deprecated - */ -public interface PluginProvidedJSFLibrary extends JSFLibrary{ - /** - * Separator between plugin id and JSF Library name - */ - public static final String ID_SEPARATOR = "$$"; - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String copyright = "Copyright (c) 2005 Oracle Corporation"; - - /** - * Returns the value of the '<em><b>Plugin ID</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Plugin ID</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Plugin ID</em>' attribute. - * @see #setPluginID(String) - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistryPackage#getPluginProvidedJSFLibrary_PluginID() - * @model required="true" - * @generated - */ - String getPluginID(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.PluginProvidedJSFLibrary#getPluginID <em>Plugin ID</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Plugin ID</em>' attribute. - * @see #getPluginID() - * @generated - */ - void setPluginID(String value); - - /** - * Returns the value of the '<em><b>Label</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Label</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Label</em>' attribute. - * @see #setLabel(String) - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistryPackage#getPluginProvidedJSFLibrary_Label() - * @model required="true" - * @generated - */ - String getLabel(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.PluginProvidedJSFLibrary#getLabel <em>Label</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Label</em>' attribute. - * @see #getLabel() - * @generated - */ - void setLabel(String value); - -} // PluginProvidedJSFLibrary diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/adapter/MaintainDefaultImplementationAdapter.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/adapter/MaintainDefaultImplementationAdapter.java deleted file mode 100644 index eb3ff119c..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/adapter/MaintainDefaultImplementationAdapter.java +++ /dev/null @@ -1,148 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Ian Trimble - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.internal.jsflibraryregistry.adapter; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.impl.AdapterImpl; -import org.eclipse.emf.common.util.EList; -import org.eclipse.jst.jsf.core.internal.jsflibraryconfig.JSFLibraryRegistryUtil; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistry; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistryPackage; - -/** - * EMF adapter that attempts to always maintain a default implementation - * JSFLibrary upon addition and removal of JSFLibrary instances and upon - * changing of a JSFLibrary instance's implementation property. - * - * @author Ian Trimble - Oracle - * @deprecated - */ -public class MaintainDefaultImplementationAdapter extends AdapterImpl { - - private static MaintainDefaultImplementationAdapter INSTANCE = - new MaintainDefaultImplementationAdapter(); - - /** - * Gets the single instance of this adapter. - * - * @return The single instance of this adapter. - */ - public static MaintainDefaultImplementationAdapter getInstance() { - return INSTANCE; - } - - /** - * Called to notify this adapter that a change has occured. - * - * @param notification EMF Notification instance - */ - public void notifyChanged(Notification notification) { - Object objNotifier = notification.getNotifier(); - if (objNotifier instanceof JSFLibraryRegistry) { - int eventType = notification.getEventType(); - switch (eventType) { - case Notification.ADD: - Object objNewValue = notification.getNewValue(); - if (objNewValue instanceof JSFLibrary) { - libraryAdded((JSFLibrary)objNewValue); - } - break; - case Notification.REMOVE: - Object objOldValue = notification.getOldValue(); - if (objOldValue instanceof JSFLibrary) { - libraryRemoved((JSFLibrary)objOldValue); - } - break; - } - } else if (objNotifier instanceof JSFLibrary) { - if (notification.getFeatureID(JSFLibrary.class) == JSFLibraryRegistryPackage.JSF_LIBRARY__IMPLEMENTATION) { - implementationFlagSet((JSFLibrary)objNotifier); - } - } - } - - /** - * Checks if the library added is an implementation and, if so, makes it - * the default implementation if it is the only implementation. - * - * @param library JSFLibrary instance - */ - protected void libraryAdded(JSFLibrary library) { - if (library != null && library.isImplementation()) { - JSFLibraryRegistry jsfLibReg = JSFLibraryRegistryUtil.getInstance().getJSFLibraryRegistry(); - EList impls = jsfLibReg.getImplJSFLibraries(); - if (impls.size() == 1) { - jsfLibReg.setDefaultImplementation(library); - } - } - } - - /** - * Checks if the library removed is the default implementation and, if so, - * makes the first remaining implementation the new default or nulls out - * the default implementation if no other implementation remains. - * - * @param library JSFLibrary instance - */ - protected void libraryRemoved(JSFLibrary library) { - if (library != null && library.isImplementation()) { - JSFLibraryRegistry jsfLibReg = JSFLibraryRegistryUtil.getInstance().getJSFLibraryRegistry(); - JSFLibrary defaultImpl = jsfLibReg.getDefaultImplementation(); - if (defaultImpl == null || library.getID().equals(defaultImpl.getID())) { - setNewDefaultImplementation(); - } - } - } - - /** - * Checks if the implementation flag of the JSFLibrary has been changed - * such that it is now eligible to become the default implementation or - * such that it is no longer eligible as the default implementation and - * sets the default implementation appropriately. Note that the passed - * JSFLibrary instance must have been added to the model before calling - * this method for it to have any effect. - * - * @param library JSFLibrary instance - */ - private void implementationFlagSet(JSFLibrary library) { - JSFLibraryRegistry jsfLibReg = JSFLibraryRegistryUtil.getInstance().getJSFLibraryRegistry(); - if (jsfLibReg != null) { - JSFLibrary defaultImpl = jsfLibReg.getDefaultImplementation(); - if ( - library.isImplementation() && - defaultImpl == null - ) { - jsfLibReg.setDefaultImplementation(library); - } else if ( - !library.isImplementation() && - (defaultImpl != null && library.getID().equals(defaultImpl.getID()))) - { - setNewDefaultImplementation(); - } - } - } - - /** - * Sets the first available JSFLibrary marked as an implementation as the - * default implementation or sets the default implementation to null if no - * JSFLibrary is marked as an implementation. - */ - protected void setNewDefaultImplementation() { - JSFLibraryRegistry jsfLibReg = JSFLibraryRegistryUtil.getInstance().getJSFLibraryRegistry(); - EList impls = jsfLibReg.getImplJSFLibraries(); - if (impls.size() > 0) { - jsfLibReg.setDefaultImplementation((JSFLibrary)impls.get(0)); - } else { - jsfLibReg.setDefaultImplementation(null); - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/impl/ArchiveFileImpl.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/impl/ArchiveFileImpl.java deleted file mode 100644 index 14d79393d..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/impl/ArchiveFileImpl.java +++ /dev/null @@ -1,706 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Ian Trimble - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.internal.jsflibraryregistry.impl; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.URL; - -import org.eclipse.core.resources.IWorkspace; -import org.eclipse.core.resources.IWorkspaceRoot; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.FileLocator; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Platform; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.NotificationChain; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.InternalEObject; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.impl.EObjectImpl; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.core.internal.Messages; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.ArchiveFile; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistryPackage; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.PluginProvidedJSFLibrary; -import org.eclipse.osgi.util.NLS; -import org.osgi.framework.Bundle; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Archive File</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.impl.ArchiveFileImpl#isRelativeToWorkspace <em>Relative To Workspace</em>}</li> - * <li>{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.impl.ArchiveFileImpl#getSourceLocation <em>Source Location</em>}</li> - * <li>{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.impl.ArchiveFileImpl#getRelativeDestLocation <em>Relative Dest Location</em>}</li> - * <li>{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.impl.ArchiveFileImpl#getJSFLibrary <em>JSF Library</em>}</li> - * </ul> - * </p> - * - * @generated - * @deprecated - */ -public class ArchiveFileImpl extends EObjectImpl implements ArchiveFile { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright (c) 2005 Oracle Corporation"; - - /** - * The default value of the '{@link #isRelativeToWorkspace() <em>Relative To Workspace</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isRelativeToWorkspace() - * @generated - * @ordered - */ - protected static final boolean RELATIVE_TO_WORKSPACE_EDEFAULT = true; - - /** - * The cached value of the '{@link #isRelativeToWorkspace() <em>Relative To Workspace</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isRelativeToWorkspace() - * @generated - * @ordered - */ - protected boolean relativeToWorkspace = RELATIVE_TO_WORKSPACE_EDEFAULT; - - /** - * The default value of the '{@link #getSourceLocation() <em>Source Location</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getSourceLocation() - * @generated - * @ordered - */ - protected static final String SOURCE_LOCATION_EDEFAULT = null; - - /** - * The cached value of the '{@link #getSourceLocation() <em>Source Location</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getSourceLocation() - * @generated - * @ordered - */ - protected String sourceLocation = SOURCE_LOCATION_EDEFAULT; - - /** - * The default value of the '{@link #getRelativeDestLocation() <em>Relative Dest Location</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getRelativeDestLocation() - * @generated - * @ordered - */ - protected static final String RELATIVE_DEST_LOCATION_EDEFAULT = null; - - /** - * The cached value of the '{@link #getRelativeDestLocation() <em>Relative Dest Location</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getRelativeDestLocation() - * @generated - * @ordered - */ - protected String relativeDestLocation = RELATIVE_DEST_LOCATION_EDEFAULT; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ArchiveFileImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * @return the static eClass - * <!-- end-user-doc --> - * @generated - */ - protected EClass eStaticClass() { - return JSFLibraryRegistryPackage.Literals.ARCHIVE_FILE; - } - - /** - * <!-- begin-user-doc --> - * @return the source location - * <!-- end-user-doc --> - * @generated - */ - public String getSourceLocation() { - return sourceLocation; - } - - /** - * <!-- begin-user-doc --> - * Enhanced to not only set the location but also to attempt to determine - * if the location passed is relative to the current workspace. If so, only - * the relative location is stored. If not, the full location as passed is - * stored and the relativeToWorkspace property is set to false. To override - * this behaviour and set the absolute location as passed regardless, call - * setRelativeToWorkspace(false) BEFORE calling this method. - * - * @param newSourceLocation - * - * <!-- end-user-doc --> - * @generated NOT - */ - public void setSourceLocation(String newSourceLocation) { - String oldSourceLocation = sourceLocation; - if (relativeToWorkspace) { - IWorkspaceRoot workspaceRoot = getWorkspaceRoot(); - if (workspaceRoot != null) { - IPath wsRootPath = workspaceRoot.getLocation(); - IPath srcPath = new Path(newSourceLocation); - if (workspaceRoot.findMember(srcPath) != null) { - sourceLocation = newSourceLocation; - } else if (wsRootPath.isPrefixOf(srcPath)) { - int segmentsMatched = wsRootPath.matchingFirstSegments(srcPath); - srcPath = srcPath.removeFirstSegments(segmentsMatched).setDevice(null); - sourceLocation = srcPath.toOSString(); - } else { - sourceLocation = newSourceLocation; - relativeToWorkspace = false; - } - } - } else { - sourceLocation = newSourceLocation; - } - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, JSFLibraryRegistryPackage.ARCHIVE_FILE__SOURCE_LOCATION, oldSourceLocation, sourceLocation)); - } - - /** - * <!-- begin-user-doc --> - * @return true if file is relative to workspace - * <!-- end-user-doc --> - * @generated - */ - public boolean isRelativeToWorkspace() { - return relativeToWorkspace; - } - - /** - * <!-- begin-user-doc --> - * To override workspace-relative recognition behaviour, be sure to call - * this method with a false value BEFORE calling setLocation(String). - * @param newRelativeToWorkspace - * <!-- end-user-doc --> - * @generated - */ - public void setRelativeToWorkspace(boolean newRelativeToWorkspace) { - boolean oldRelativeToWorkspace = relativeToWorkspace; - relativeToWorkspace = newRelativeToWorkspace; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, JSFLibraryRegistryPackage.ARCHIVE_FILE__RELATIVE_TO_WORKSPACE, oldRelativeToWorkspace, relativeToWorkspace)); - } - - /** - * <!-- begin-user-doc --> - * @return the relative destination location - * <!-- end-user-doc --> - * @generated - */ - public String getRelativeDestLocation() { - return relativeDestLocation; - } - - /** - * <!-- begin-user-doc --> - * @param newRelativeDestLocation - * <!-- end-user-doc --> - * @generated - */ - public void setRelativeDestLocation(String newRelativeDestLocation) { - String oldRelativeDestLocation = relativeDestLocation; - relativeDestLocation = newRelativeDestLocation; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, JSFLibraryRegistryPackage.ARCHIVE_FILE__RELATIVE_DEST_LOCATION, oldRelativeDestLocation, relativeDestLocation)); - } - - /** - * <!-- begin-user-doc --> - * @return the jsf library instance - * <!-- end-user-doc --> - * @generated - */ - public JSFLibrary getJSFLibrary() { - if (eContainerFeatureID != JSFLibraryRegistryPackage.ARCHIVE_FILE__JSF_LIBRARY) return null; - return (JSFLibrary)eContainer(); - } - - /** - * <!-- begin-user-doc --> - * @param newJSFLibrary - * @param msgs - * @return NotificationChain - * <!-- end-user-doc --> - * @generated - */ - public NotificationChain basicSetJSFLibrary(JSFLibrary newJSFLibrary, NotificationChain msgs) { - msgs = eBasicSetContainer((InternalEObject)newJSFLibrary, JSFLibraryRegistryPackage.ARCHIVE_FILE__JSF_LIBRARY, msgs); - return msgs; - } - - /** - * <!-- begin-user-doc --> - * @param newJSFLibrary - * <!-- end-user-doc --> - * @generated - */ - public void setJSFLibrary(JSFLibrary newJSFLibrary) { - if (newJSFLibrary != eInternalContainer() || (eContainerFeatureID != JSFLibraryRegistryPackage.ARCHIVE_FILE__JSF_LIBRARY && newJSFLibrary != null)) { - if (EcoreUtil.isAncestor(this, newJSFLibrary)) - throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); - NotificationChain msgs = null; - if (eInternalContainer() != null) - msgs = eBasicRemoveFromContainer(msgs); - if (newJSFLibrary != null) - msgs = ((InternalEObject)newJSFLibrary).eInverseAdd(this, JSFLibraryRegistryPackage.JSF_LIBRARY__ARCHIVE_FILES, JSFLibrary.class, msgs); - msgs = basicSetJSFLibrary(newJSFLibrary, msgs); - if (msgs != null) msgs.dispatch(); - } - else if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, JSFLibraryRegistryPackage.ARCHIVE_FILE__JSF_LIBRARY, newJSFLibrary, newJSFLibrary)); - } - - /** - * <!-- begin-user-doc --> - * @return the path - * <!-- end-user-doc --> - * @generated NOT - */ - public String getPath() { - String path = null; - String resolvedSourceLocation = getResolvedSourceLocation(); - if (resolvedSourceLocation != null) { - int iPos = resolvedSourceLocation.lastIndexOf('/'); - if (iPos < 0) { - iPos = resolvedSourceLocation.lastIndexOf('\\'); - } - if (iPos < 1) { - path = ""; //$NON-NLS-1$ - } else { - path = resolvedSourceLocation.substring(0, iPos); - } - } - return path; - } - - /** - * <!-- begin-user-doc --> - * @return the name - * <!-- end-user-doc --> - * @generated NOT - */ - public String getName() { - String name = null; - String resolvedSourceLocation = getResolvedSourceLocation(); - if (resolvedSourceLocation != null) { - int iPos = resolvedSourceLocation.lastIndexOf('/'); - if (iPos < 0) { - iPos = resolvedSourceLocation.lastIndexOf('\\'); - } - if (iPos < 0 || iPos == resolvedSourceLocation.length() - 1) { - name = resolvedSourceLocation; - } else { - name = resolvedSourceLocation.substring(iPos + 1); - } - } - return name; - } - - /** - * <!-- begin-user-doc --> - * @return true if the archive file exists in the bundle - * <!-- end-user-doc --> - * @generated NOT - */ - public boolean exists() { - boolean exists = false; - if (getJSFLibrary() instanceof PluginProvidedJSFLibrary) { - Bundle bundle = getBundle(); - if (bundle != null) { - exists = bundle.getEntry(sourceLocation) != null; - } - } else { - String resolvedSourceLocation = getResolvedSourceLocation(); - if (resolvedSourceLocation != null) { - exists = new File(resolvedSourceLocation).exists(); - } - } - return exists; - } - - /** - * <!-- begin-user-doc --> - * @param object - * @return true if equal - * <!-- end-user-doc --> - * @generated NOT - */ - public boolean equals(Object object) { - boolean equal = false; - if (object instanceof ArchiveFile) { - String resolvedSourceLocation = getResolvedSourceLocation(); - String objResolvedSourceLocation = ((ArchiveFile)object).getResolvedSourceLocation(); - if (resolvedSourceLocation == null && objResolvedSourceLocation == null) { - equal = true; - } else if (resolvedSourceLocation != null) { - equal = resolvedSourceLocation.equals(objResolvedSourceLocation); - } - } - return equal; - } - - /** - * <!-- begin-user-doc --> - * @return a the resolved source location hash or 0 if it is null - * <!-- end-user-doc --> - * @generated NOT - */ - public int hashCode() { - return getResolvedSourceLocation() != null ? getResolvedSourceLocation().hashCode() : 0; - } - - /** - * <!-- begin-user-doc --> - * @param baseDestLocation - * @return true if the copy is successful - * <!-- end-user-doc --> - * @generated NOT - */ - public boolean copyTo(String baseDestLocation) { - boolean copied = false; - InputStream in = null; - OutputStream out = null; - IPath outPath = new Path(baseDestLocation); - if (relativeDestLocation != null) { - outPath = outPath.append(relativeDestLocation); - } - outPath = outPath.append(getName()); - try { - if (!outPath.toFile().exists()) { - out = new FileOutputStream(outPath.toOSString()); - } else { - return copied; - } - if (getJSFLibrary() instanceof PluginProvidedJSFLibrary) { - Bundle bundle = getBundle(); - URL inURL = bundle.getEntry(sourceLocation); - if (inURL != null) { - in = inURL.openStream(); - } else { - JSFCorePlugin.log( - IStatus.ERROR, - NLS.bind(Messages.ArchiveFileImpl_CannotLocatePluginRelativeFile, - sourceLocation)); - return copied; - } - } else { - in = new FileInputStream(getResolvedSourceLocation()); - } - byte[] buf = new byte[1024]; - int len = 0; - while ((len = in.read(buf)) > 0) { - out.write(buf, 0, len); - } - copied = true; - } catch(FileNotFoundException fnfe) { - JSFCorePlugin.log(IStatus.ERROR, Messages.ArchiveFileImpl_CannotCopyFile, fnfe); - } catch(IOException ioe) { - JSFCorePlugin.log(IStatus.ERROR, Messages.ArchiveFileImpl_CannotCopyFile, ioe); - } finally { - try { - if (in != null) { - in.close(); - } - if (out != null) { - out.close(); - } - } catch(IOException ioe) { - JSFCorePlugin.log(IStatus.WARNING, Messages.ArchiveFileImpl_CannotCloseFile, ioe); - } - } - return copied; - } - - /** - * <!-- begin-user-doc --> - * @return the resolved source location - * <!-- end-user-doc --> - * @generated NOT - */ - public String getResolvedSourceLocation() { - String resolvedSourceLocation = null; - /** - * The implementation to support PluginProvidedJSFLibrary assume the following. - * 1. Plugin provided JSF library needs to be distributed as an expanded folder. - * 2. JARs for plugin provided JSF library need to reside inside the folder mentioned in item 1 above. - * 3. Each JAR needs to specify a relative path for the folder mentioned in item 1 above. - * - * Fix for bug 144954. - */ - if (getJSFLibrary() instanceof PluginProvidedJSFLibrary) { - Bundle bundle = getBundle(); - if (bundle != null) { - //resolvedSourceLocation = appendSeparator(bundleLocation) + sourceLocation; - try { - Path srcPath = new Path(sourceLocation); - URL fileURL = FileLocator.find(bundle, srcPath, null); - if (fileURL != null){ - URL url = FileLocator.resolve(fileURL); - resolvedSourceLocation = url.getPath(); - } - else - resolvedSourceLocation = sourceLocation; - } catch (IOException e) { - resolvedSourceLocation = sourceLocation; - } - } else { - resolvedSourceLocation = sourceLocation; - } - } else { - if (isRelativeToWorkspace()) { - IWorkspaceRoot workspaceRoot = getWorkspaceRoot(); - if (workspaceRoot != null) { - String workspaceLocation = workspaceRoot.getLocation().toOSString(); - if (workspaceLocation != null) { - resolvedSourceLocation = appendSeparator(workspaceLocation) + sourceLocation; - } else { - resolvedSourceLocation = sourceLocation; - } - } else { - resolvedSourceLocation = sourceLocation; - } - } else { - resolvedSourceLocation = sourceLocation; - } - } - return resolvedSourceLocation; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { - switch (featureID) { - case JSFLibraryRegistryPackage.ARCHIVE_FILE__JSF_LIBRARY: - if (eInternalContainer() != null) - msgs = eBasicRemoveFromContainer(msgs); - return basicSetJSFLibrary((JSFLibrary)otherEnd, msgs); - } - return super.eInverseAdd(otherEnd, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { - switch (featureID) { - case JSFLibraryRegistryPackage.ARCHIVE_FILE__JSF_LIBRARY: - return basicSetJSFLibrary(null, msgs); - } - return super.eInverseRemove(otherEnd, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> - * @param msgs - * @return NotificationChain - * <!-- end-user-doc --> - * @generated - */ - public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { - switch (eContainerFeatureID) { - case JSFLibraryRegistryPackage.ARCHIVE_FILE__JSF_LIBRARY: - return eInternalContainer().eInverseRemove(this, JSFLibraryRegistryPackage.JSF_LIBRARY__ARCHIVE_FILES, JSFLibrary.class, msgs); - } - return super.eBasicRemoveFromContainerFeature(msgs); - } - - /** - * <!-- begin-user-doc --> - * @param featureID - * @param resolve - * @param coreType - * @return - * <!-- end-user-doc --> - * @generated - */ - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case JSFLibraryRegistryPackage.ARCHIVE_FILE__RELATIVE_TO_WORKSPACE: - return isRelativeToWorkspace() ? Boolean.TRUE : Boolean.FALSE; - case JSFLibraryRegistryPackage.ARCHIVE_FILE__SOURCE_LOCATION: - return getSourceLocation(); - case JSFLibraryRegistryPackage.ARCHIVE_FILE__RELATIVE_DEST_LOCATION: - return getRelativeDestLocation(); - case JSFLibraryRegistryPackage.ARCHIVE_FILE__JSF_LIBRARY: - return getJSFLibrary(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * @param featureID - * @param newValue - * <!-- end-user-doc --> - * @generated - */ - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case JSFLibraryRegistryPackage.ARCHIVE_FILE__RELATIVE_TO_WORKSPACE: - setRelativeToWorkspace(((Boolean)newValue).booleanValue()); - return; - case JSFLibraryRegistryPackage.ARCHIVE_FILE__SOURCE_LOCATION: - setSourceLocation((String)newValue); - return; - case JSFLibraryRegistryPackage.ARCHIVE_FILE__RELATIVE_DEST_LOCATION: - setRelativeDestLocation((String)newValue); - return; - case JSFLibraryRegistryPackage.ARCHIVE_FILE__JSF_LIBRARY: - setJSFLibrary((JSFLibrary)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eUnset(int featureID) { - switch (featureID) { - case JSFLibraryRegistryPackage.ARCHIVE_FILE__RELATIVE_TO_WORKSPACE: - setRelativeToWorkspace(RELATIVE_TO_WORKSPACE_EDEFAULT); - return; - case JSFLibraryRegistryPackage.ARCHIVE_FILE__SOURCE_LOCATION: - setSourceLocation(SOURCE_LOCATION_EDEFAULT); - return; - case JSFLibraryRegistryPackage.ARCHIVE_FILE__RELATIVE_DEST_LOCATION: - setRelativeDestLocation(RELATIVE_DEST_LOCATION_EDEFAULT); - return; - case JSFLibraryRegistryPackage.ARCHIVE_FILE__JSF_LIBRARY: - setJSFLibrary((JSFLibrary)null); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean eIsSet(int featureID) { - switch (featureID) { - case JSFLibraryRegistryPackage.ARCHIVE_FILE__RELATIVE_TO_WORKSPACE: - return relativeToWorkspace != RELATIVE_TO_WORKSPACE_EDEFAULT; - case JSFLibraryRegistryPackage.ARCHIVE_FILE__SOURCE_LOCATION: - return SOURCE_LOCATION_EDEFAULT == null ? sourceLocation != null : !SOURCE_LOCATION_EDEFAULT.equals(sourceLocation); - case JSFLibraryRegistryPackage.ARCHIVE_FILE__RELATIVE_DEST_LOCATION: - return RELATIVE_DEST_LOCATION_EDEFAULT == null ? relativeDestLocation != null : !RELATIVE_DEST_LOCATION_EDEFAULT.equals(relativeDestLocation); - case JSFLibraryRegistryPackage.ARCHIVE_FILE__JSF_LIBRARY: - return getJSFLibrary() != null; - } - return super.eIsSet(featureID); - } - - /** - * Gets the Bundle instance by parent PluginProvidedJSFLibrary instance's - * pluginID property, if and only if the parent JSFLibrary instance IS a - * PluginProvidedJSFLibrary, else returns null. - * @return Bundle instance, or null if not located or applicable - */ - protected Bundle getBundle() { - Bundle bundle = null; - if (getJSFLibrary() instanceof PluginProvidedJSFLibrary) { - String pluginID = ((PluginProvidedJSFLibrary)getJSFLibrary()).getPluginID(); - if (pluginID != null) { - bundle = Platform.getBundle(pluginID); - } - } - return bundle; - } - - /** - * Gets the IWorkspaceRoot instance. - * @return IWorkspaceRoot instance - */ - protected IWorkspaceRoot getWorkspaceRoot() { - IWorkspaceRoot workspaceRoot = null; - IWorkspace workspace = ResourcesPlugin.getWorkspace(); - if (workspace != null) { - workspaceRoot = workspace.getRoot(); - } - return workspaceRoot; - } - - /** - * @param path - * @return the the path string with invalid path separators correctly fixed - */ - protected String appendSeparator(String path) { - String newPath = null; - if (!path.endsWith("\\") && !path.endsWith("/")) { //$NON-NLS-1$ //$NON-NLS-2$ - newPath = path + System.getProperty("file.separator"); //$NON-NLS-1$ - } else { - newPath = path; - } - return newPath; - } - - /** - * <!-- begin-user-doc --> - * @return the string representation of this archive file - * <!-- end-user-doc --> - * @generated - */ - public String toString() { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (RelativeToWorkspace: "); - result.append(relativeToWorkspace); - result.append(", SourceLocation: "); - result.append(sourceLocation); - result.append(", RelativeDestLocation: "); - result.append(relativeDestLocation); - result.append(')'); - return result.toString(); - } - -} //ArchiveFileImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/impl/JSFLibraryImpl.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/impl/JSFLibraryImpl.java deleted file mode 100644 index 6240b5f92..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/impl/JSFLibraryImpl.java +++ /dev/null @@ -1,558 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Ian Trimble - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.internal.jsflibraryregistry.impl; - -import java.util.Collection; -import java.util.Iterator; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.NotificationChain; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.InternalEObject; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.impl.EObjectImpl; -import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList; -import org.eclipse.emf.ecore.util.InternalEList; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.ArchiveFile; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistryFactory; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistryPackage; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFVersion; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.adapter.MaintainDefaultImplementationAdapter; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>JSF Library</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.impl.JSFLibraryImpl#getID <em>ID</em>}</li> - * <li>{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.impl.JSFLibraryImpl#getName <em>Name</em>}</li> - * <li>{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.impl.JSFLibraryImpl#getJSFVersion <em>JSF Version</em>}</li> - * <li>{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.impl.JSFLibraryImpl#isDeployed <em>Deployed</em>}</li> - * <li>{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.impl.JSFLibraryImpl#isImplementation <em>Implementation</em>}</li> - * <li>{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.impl.JSFLibraryImpl#getArchiveFiles <em>Archive Files</em>}</li> - * </ul> - * </p> - * - * @generated - * @deprecated - */ -public class JSFLibraryImpl extends EObjectImpl implements JSFLibrary { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright (c) 2005 Oracle Corporation"; - - /** - * The default value of the '{@link #getID() <em>ID</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getID() - * @generated - * @ordered - */ - protected static final String ID_EDEFAULT = ""; - - /** - * The cached value of the '{@link #getID() <em>ID</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getID() - * @generated - * @ordered - */ - protected String id = ID_EDEFAULT; - - /** - * The default value of the '{@link #getName() <em>Name</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getName() - * @generated - * @ordered - */ - protected static final String NAME_EDEFAULT = null; - - /** - * The cached value of the '{@link #getName() <em>Name</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getName() - * @generated - * @ordered - */ - protected String name = NAME_EDEFAULT; - - /** - * The default value of the '{@link #getJSFVersion() <em>JSF Version</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getJSFVersion() - * @generated - * @ordered - */ - protected static final JSFVersion JSF_VERSION_EDEFAULT = JSFVersion.UNKNOWN_LITERAL; - - /** - * The cached value of the '{@link #getJSFVersion() <em>JSF Version</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getJSFVersion() - * @generated - * @ordered - */ - protected JSFVersion jsfVersion = JSF_VERSION_EDEFAULT; - - /** - * The default value of the '{@link #isDeployed() <em>Deployed</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isDeployed() - * @generated - * @ordered - */ - protected static final boolean DEPLOYED_EDEFAULT = true; - - /** - * The cached value of the '{@link #isDeployed() <em>Deployed</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isDeployed() - * @generated - * @ordered - */ - protected boolean deployed = DEPLOYED_EDEFAULT; - - /** - * The default value of the '{@link #isImplementation() <em>Implementation</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isImplementation() - * @generated - * @ordered - */ - protected static final boolean IMPLEMENTATION_EDEFAULT = false; - - /** - * The cached value of the '{@link #isImplementation() <em>Implementation</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isImplementation() - * @generated - * @ordered - */ - protected boolean implementation = IMPLEMENTATION_EDEFAULT; - - /** - * The cached value of the '{@link #getArchiveFiles() <em>Archive Files</em>}' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getArchiveFiles() - * @generated - * @ordered - */ - protected EList archiveFiles; - - /** - * <!-- begin-user-doc --> - * Enhanced to not only create an instance but also to set an initial ID - * (which can be reset later) and to add the - * MaintainDefaultImplementationAdapter to the list of adapters. - * <!-- end-user-doc --> - * @generated NOT - */ - protected JSFLibraryImpl() { - super(); -// //set initial ID; will be overwritten from XML if already persisted -// setID(String.valueOf(System.currentTimeMillis())); - //add adapter to maintain a default implementation - eAdapters().add(MaintainDefaultImplementationAdapter.getInstance()); - } - - /** - * <!-- begin-user-doc --> - * @return the static eClass - * <!-- end-user-doc --> - * @generated - */ - protected EClass eStaticClass() { - return JSFLibraryRegistryPackage.Literals.JSF_LIBRARY; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - public String getID() { - return getName(); - } - - /** - * <!-- begin-user-doc --> - * @return the name - * <!-- end-user-doc --> - * @generated - */ - public String getName() { - return name; - } - - /** - * <!-- begin-user-doc --> - * @param newName - * <!-- end-user-doc --> - * @generated - */ - public void setName(String newName) { - String oldName = name; - name = newName; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, JSFLibraryRegistryPackage.JSF_LIBRARY__NAME, oldName, name)); - } - - /** - * <!-- begin-user-doc --> - * @return the jsf version - * <!-- end-user-doc --> - * @generated - */ - public JSFVersion getJSFVersion() { - return jsfVersion; - } - - /** - * <!-- begin-user-doc --> - * @param newJSFVersion - * <!-- end-user-doc --> - * @generated - */ - public void setJSFVersion(JSFVersion newJSFVersion) { - JSFVersion oldJSFVersion = jsfVersion; - jsfVersion = newJSFVersion == null ? JSF_VERSION_EDEFAULT : newJSFVersion; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, JSFLibraryRegistryPackage.JSF_LIBRARY__JSF_VERSION, oldJSFVersion, jsfVersion)); - } - - /** - * <!-- begin-user-doc --> - * @return true if library is to be deployed - * <!-- end-user-doc --> - * @generated - */ - public boolean isDeployed() { - return deployed; - } - - /** - * <!-- begin-user-doc --> - * @param newDeployed - * <!-- end-user-doc --> - * @generated - */ - public void setDeployed(boolean newDeployed) { - boolean oldDeployed = deployed; - deployed = newDeployed; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, JSFLibraryRegistryPackage.JSF_LIBRARY__DEPLOYED, oldDeployed, deployed)); - } - - /** - * <!-- begin-user-doc --> - * @return true if implementation - * <!-- end-user-doc --> - * @generated - */ - public boolean isImplementation() { - return implementation; - } - - /** - * <!-- begin-user-doc --> - * @param newImplementation - * <!-- end-user-doc --> - * @generated - */ - public void setImplementation(boolean newImplementation) { - boolean oldImplementation = implementation; - implementation = newImplementation; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, JSFLibraryRegistryPackage.JSF_LIBRARY__IMPLEMENTATION, oldImplementation, implementation)); - } - - /** - * <!-- begin-user-doc --> - * @return the list of archive files - * <!-- end-user-doc --> - * @generated - */ - public EList getArchiveFiles() { - if (archiveFiles == null) { - archiveFiles = new EObjectContainmentWithInverseEList(ArchiveFile.class, this, JSFLibraryRegistryPackage.JSF_LIBRARY__ARCHIVE_FILES, JSFLibraryRegistryPackage.ARCHIVE_FILE__JSF_LIBRARY); - } - return archiveFiles; - } - - /** - * <!-- begin-user-doc --> - * @param fullPath - * @return the true if the fullPath contains an archive file - * <!-- end-user-doc --> - * @generated NOT - */ - public boolean containsArchiveFile(String fullPath) { - boolean contains = false; - if (fullPath != null) { - Iterator itArchiveFiles = getArchiveFiles().iterator(); - while (itArchiveFiles.hasNext()) { - ArchiveFile archiveFile = (ArchiveFile)itArchiveFiles.next(); - if (fullPath.equals(archiveFile.getResolvedSourceLocation())) { - contains = true; - break; - } - } - } - return contains; - } - - /** - * <!-- begin-user-doc --> - * @return the working copy - * <!-- end-user-doc --> - * @generated NOT - */ - public JSFLibrary getWorkingCopy() { - JSFLibrary workingCopyLib = JSFLibraryRegistryFactory.eINSTANCE.createJSFLibrary(); -// workingCopyLib.setID(getID()); - workingCopyLib.setName(getName()); - workingCopyLib.setJSFVersion(getJSFVersion()); - workingCopyLib.setDeployed(isDeployed()); - workingCopyLib.setImplementation(isImplementation()); - Iterator itArchiveFiles = getArchiveFiles().iterator(); - while (itArchiveFiles.hasNext()) { - ArchiveFile srcArchiveFile = (ArchiveFile)itArchiveFiles.next(); - ArchiveFile destArchiveFile = JSFLibraryRegistryFactory.eINSTANCE.createArchiveFile(); - destArchiveFile.setRelativeToWorkspace(srcArchiveFile.isRelativeToWorkspace()); - destArchiveFile.setSourceLocation(srcArchiveFile.getSourceLocation()); - destArchiveFile.setRelativeDestLocation(srcArchiveFile.getRelativeDestLocation()); - workingCopyLib.getArchiveFiles().add(destArchiveFile); - } - return workingCopyLib; - } - - /** - * <!-- begin-user-doc --> - * @param otherLibrary - * <!-- end-user-doc --> - * @generated NOT - */ - public void updateValues(JSFLibrary otherLibrary) { - if (otherLibrary != null) { -// setID(otherLibrary.getID()); - setName(otherLibrary.getName()); - setJSFVersion(otherLibrary.getJSFVersion()); - setDeployed(otherLibrary.isDeployed()); - setImplementation(otherLibrary.isImplementation()); - Iterator itArchiveFiles = otherLibrary.getArchiveFiles().iterator(); - getArchiveFiles().clear(); - while (itArchiveFiles.hasNext()) { - ArchiveFile srcArchiveFile = (ArchiveFile)itArchiveFiles.next(); - ArchiveFile destArchiveFile = JSFLibraryRegistryFactory.eINSTANCE.createArchiveFile(); - destArchiveFile.setRelativeToWorkspace(srcArchiveFile.isRelativeToWorkspace()); - destArchiveFile.setSourceLocation(srcArchiveFile.getSourceLocation()); - destArchiveFile.setRelativeDestLocation(srcArchiveFile.getRelativeDestLocation()); - getArchiveFiles().add(destArchiveFile); - } - } - } - - /** - * <!-- begin-user-doc --> - * @param baseDestLocation - * @return the base destination location - * <!-- end-user-doc --> - * @generated NOT - */ - public boolean copyTo(String baseDestLocation) { - boolean allCopied = true; - Iterator itFiles = getArchiveFiles().iterator(); - while (itFiles.hasNext()) { - ArchiveFile archiveFile = (ArchiveFile)itFiles.next(); - boolean copied = archiveFile.copyTo(baseDestLocation); - allCopied = allCopied && copied; - } - return allCopied; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - public String getLabel() { - return getName(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { - switch (featureID) { - case JSFLibraryRegistryPackage.JSF_LIBRARY__ARCHIVE_FILES: - return ((InternalEList)getArchiveFiles()).basicAdd(otherEnd, msgs); - } - return super.eInverseAdd(otherEnd, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { - switch (featureID) { - case JSFLibraryRegistryPackage.JSF_LIBRARY__ARCHIVE_FILES: - return ((InternalEList)getArchiveFiles()).basicRemove(otherEnd, msgs); - } - return super.eInverseRemove(otherEnd, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case JSFLibraryRegistryPackage.JSF_LIBRARY__ID: - return getID(); - case JSFLibraryRegistryPackage.JSF_LIBRARY__NAME: - return getName(); - case JSFLibraryRegistryPackage.JSF_LIBRARY__JSF_VERSION: - return getJSFVersion(); - case JSFLibraryRegistryPackage.JSF_LIBRARY__DEPLOYED: - return isDeployed() ? Boolean.TRUE : Boolean.FALSE; - case JSFLibraryRegistryPackage.JSF_LIBRARY__IMPLEMENTATION: - return isImplementation() ? Boolean.TRUE : Boolean.FALSE; - case JSFLibraryRegistryPackage.JSF_LIBRARY__ARCHIVE_FILES: - return getArchiveFiles(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case JSFLibraryRegistryPackage.JSF_LIBRARY__NAME: - setName((String)newValue); - return; - case JSFLibraryRegistryPackage.JSF_LIBRARY__JSF_VERSION: - setJSFVersion((JSFVersion)newValue); - return; - case JSFLibraryRegistryPackage.JSF_LIBRARY__DEPLOYED: - setDeployed(((Boolean)newValue).booleanValue()); - return; - case JSFLibraryRegistryPackage.JSF_LIBRARY__IMPLEMENTATION: - setImplementation(((Boolean)newValue).booleanValue()); - return; - case JSFLibraryRegistryPackage.JSF_LIBRARY__ARCHIVE_FILES: - getArchiveFiles().clear(); - getArchiveFiles().addAll((Collection)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eUnset(int featureID) { - switch (featureID) { - case JSFLibraryRegistryPackage.JSF_LIBRARY__NAME: - setName(NAME_EDEFAULT); - return; - case JSFLibraryRegistryPackage.JSF_LIBRARY__JSF_VERSION: - setJSFVersion(JSF_VERSION_EDEFAULT); - return; - case JSFLibraryRegistryPackage.JSF_LIBRARY__DEPLOYED: - setDeployed(DEPLOYED_EDEFAULT); - return; - case JSFLibraryRegistryPackage.JSF_LIBRARY__IMPLEMENTATION: - setImplementation(IMPLEMENTATION_EDEFAULT); - return; - case JSFLibraryRegistryPackage.JSF_LIBRARY__ARCHIVE_FILES: - getArchiveFiles().clear(); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean eIsSet(int featureID) { - switch (featureID) { - case JSFLibraryRegistryPackage.JSF_LIBRARY__ID: - return ID_EDEFAULT == null ? id != null : !ID_EDEFAULT.equals(id); - case JSFLibraryRegistryPackage.JSF_LIBRARY__NAME: - return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); - case JSFLibraryRegistryPackage.JSF_LIBRARY__JSF_VERSION: - return jsfVersion != JSF_VERSION_EDEFAULT; - case JSFLibraryRegistryPackage.JSF_LIBRARY__DEPLOYED: - return deployed != DEPLOYED_EDEFAULT; - case JSFLibraryRegistryPackage.JSF_LIBRARY__IMPLEMENTATION: - return implementation != IMPLEMENTATION_EDEFAULT; - case JSFLibraryRegistryPackage.JSF_LIBRARY__ARCHIVE_FILES: - return archiveFiles != null && !archiveFiles.isEmpty(); - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * @return the string representation - * <!-- end-user-doc --> - * @generated - */ - public String toString() { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (ID: "); - result.append(id); - result.append(", Name: "); - result.append(name); - result.append(", JSFVersion: "); - result.append(jsfVersion); - result.append(", Deployed: "); - result.append(deployed); - result.append(", Implementation: "); - result.append(implementation); - result.append(')'); - return result.toString(); - } - -} //JSFLibraryImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/impl/JSFLibraryRegistryFactoryImpl.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/impl/JSFLibraryRegistryFactoryImpl.java deleted file mode 100644 index 0f48f29f5..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/impl/JSFLibraryRegistryFactoryImpl.java +++ /dev/null @@ -1,215 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Ian Trimble - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.internal.jsflibraryregistry.impl; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EDataType; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.impl.EFactoryImpl; -import org.eclipse.emf.ecore.plugin.EcorePlugin; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.ArchiveFile; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistry; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistryFactory; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistryPackage; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFVersion; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.PluginProvidedJSFLibrary; - -/** - * <!-- begin-user-doc --> - * An implementation of the model <b>Factory</b>. - * <!-- end-user-doc --> - * @generated - * @deprecated - */ -public class JSFLibraryRegistryFactoryImpl extends EFactoryImpl implements JSFLibraryRegistryFactory { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright (c) 2005 Oracle Corporation"; - - /** - * Creates the default factory implementation. - * <!-- begin-user-doc --> - * @return the initialized factory - * <!-- end-user-doc --> - * @generated - */ - public static JSFLibraryRegistryFactory init() { - try { - JSFLibraryRegistryFactory theJSFLibraryRegistryFactory = (JSFLibraryRegistryFactory)EPackage.Registry.INSTANCE.getEFactory("http://www.eclipse.org/webtools/jsf/schema/jsflibraryregistry.xsd"); - if (theJSFLibraryRegistryFactory != null) { - return theJSFLibraryRegistryFactory; - } - } - catch (Exception exception) { - EcorePlugin.INSTANCE.log(exception); - } - return new JSFLibraryRegistryFactoryImpl(); - } - - /** - * Creates an instance of the factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public JSFLibraryRegistryFactoryImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * @param eClass - * @return the static eclass - * <!-- end-user-doc --> - * @generated - */ - public EObject create(EClass eClass) { - switch (eClass.getClassifierID()) { - case JSFLibraryRegistryPackage.JSF_LIBRARY_REGISTRY: return createJSFLibraryRegistry(); - case JSFLibraryRegistryPackage.JSF_LIBRARY: return createJSFLibrary(); - case JSFLibraryRegistryPackage.PLUGIN_PROVIDED_JSF_LIBRARY: return createPluginProvidedJSFLibrary(); - case JSFLibraryRegistryPackage.ARCHIVE_FILE: return createArchiveFile(); - default: - throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); - } - } - - /** - * <!-- begin-user-doc --> - * @param eDataType - * @param initialValue - * @return an instance of eDataType for initialValue - * <!-- end-user-doc --> - * @generated - */ - public Object createFromString(EDataType eDataType, String initialValue) { - switch (eDataType.getClassifierID()) { - case JSFLibraryRegistryPackage.JSF_VERSION: - return createJSFVersionFromString(eDataType, initialValue); - default: - throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); - } - } - - /** - * <!-- begin-user-doc --> - * @param eDataType - * @param instanceValue - * @return the string created from instanceValue from eDataType - * <!-- end-user-doc --> - * @generated - */ - public String convertToString(EDataType eDataType, Object instanceValue) { - switch (eDataType.getClassifierID()) { - case JSFLibraryRegistryPackage.JSF_VERSION: - return convertJSFVersionToString(eDataType, instanceValue); - default: - throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); - } - } - - /** - * <!-- begin-user-doc --> - * @return the jsf library registry - * <!-- end-user-doc --> - * @generated - */ - public JSFLibraryRegistry createJSFLibraryRegistry() { - JSFLibraryRegistryImpl jsfLibraryRegistry = new JSFLibraryRegistryImpl(); - return jsfLibraryRegistry; - } - - /** - * <!-- begin-user-doc --> - * @return the jsf library - * <!-- end-user-doc --> - * @generated - */ - public JSFLibrary createJSFLibrary() { - JSFLibraryImpl jsfLibrary = new JSFLibraryImpl(); - return jsfLibrary; - } - - /** - * <!-- begin-user-doc --> - * @return the archive file - * <!-- end-user-doc --> - * @generated - */ - public ArchiveFile createArchiveFile() { - ArchiveFileImpl archiveFile = new ArchiveFileImpl(); - return archiveFile; - } - - /** - * <!-- begin-user-doc --> - * @return the plugin provided JSF library - * <!-- end-user-doc --> - * @generated - */ - public PluginProvidedJSFLibrary createPluginProvidedJSFLibrary() { - PluginProvidedJSFLibraryImpl pluginProvidedJSFLibrary = new PluginProvidedJSFLibraryImpl(); - return pluginProvidedJSFLibrary; - } - - /** - * <!-- begin-user-doc --> - * @param eDataType - * @param initialValue - * @return the jsfVersion the dataType - * <!-- end-user-doc --> - * @generated - */ - public JSFVersion createJSFVersionFromString(EDataType eDataType, String initialValue) { - JSFVersion result = JSFVersion.get(initialValue); - if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); - return result; - } - - /** - * <!-- begin-user-doc --> - * @param eDataType - * @param instanceValue - * @return the string version of the data type - * <!-- end-user-doc --> - * @generated - */ - public String convertJSFVersionToString(EDataType eDataType, Object instanceValue) { - return instanceValue == null ? null : instanceValue.toString(); - } - - /** - * <!-- begin-user-doc --> - * @return the registry package - * <!-- end-user-doc --> - * @generated - */ - public JSFLibraryRegistryPackage getJSFLibraryRegistryPackage() { - return (JSFLibraryRegistryPackage)getEPackage(); - } - - /** - * <!-- begin-user-doc --> - * @return the package - * <!-- end-user-doc --> - * @deprecated - * @generated - */ - public static JSFLibraryRegistryPackage getPackage() { - return JSFLibraryRegistryPackage.eINSTANCE; - } - -} //JSFLibraryRegistryFactoryImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/impl/JSFLibraryRegistryImpl.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/impl/JSFLibraryRegistryImpl.java deleted file mode 100644 index d180e93aa..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/impl/JSFLibraryRegistryImpl.java +++ /dev/null @@ -1,434 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Ian Trimble - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.internal.jsflibraryregistry.impl; - -import java.util.Collection; -import java.util.Iterator; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.NotificationChain; -import org.eclipse.emf.common.util.BasicEList; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.InternalEObject; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.impl.EObjectImpl; -import org.eclipse.emf.ecore.util.EObjectContainmentEList; -import org.eclipse.emf.ecore.util.InternalEList; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistry; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistryPackage; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.PluginProvidedJSFLibrary; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>JSF Library Registry</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.impl.JSFLibraryRegistryImpl#getDefaultImplementationID <em>Default Implementation ID</em>}</li> - * <li>{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.impl.JSFLibraryRegistryImpl#getJSFLibraries <em>JSF Libraries</em>}</li> - * <li>{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.impl.JSFLibraryRegistryImpl#getPluginProvidedJSFLibraries <em>Plugin Provided JSF Libraries</em>}</li> - * </ul> - * </p> - * - * @generated - * @deprecated - */ -public class JSFLibraryRegistryImpl extends EObjectImpl implements JSFLibraryRegistry { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright (c) 2005 Oracle Corporation"; - - /** - * The default value of the '{@link #getDefaultImplementationID() <em>Default Implementation ID</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getDefaultImplementationID() - * @generated - * @ordered - */ - protected static final String DEFAULT_IMPLEMENTATION_ID_EDEFAULT = ""; - - /** - * The cached value of the '{@link #getDefaultImplementationID() <em>Default Implementation ID</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getDefaultImplementationID() - * @generated - * @ordered - */ - protected String defaultImplementationID = DEFAULT_IMPLEMENTATION_ID_EDEFAULT; - - /** - * The cached value of the '{@link #getJSFLibraries() <em>JSF Libraries</em>}' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getJSFLibraries() - * @generated - * @ordered - */ - protected EList jsfLibraries; - - /** - * The cached value of the '{@link #getPluginProvidedJSFLibraries() <em>Plugin Provided JSF Libraries</em>}' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getPluginProvidedJSFLibraries() - * @generated - * @ordered - */ - protected EList pluginProvidedJSFLibraries; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected JSFLibraryRegistryImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * @return the static eClass - * <!-- end-user-doc --> - * @generated - */ - protected EClass eStaticClass() { - return JSFLibraryRegistryPackage.Literals.JSF_LIBRARY_REGISTRY; - } - - /** - * <!-- begin-user-doc --> - * @return the default implementation id - * <!-- end-user-doc --> - * @generated - */ - public String getDefaultImplementationID() { - return defaultImplementationID; - } - - /** - * <!-- begin-user-doc --> - * @param newDefaultImplementationID - * <!-- end-user-doc --> - * @generated - */ - public void setDefaultImplementationID(String newDefaultImplementationID) { - String oldDefaultImplementationID = defaultImplementationID; - defaultImplementationID = newDefaultImplementationID; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, JSFLibraryRegistryPackage.JSF_LIBRARY_REGISTRY__DEFAULT_IMPLEMENTATION_ID, oldDefaultImplementationID, defaultImplementationID)); - } - - /** - * <!-- begin-user-doc --> - * @return the list of jsf libraries - * <!-- end-user-doc --> - * @generated - */ - public EList getJSFLibraries() { - if (jsfLibraries == null) { - jsfLibraries = new EObjectContainmentEList(JSFLibrary.class, this, JSFLibraryRegistryPackage.JSF_LIBRARY_REGISTRY__JSF_LIBRARIES); - } - return jsfLibraries; - } - - /** - * <!-- begin-user-doc --> - * @return the list of plugin provided JSF libraries - * <!-- end-user-doc --> - * @generated - */ - public EList getPluginProvidedJSFLibraries() { - if (pluginProvidedJSFLibraries == null) { - pluginProvidedJSFLibraries = new EObjectContainmentEList(PluginProvidedJSFLibrary.class, this, JSFLibraryRegistryPackage.JSF_LIBRARY_REGISTRY__PLUGIN_PROVIDED_JSF_LIBRARIES); - } - return pluginProvidedJSFLibraries; - } - - /** - * <!-- begin-user-doc --> - * @return the default implemention JSF library - * <!-- end-user-doc --> - * @generated NOT - */ - public JSFLibrary getDefaultImplementation() { - return getJSFLibraryByID(getDefaultImplementationID()); - } - - /** - * <!-- begin-user-doc --> - * @param implementation - * <!-- end-user-doc --> - * @generated NOT - */ - public void setDefaultImplementation(JSFLibrary implementation) { - if (implementation != null) { - setDefaultImplementationID(implementation.getID()); - } else { - setDefaultImplementationID(null); - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { - switch (featureID) { - case JSFLibraryRegistryPackage.JSF_LIBRARY_REGISTRY__JSF_LIBRARIES: - return ((InternalEList)getJSFLibraries()).basicRemove(otherEnd, msgs); - case JSFLibraryRegistryPackage.JSF_LIBRARY_REGISTRY__PLUGIN_PROVIDED_JSF_LIBRARIES: - return ((InternalEList)getPluginProvidedJSFLibraries()).basicRemove(otherEnd, msgs); - } - return super.eInverseRemove(otherEnd, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case JSFLibraryRegistryPackage.JSF_LIBRARY_REGISTRY__DEFAULT_IMPLEMENTATION_ID: - return getDefaultImplementationID(); - case JSFLibraryRegistryPackage.JSF_LIBRARY_REGISTRY__JSF_LIBRARIES: - return getJSFLibraries(); - case JSFLibraryRegistryPackage.JSF_LIBRARY_REGISTRY__PLUGIN_PROVIDED_JSF_LIBRARIES: - return getPluginProvidedJSFLibraries(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case JSFLibraryRegistryPackage.JSF_LIBRARY_REGISTRY__DEFAULT_IMPLEMENTATION_ID: - setDefaultImplementationID((String)newValue); - return; - case JSFLibraryRegistryPackage.JSF_LIBRARY_REGISTRY__JSF_LIBRARIES: - getJSFLibraries().clear(); - getJSFLibraries().addAll((Collection)newValue); - return; - case JSFLibraryRegistryPackage.JSF_LIBRARY_REGISTRY__PLUGIN_PROVIDED_JSF_LIBRARIES: - getPluginProvidedJSFLibraries().clear(); - getPluginProvidedJSFLibraries().addAll((Collection)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eUnset(int featureID) { - switch (featureID) { - case JSFLibraryRegistryPackage.JSF_LIBRARY_REGISTRY__DEFAULT_IMPLEMENTATION_ID: - setDefaultImplementationID(DEFAULT_IMPLEMENTATION_ID_EDEFAULT); - return; - case JSFLibraryRegistryPackage.JSF_LIBRARY_REGISTRY__JSF_LIBRARIES: - getJSFLibraries().clear(); - return; - case JSFLibraryRegistryPackage.JSF_LIBRARY_REGISTRY__PLUGIN_PROVIDED_JSF_LIBRARIES: - getPluginProvidedJSFLibraries().clear(); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean eIsSet(int featureID) { - switch (featureID) { - case JSFLibraryRegistryPackage.JSF_LIBRARY_REGISTRY__DEFAULT_IMPLEMENTATION_ID: - return DEFAULT_IMPLEMENTATION_ID_EDEFAULT == null ? defaultImplementationID != null : !DEFAULT_IMPLEMENTATION_ID_EDEFAULT.equals(defaultImplementationID); - case JSFLibraryRegistryPackage.JSF_LIBRARY_REGISTRY__JSF_LIBRARIES: - return jsfLibraries != null && !jsfLibraries.isEmpty(); - case JSFLibraryRegistryPackage.JSF_LIBRARY_REGISTRY__PLUGIN_PROVIDED_JSF_LIBRARIES: - return pluginProvidedJSFLibraries != null && !pluginProvidedJSFLibraries.isEmpty(); - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * @param ID - * @return the jsf library of ID or null if none - * <!-- end-user-doc --> - * @generated NOT - */ - public JSFLibrary getJSFLibraryByID(String ID) { - JSFLibrary library = null; - if (ID != null) { - Iterator itLibs = getAllJSFLibraries().iterator(); - while (itLibs.hasNext()) { - JSFLibrary curLib = (JSFLibrary)itLibs.next(); - if (ID.equals(curLib.getID())) { - library = curLib; - break; - } - } - } - return library; - } - - /** - * <!-- begin-user-doc --> - * @param name - * @return the list of libraries named 'name' - * <!-- end-user-doc --> - * @generated NOT - */ - public EList getJSFLibrariesByName(String name) { - EList libraries = new BasicEList(); - if (name != null) { - Iterator itLibs = getAllJSFLibraries().iterator(); - while(itLibs.hasNext()) { - JSFLibrary curLib = (JSFLibrary)itLibs.next(); - if (name.equals(curLib.getName())) { - libraries.add(curLib); - } - } - } - return libraries; - } - - /** - * <!-- begin-user-doc --> - * This is a convenience method to return an EList of JSFLibrary instances - * that are marked as JSF implementations; while all instances are valid - * references, the returned EList should not be used for additions and/or - * removals of instances (use the EList returned by getJSFLibraries()). - * @return the list of implemention jsf libraries - * <!-- end-user-doc --> - * @generated NOT - */ - public EList getImplJSFLibraries() { - EList implementations = new BasicEList(); - Iterator itLibs = getAllJSFLibraries().iterator(); - while (itLibs.hasNext()) { - JSFLibrary lib = (JSFLibrary)itLibs.next(); - if (lib.isImplementation()) { - implementations.add(lib); - } - } - return implementations; - } - - /** - * <!-- begin-user-doc --> - * This is a convenience method to return an EList of JSFLibrary instances - * that are not marked as JSF implementations; while all instances are - * valid references, the returned EList should not be used for additions - * and/or removals of instances (use the EList returned by - * getJSFLibraries()). - * @return the non-implemention JSF libraries - * <!-- end-user-doc --> - * @generated NOT - */ - public EList getNonImplJSFLibraries() { - EList nonImplementations = new BasicEList(); - Iterator itLibs = getAllJSFLibraries().iterator(); - while (itLibs.hasNext()) { - JSFLibrary lib = (JSFLibrary)itLibs.next(); - if (!lib.isImplementation()) { - nonImplementations.add(lib); - } - } - return nonImplementations; - } - - /** - * <!-- begin-user-doc --> - * This is a convenience method to return an EList of JSFLibrary instances - * and PluginProvidedJSFLibrary instances; while all instances are valid - * references, the returned EList should not be used for additions and/or - * removals of instances (use the EList returned by getJSFLibraries()). - * @return all JSF libraries - * <!-- end-user-doc --> - * @generated NOT - */ - public EList getAllJSFLibraries() { - EList allLibs = new BasicEList(); - allLibs.addAll(getJSFLibraries()); - allLibs.addAll(getPluginProvidedJSFLibraries()); - return allLibs; - } - - /** - * <!-- begin-user-doc --> - * @param library - * @return true if library is successfully added - * <!-- end-user-doc --> - * @generated NOT - */ - public boolean addJSFLibrary(JSFLibrary library) { - boolean added = false; - if (library instanceof PluginProvidedJSFLibrary) { - added = getPluginProvidedJSFLibraries().add(library); - } else { - added = getJSFLibraries().add(library); - } - return added; - } - - /** - * <!-- begin-user-doc --> - * @param library - * @return true if library is successfully removed - * <!-- end-user-doc --> - * @generated NOT - */ - public boolean removeJSFLibrary(JSFLibrary library) { - boolean removed = false; - if (library instanceof PluginProvidedJSFLibrary) { - removed = getPluginProvidedJSFLibraries().remove(library); - } else { - removed = getJSFLibraries().remove(library); - } - return removed; - } - - /** - * <!-- begin-user-doc --> - * @return the string representation - * <!-- end-user-doc --> - * @generated - */ - public String toString() { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (DefaultImplementationID: "); - result.append(defaultImplementationID); - result.append(')'); - return result.toString(); - } - - -} //JSFLibraryRegistryImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/impl/JSFLibraryRegistryPackageImpl.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/impl/JSFLibraryRegistryPackageImpl.java deleted file mode 100644 index 6602ace13..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/impl/JSFLibraryRegistryPackageImpl.java +++ /dev/null @@ -1,515 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Ian Trimble - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.internal.jsflibraryregistry.impl; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EEnum; -import org.eclipse.emf.ecore.EOperation; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.ecore.impl.EPackageImpl; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.ArchiveFile; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistry; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistryFactory; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistryPackage; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFVersion; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.PluginProvidedJSFLibrary; - - -/** - * <!-- begin-user-doc --> - * An implementation of the model <b>Package</b>. - * <!-- end-user-doc --> - * @generated - * @deprecated - */ -public class JSFLibraryRegistryPackageImpl extends EPackageImpl implements JSFLibraryRegistryPackage { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright (c) 2005 Oracle Corporation"; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass jsfLibraryRegistryEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass jsfLibraryEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass archiveFileEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass pluginProvidedJSFLibraryEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EEnum jsfVersionEEnum = null; - - /** - * Creates an instance of the model <b>Package</b>, registered with - * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package - * package URI value. - * <p>Note: the correct way to create the package is via the static - * factory method {@link #init init()}, which also performs - * initialization of the package, or returns the registered package, - * if one already exists. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.ecore.EPackage.Registry - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistryPackage#eNS_URI - * @see #init() - * @generated - */ - private JSFLibraryRegistryPackageImpl() { - super(eNS_URI, JSFLibraryRegistryFactory.eINSTANCE); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private static boolean isInited = false; - - /** - * Creates, registers, and initializes the <b>Package</b> for this - * model, and for any others upon which it depends. Simple - * dependencies are satisfied by calling this method on all - * dependent packages before doing anything else. This method drives - * initialization for interdependent packages directly, in parallel - * with this package, itself. - * <p>Of this package and its interdependencies, all packages which - * have not yet been registered by their URI values are first created - * and registered. The packages are then initialized in two steps: - * meta-model objects for all of the packages are created before any - * are initialized, since one package's meta-model objects may refer to - * those of another. - * <p>Invocation of this method will not affect any packages that have - * already been initialized. - * <!-- begin-user-doc --> - * @return the JSF library registry package - * <!-- end-user-doc --> - * @see #eNS_URI - * @see #createPackageContents() - * @see #initializePackageContents() - * @generated - */ - public static JSFLibraryRegistryPackage init() { - if (isInited) return (JSFLibraryRegistryPackage)EPackage.Registry.INSTANCE.getEPackage(JSFLibraryRegistryPackage.eNS_URI); - - // Obtain or create and register package - JSFLibraryRegistryPackageImpl theJSFLibraryRegistryPackage = (JSFLibraryRegistryPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(eNS_URI) instanceof JSFLibraryRegistryPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(eNS_URI) : new JSFLibraryRegistryPackageImpl()); - - isInited = true; - - // Create package meta-data objects - theJSFLibraryRegistryPackage.createPackageContents(); - - // Initialize created meta-data - theJSFLibraryRegistryPackage.initializePackageContents(); - - // Mark meta-data to indicate it can't be changed - theJSFLibraryRegistryPackage.freeze(); - - return theJSFLibraryRegistryPackage; - } - - /** - * <!-- begin-user-doc --> - * @return the eclass - * <!-- end-user-doc --> - * @generated - */ - public EClass getJSFLibraryRegistry() { - return jsfLibraryRegistryEClass; - } - - /** - * <!-- begin-user-doc --> - * @return the eattribute - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getJSFLibraryRegistry_DefaultImplementationID() { - return (EAttribute)jsfLibraryRegistryEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * @return the ereference - * <!-- end-user-doc --> - * @generated - */ - public EReference getJSFLibraryRegistry_JSFLibraries() { - return (EReference)jsfLibraryRegistryEClass.getEStructuralFeatures().get(1); - } - - /** - * <!-- begin-user-doc --> - * @return the ereference - * <!-- end-user-doc --> - * @generated - */ - public EReference getJSFLibraryRegistry_PluginProvidedJSFLibraries() { - return (EReference)jsfLibraryRegistryEClass.getEStructuralFeatures().get(2); - } - - /** - * <!-- begin-user-doc --> - * @return the eclass - * <!-- end-user-doc --> - * @generated - */ - public EClass getJSFLibrary() { - return jsfLibraryEClass; - } - - /** - * <!-- begin-user-doc --> - * @return the eattribute - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getJSFLibrary_ID() { - return (EAttribute)jsfLibraryEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * @return the eattribute - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getJSFLibrary_Name() { - return (EAttribute)jsfLibraryEClass.getEStructuralFeatures().get(1); - } - - /** - * <!-- begin-user-doc --> - * @return the eattribute - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getJSFLibrary_JSFVersion() { - return (EAttribute)jsfLibraryEClass.getEStructuralFeatures().get(2); - } - - /** - * <!-- begin-user-doc --> - * @return the eattribute - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getJSFLibrary_Deployed() { - return (EAttribute)jsfLibraryEClass.getEStructuralFeatures().get(3); - } - - /** - * <!-- begin-user-doc --> - * @return the eattribute - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getJSFLibrary_Implementation() { - return (EAttribute)jsfLibraryEClass.getEStructuralFeatures().get(4); - } - - /** - * <!-- begin-user-doc --> - * @return the ereference - * <!-- end-user-doc --> - * @generated - */ - public EReference getJSFLibrary_ArchiveFiles() { - return (EReference)jsfLibraryEClass.getEStructuralFeatures().get(5); - } - - /** - * <!-- begin-user-doc --> - * @return the eclass - * <!-- end-user-doc --> - * @generated - */ - public EClass getArchiveFile() { - return archiveFileEClass; - } - - /** - * <!-- begin-user-doc --> - * @return the eattribute - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getArchiveFile_SourceLocation() { - return (EAttribute)archiveFileEClass.getEStructuralFeatures().get(1); - } - - /** - * <!-- begin-user-doc --> - * @return the eattribute - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getArchiveFile_RelativeToWorkspace() { - return (EAttribute)archiveFileEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * @return the eattribute - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getArchiveFile_RelativeDestLocation() { - return (EAttribute)archiveFileEClass.getEStructuralFeatures().get(2); - } - - /** - * <!-- begin-user-doc --> - * @return the ereference - * <!-- end-user-doc --> - * @generated - */ - public EReference getArchiveFile_JSFLibrary() { - return (EReference)archiveFileEClass.getEStructuralFeatures().get(3); - } - - /** - * <!-- begin-user-doc --> - * @return the eclass - * <!-- end-user-doc --> - * @generated - */ - public EClass getPluginProvidedJSFLibrary() { - return pluginProvidedJSFLibraryEClass; - } - - /** - * <!-- begin-user-doc --> - * @return the eattribute - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getPluginProvidedJSFLibrary_PluginID() { - return (EAttribute)pluginProvidedJSFLibraryEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getPluginProvidedJSFLibrary_Label() { - return (EAttribute)pluginProvidedJSFLibraryEClass.getEStructuralFeatures().get(1); - } - - /** - * <!-- begin-user-doc --> - * @return the eenum - * <!-- end-user-doc --> - * @generated - */ - public EEnum getJSFVersion() { - return jsfVersionEEnum; - } - - /** - * <!-- begin-user-doc --> - * @return the jsf library registry factory - * <!-- end-user-doc --> - * @generated - */ - public JSFLibraryRegistryFactory getJSFLibraryRegistryFactory() { - return (JSFLibraryRegistryFactory)getEFactoryInstance(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private boolean isCreated = false; - - /** - * Creates the meta-model objects for the package. This method is - * guarded to have no affect on any invocation but its first. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void createPackageContents() { - if (isCreated) return; - isCreated = true; - - // Create classes and their features - jsfLibraryRegistryEClass = createEClass(JSF_LIBRARY_REGISTRY); - createEAttribute(jsfLibraryRegistryEClass, JSF_LIBRARY_REGISTRY__DEFAULT_IMPLEMENTATION_ID); - createEReference(jsfLibraryRegistryEClass, JSF_LIBRARY_REGISTRY__JSF_LIBRARIES); - createEReference(jsfLibraryRegistryEClass, JSF_LIBRARY_REGISTRY__PLUGIN_PROVIDED_JSF_LIBRARIES); - - jsfLibraryEClass = createEClass(JSF_LIBRARY); - createEAttribute(jsfLibraryEClass, JSF_LIBRARY__ID); - createEAttribute(jsfLibraryEClass, JSF_LIBRARY__NAME); - createEAttribute(jsfLibraryEClass, JSF_LIBRARY__JSF_VERSION); - createEAttribute(jsfLibraryEClass, JSF_LIBRARY__DEPLOYED); - createEAttribute(jsfLibraryEClass, JSF_LIBRARY__IMPLEMENTATION); - createEReference(jsfLibraryEClass, JSF_LIBRARY__ARCHIVE_FILES); - - pluginProvidedJSFLibraryEClass = createEClass(PLUGIN_PROVIDED_JSF_LIBRARY); - createEAttribute(pluginProvidedJSFLibraryEClass, PLUGIN_PROVIDED_JSF_LIBRARY__PLUGIN_ID); - createEAttribute(pluginProvidedJSFLibraryEClass, PLUGIN_PROVIDED_JSF_LIBRARY__LABEL); - - archiveFileEClass = createEClass(ARCHIVE_FILE); - createEAttribute(archiveFileEClass, ARCHIVE_FILE__RELATIVE_TO_WORKSPACE); - createEAttribute(archiveFileEClass, ARCHIVE_FILE__SOURCE_LOCATION); - createEAttribute(archiveFileEClass, ARCHIVE_FILE__RELATIVE_DEST_LOCATION); - createEReference(archiveFileEClass, ARCHIVE_FILE__JSF_LIBRARY); - - // Create enums - jsfVersionEEnum = createEEnum(JSF_VERSION); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private boolean isInitialized = false; - - /** - * Complete the initialization of the package and its meta-model. This - * method is guarded to have no affect on any invocation but its first. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void initializePackageContents() { - if (isInitialized) return; - isInitialized = true; - - // Initialize package - setName(eNAME); - setNsPrefix(eNS_PREFIX); - setNsURI(eNS_URI); - - // Add supertypes to classes - pluginProvidedJSFLibraryEClass.getESuperTypes().add(this.getJSFLibrary()); - - // Initialize classes and features; add operations and parameters - initEClass(jsfLibraryRegistryEClass, JSFLibraryRegistry.class, "JSFLibraryRegistry", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEAttribute(getJSFLibraryRegistry_DefaultImplementationID(), ecorePackage.getEString(), "DefaultImplementationID", "", 0, 1, JSFLibraryRegistry.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEReference(getJSFLibraryRegistry_JSFLibraries(), this.getJSFLibrary(), null, "JSFLibraries", null, 0, -1, JSFLibraryRegistry.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEReference(getJSFLibraryRegistry_PluginProvidedJSFLibraries(), this.getPluginProvidedJSFLibrary(), null, "PluginProvidedJSFLibraries", null, 0, -1, JSFLibraryRegistry.class, IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - - EOperation op = addEOperation(jsfLibraryRegistryEClass, this.getJSFLibrary(), "getJSFLibraryByID", 1, 1); - addEParameter(op, ecorePackage.getEString(), "ID", 1, 1); - - op = addEOperation(jsfLibraryRegistryEClass, ecorePackage.getEEList(), "getJSFLibrariesByName", 1, 1); - addEParameter(op, ecorePackage.getEString(), "name", 1, 1); - - addEOperation(jsfLibraryRegistryEClass, ecorePackage.getEEList(), "getImplJSFLibraries", 1, 1); - - addEOperation(jsfLibraryRegistryEClass, ecorePackage.getEEList(), "getNonImplJSFLibraries", 1, 1); - - addEOperation(jsfLibraryRegistryEClass, ecorePackage.getEEList(), "getAllJSFLibraries", 1, 1); - - op = addEOperation(jsfLibraryRegistryEClass, ecorePackage.getEBoolean(), "addJSFLibrary", 1, 1); - addEParameter(op, this.getJSFLibrary(), "library", 1, 1); - - op = addEOperation(jsfLibraryRegistryEClass, ecorePackage.getEBoolean(), "removeJSFLibrary", 1, 1); - addEParameter(op, this.getJSFLibrary(), "library", 1, 1); - - addEOperation(jsfLibraryRegistryEClass, this.getJSFLibrary(), "getDefaultImplementation", 1, 1); - - op = addEOperation(jsfLibraryRegistryEClass, null, "setDefaultImplementation"); - addEParameter(op, this.getJSFLibrary(), "implementation", 1, 1); - - initEClass(jsfLibraryEClass, JSFLibrary.class, "JSFLibrary", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEAttribute(getJSFLibrary_ID(), ecorePackage.getEString(), "ID", "", 0, 1, JSFLibrary.class, IS_TRANSIENT, !IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, IS_DERIVED, IS_ORDERED); - initEAttribute(getJSFLibrary_Name(), ecorePackage.getEString(), "Name", null, 1, 1, JSFLibrary.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getJSFLibrary_JSFVersion(), this.getJSFVersion(), "JSFVersion", "UNKNOWN", 1, 1, JSFLibrary.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getJSFLibrary_Deployed(), ecorePackage.getEBoolean(), "Deployed", "true", 1, 1, JSFLibrary.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getJSFLibrary_Implementation(), ecorePackage.getEBoolean(), "Implementation", "false", 1, 1, JSFLibrary.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEReference(getJSFLibrary_ArchiveFiles(), this.getArchiveFile(), this.getArchiveFile_JSFLibrary(), "ArchiveFiles", null, 0, -1, JSFLibrary.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - - op = addEOperation(jsfLibraryEClass, ecorePackage.getEBoolean(), "containsArchiveFile", 1, 1); - addEParameter(op, ecorePackage.getEString(), "fullPath", 1, 1); - - addEOperation(jsfLibraryEClass, this.getJSFLibrary(), "getWorkingCopy", 1, 1); - - op = addEOperation(jsfLibraryEClass, null, "updateValues"); - addEParameter(op, this.getJSFLibrary(), "otherLibrary", 1, 1); - - op = addEOperation(jsfLibraryEClass, ecorePackage.getEBoolean(), "copyTo", 1, 1); - addEParameter(op, ecorePackage.getEString(), "baseDestLocation", 1, 1); - - addEOperation(jsfLibraryEClass, ecorePackage.getEString(), "getLabel", 1, 1); - - initEClass(pluginProvidedJSFLibraryEClass, PluginProvidedJSFLibrary.class, "PluginProvidedJSFLibrary", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEAttribute(getPluginProvidedJSFLibrary_PluginID(), ecorePackage.getEString(), "pluginID", null, 1, 1, PluginProvidedJSFLibrary.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getPluginProvidedJSFLibrary_Label(), ecorePackage.getEString(), "Label", null, 1, 1, PluginProvidedJSFLibrary.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - - initEClass(archiveFileEClass, ArchiveFile.class, "ArchiveFile", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEAttribute(getArchiveFile_RelativeToWorkspace(), ecorePackage.getEBoolean(), "RelativeToWorkspace", "true", 1, 1, ArchiveFile.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getArchiveFile_SourceLocation(), ecorePackage.getEString(), "SourceLocation", null, 1, 1, ArchiveFile.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getArchiveFile_RelativeDestLocation(), ecorePackage.getEString(), "RelativeDestLocation", null, 1, 1, ArchiveFile.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEReference(getArchiveFile_JSFLibrary(), this.getJSFLibrary(), this.getJSFLibrary_ArchiveFiles(), "JSFLibrary", null, 1, 1, ArchiveFile.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - - addEOperation(archiveFileEClass, ecorePackage.getEString(), "getName", 1, 1); - - addEOperation(archiveFileEClass, ecorePackage.getEString(), "getPath", 1, 1); - - addEOperation(archiveFileEClass, ecorePackage.getEBoolean(), "exists", 1, 1); - - op = addEOperation(archiveFileEClass, ecorePackage.getEBoolean(), "equals", 1, 1); - addEParameter(op, ecorePackage.getEJavaObject(), "object", 1, 1); - - addEOperation(archiveFileEClass, ecorePackage.getEInt(), "hashCode", 1, 1); - - op = addEOperation(archiveFileEClass, ecorePackage.getEBoolean(), "copyTo", 1, 1); - addEParameter(op, ecorePackage.getEString(), "baseDestLocation", 1, 1); - - addEOperation(archiveFileEClass, ecorePackage.getEString(), "getResolvedSourceLocation", 1, 1); - - // Initialize enums and add enum literals - initEEnum(jsfVersionEEnum, JSFVersion.class, "JSFVersion"); - addEEnumLiteral(jsfVersionEEnum, JSFVersion.UNKNOWN_LITERAL); - addEEnumLiteral(jsfVersionEEnum, JSFVersion.V1_1_LITERAL); - addEEnumLiteral(jsfVersionEEnum, JSFVersion.V1_2_LITERAL); - - // Create resource - createResource(eNS_URI); - } - -} //JSFLibraryRegistryPackageImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/impl/PluginProvidedJSFLibraryImpl.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/impl/PluginProvidedJSFLibraryImpl.java deleted file mode 100644 index 76a3c4a12..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/impl/PluginProvidedJSFLibraryImpl.java +++ /dev/null @@ -1,272 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Ian Trimble - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.internal.jsflibraryregistry.impl; - -import java.util.Iterator; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.ArchiveFile; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistryFactory; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistryPackage; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.PluginProvidedJSFLibrary; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Plugin Provided JSF Library</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.impl.PluginProvidedJSFLibraryImpl#getPluginID <em>Plugin ID</em>}</li> - * <li>{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.impl.PluginProvidedJSFLibraryImpl#getLabel <em>Label</em>}</li> - * </ul> - * </p> - * - * @generated - * @deprecated - */ -public class PluginProvidedJSFLibraryImpl extends JSFLibraryImpl implements PluginProvidedJSFLibrary { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @SuppressWarnings("hiding") - public static final String copyright = "Copyright (c) 2005 Oracle Corporation"; - - /** - * The default value of the '{@link #getPluginID() <em>Plugin ID</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getPluginID() - * @generated - * @ordered - */ - protected static final String PLUGIN_ID_EDEFAULT = null; - - /** - * The cached value of the '{@link #getPluginID() <em>Plugin ID</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getPluginID() - * @generated - * @ordered - */ - protected String pluginID = PLUGIN_ID_EDEFAULT; - - /** - * The default value of the '{@link #getLabel() <em>Label</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getLabel() - * @generated - * @ordered - */ - protected static final String LABEL_EDEFAULT = null; - - /** - * The cached value of the '{@link #getLabel() <em>Label</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getLabel() - * @generated - * @ordered - */ - protected String label = LABEL_EDEFAULT; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected PluginProvidedJSFLibraryImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * @return the static eclass - * <!-- end-user-doc --> - * @generated - */ - protected EClass eStaticClass() { - return JSFLibraryRegistryPackage.Literals.PLUGIN_PROVIDED_JSF_LIBRARY; - } - - /** - * <!-- begin-user-doc --> - * @return the plugin id - * <!-- end-user-doc --> - * @generated - */ - public String getPluginID() { - return pluginID; - } - - /** - * <!-- begin-user-doc --> - * @param newPluginID - * <!-- end-user-doc --> - * @generated - */ - public void setPluginID(String newPluginID) { - String oldPluginID = pluginID; - pluginID = newPluginID; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, JSFLibraryRegistryPackage.PLUGIN_PROVIDED_JSF_LIBRARY__PLUGIN_ID, oldPluginID, pluginID)); - } - - /** - * <!-- begin-user-doc --> - * @return translatable label - * <!-- end-user-doc --> - * @generated NOT - */ - public String getLabel() { - if (label == null) - return super.getLabel(); - return label; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setLabel(String newLabel) { - String oldLabel = label; - label = newLabel; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, JSFLibraryRegistryPackage.PLUGIN_PROVIDED_JSF_LIBRARY__LABEL, oldLabel, label)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case JSFLibraryRegistryPackage.PLUGIN_PROVIDED_JSF_LIBRARY__PLUGIN_ID: - return getPluginID(); - case JSFLibraryRegistryPackage.PLUGIN_PROVIDED_JSF_LIBRARY__LABEL: - return getLabel(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case JSFLibraryRegistryPackage.PLUGIN_PROVIDED_JSF_LIBRARY__PLUGIN_ID: - setPluginID((String)newValue); - return; - case JSFLibraryRegistryPackage.PLUGIN_PROVIDED_JSF_LIBRARY__LABEL: - setLabel((String)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eUnset(int featureID) { - switch (featureID) { - case JSFLibraryRegistryPackage.PLUGIN_PROVIDED_JSF_LIBRARY__PLUGIN_ID: - setPluginID(PLUGIN_ID_EDEFAULT); - return; - case JSFLibraryRegistryPackage.PLUGIN_PROVIDED_JSF_LIBRARY__LABEL: - setLabel(LABEL_EDEFAULT); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean eIsSet(int featureID) { - switch (featureID) { - case JSFLibraryRegistryPackage.PLUGIN_PROVIDED_JSF_LIBRARY__PLUGIN_ID: - return PLUGIN_ID_EDEFAULT == null ? pluginID != null : !PLUGIN_ID_EDEFAULT.equals(pluginID); - case JSFLibraryRegistryPackage.PLUGIN_PROVIDED_JSF_LIBRARY__LABEL: - return LABEL_EDEFAULT == null ? label != null : !LABEL_EDEFAULT.equals(label); - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - public String getID() { - return getPluginID() + ID_SEPARATOR + getName(); - } - - /** - * <!-- begin-user-doc --> - * @return the working copy - * <!-- end-user-doc --> - * @generated NOT - */ - public JSFLibrary getWorkingCopy() { - PluginProvidedJSFLibrary workingCopyLib = JSFLibraryRegistryFactory.eINSTANCE.createPluginProvidedJSFLibrary(); -// workingCopyLib.setID(getID()); - workingCopyLib.setName(getName()); - if (label != null) workingCopyLib.setLabel(getLabel()); - workingCopyLib.setJSFVersion(getJSFVersion()); - workingCopyLib.setDeployed(isDeployed()); - workingCopyLib.setImplementation(isImplementation()); - workingCopyLib.setPluginID(getPluginID()); - Iterator itArchiveFiles = getArchiveFiles().iterator(); - while (itArchiveFiles.hasNext()) { - ArchiveFile srcArchiveFile = (ArchiveFile)itArchiveFiles.next(); - ArchiveFile destArchiveFile = JSFLibraryRegistryFactory.eINSTANCE.createArchiveFile(); - destArchiveFile.setRelativeToWorkspace(srcArchiveFile.isRelativeToWorkspace()); - destArchiveFile.setSourceLocation(srcArchiveFile.getSourceLocation()); - destArchiveFile.setRelativeDestLocation(srcArchiveFile.getRelativeDestLocation()); - workingCopyLib.getArchiveFiles().add(destArchiveFile); - } - return workingCopyLib; - } - - /** - * <!-- begin-user-doc --> - * @return the string representation - * <!-- end-user-doc --> - * @generated - */ - public String toString() { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (pluginID: "); - result.append(pluginID); - result.append(", Label: "); - result.append(label); - result.append(')'); - return result.toString(); - } - -} //PluginProvidedJSFLibraryImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/util/JSFLibraryRegistryAdapterFactory.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/util/JSFLibraryRegistryAdapterFactory.java deleted file mode 100644 index 65caeb390..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/util/JSFLibraryRegistryAdapterFactory.java +++ /dev/null @@ -1,186 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Ian Trimble - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.internal.jsflibraryregistry.util; - -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.common.notify.Notifier; -import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.ArchiveFile; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistry; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistryPackage; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.PluginProvidedJSFLibrary; - - -/** - * <!-- begin-user-doc --> - * The <b>Adapter Factory</b> for the model. - * It provides an adapter <code>createXXX</code> method for each class of the model. - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistryPackage - * @generated - * @deprecated - */ -public class JSFLibraryRegistryAdapterFactory extends AdapterFactoryImpl { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright (c) 2005 Oracle Corporation"; - - /** - * The cached model package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected static JSFLibraryRegistryPackage modelPackage; - - /** - * Creates an instance of the adapter factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public JSFLibraryRegistryAdapterFactory() { - if (modelPackage == null) { - modelPackage = JSFLibraryRegistryPackage.eINSTANCE; - } - } - - /** - * Returns whether this factory is applicable for the type of the object. - * <!-- begin-user-doc --> - * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model. - * @param object - * <!-- end-user-doc --> - * @return whether this factory is applicable for the type of the object. - * @generated - */ - public boolean isFactoryForType(Object object) { - if (object == modelPackage) { - return true; - } - if (object instanceof EObject) { - return ((EObject)object).eClass().getEPackage() == modelPackage; - } - return false; - } - - /** - * The switch the delegates to the <code>createXXX</code> methods. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected JSFLibraryRegistrySwitch modelSwitch = - new JSFLibraryRegistrySwitch() { - public Object caseJSFLibraryRegistry(JSFLibraryRegistry object) { - return createJSFLibraryRegistryAdapter(); - } - public Object caseJSFLibrary(JSFLibrary object) { - return createJSFLibraryAdapter(); - } - public Object casePluginProvidedJSFLibrary(PluginProvidedJSFLibrary object) { - return createPluginProvidedJSFLibraryAdapter(); - } - public Object caseArchiveFile(ArchiveFile object) { - return createArchiveFileAdapter(); - } - public Object defaultCase(EObject object) { - return createEObjectAdapter(); - } - }; - - /** - * Creates an adapter for the <code>target</code>. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param target the object to adapt. - * @return the adapter for the <code>target</code>. - * @generated - */ - public Adapter createAdapter(Notifier target) { - return (Adapter)modelSwitch.doSwitch((EObject)target); - } - - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistry <em>JSF Library Registry</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistry - * @generated - */ - public Adapter createJSFLibraryRegistryAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary <em>JSF Library</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary - * @generated - */ - public Adapter createJSFLibraryAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.ArchiveFile <em>Archive File</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.ArchiveFile - * @generated - */ - public Adapter createArchiveFileAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.core.internal.jsflibraryregistry.PluginProvidedJSFLibrary <em>Plugin Provided JSF Library</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.PluginProvidedJSFLibrary - * @generated - */ - public Adapter createPluginProvidedJSFLibraryAdapter() { - return null; - } - - /** - * Creates a new adapter for the default case. - * <!-- begin-user-doc --> - * This default implementation returns null. - * <!-- end-user-doc --> - * @return the new adapter. - * @generated - */ - public Adapter createEObjectAdapter() { - return null; - } - -} //JSFLibraryRegistryAdapterFactory diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/util/JSFLibraryRegistryResourceFactoryImpl.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/util/JSFLibraryRegistryResourceFactoryImpl.java deleted file mode 100644 index 8236da252..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/util/JSFLibraryRegistryResourceFactoryImpl.java +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Ian Trimble - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.internal.jsflibraryregistry.util; - -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.impl.ResourceFactoryImpl; - -/** - * <!-- begin-user-doc --> - * The <b>Resource Factory</b> associated with the package. - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.util.JSFLibraryRegistryResourceImpl - * @generated - * @deprecated - */ -public class JSFLibraryRegistryResourceFactoryImpl extends ResourceFactoryImpl { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright (c) 2005 Oracle Corporation"; - - /** - * Creates an instance of the resource factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public JSFLibraryRegistryResourceFactoryImpl() { - super(); - } - - /** - * Creates an instance of the resource. - * <!-- begin-user-doc --> - * @param uri - * @return the Resource - * <!-- end-user-doc --> - * @generated - */ - public Resource createResource(URI uri) { - Resource result = new JSFLibraryRegistryResourceImpl(uri); - return result; - } - -} //JSFLibraryRegistryResourceFactoryImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/util/JSFLibraryRegistryResourceImpl.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/util/JSFLibraryRegistryResourceImpl.java deleted file mode 100644 index c1804bc50..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/util/JSFLibraryRegistryResourceImpl.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Ian Trimble - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.internal.jsflibraryregistry.util; - -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl; - -/** - * <!-- begin-user-doc --> - * The <b>Resource </b> associated with the package. - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.util.JSFLibraryRegistryResourceFactoryImpl - * @generated - * @deprecated - */ -public class JSFLibraryRegistryResourceImpl extends XMLResourceImpl { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright (c) 2005 Oracle Corporation"; - - /** - * Creates an instance of the resource. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param uri the URI of the new resource. - * @generated - */ - public JSFLibraryRegistryResourceImpl(URI uri) { - super(uri); - } - -} //JSFLibraryRegistryResourceImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/util/JSFLibraryRegistrySwitch.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/util/JSFLibraryRegistrySwitch.java deleted file mode 100644 index a9063a821..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/util/JSFLibraryRegistrySwitch.java +++ /dev/null @@ -1,213 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Ian Trimble - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.internal.jsflibraryregistry.util; - -import java.util.List; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.ArchiveFile; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistry; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistryPackage; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.PluginProvidedJSFLibrary; - - -/** - * <!-- begin-user-doc --> - * The <b>Switch</b> for the model's inheritance hierarchy. - * It supports the call {@link #doSwitch(EObject) doSwitch(object)} - * to invoke the <code>caseXXX</code> method for each class of the model, - * starting with the actual class of the object - * and proceeding up the inheritance hierarchy - * until a non-null result is returned, - * which is the result of the switch. - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistryPackage - * @generated - * @deprecated - */ -public class JSFLibraryRegistrySwitch { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright (c) 2005 Oracle Corporation"; - - /** - * The cached model package - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected static JSFLibraryRegistryPackage modelPackage; - - /** - * Creates an instance of the switch. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public JSFLibraryRegistrySwitch() { - if (modelPackage == null) { - modelPackage = JSFLibraryRegistryPackage.eINSTANCE; - } - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * @param theEObject - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - public Object doSwitch(EObject theEObject) { - return doSwitch(theEObject.eClass(), theEObject); - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * @param theEClass - * @param theEObject - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - protected Object doSwitch(EClass theEClass, EObject theEObject) { - if (theEClass.eContainer() == modelPackage) { - return doSwitch(theEClass.getClassifierID(), theEObject); - } - List eSuperTypes = theEClass.getESuperTypes(); - return - eSuperTypes.isEmpty() ? - defaultCase(theEObject) : - doSwitch((EClass)eSuperTypes.get(0), theEObject); - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * @param classifierID - * @param theEObject - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - protected Object doSwitch(int classifierID, EObject theEObject) { - switch (classifierID) { - case JSFLibraryRegistryPackage.JSF_LIBRARY_REGISTRY: { - JSFLibraryRegistry jsfLibraryRegistry = (JSFLibraryRegistry)theEObject; - Object result = caseJSFLibraryRegistry(jsfLibraryRegistry); - if (result == null) result = defaultCase(theEObject); - return result; - } - case JSFLibraryRegistryPackage.JSF_LIBRARY: { - JSFLibrary jsfLibrary = (JSFLibrary)theEObject; - Object result = caseJSFLibrary(jsfLibrary); - if (result == null) result = defaultCase(theEObject); - return result; - } - case JSFLibraryRegistryPackage.PLUGIN_PROVIDED_JSF_LIBRARY: { - PluginProvidedJSFLibrary pluginProvidedJSFLibrary = (PluginProvidedJSFLibrary)theEObject; - Object result = casePluginProvidedJSFLibrary(pluginProvidedJSFLibrary); - if (result == null) result = caseJSFLibrary(pluginProvidedJSFLibrary); - if (result == null) result = defaultCase(theEObject); - return result; - } - case JSFLibraryRegistryPackage.ARCHIVE_FILE: { - ArchiveFile archiveFile = (ArchiveFile)theEObject; - Object result = caseArchiveFile(archiveFile); - if (result == null) result = defaultCase(theEObject); - return result; - } - default: return defaultCase(theEObject); - } - } - - /** - * Returns the result of interpretting the object as an instance of '<em>JSF Library Registry</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpretting the object as an instance of '<em>JSF Library Registry</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object caseJSFLibraryRegistry(JSFLibraryRegistry object) { - return null; - } - - /** - * Returns the result of interpretting the object as an instance of '<em>JSF Library</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpretting the object as an instance of '<em>JSF Library</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object caseJSFLibrary(JSFLibrary object) { - return null; - } - - /** - * Returns the result of interpretting the object as an instance of '<em>Archive File</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpretting the object as an instance of '<em>Archive File</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object caseArchiveFile(ArchiveFile object) { - return null; - } - - /** - * Returns the result of interpretting the object as an instance of '<em>Plugin Provided JSF Library</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpretting the object as an instance of '<em>Plugin Provided JSF Library</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object casePluginProvidedJSFLibrary(PluginProvidedJSFLibrary object) { - return null; - } - - /** - * Returns the result of interpretting the object as an instance of '<em>EObject</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch, but this is the last case anyway. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpretting the object as an instance of '<em>EObject</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) - * @generated - */ - public Object defaultCase(EObject object) { - return null; - } - -} //JSFLibraryRegistrySwitch diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/util/JSFLibraryRegistryUpgradeUtil.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/util/JSFLibraryRegistryUpgradeUtil.java deleted file mode 100644 index 1a74ab229..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/util/JSFLibraryRegistryUpgradeUtil.java +++ /dev/null @@ -1,236 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.internal.jsflibraryregistry.util; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URL; - -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Platform; -import org.eclipse.emf.common.util.URI; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; - -/** - * Utility for checking for, and upgrading the JSF Library Registry when the EMF model changes. - * @deprecated - */ -public class JSFLibraryRegistryUpgradeUtil { - static String v1Tov2UpgradeURL = "http://www.eclipse.org/JSFxxxxxxxxxxxxxxxxxxxxxx"; - - /** - * default state is OK, no upgrade - */ - private UpgradeStatus upgradeStatus; - - /** - * The workspace-relative part of the URL of the JSF Library Registry - * persistence store. (version 1) - */ - public static final String JSF_LIBRARY_REGISTRY_V1_URL = ".metadata/.plugins/org.eclipse.jst.jsf.core/JSFLibraryRegistry.xml"; //$NON-NLS-1$ - - /** - * The workspace-relative part of the URL of the JSF Library Registry - * persistence store. (version 2) - */ - public static final String JSF_LIBRARY_REGISTRY_V2_URL = ".metadata/.plugins/org.eclipse.jst.jsf.core/JSFLibraryRegistryV2.xml"; //$NON-NLS-1$ - - /** - * The LATEST VERSION of the workspace-relative part of the URL of the JSF Library Registry - * persistence store. - */ - public static final String JSF_LIBRARY_REGISTRY_LATESTVERSION_URL = JSF_LIBRARY_REGISTRY_V2_URL; - /** - * The latest version value. - */ - public static final int LATESTVERSION = 2; - - private static final int NO_VERSION = 0; - - private static JSFLibraryRegistryUpgradeUtil INSTANCE; - - /** - * @return the stateful runtime singleton - */ - public static synchronized JSFLibraryRegistryUpgradeUtil getInstance(){ - if (INSTANCE == null){ - INSTANCE = new JSFLibraryRegistryUpgradeUtil(); - } - return INSTANCE; - } - - /** - * Return the URI for the specified JSF Library Registry - * @param registryVersion - * @return URI - * @throws MalformedURLException - */ - public static URI getRegistryURI(String registryVersion) throws MalformedURLException { - URL jsfLibRegURL = new URL(Platform.getInstanceLocation().getURL(), registryVersion); - return URI.createURI(jsfLibRegURL.toString()); - } - - /** - * @param originalFile - * @return the backup file name for a file - */ - public static String getBackupFileName(final String originalFile) - { - return originalFile.concat(".bkp"); - } - - /** - * Upgrades the JSF Library registry from oldest to newest - * @param expectedVersion - */ - public void upgradeRegistryIfNecessary(int expectedVersion) { - //when adding upgrades, the upgrades should progress from oldest to newest - try - { - int curVersion = getCurVersion(); - - if (curVersion < expectedVersion && curVersion != NO_VERSION) - { - UpgradeOperation op = getUpgradeOperation(curVersion); - - if (op.canExecute()) - { - try - { - // TODO: when move to Java 5, use co-variant return - upgradeStatus = (UpgradeStatus) - op.execute(new NullProgressMonitor(), null); - upgradeStatus.setUpgradeOperation(op); - } - catch (ExecutionException e) - { - // should never happen since we control the URL's - JSFCorePlugin.log(IStatus.ERROR, "Error during loading JSF Library registry", e); - //TODO: flag failure in status - upgradeStatus = - new UpgradeStatus(IStatus.ERROR, true, "Error detected during upgrade!"); - } - } - else - { - // TODO: what if can't execute? - upgradeStatus = - new UpgradeStatus(IStatus.ERROR, false, "Error detected during upgrade!"); - } - } - else - { - // everything ok, not upgrade - upgradeStatus = new UpgradeStatus(); - } - } - catch (MalformedURLException e) { - // should never happen since we control the URL's - JSFCorePlugin.log(IStatus.ERROR, "Error during loading JSF Library registry", e); - } - } - - private int getCurVersion() throws MalformedURLException - { - // TODO: need generalized algorithm here - URI v2File = getRegistryURI(JSF_LIBRARY_REGISTRY_V2_URL); - File file = new File(v2File.toFileString()); - if (file.exists()) - { - return 2; - } - - URI v1File = getRegistryURI(JSF_LIBRARY_REGISTRY_V1_URL); - file = new File(v1File.toFileString()); - if (file.exists()) - { - return 1; - } - return NO_VERSION; - } - - /** - * @param curVersion - * @return the upgrade operation to move from curVersion to the latest - * @throws MalformedURLException - */ - protected UpgradeOperation getUpgradeOperation(int curVersion) throws MalformedURLException - { - UpgradeOperation op = new UpgradeOperation("JSF Registry Upgrade"); - switch(curVersion) - { - case 1: - op.addVersionUpgrade( - new MigrateV1toV2Operation("Upgrade v1 to v2" - ,getRegistryURI(JSF_LIBRARY_REGISTRY_V1_URL) - , getRegistryURI(JSF_LIBRARY_REGISTRY_V2_URL))); - } - - return op; - } - - - /** - * @return array of {@link UpgradeStatus}s. There can be more than one if the registry has been upgraded by more than one version. - * Will not be null. - */ - public UpgradeStatus getUpgradeStatus(){ - return this.upgradeStatus; - } - - static void deleteFile(String fileName) { - File f = new File(fileName); - if (f.exists()){ - f.delete(); - if (f.exists()) - f.deleteOnExit(); - } - } - - static void copyFile(String srcFileName, String destFileName) { - - File srcFile = new File(srcFileName); - File destFile = new File(destFileName); - FileInputStream from = null; - FileOutputStream to = null; - try { - from = new FileInputStream(srcFile); - to = new FileOutputStream(destFile); - byte[] buffer = new byte[4096]; - int bytesRead; - - while ((bytesRead = from.read(buffer)) != -1) - to.write(buffer, 0, bytesRead); // write - } catch (IOException ioe){ - JSFCorePlugin.log(ioe, "Error during file copy"); - } finally { - if (from != null) - try { - from.close(); - } catch (IOException e) { - JSFCorePlugin.log(e, "Error during file close"); - } - if (to != null) - try { - to.close(); - } catch (IOException e) { - JSFCorePlugin.log(e, "Error during file close"); - } - } - - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/util/JSFLibraryRegistryXMLProcessor.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/util/JSFLibraryRegistryXMLProcessor.java deleted file mode 100644 index db7a4db10..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/util/JSFLibraryRegistryXMLProcessor.java +++ /dev/null @@ -1,58 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: JSFLibraryRegistryXMLProcessor.java,v 1.3 2008/11/04 01:28:34 gkessler Exp $ - */ -package org.eclipse.jst.jsf.core.internal.jsflibraryregistry.util; - -import java.util.Map; - -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.xmi.util.XMLProcessor; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistryPackage; - -/** - * This class contains helper methods to serialize and deserialize XML documents - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @deprecated - */ -public class JSFLibraryRegistryXMLProcessor extends XMLProcessor { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright (c) 2005 Oracle Corporation"; - - - /** - * Public constructor to instantiate the helper. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public JSFLibraryRegistryXMLProcessor() { - super((EPackage.Registry.INSTANCE)); - JSFLibraryRegistryPackage.eINSTANCE.eClass(); - } - - /** - * Register for "*" and "xml" file extensions the JSFLibraryRegistryResourceFactoryImpl factory. - * <!-- begin-user-doc --> - * @return Map of registrations - * <!-- end-user-doc --> - * @generated - */ - protected Map getRegistrations() { - if (registrations == null) { - super.getRegistrations(); - registrations.put(XML_EXTENSION, new JSFLibraryRegistryResourceFactoryImpl()); - registrations.put(STAR_EXTENSION, new JSFLibraryRegistryResourceFactoryImpl()); - } - return registrations; - } - -} //JSFLibraryRegistryXMLProcessor diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/util/MigrateV1toV2Operation.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/util/MigrateV1toV2Operation.java deleted file mode 100644 index 1d021a86b..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/util/MigrateV1toV2Operation.java +++ /dev/null @@ -1,125 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.internal.jsflibraryregistry.util; - -import java.io.IOException; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.xmi.XMLResource; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.core.internal.Messages; -import org.eclipse.jst.jsf.core.internal.jsflibraryconfig.JSFLibraryRegistryUtil; - -/** - * @deprecated - */ -class MigrateV1toV2Operation extends VersionUpgradeOperation { - - private final URI _v1Registry; - private final URI _v2Registry; - - /** - * @param label - * @param v1Registry - * @param v2Registry - */ - public MigrateV1toV2Operation(String label, URI v1Registry, URI v2Registry) { - super(label, 1, 2); - _v1Registry = v1Registry; - _v2Registry = v2Registry; - } - - public IStatus doCommit() { - JSFLibraryRegistryUpgradeUtil.deleteFile(_v1Registry.toFileString()); - return Status.OK_STATUS; - } - - public IStatus doExecute(IProgressMonitor monitor, IAdaptable info) - { - JSFLibraryRegistryUpgradeUtil.copyFile - (_v1Registry.toFileString(), JSFLibraryRegistryUpgradeUtil.getBackupFileName(_v1Registry.toFileString())); - JSFLibraryRegistryResourceFactoryImpl resourceFactory = new JSFLibraryRegistryResourceFactoryImpl(); - JSFLibraryRegistryResourceImpl res = (JSFLibraryRegistryResourceImpl)resourceFactory.createResource(_v1Registry); - try { - URI newRegURI = - JSFLibraryRegistryUpgradeUtil.getRegistryURI - (JSFLibraryRegistryUpgradeUtil.JSF_LIBRARY_REGISTRY_V2_URL); - Map options = new HashMap(); - //disable notifications during load to avoid changing stored default implementation - options.put(XMLResource.OPTION_DISABLE_NOTIFY, Boolean.TRUE); - res.load(options); - //if we got this far then the registry was empty - //"upgrade" to v2 and then delete old. no point in upgrade status being sent - JSFLibraryRegistryUtil.getInstance().saveJSFLibraryRegistry(); - JSFLibraryRegistryUpgradeUtil.copyFile(_v1Registry.toFileString(), newRegURI.toFileString());//save as v2 file - JSFLibraryRegistryUpgradeUtil.deleteFile(_v1Registry.toFileString()); - - return new UpgradeStatus();//all is ok and no need to alert user - - } catch(IOException ioe) { - //this was expected... if there was actual v1 contents in the regsistry... upgrade by saving - //perform save which will lose the ID - try { - res.save(Collections.EMPTY_MAP); - //create v2 xml file - URI newRegURI = - JSFLibraryRegistryUpgradeUtil.getRegistryURI - (JSFLibraryRegistryUpgradeUtil.JSF_LIBRARY_REGISTRY_V2_URL); - JSFLibraryRegistryUpgradeUtil.copyFile(_v1Registry.toFileString(), newRegURI.toFileString()); - //delete upgraded v1 - JSFLibraryRegistryUpgradeUtil.deleteFile(_v1Registry.toFileString()); - //restore backup to v1 name - JSFLibraryRegistryUpgradeUtil.copyFile(_v1Registry.toFileString().concat(".bkp"), _v1Registry.toFileString()); - //Alert end user - return new UpgradeStatus(IStatus.OK, true, Messages.JSFRegistryMigration05_to_10_customMessage); - } catch(IOException e) { - JSFCorePlugin.log(IStatus.ERROR, "Error during repository upgrade from v1 to v2", e); - return new UpgradeStatus(IStatus.ERROR, false, - Messages.JSFRegistryMigrationCannot05_to_10_customMessage); - } - } - //return ; - } - - public IStatus doRedo(IProgressMonitor monitor, IAdaptable info) - throws ExecutionException { - return doExecute(monitor, info); - } - - - public boolean canUndo() { - // commit is undoable for this operation - return super.canUndo() && !hasCommitted(); - } - - public IStatus doUndo(IProgressMonitor monitor, IAdaptable info) - throws ExecutionException - { - //restore backup to v1 name - JSFLibraryRegistryUpgradeUtil.copyFile(_v1Registry.toFileString().concat(".bkp"), _v1Registry.toFileString()); - - // delete the new registry - JSFLibraryRegistryUpgradeUtil.deleteFile(_v2Registry.toFileString()); - - //and the backup - JSFLibraryRegistryUpgradeUtil.deleteFile(_v1Registry.toFileString().concat(".bkp")); - - return Status.OK_STATUS; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/util/UpgradeOperation.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/util/UpgradeOperation.java deleted file mode 100644 index e90d41593..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/util/UpgradeOperation.java +++ /dev/null @@ -1,217 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.internal.jsflibraryregistry.util; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.commands.operations.AbstractOperation; -import org.eclipse.core.commands.operations.IUndoableOperation; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; - -/** - * Encapsulates a chain of one or more version steps into a full upgrade. - * - * @author cbateman - * @deprecated - */ -public class UpgradeOperation extends AbstractOperation { - - private final List/*<VersionUpgradeOperation*/ _stepOperations; - - /** - * @param label - */ - public UpgradeOperation(String label) { - super(label); - _stepOperations = new ArrayList(); - } - - /** - * Add upgrade operation to the list of operations. - * Execute, undo and redo call each operation's corresponding - * method in the order they are added to the list. - * @param operation - */ - public void addVersionUpgrade(VersionUpgradeOperation operation) - { - _stepOperations.add(operation); - } - - /** - * @param monitor - * @param info - * @return an OK status if all goes well. The status for the first op - * that fails otherwise. - * @throws ExecutionException - */ - public IStatus execute(IProgressMonitor monitor, IAdaptable info) - throws ExecutionException { - - boolean upgraded = false; - - for (final Iterator it = _stepOperations.iterator(); it.hasNext();) - { - VersionUpgradeOperation op = (VersionUpgradeOperation) it.next(); - // TODO: move to covariant - UpgradeStatus status = (UpgradeStatus) op.execute(monitor, info); - - // fail fast - if (status.getSeverity() != IStatus.OK) - { - return status; - } - - // once an upgrade is flagged, set flag - if (status.isUpgradeOccurred()) - { - upgraded = true; - } - } - - return new UpgradeStatus(IStatus.OK, upgraded, "Upgrade succeeded"); - } - - /** - * @param monitor - * @param info - * @return an OK status if all goes well. The status for the first op - * that fails otherwise. - * @throws ExecutionException - */ - public IStatus redo(IProgressMonitor monitor, IAdaptable info) - throws ExecutionException { - for (final Iterator it = _stepOperations.iterator(); it.hasNext();) - { - VersionUpgradeOperation op = (VersionUpgradeOperation) it.next(); - IStatus status = op.redo(monitor, info); - - // fail fast - if (status.getSeverity() != IStatus.OK) - { - return status; - } - } - - return new UpgradeStatus(IStatus.OK, true, "Upgrade succeeded"); - } - - /** - * @param monitor - * @param info - * @return an OK status if all goes well. The status for the first op - * that fails otherwise. - * @throws ExecutionException - */ - public IStatus undo(IProgressMonitor monitor, IAdaptable info) - throws ExecutionException { - for (final Iterator it = _stepOperations.iterator(); it.hasNext();) - { - VersionUpgradeOperation op = (VersionUpgradeOperation) it.next(); - IStatus status = op.undo(monitor, info); - - // fail fast - if (status.getSeverity() != IStatus.OK) - { - return status; - } - } - - return Status.OK_STATUS; - } - - /** - * @return an OK status if all goes well. The status for the first op - * that fails otherwise. - * @throws ExecutionException - */ - public IStatus commit() throws ExecutionException - { - for (final Iterator it = _stepOperations.iterator(); it.hasNext();) - { - VersionUpgradeOperation op = (VersionUpgradeOperation) it.next(); - - if (op.canCommit()) - { - IStatus status = op.commit(); - - // fail fast - if (status.getSeverity() != IStatus.OK) - { - return status; - } - } - } - - return Status.OK_STATUS; - } - - public boolean canExecute() - { - for (final Iterator it = _stepOperations.iterator(); it.hasNext();) - { - IUndoableOperation op = (IUndoableOperation) it.next(); - - // fail fast - if (!op.canExecute()) - { - return false; - } - } - - return true; - } - - public boolean canRedo() { - for (final Iterator it = _stepOperations.iterator(); it.hasNext();) - { - IUndoableOperation op = (IUndoableOperation) it.next(); - - // fail fast - if (!op.canRedo()) - { - return false; - } - } - - return true; - } - - public boolean canUndo() { - for (final Iterator it = _stepOperations.iterator(); it.hasNext();) - { - IUndoableOperation op = (IUndoableOperation) it.next(); - - // fail fast - if (!op.canUndo()) - { - return false; - } - } - - return true; - } - - public void dispose() - { - for (final Iterator it = _stepOperations.iterator(); it.hasNext();) - { - IUndoableOperation op = (IUndoableOperation) it.next(); - op.dispose(); - } - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/util/UpgradeStatus.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/util/UpgradeStatus.java deleted file mode 100644 index 3dc32270c..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/util/UpgradeStatus.java +++ /dev/null @@ -1,105 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.internal.jsflibraryregistry.util; - -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Status; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; - -/** - * Communicates the status of the JSF Library Registry - * @deprecated - */ -public class UpgradeStatus extends Status -{ - private final boolean upgradeOccurred; - private UpgradeOperation upgradeOperation; - - /** - * All-is-well UpgradeStatus constructor - */ - public UpgradeStatus(){ - super(IStatus.OK, JSFCorePlugin.getDefault().getPluginID(), "OK"); - this.upgradeOccurred = false; - } - - /** - * Constructor when registry upgrade has occured or there is a problem during upgrade - * @param severity - * @param upgradeOccurred flag - * @param message - * - */ - public UpgradeStatus(int severity, boolean upgradeOccurred, String message){ - super(severity, JSFCorePlugin.getDefault().getPluginID(), message); - this.upgradeOccurred = upgradeOccurred; - } - - /** - * @return true if a registry upgrade occurred - */ - public boolean isUpgradeOccurred() { - return upgradeOccurred; - } - - /** - * @return the operation used to do the upgrade. - */ - protected UpgradeOperation getUpgradeOperation() { - return upgradeOperation; - } - - void setUpgradeOperation(UpgradeOperation upgradeOperation) - { - this.upgradeOperation = upgradeOperation; - } - - /** - * Commits any upgrade that has occurred - * @return the result of the commit - */ - public IStatus commit() - { - if (upgradeOperation != null) - { - try - { - return upgradeOperation.commit(); - } - catch (ExecutionException e) - { - return new Status(IStatus.ERROR, JSFCorePlugin.getDefault().getPluginID(), "Error committing status", e); - } - } - return Status.OK_STATUS; - } - - /** - * @return the result of rolling back any changes - */ - public IStatus rollback() - { - if (upgradeOperation != null) - { - try - { - return upgradeOperation.undo(new NullProgressMonitor(), null); - } - catch (ExecutionException e) - { - return new Status(IStatus.ERROR, JSFCorePlugin.getDefault().getPluginID(), "Error committing status", e); - } - } - return Status.OK_STATUS; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/util/VersionUpgradeOperation.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/util/VersionUpgradeOperation.java deleted file mode 100644 index bf9928c6f..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryregistry/util/VersionUpgradeOperation.java +++ /dev/null @@ -1,236 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.internal.jsflibraryregistry.util; - -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.commands.operations.AbstractOperation; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; - -/** - * Implements a single step (vX -> v(X+1)) version upgrade as an - * Eclipse operation. Adds an additional "commit" abstract method. This - * can be called after execute in situations where further actions require - * user approval etc. See the javadocs for the method, it contains important - * API rules - * - * @author cbateman - * @deprecated - */ -public abstract class VersionUpgradeOperation extends AbstractOperation -{ - /** - * the version being upgraded from - */ - protected final int _oldVersion; - /** - * the version being upgraded to - */ - protected final int _newVersion; - - private boolean _hasExecuted; - private boolean _hasCommitted; - private boolean _hasCleanState = true; - - /** - * @param label - * @param oldVersion - * @param newVersion - */ - public VersionUpgradeOperation(String label, int oldVersion, int newVersion) { - super(label); - _oldVersion = oldVersion; - _newVersion = newVersion; - } - - /** - * Allows selected functionality to be called after execute is called. - * Commit must conform to following contract: - * - * 1) should do nothing if execute() has not been called. - * 2) must do nothing if canCommit == false - * 3) once executed, undo should undo commit() first, then execute() - * 4) once undone, redo should call commit only if it was called before undo() - * @return must conform to same contract as execute() - * @throws ExecutionException - * - */ - public final IStatus commit() throws ExecutionException - { - if (canCommit()) - { - IStatus result = doCommit(); - if (result.getSeverity() == IStatus.OK) - { - _hasCommitted = true; - } - else - { - _hasCommitted = false; - _hasCleanState = false; - } - return result; - } - throw new ExecutionException("Cannot execute"); - } - - /** - * @return the result of the actual commit - * @throws ExecutionException - */ - protected abstract IStatus doCommit() throws ExecutionException; - - /** - * @return true if the operation can be committed - */ - public boolean canCommit() - { - return _hasExecuted && !_hasCommitted && _hasCleanState; - } - - public final IStatus execute(IProgressMonitor monitor, IAdaptable info) - throws ExecutionException - { - if (canExecute()) - { - IStatus result = doExecute(monitor, info); - if (result.getSeverity() == IStatus.OK) - { - _hasExecuted = true; - } - else - { - _hasExecuted = false; - _hasCleanState = false; - } - return result; - } - throw new ExecutionException("Cannot execute"); - } - - /** - * @param monitor - * @param info - * @return the status of the real execution - * @throws ExecutionException - */ - protected abstract IStatus doExecute(IProgressMonitor monitor, IAdaptable info)throws ExecutionException; - - public final IStatus redo(IProgressMonitor monitor, IAdaptable info) - throws ExecutionException { - if (canRedo()) - { - IStatus result = doRedo(monitor, info); - if (result.getSeverity() == IStatus.OK) - { - _hasExecuted = true; - } - else - { - _hasExecuted = false; - _hasCleanState = false; - } - return result; - } - throw new ExecutionException("Cannot redo"); - } - - /** - * @param monitor - * @param info - * @return the status of the real redo - * @throws ExecutionException - */ - protected abstract IStatus doRedo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException; - - public final IStatus undo(IProgressMonitor monitor, IAdaptable info) - throws ExecutionException { - if (canUndo()) - { - IStatus result = doUndo(monitor, info); - if (result.getSeverity() == IStatus.OK) - { - _hasExecuted = false; - } - else - { - _hasExecuted = true; - _hasCleanState = false; - } - return result; - } - throw new ExecutionException("Cannot redo"); - } - - /** - * @param monitor - * @param info - * @return the status of the real redo - * @throws ExecutionException - */ - protected abstract IStatus doUndo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException; - - public boolean canExecute() { - return !_hasExecuted && _hasCleanState; - } - - public boolean canRedo() { - return canExecute(); - } - - public boolean canUndo() { - return _hasExecuted && _hasCleanState; - } - - /** - * @param executed - */ - protected void setHasExecuted(boolean executed) { - _hasExecuted = executed; - } - - /** - * @param committed - */ - protected void setHasCommitted(boolean committed) { - _hasCommitted = committed; - } - - /** - * @param cleanState - */ - protected void setHasCleanState(boolean cleanState) { - _hasCleanState = cleanState; - } - - /** - * @return true if has executed - */ - protected boolean hasExecuted() { - return _hasExecuted; - } - - /** - * @return true if has committed - */ - protected boolean hasCommitted() { - return _hasCommitted; - } - - /** - * @return true if has clean state - */ - protected boolean hasCleanState() { - return _hasCleanState; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/launch/JSFFileURL.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/launch/JSFFileURL.java deleted file mode 100644 index bb3192dcc..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/launch/JSFFileURL.java +++ /dev/null @@ -1,190 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.core.internal.launch; - -import java.util.Iterator; - -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.jst.j2ee.internal.web.jfaces.extension.FileURL; -import org.eclipse.jst.j2ee.model.IModelProvider; -import org.eclipse.jst.j2ee.model.ModelProviderManager; -import org.eclipse.jst.j2ee.webapplication.Servlet; -import org.eclipse.jst.j2ee.webapplication.ServletMapping; -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.jst.jsf.core.internal.project.facet.JSFUtils11; -import org.eclipse.jst.jsf.core.internal.project.facet.JSFUtils12; - -/** - * Extends the FileURL extension-point so that a JSF JSP page - * can have it's URL mapped to the Faces Servlet using the servlet-mapping - * specified in the web.xml file - * - * @author Gerry Kessler - Oracle - * - */ -public class JSFFileURL implements FileURL { - - /** - * If this is a JSP page, this will return a URL using the first valid servlet-mapping to the Faces Servlet - * if found. If the faces servlet is not defined in the web.xml or there is no servlet-mapping, this will return null. - * - * The resource's file extension is compared with the javax.faces.DEFAULT_SUFFIX context-param if set. If the same, then - * extension mapping will be used if found in the web.xml. If not set, "jsp" default is assumed. If resource does not have the default - * file extension, then it must have either: jsp,jspx, or jsf file extensions in order to be considered for launch. - * - * This will not guarentee a page to be run. The user will still need a properly configured server with valid URL mappings and - * context-params. - * - * TODO: We could detect and insert or just warn for context-params and url mappings to run. However, this would better detected during a JSF App validation step. - * - * @see org.eclipse.jst.j2ee.internal.web.jfaces.extension.FileURL#getFileURL(org.eclipse.core.resources.IResource, org.eclipse.core.runtime.IPath) - */ - public IPath getFileURL(IResource resource, IPath existingURL) { - - //is this is a Faces Project with a Faces Servlet? - //we will not check to see if facet is installed. - // check to see if this resource is a JSF page (currently always true) and then, - //if servlet is present, we will change the url based on first mapping found - IModelProvider provider = ModelProviderManager.getModelProvider(resource.getProject()); - Object webAppObj = provider.getModelObject(); - if (webAppObj != null){ - //methods below returning the path are identical except for the APIs required - if (JSFUtils12.isWebApp25(webAppObj)){ - return getJavaEEFileURLPath(webAppObj, resource, existingURL); - } - else if (JSFUtils11.isWebApp24(webAppObj) || JSFUtils11.isWebApp23(webAppObj)) { - return getJ2EEFileURLPath(webAppObj, resource, existingURL); - } - } - return null; - } - - private IPath getJ2EEFileURLPath(Object webAppObj, IResource resource, - IPath existingURL) { - WebApp webApp = (WebApp)webAppObj; - if (webApp != null){ - Servlet servlet = JSFUtils11.findJSFServlet(webApp); - if (servlet == null)//if no faces servlet, do nothing - return null; - - //if not a JSF page, do nothing - if (!isJSFPage(resource)) - return null; - - String defaultSuffix = JSFUtils11.getDefaultSuffix(webApp); - //is the resource using default_suffix - boolean canUseExtensionMapping = resource.getFileExtension().equalsIgnoreCase(defaultSuffix); - - //if not using default extension and is not a known file extension, then we will abort - if (! canUseExtensionMapping && ! isValidKnownExtension(resource.getFileExtension())) - return null; - - Iterator mappings = servlet.getMappings().iterator(); - ServletMapping map = null; - String foundFileExtension = null; - String foundPrefixMapping = null; - while (mappings.hasNext()){ - map = (ServletMapping)mappings.next(); - - foundFileExtension = JSFUtils11.getFileExtensionFromMap(map); - if (foundFileExtension != null && canUseExtensionMapping) { - return existingURL.removeFileExtension().addFileExtension(foundFileExtension); - } - - if (foundPrefixMapping == null){ - foundPrefixMapping = JSFUtils11.getPrefixMapping(map); - } - - } - if (foundPrefixMapping != null) - return new Path(foundPrefixMapping).append(existingURL); - - if (! canUseExtensionMapping && foundFileExtension != null){ - //we could prompt user that this may not work... - //for now we will return the extension mapping - return existingURL.removeFileExtension().addFileExtension(foundFileExtension); - } - - //we could, at this point, add a url mapping to the faces servlet, or prompt user that it may be a good idea to add one... ;- - } - return null; - } - - private IPath getJavaEEFileURLPath(Object webAppObj, IResource resource, - IPath existingURL) { - org.eclipse.jst.javaee.web.WebApp webApp = (org.eclipse.jst.javaee.web.WebApp )webAppObj; - if (webApp != null){ - org.eclipse.jst.javaee.web.Servlet servlet = JSFUtils12.findJSFServlet(webApp); - if (servlet == null)//if no faces servlet, do nothing - return null; - - //if not a JSF page, do nothing - if (!isJSFPage(resource)) - return null; - - String defaultSuffix = JSFUtils12.getDefaultSuffix(webApp); - //is the resource using default_suffix - boolean canUseExtensionMapping = resource.getFileExtension().equalsIgnoreCase(defaultSuffix); - - //if not using default extension and is not a known file extension, then we will abort - if (! canUseExtensionMapping && ! isValidKnownExtension(resource.getFileExtension())) - return null; - - Iterator mappings = webApp.getServletMappings().iterator(); - org.eclipse.jst.javaee.web.ServletMapping map = null; - String foundFileExtension = null; - while (mappings.hasNext()){ - map = (org.eclipse.jst.javaee.web.ServletMapping)mappings.next(); - if (map.getServletName().equals(servlet.getServletName())){ - foundFileExtension = JSFUtils12.getFileExtensionFromMap(map); - if (foundFileExtension != null && canUseExtensionMapping) { - return existingURL.removeFileExtension().addFileExtension(foundFileExtension); - } - - String foundPrefixMapping = JSFUtils12.getPrefixMapping(map); - if (foundPrefixMapping != null){ - return new Path(foundPrefixMapping).append(existingURL); - } - } - } - - if (! canUseExtensionMapping && foundFileExtension != null){ - //we could prompt user that this may not work... - //for now we will return the extension mapping - return existingURL.removeFileExtension().addFileExtension(foundFileExtension); - } - - //we could, at this point, add a url mapping to the faces servlet, or prompt user that it may be a good idea to add one... ;- - } - - return null; - } - - private boolean isValidKnownExtension(String fileExtension) { - if (( fileExtension.equalsIgnoreCase("jsp") || //$NON-NLS-1$ - fileExtension.equalsIgnoreCase("jspx") || //$NON-NLS-1$ - fileExtension.equalsIgnoreCase("jsf") || //$NON-NLS-1$ - fileExtension.equalsIgnoreCase("xhtml"))) //$NON-NLS-1$ - return true; - - return false; - } - - - private boolean isJSFPage(IResource resource) { - // currently always return true. - // need to find quick way of determining whether this is a JSF JSP Page - return true; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/messages.properties b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/messages.properties deleted file mode 100644 index 3fde93ba3..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/messages.properties +++ /dev/null @@ -1,82 +0,0 @@ -############################################################################### -# Copyright (c) 2005 Oracle Corporation. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Gerry Kessler - initial API and implementation -# Ian Trimble - change key names for use with org.eclipse.osgi.util.NLS -############################################################################### -JSFLibraryRegistry_ErrorCreatingURL=Error creating URL for JSF Library Registry -JSFLibraryRegistry_NoLoadCreatingNew=Could not load JSF Library Registry; creating new registry -JSFLibraryRegistry_ErrorSaving=Error saving JSF Library Registry -JSFLibraryRegistry_DEFAULT_IMPL_LABEL=<Default> -JSFLibraryConfigModel_Null_Data_Source=Data Source is not provided. -JSFLibraryRegistry_ErrorLoadingFromExtPt=Error while loading JSF Libaries from extension points -JSFLibraryClasspathContainer_IMPL_LIBRARY=[JSF Library - implementation] - -JSFFacetInstallDataModelProvider_ValidateServletName=Specify a servlet name to use -JSFLibraryConfigPersistData_SAVED_IMPLLIB_NOT_FOUND=Saved JSF implementation library in {0} is unavailable in JSF Library Registry -JSFLibraryConfigPersistData_SAVED_COMPLIB_NOT_FOUND=Saved JSF component library in {0} is unavailable in JSF Library Registry -JSFLibraryClasspathContainer_NON_IMPL_LIBRARY=[JSF Library] -JSFLibrariesContainerInitializer_missing_library=[missing JSF Library] -JSFFacetInstallDataModelProvider_DupeJarValidation=Duplicated jar on classpath: {0} -JSFFacetInstallDataModelProvider_ValidateConfigFilePath=The configuration file path is not valid -JSFFacetInstallDataModelProvider_ValidateConfigFileEmpty=Specify a valid name and location for JSF configuration file -JSFFacetInstallDataModelProvider_ValidateConfigFileRelative1=Configuration file must be specified relative to the project''s {0} folder -JSFFacetInstallDataModelProvider_ValidateConfigFileRelative2=Configuration file must be located in the project''s {0} folder -JSFFacetInstallDataModelProvider_INITIAL_VALIDATION_IMPL_TYPE=Select an implementation library. If a server supplied library is chosen , the chosen server adapter must be capable of providing the JSF Implementation jars, or the application will not validate or compile. -JSFFacetInstallDataModelProvider_ValidateConfigFileXML=JSF configuration file must be an XML file -JSFFacetInstallDataModelProvider_ValidateConfigFileSlashes=Configuration file path must not contain "\\"s. Use "/" instead. -JSFLibCfgDialogSettingData_Sticky_Component_Lib_Not_Exist=A sticky component library selection no longer exists. - -JSFFacetInstallDelegate_InternalErr=Internal Error creating JSF Facet. Missing configuration. -JSFFacetInstallDelegate_ConfigErr=''{0}'' : unable to configure web module for JavaServer Faces -JSFFacetInstallDelegate_NonUpdateableWebXML=JSF Facet was not installed on ''{0}''. The web.xml file needs to be updateable. -JSFFacetUninstallDelegate_ConfigErr=''{0}'' : unable to de-configure web module for JavaServer Faces -JSFFacetUninstallDelegate_NonUpdateableWebXML=JSF Facet was not un-installed from ''{0}''. The web.xml file needs to be updateable. - -ArchiveFileImpl_CannotCopyFile=Cannot copy file -ArchiveFileImpl_CannotCloseFile=Cannot close file -ArchiveFileImpl_CannotLocatePluginRelativeFile=Cannot locate plugin-relative file "{0}" - -PluginProvidedJSFLibraryCreationHelper_ErrorCreating=Unable to create JSF Library: {0} -PluginProvidedJSFLibraryCreationHelper_ErrorMultipleDefinition={0} defined multiple times in {1} - -JSFUtils_ErrorCreatingConfigFile=Error creating config file -JSFUtils_ErrorClosingConfigFile=Error closing config file - -JSFAppConfigUtils_ErrorOpeningJarFile=Error opening JarFile "{0}" - -JARFileJSFAppConfigProvider_ErrorLoadingModel=Error loading model for file "{0}" -JSFUtils_MissingJAR= Missing JSF Library Jar: {0} in {1} - -J2EEModuleDependencyDelegate_UpdatingJ2EEModuleDependencies=Updating J2EE Module Dependencies -J2EEModuleDependencyDelegate_UpdatingJ2EEModuleDependenciesForProject=Updating J2EE Module Dependencies for project "{0}" - -JSFRegistryMigration05_to_10_title=User Intervention Required -JSFRegistryMigration05_to_10_message=IMPORTANT! Please read below: -JSFRegistryMigration05_to_10_customMessage=You have loaded a workspace created with a previous \ -version of JSF Tools.\nYour JSF Library Registry is out of date and needs to be migrated forward to continue.\n\ -If you choose to proceed, be aware of the following consequences:\n\ -\n\ -1) Projects in this workspace will need to be manually migrated by you to work in this version of JSF Tools.\n\ -2) Once migrated, this workspace will no longer work in older versions of JSF Tools.\n\ -\n\ -If this is not what you want, exit immediately and your workspace will still load in older versions. - -JSFRegistryMigrationCannot05_to_10_title=Error During Registry Upgrade -JSFRegistryMigrationCannot05_to_10_message=IMPORTANT! Please read below: -JSFRegistryMigrationCannot05_to_10_customMessage=You a loaded a workspace created with a previous \ -version of JSF Tools.\nYour JSF Library Registry is out of date and needs to be migrated forward to continue.\n\ -However, the existing registry has a problem and cannot be upgraded. -RegistryMigrationStartupHandler_Error_committing_migration=Error committing migration\! -RegistryMigrationStartupHandler_Error_Rolling_Back_Migration=Error rolling back migration\! -RegistryMigrationStartupHandler_Dialog_Confirm_Migration=Confirm -RegistryMigrationStartupHandler_Dialog_Abort_And_Exit_Migration=Abort and Exit -RegistryMigrationStartupHandler_Launch_Migration_Doc_On_Confirm=Launch Migration Doc on Confirm - -JSFFacet11_presetLabel = JavaServer Faces v1.1 Project -JSFFacet11_presetDescription = Configures a Dynamic Web application to use JSF v1.1 diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/IJSFFacetInstallDataModelProperties.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/IJSFFacetInstallDataModelProperties.java deleted file mode 100644 index 3f5004f6b..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/IJSFFacetInstallDataModelProperties.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.internal.project.facet; - -import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetInstallDataModelProperties; - -/** - * Defines properties used by the JSF facet install data model. - * - * @author Gerry Kessler - Oracle - */ -public interface IJSFFacetInstallDataModelProperties extends - IFacetInstallDataModelProperties { - - /** - * TODO: - */ - public static final String CONFIG_PATH = "IJSFFacetInstallDataModelProperties.CONFIG_PATH"; //$NON-NLS-1$ - - /** - * TODO: - */ - public static final String SERVLET_NAME = "IJSFFacetInstallDataModelProperties.SERVLET_NAME"; //$NON-NLS-1$ - - /** - * TODO: - */ - public static final String SERVLET_CLASSNAME = "IJSFFacetInstallDataModelProperties.SERVLET_CLASSNAME"; //$NON-NLS-1$ - - /** - * TODO: - */ - public static final String SERVLET_URL_PATTERNS = "IJSFFacetInstallDataModelProperties.SERVLET_URL_PATTERNS"; //$NON-NLS-1$ - - /** - * TODO: - */ - public static final String WEBCONTENT_DIR = "IJSFFacetInstallDataModelProperties.WEBCONTENT_DIR"; //$NON-NLS-1$ - - /** - * TODO: - */ - public static final String LIBRARY_PROVIDER_DELEGATE = "IJSFFacetInstallDataModelProperties.LIBRARY_PROVIDER_DELEGATE"; //$NON-NLS-1$ - - /** - * TODO: - */ - public static final String COMPONENT_LIBRARIES = "IJSFFacetInstallDataModelProperties.COMPONENT_LIBRARIES"; //$NON-NLS-1$ - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/JSFConfigurationPresetFactory11.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/JSFConfigurationPresetFactory11.java deleted file mode 100644 index de9ae3ef1..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/JSFConfigurationPresetFactory11.java +++ /dev/null @@ -1,84 +0,0 @@ -/****************************************************************************** - * Copyright (c) 2008 BEA Systems, Inc. and others - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Konstantin Komissarchik - ******************************************************************************/ - -package org.eclipse.jst.jsf.core.internal.project.facet; - -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jst.common.project.facet.JavaFacetUtils; -import org.eclipse.jst.j2ee.web.project.facet.WebFacetUtils; -import org.eclipse.jst.jsf.core.IJSFCoreConstants; -import org.eclipse.jst.jsf.core.internal.Messages; -import org.eclipse.wst.common.project.facet.core.IDynamicPreset; -import org.eclipse.wst.common.project.facet.core.IFacetedProjectBase; -import org.eclipse.wst.common.project.facet.core.IPresetFactory; -import org.eclipse.wst.common.project.facet.core.IProjectFacet; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; -import org.eclipse.wst.common.project.facet.core.PresetDefinition; -import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager; - -/** - * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a> - */ - -public final class JSFConfigurationPresetFactory11 - - implements IPresetFactory - -{ - public PresetDefinition createPreset( final String presetId, - final Map<String,Object> context ) - - throws CoreException - - { - final IFacetedProjectBase fproj - = (IFacetedProjectBase) context.get( IDynamicPreset.CONTEXT_KEY_FACETED_PROJECT ); - - final IProjectFacetVersion webFacetVersion - = fproj.getProjectFacetVersion( WebFacetUtils.WEB_FACET ); - - if( webFacetVersion != null && webFacetVersion.compareTo( WebFacetUtils.WEB_23 ) >= 0 ) - { - final Set<IProjectFacetVersion> facets = new HashSet<IProjectFacetVersion>(); - - final IProjectFacet jsfFacet - = ProjectFacetsManager.getProjectFacet( IJSFCoreConstants.JSF_CORE_FACET_ID ); - - final IProjectFacetVersion jsfFacetVersion11 - = jsfFacet.getVersion( IJSFCoreConstants.JSF_VERSION_1_1 ); - - facets.add( jsfFacetVersion11 ); - facets.add( webFacetVersion ); - - if( webFacetVersion == WebFacetUtils.WEB_23 ) - { - facets.add( JavaFacetUtils.JAVA_13 ); - } - else if( webFacetVersion == WebFacetUtils.WEB_24 ) - { - facets.add( JavaFacetUtils.JAVA_14 ); - } - else - { - facets.add( JavaFacetUtils.JAVA_50 ); - } - - return new PresetDefinition( Messages.JSFFacet11_presetLabel, Messages.JSFFacet11_presetDescription, facets ); - } - - return null; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/JSFFacetDefaultVersionProvider.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/JSFFacetDefaultVersionProvider.java deleted file mode 100644 index 549f05027..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/JSFFacetDefaultVersionProvider.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.internal.project.facet; - -import org.eclipse.jst.jsf.core.IJSFCoreConstants; -import org.eclipse.wst.common.project.facet.core.IDefaultVersionProvider; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; -import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager; - -/** - * Provides the default JSF project facet version. - * Currently always returns "1.1" facet version. Eventually should be computed from the project's facet context. - */ -public final class JSFFacetDefaultVersionProvider implements IDefaultVersionProvider { - - /* (non-Javadoc) - * @see org.eclipse.wst.common.project.facet.core.IDefaultVersionProvider#getDefaultVersion() - */ - public IProjectFacetVersion getDefaultVersion() { - return ProjectFacetsManager.getProjectFacet(IJSFCoreConstants.JSF_CORE_FACET_ID).getVersion(IJSFCoreConstants.FACET_VERSION_1_1); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/JSFFacetException.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/JSFFacetException.java deleted file mode 100644 index d2878b347..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/JSFFacetException.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.internal.project.facet; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; - -/** - * Exception for use during JSF Facet installation/un-installation - * - */ -public class JSFFacetException extends CoreException { - - private static final long serialVersionUID = 1L; - - /** - * Constructor - * @param msg - */ - public JSFFacetException(String msg) { - super(new Status(IStatus.ERROR, JSFCorePlugin.PLUGIN_ID, msg)); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/JSFFacetInstallDataModelProvider.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/JSFFacetInstallDataModelProvider.java deleted file mode 100644 index cc5b580bc..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/JSFFacetInstallDataModelProvider.java +++ /dev/null @@ -1,346 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.internal.project.facet; - -import java.util.HashSet; -import java.util.Iterator; -import java.util.Set; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Status; -import org.eclipse.jdt.core.IClasspathEntry; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jst.common.project.facet.core.libprov.IPropertyChangeListener; -import org.eclipse.jst.common.project.facet.core.libprov.LibraryInstallDelegate; -import org.eclipse.jst.j2ee.project.facet.IJ2EEModuleFacetInstallDataModelProperties; -import org.eclipse.jst.jsf.core.IJSFCoreConstants; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.core.internal.Messages; -import org.eclipse.jst.jsf.core.internal.jsflibraryconfig.JSFLibraryInternalReference; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.ArchiveFile; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary; -import org.eclipse.osgi.util.NLS; -import org.eclipse.wst.common.componentcore.ComponentCore; -import org.eclipse.wst.common.componentcore.datamodel.FacetInstallDataModelProvider; -import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetDataModelProperties; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; -import org.eclipse.wst.common.project.facet.core.IFacetedProjectWorkingCopy; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; -import org.eclipse.wst.common.project.facet.core.IFacetedProject.Action; - -/** - * Provides a data model used by the JSF facet install. - * - * @author Gerry Kessler - Oracle - */ -public class JSFFacetInstallDataModelProvider extends - FacetInstallDataModelProvider implements - IJSFFacetInstallDataModelProperties { - - private LibraryInstallDelegate libraryInstallDelegate = null; - - private void initLibraryInstallDelegate() - { - final IFacetedProjectWorkingCopy fpjwc = (IFacetedProjectWorkingCopy) getProperty( FACETED_PROJECT_WORKING_COPY ); - final IProjectFacetVersion fv = (IProjectFacetVersion) getProperty( FACET_VERSION ); - - if( this.libraryInstallDelegate == null && fpjwc != null && fv != null ) - { - this.libraryInstallDelegate = new LibraryInstallDelegate( fpjwc, fv ); - - this.libraryInstallDelegate.addListener - ( - new IPropertyChangeListener() - { - public void propertyChanged( final String property, - final Object oldValue, - final Object newValue ) - { - final IDataModel dm = getDataModel(); - - if( dm != null ) - { - dm.notifyPropertyChange( LIBRARY_PROVIDER_DELEGATE, IDataModel.VALUE_CHG ); - } - } - } - ); - } - } - - private String errorMessage; - - public Set getPropertyNames() { - Set names = super.getPropertyNames(); - names.add(CONFIG_PATH); - names.add(SERVLET_NAME); - names.add(SERVLET_CLASSNAME); - names.add(SERVLET_URL_PATTERNS); - names.add(WEBCONTENT_DIR); - names.add(LIBRARY_PROVIDER_DELEGATE); - names.add(COMPONENT_LIBRARIES); - - return names; - } - - public Object getDefaultProperty(String propertyName) { - if (propertyName.equals(CONFIG_PATH)) { - return JSFUtils.JSF_DEFAULT_CONFIG_PATH; - } else if (propertyName.equals(SERVLET_NAME)) { - return JSFUtils.JSF_DEFAULT_SERVLET_NAME; - } else if (propertyName.equals(SERVLET_CLASSNAME)) { - return JSFUtils.JSF_SERVLET_CLASS; - } else if (propertyName.equals(SERVLET_URL_PATTERNS)) { - return new String[] {JSFUtils.JSF_DEFAULT_URL_MAPPING }; - } else if (propertyName.equals(FACET_ID)) { - return IJSFCoreConstants.JSF_CORE_FACET_ID; - } else if (propertyName.equals(WEBCONTENT_DIR)){ - return "WebContent"; //not sure I need this //$NON-NLS-1$ - } else if (propertyName.equals(LIBRARY_PROVIDER_DELEGATE)) { - return this.libraryInstallDelegate; - } else if (propertyName.equals(COMPONENT_LIBRARIES)) { - return new JSFLibraryInternalReference[0]; - } - return super.getDefaultProperty(propertyName); - } - - @Override - public boolean propertySet( final String propertyName, - final Object propertyValue ) - { - if( propertyName.equals( FACETED_PROJECT_WORKING_COPY ) || propertyName.equals( FACET_VERSION ) ) - { - initLibraryInstallDelegate(); - } - - return super.propertySet( propertyName, propertyValue ); - } - - public IStatus validate(String name) { - errorMessage = null; - if (name.equals(CONFIG_PATH)) { - return validateConfigLocation(getStringProperty(CONFIG_PATH)); - } else if (name.equals(SERVLET_NAME)) { - return validateServletName(getStringProperty(SERVLET_NAME)); - } - else if (name.equals(LIBRARY_PROVIDER_DELEGATE)) { - return ((LibraryInstallDelegate) getProperty(LIBRARY_PROVIDER_DELEGATE)).validate(); - } - else if (name.equals(COMPONENT_LIBRARIES)) { - return validateClasspath(); - } - return super.validate(name); - } - - private IStatus createErrorStatus(String msg) { - return new Status(IStatus.ERROR, JSFCorePlugin.PLUGIN_ID, msg); - } - - private IStatus validateServletName(String servletName) { - if (servletName == null || servletName.trim().length() == 0) { - errorMessage = Messages.JSFFacetInstallDataModelProvider_ValidateServletName; - return createErrorStatus(errorMessage); - } - - return OK_STATUS; - } - - private IStatus validateConfigLocation(String text) { - if (text == null || text.trim().equals("")) { //$NON-NLS-1$ - errorMessage = Messages.JSFFacetInstallDataModelProvider_ValidateConfigFileEmpty; - return createErrorStatus(errorMessage); - } - text = text.trim(); - - if (getProjectPath() == null) //this circumstance occurs on page init - return OK_STATUS; - - IPath fullPath = getProjectPath().append(text); - IPath passedPath = new Path(text); - if (!fullPath.isValidPath(text)){ - errorMessage = Messages.JSFFacetInstallDataModelProvider_ValidateConfigFilePath; - return createErrorStatus(errorMessage); - } - - //FIXME: check for valid file path also [passedPath.toFile().isFile()] - if (text.toLowerCase().lastIndexOf(".xml") != text.length() - 4) { //$NON-NLS-1$ - errorMessage = Messages.JSFFacetInstallDataModelProvider_ValidateConfigFileXML; - return createErrorStatus(errorMessage); - } - - if (text.lastIndexOf("\\") >= 0){ //$NON-NLS-1$ - errorMessage = Messages.JSFFacetInstallDataModelProvider_ValidateConfigFileSlashes; - return createErrorStatus(errorMessage); - } - - if (passedPath.getDevice() != null) { - errorMessage = NLS.bind( - Messages.JSFFacetInstallDataModelProvider_ValidateConfigFileRelative1, - getWebContentFolderName()); - return createErrorStatus(errorMessage); - } - IPath webContentFolder = getWebContentFolder(); - IPath setPath = webContentFolder.append(passedPath); - if (!getWebContentFolder().isPrefixOf(setPath)) { - errorMessage = NLS.bind( - Messages.JSFFacetInstallDataModelProvider_ValidateConfigFileRelative2, - getWebContentFolderName()); - return createErrorStatus(errorMessage); - } - - return OK_STATUS; - } - - private IStatus validateClasspath(){ - Set jars = new HashSet(); - if (doesProjectExist()){ - //validate actual classpath by loading jars from cp - try { - IClasspathEntry[] entries = getJavaProject().getResolvedClasspath(true); - for (int i=0;i<entries.length;i++){ - IClasspathEntry entry = entries[i]; - if (entry.getEntryKind() == IClasspathEntry.CPE_LIBRARY){ - jars.add(entry.getPath().makeAbsolute().toString()); - } - } - } catch (JavaModelException e) { - // FIXME: what should we do in this case? - JSFCorePlugin.log(e, "Error searching class path"); //$NON-NLS-1$ - } - } - //else as we do not have a javaProject yet, all we can do is validate that there is no duplicate jars (absolute path) - - IStatus status = null; - - JSFLibraryInternalReference[] compLibs = (JSFLibraryInternalReference[]) getProperty(IJSFFacetInstallDataModelProperties.COMPONENT_LIBRARIES); - if (compLibs != null){ - for (int i=0;i<compLibs.length;i++){ - JSFLibrary lib = compLibs[i].getLibrary(); - status = checkForDupeArchiveFiles(jars, lib); - if (!OK_STATUS.equals(status)){ - return status; - } - } - } - return OK_STATUS; - } - - private IJavaProject getJavaProject() { - IProject proj = getProject(); - if (proj != null) - return JavaCore.create(proj); - return null; - } - - private IProject getProject(){ - String projName = (String)getProperty(FACET_PROJECT_NAME); - if (projName == null || "".equals(projName)) - return null; - - IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projName); - return project; - } - - private boolean doesProjectExist() { - IProject project = getProject(); - return (project != null) && project.exists(); - } - - private IStatus checkForDupeArchiveFiles(Set jars, - JSFLibrary aJSFLib) { - if (aJSFLib == null) - return OK_STATUS; - - for (Iterator it=aJSFLib.getArchiveFiles().iterator();it.hasNext();){ - ArchiveFile jar = (ArchiveFile)it.next(); - if (jars.contains(jar.getResolvedSourceLocation())){ - return createErrorStatus(NLS.bind(Messages.JSFFacetInstallDataModelProvider_DupeJarValidation,jar.getResolvedSourceLocation())); - } - jars.add(jar.getResolvedSourceLocation()); - } - return OK_STATUS; - } - - private IPath getProjectPath() { - IProject project = getProject(); - if (project == null) - return null; - else if (project.exists()) - return project.getLocation(); - - String projName = (String)getProperty(FACET_PROJECT_NAME); - IFacetedProjectWorkingCopy projModel = (IFacetedProjectWorkingCopy)getProperty(FACETED_PROJECT_WORKING_COPY ); - - if (projModel.getProjectLocation() != null) - return projModel.getProjectLocation().append(projName); - - return ResourcesPlugin.getWorkspace().getRoot().getRawLocation().append(projName); - - } - - private IPath getWebContentFolder() { - //One can get here 2 ways: - //if web app exists and user is adding a facet, or - // if creating a new web app. - - IPath webContentPath = null; - String projName = model.getStringProperty(IFacetDataModelProperties.FACET_PROJECT_NAME); - IProject proj = ResourcesPlugin.getWorkspace().getRoot() - .getProject(projName); - - String webFolder = getWebContentFolderName(); - if (proj.exists()) { - - webContentPath = ComponentCore.createComponent(proj).getRootFolder() - .getUnderlyingFolder().getRawLocation(); - } - else { - - if (webFolder == null){ - //we got problems... should not happen - return proj.getFullPath(); - } - webContentPath = proj.getFullPath().append(webFolder); - - } - return webContentPath; - } - - private String getWebContentFolderName() { - String projName = (String)getProperty(FACET_PROJECT_NAME); - IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projName); - if (project.exists()){ - IPath webContentPath = ComponentCore.createComponent(project).getRootFolder() - .getUnderlyingFolder().getProjectRelativePath(); - - return webContentPath.toString(); - } - - IFacetedProjectWorkingCopy projWC = (IFacetedProjectWorkingCopy)getProperty(FACETED_PROJECT_WORKING_COPY); - Set<Action> pfas = projWC.getProjectFacetActions(); - for (Action action : pfas){ - if (action.getProjectFacetVersion().getProjectFacet().getId().equals("jst.web")){ - IDataModel webFacet = (IDataModel) action.getConfig(); - return webFacet.getStringProperty(IJ2EEModuleFacetInstallDataModelProperties.CONFIG_FOLDER ); - } - } - - //should not get here. - return null; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/JSFFacetInstallDelegate.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/JSFFacetInstallDelegate.java deleted file mode 100644 index 39594e80b..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/JSFFacetInstallDelegate.java +++ /dev/null @@ -1,339 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.core.internal.project.facet; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IWorkspaceRunnable; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.jst.common.project.facet.core.libprov.LibraryInstallDelegate; -import org.eclipse.jst.j2ee.internal.J2EEVersionConstants; -import org.eclipse.jst.j2ee.model.IModelProvider; -import org.eclipse.jst.j2ee.model.ModelProviderManager; -import org.eclipse.jst.javaee.web.Servlet; -import org.eclipse.jst.javaee.web.WebApp; -import org.eclipse.jst.jsf.core.IJSFCoreConstants; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.core.internal.Messages; -import org.eclipse.osgi.util.NLS; -import org.eclipse.wst.common.componentcore.ComponentCore; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; -import org.eclipse.wst.common.project.facet.core.IDelegate; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; - -/** - * JSF Facet Install Delegate for WTP faceted web projects. Deals with 2.3, 2.4 and 2.5 web app models. - * - * Uses <code>com.eclispe.jst.jsf.core.internal.project.facet.JSFFacetInstallDataModelProvider<code> for model - * <li> creates JSF configuration file if not already present. It will not attempt to upgrade or downgrade the version if there is a mismatch. - * <li> updates web.xml for: servlet, servlet-mapping and context-param - * <li> adds implementation jars to WEB-INF/lib if user requests - * - * @see org.eclipse.jst.jsf.core.internal.project.facet.JSFFacetInstallDataModelProvider - * @since 1.0 - */ -public final class JSFFacetInstallDelegate implements IDelegate { - - /* (non-Javadoc) - * @see org.eclipse.wst.common.project.facet.core.IDelegate#execute(org.eclipse.core.resources.IProject, org.eclipse.wst.common.project.facet.core.IProjectFacetVersion, java.lang.Object, org.eclipse.core.runtime.IProgressMonitor) - */ - public void execute(final IProject project, final IProjectFacetVersion fv, - final Object cfg, final IProgressMonitor monitor) - throws CoreException - - { - - if (monitor != null) { - monitor.beginTask("", 1); //$NON-NLS-1$ - } - - try { - IDataModel config = null; - - if (cfg != null) { - config = (IDataModel) cfg; - } else { - throw new JSFFacetException( - Messages.JSFFacetInstallDelegate_InternalErr); - } - - //Before we do any configuration, verify that web.xml is available for update - IModelProvider provider = JSFUtils.getModelProvider(project); - if (provider == null ) { - throw new JSFFacetException( NLS.bind(Messages.JSFFacetInstallDelegate_ConfigErr, project.getName())); - } else if (!(provider.validateEdit(null, null).isOK())){ - if (!(provider.validateEdit(null, null).isOK())) {//checks for web.xml file being read-only and allows user to set writeable - throw new JSFFacetException(NLS.bind(Messages.JSFFacetInstallDelegate_NonUpdateableWebXML, project.getName())); //$NON-NLS-2$ - } - } - -// // Create JSF Libs as classpath containers and set WTP dependencies -// // as required -// createClasspathEntries(project, fv, config, monitor); - - //Configure libraries - ( (LibraryInstallDelegate) config.getProperty( IJSFFacetInstallDataModelProperties.LIBRARY_PROVIDER_DELEGATE ) ).execute( new NullProgressMonitor() ); - - // Create config file - createConfigFile(project, fv, config, monitor); - - // Update web model - createServletAndModifyWebXML(project, config, monitor); - - if (monitor != null) { - monitor.worked(1); - } - - } finally { - if (monitor != null) { - monitor.done(); - } - } - } - -// /** -// * Adds the JSF Library references specified in the wizard to the project as -// * classpath containers. Marks the containers as J2EE module dependencies as -// * required -// * -// * @param project -// * @param config -// * @param monitor -// */ -// private void createClasspathEntries(final IProject project, final IProjectFacetVersion fv, final IDataModel config, final IProgressMonitor monitor) throws CoreException { -// IJavaProject javaProject = JavaCore.create(project); -// List cpEntries = new ArrayList(); -// try { -// for (int i=0;i<javaProject.getRawClasspath().length;i++){ -// cpEntries.add(javaProject.getRawClasspath()[i]); -// } -// } catch (JavaModelException e) { -// JSFCorePlugin.log(e, "Unable to read classpath"); //$NON-NLS-1$ -// } -// -// IPath path, cp = null; -// IClasspathEntry entry = null; -// JSFLibraryInternalReference libref = null; -// -// JSFLibraryInternalReference[] compLibs = (JSFLibraryInternalReference[])config.getProperty(IJSFFacetInstallDataModelProperties.COMPONENT_LIBRARIES); -// for (int i=0;i<compLibs.length;i++){ -// libref = compLibs[i]; -// cp = new Path(JSFLibraryConfigurationHelper.JSF_LIBRARY_CP_CONTAINER_ID); -// path = cp.append(new Path(libref.getID())); -// entry = getNewCPEntry(path, libref); -// if (entry != null) -// cpEntries.add(entry); -// } -// -// JSFLibraryRegistryUtil.setRawClasspath(javaProject, cpEntries, monitor); -// -// ( (LibraryInstallDelegate) config.getProperty( IJSFFacetInstallDataModelProperties.LIBRARY_PROVIDER_DELEGATE ) ).execute( new NullProgressMonitor() ); -// } - -// /** -// * @param path -// * @param lib -// * @return creates new IClasspathEntry with WTP dependency attribute set, if required -// */ -// private IClasspathEntry getNewCPEntry(final IPath path, final JSFLibraryInternalReference lib) { -// -// IClasspathEntry entry = null; -// if (lib.isCheckedToBeDeployed()){ -// IClasspathAttribute depAttrib = JavaCore.newClasspathAttribute(IClasspathDependencyConstants.CLASSPATH_COMPONENT_DEPENDENCY, -// ClasspathDependencyUtil.getDefaultRuntimePath(true).toString()); -// entry = JavaCore.newContainerEntry(path,null, new IClasspathAttribute[]{depAttrib}, true); -// } -// else { -// entry = JavaCore.newContainerEntry(path); -// } -// -// return entry; -// } - - /** - * @param config - * @return list of URL patterns from the datamodel - */ - private List getServletMappings(final IDataModel config) { - List mappings = new ArrayList(); - String[] patterns = (String[])config.getProperty(IJSFFacetInstallDataModelProperties.SERVLET_URL_PATTERNS); - for (int i = 0; i < patterns.length; i++) { - String pattern = patterns[i]; - mappings.add(pattern); - } - - return mappings; - } - - /** - * @param project - * @param jsfConfigPath - * @return absolute IPath to jsfConfig - */ - private IPath resolveConfigPath(final IProject project, final String jsfConfigPath) { - return ComponentCore.createComponent(project).getRootFolder() - .getUnderlyingFolder().getRawLocation().append( - new Path(jsfConfigPath)); - - } - - /** - * Create the faces configuration file. If the file already exist, then the file is left alone. - * @param project - * @param fv - * @param config - * @param monitor - */ - private void createConfigFile(final IProject project, - final IProjectFacetVersion fv, final IDataModel config, - final IProgressMonitor monitor) { - - - final IPath configPath = resolveConfigPath(project, config.getStringProperty(IJSFFacetInstallDataModelProperties.CONFIG_PATH)); - try { - // do not overwrite if the file exists - if (!configPath.toFile().exists()) { - final IWorkspaceRunnable op = new IWorkspaceRunnable(){ - public void run(IProgressMonitor monitor_inner) throws CoreException{ - if (shouldUseJ2EEConfig(fv)){ - JSFUtils11.createConfigFile(fv.getVersionString(), - configPath); - } else { - JSFUtils12.createConfigFile(fv.getVersionString(), - configPath); - } - project.refreshLocal(IResource.DEPTH_INFINITE, monitor_inner); - } - - private boolean shouldUseJ2EEConfig(final IProjectFacetVersion facetVersion) { - if (IJSFCoreConstants.FACET_VERSION_1_1.equals(facetVersion.getVersionString())) - { - return true; - } - return false; - } - }; - op.run(monitor); - } - } catch (CoreException e) { - JSFCorePlugin.log(e, "Exception occured while creating faces-config.xml");//$NON-NLS-1$ - } - - } - - /** - * Create servlet and URL mappings and update the webapp - * @param project - * @param config - * @param monitor - */ - private void createServletAndModifyWebXML(final IProject project, - final IDataModel config, final IProgressMonitor monitor) { - - IModelProvider provider = JSFUtils.getModelProvider(project); - IPath webXMLPath = new Path("WEB-INF").append("web.xml"); //$NON-NLS-1$ //$NON-NLS-2$ - if (JSFUtils12.isWebApp25(provider.getModelObject())) { - provider.modify(new UpdateWebXMLForJavaEE(project, config), doesDDFileExist(project, webXMLPath) ? webXMLPath : IModelProvider.FORCESAVE); - } - else {//must be 2.3 or 2.4 - provider.modify(new UpdateWebXMLForJ2EE(project, config), webXMLPath); - } - - } - - private boolean doesDDFileExist(IProject project, IPath webXMLPath) { - return project.getProjectRelativePath().append(webXMLPath).toFile().exists(); - } - - private class UpdateWebXMLForJavaEE implements Runnable { - private IProject project; - private IDataModel config; - - UpdateWebXMLForJavaEE(final IProject project, final IDataModel config){ - this.project = project; - this.config = config; - } - - public void run() { - WebApp webApp = (WebApp) ModelProviderManager.getModelProvider(project).getModelObject(); - // create or update servlet ref - Servlet servlet = JSFUtils12.findJSFServlet(webApp);// check to see - // if already -// No longer removing any old mappings on install - see 194919 // present -// if (servlet != null) { -// // remove old mappings -// JSFUtils12.removeURLMappings(webApp, servlet); -// } - - servlet = JSFUtils12 - .createOrUpdateServletRef(webApp, config, servlet); - - // init mappings - List listOfMappings = getServletMappings(config); - JSFUtils12.setUpURLMappings(webApp, listOfMappings, servlet); - - // setup context params - JSFUtils12.setupConfigFileContextParamForV2_5(webApp, config); - } - } - - private class UpdateWebXMLForJ2EE implements Runnable { - private IProject project; - private IDataModel config; - - UpdateWebXMLForJ2EE(IProject project, final IDataModel config){ - this.project = project ; - this.config = config; - } - - public void run() { - org.eclipse.jst.j2ee.webapplication.WebApp webApp = (org.eclipse.jst.j2ee.webapplication.WebApp)ModelProviderManager.getModelProvider(project).getModelObject(); - // create or update servlet ref - org.eclipse.jst.j2ee.webapplication.Servlet servlet = JSFUtils11.findJSFServlet(webApp);// check to see - // if already - // present - -// No longer removing any old mappings on install - see 194919 -// if (servlet != null) { -// // remove old mappings -// JSFUtils11.removeURLMappings(webApp, servlet); -// } - - servlet = JSFUtils11 - .createOrUpdateServletRef(webApp, config, servlet); - - // init mappings - List listOfMappings = getServletMappings(config); - JSFUtils11.setUpURLMappings(webApp, listOfMappings, servlet); - - // setup context params - setupContextParams(webApp, config); - } - - private void setupContextParams(final org.eclipse.jst.j2ee.webapplication.WebApp webApp, final IDataModel config) { - if (webApp.getVersionID() == J2EEVersionConstants.WEB_2_3_ID)//shouldn't have to do it this way, but that's the way it goes 119442 - JSFUtils11.setupConfigFileContextParamForV2_3(webApp, config); - else - JSFUtils11.setupConfigFileContextParamForV2_4(webApp, config); - } - } - - - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/JSFFacetPrimaryRuntimeChangedListener.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/JSFFacetPrimaryRuntimeChangedListener.java deleted file mode 100644 index e85555178..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/JSFFacetPrimaryRuntimeChangedListener.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.internal.project.facet; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jst.common.project.facet.core.ClasspathHelper; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.core.jsfappconfig.JSFAppConfigUtils; -import org.eclipse.jst.jsf.core.jsflibraryconfiguration.JSFLibraryConfigurationHelper; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; -import org.eclipse.wst.common.project.facet.core.events.IFacetedProjectEvent; -import org.eclipse.wst.common.project.facet.core.events.IFacetedProjectListener; -import org.eclipse.wst.common.project.facet.core.events.IPrimaryRuntimeChangedEvent; - -/** - * Handles primary runtime changed events when the JSF Facet is installed - * - * @since JSF 1.0.1 - */ -public class JSFFacetPrimaryRuntimeChangedListener implements IFacetedProjectListener { - - /* (non-Javadoc) - * @see org.eclipse.wst.common.project.facet.core.events.IFacetedProjectListener#handleEvent(org.eclipse.wst.common.project.facet.core.events.IFacetedProjectEvent) - */ - public void handleEvent(IFacetedProjectEvent event) { - if (event instanceof IPrimaryRuntimeChangedEvent && - getJSFFacetedVersion(event.getProject().getProject()) != null && //must be a JSF faceted project - JSFLibraryConfigurationHelper.isConfiguredForSystemSuppliedImplementation(event.getProject().getProject())){ - - try { - IProject project = event.getProject().getProject(); - IProjectFacetVersion fv = getJSFFacetedVersion(project); - ClasspathHelper.removeClasspathEntries(project, fv); - ClasspathHelper.addClasspathEntries(project, fv); - } catch (CoreException e) { - JSFCorePlugin.log(IStatus.ERROR, "Unable to replace server supplied implementation when runtime changed.", e);//$NON-NLS-1$ - } - } - - } - - /** - * @param project - * @return IProjectFacetVersion and null if not JSF faceted - */ - private IProjectFacetVersion getJSFFacetedVersion(IProject project) { - return JSFAppConfigUtils.getProjectFacet(project); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/JSFFacetUninstallConfig.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/JSFFacetUninstallConfig.java deleted file mode 100644 index f0d06d2df..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/JSFFacetUninstallConfig.java +++ /dev/null @@ -1,57 +0,0 @@ -package org.eclipse.jst.jsf.core.internal.project.facet; - -import org.eclipse.jst.common.project.facet.core.libprov.LibraryUninstallDelegate; -import org.eclipse.wst.common.project.facet.core.ActionConfig; -import org.eclipse.wst.common.project.facet.core.IActionConfigFactory; -import org.eclipse.wst.common.project.facet.core.IFacetedProjectWorkingCopy; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; - -public class JSFFacetUninstallConfig - - extends ActionConfig - -{ - private LibraryUninstallDelegate librariesUninstallDelegate = null; - - public LibraryUninstallDelegate getLibrariesUninstallDelegate() - { - return this.librariesUninstallDelegate; - } - - @Override - public void setFacetedProjectWorkingCopy( final IFacetedProjectWorkingCopy fpjwc ) - { - super.setFacetedProjectWorkingCopy( fpjwc ); - init(); - } - - @Override - public void setProjectFacetVersion( final IProjectFacetVersion fv ) - { - super.setProjectFacetVersion( fv ); - init(); - } - - private void init() - { - final IFacetedProjectWorkingCopy fpjwc = getFacetedProjectWorkingCopy(); - final IProjectFacetVersion fv = getProjectFacetVersion(); - - if( this.librariesUninstallDelegate == null && fpjwc != null && fv != null ) - { - this.librariesUninstallDelegate = new LibraryUninstallDelegate( fpjwc, fv ); - } - } - - public static final class Factory - - implements IActionConfigFactory - - { - public Object create() - { - return new JSFFacetUninstallConfig(); - } - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/JSFFacetUninstallDelegate.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/JSFFacetUninstallDelegate.java deleted file mode 100644 index 2e0db7d24..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/JSFFacetUninstallDelegate.java +++ /dev/null @@ -1,183 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.internal.project.facet; - -import java.util.Iterator; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.jst.j2ee.model.IModelProvider; -import org.eclipse.jst.j2ee.model.ModelProviderManager; -import org.eclipse.jst.javaee.core.ParamValue; -import org.eclipse.jst.javaee.web.Servlet; -import org.eclipse.jst.javaee.web.WebApp; -import org.eclipse.jst.jsf.core.internal.Messages; -import org.eclipse.osgi.util.NLS; -import org.eclipse.wst.common.project.facet.core.IDelegate; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; - -/** - * JSF Facet Un-install Delegate for WTP faceted projects. - * - * <li> removes JSF servlet, servlet-mappings and context-params - * <li> leaves JSF configuration files on disk - * <li> removes JSF classpath containers - * - */ -public final class JSFFacetUninstallDelegate implements IDelegate { - - /* (non-Javadoc) - * @see org.eclipse.wst.common.project.facet.core.IDelegate#execute(org.eclipse.core.resources.IProject, org.eclipse.wst.common.project.facet.core.IProjectFacetVersion, java.lang.Object, org.eclipse.core.runtime.IProgressMonitor) - */ - public void execute(final IProject project, final IProjectFacetVersion fv, - final Object config, final IProgressMonitor monitor) throws CoreException { - { - - if (monitor != null) { - monitor.beginTask("", 1); //$NON-NLS-1$ - } - - try { - //Before we do any de-configuration, verify that web.xml is available for update - IModelProvider provider = JSFUtils.getModelProvider(project); - if (provider == null ) { - throw new JSFFacetException(NLS.bind(Messages.JSFFacetUninstallDelegate_ConfigErr, project.getName())); - } else if (!(provider.validateEdit(null, null).isOK())){ - throw new JSFFacetException(NLS.bind(Messages.JSFFacetUninstallDelegate_NonUpdateableWebXML, project.getName())); - } - - // Remove JSF Libraries - ( (JSFFacetUninstallConfig) config ).getLibrariesUninstallDelegate().execute( null ); - - // remove servlet stuff from web.xml - uninstallJSFReferencesFromWebApp(project, monitor); - - if (monitor != null) { - monitor.worked(1); - } - - } finally { - if (monitor != null) { - monitor.done(); - } - } - } - } - - private void uninstallJSFReferencesFromWebApp(final IProject project, - final IProgressMonitor monitor) { - - IModelProvider provider = JSFUtils.getModelProvider(project); - Object webAppObj = provider.getModelObject(); - if (webAppObj != null) { - IPath ddPath = new Path("WEB-INF").append("web.xml"); //$NON-NLS-1$ //$NON-NLS-2$ - if (isJavaEEWebApp(webAppObj)){ - WebApp webApp = (WebApp)webAppObj; - Servlet servlet = JSFUtils12.findJSFServlet(webApp); - if (servlet == null) - return; - - provider.modify(new RemoveJSFFromJavaEEWebAppOperation(project), ddPath); - } else {//2.3 or 2.4 web app - org.eclipse.jst.j2ee.webapplication.WebApp webApp = (org.eclipse.jst.j2ee.webapplication.WebApp)webAppObj; - org.eclipse.jst.j2ee.webapplication.Servlet servlet = JSFUtils11.findJSFServlet(webApp); - if (servlet == null) - return; - - provider.modify(new RemoveJSFFromJ2EEWebAppOperation(project), ddPath); - } - } - } - - private boolean isJavaEEWebApp(final Object webAppObj) { - if (webAppObj instanceof WebApp) - return true; - - return false; - - } - - static class RemoveJSFFromJavaEEWebAppOperation implements Runnable { - private IProject _project; - - RemoveJSFFromJavaEEWebAppOperation(final IProject project){ - this._project = project; - } - - public void run() { - WebApp webApp = (WebApp) ModelProviderManager.getModelProvider(_project).getModelObject(); - Servlet servlet = JSFUtils12.findJSFServlet(webApp); - - // remove faces url mappings - JSFUtils12.removeURLMappings(webApp, servlet); - // remove context params - removeJSFContextParams(webApp, servlet); - // remove servlet - removeJSFServlet(webApp, servlet); - - } - private void removeJSFContextParams(final WebApp webApp, final Servlet servlet) { - Iterator it = webApp.getContextParams().iterator(); - while (it.hasNext()) { - ParamValue cp = (ParamValue) it.next(); - if (cp.getParamName().equals(JSFUtils.JSF_CONFIG_CONTEXT_PARAM)) { - webApp.getContextParams().remove(cp); - break; - } - } - } - - private void removeJSFServlet(final WebApp webApp, final Servlet servlet) { - webApp.getServlets().remove(servlet); - } - - } - - static class RemoveJSFFromJ2EEWebAppOperation implements Runnable { - private IProject _project; - - RemoveJSFFromJ2EEWebAppOperation(final IProject project){ - this._project = project; - } - - public void run() { - org.eclipse.jst.j2ee.webapplication.WebApp webApp = (org.eclipse.jst.j2ee.webapplication.WebApp) ModelProviderManager.getModelProvider(_project).getModelObject(); - org.eclipse.jst.j2ee.webapplication.Servlet servlet = JSFUtils11.findJSFServlet(webApp); - - // remove faces url mappings - JSFUtils11.removeURLMappings(webApp, servlet); - // remove context params - removeJSFContextParams(webApp, servlet); - // remove servlet - removeJSFServlet(webApp, servlet); - - } - private void removeJSFContextParams(final org.eclipse.jst.j2ee.webapplication.WebApp webApp, final org.eclipse.jst.j2ee.webapplication.Servlet servlet) { - Iterator it = webApp.getContextParams().iterator(); - while (it.hasNext()) { - org.eclipse.jst.j2ee.common.ParamValue cp = (org.eclipse.jst.j2ee.common.ParamValue) it.next(); - if (cp.getName().equals(JSFUtils.JSF_CONFIG_CONTEXT_PARAM)) { - webApp.getContextParams().remove(cp); - break; - } - } - } - - private void removeJSFServlet(final org.eclipse.jst.j2ee.webapplication.WebApp webApp, final org.eclipse.jst.j2ee.webapplication.Servlet servlet) { - webApp.getServlets().remove(servlet); - } - - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/JSFUtils.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/JSFUtils.java deleted file mode 100644 index 88e8d610a..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/JSFUtils.java +++ /dev/null @@ -1,327 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.core.internal.project.facet; - -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Path; -import org.eclipse.emf.common.util.EList; -import org.eclipse.jst.j2ee.model.IModelProvider; -import org.eclipse.jst.j2ee.model.ModelProviderManager; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.core.internal.Messages; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.ArchiveFile; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary; -import org.eclipse.osgi.util.NLS; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; - - -/** - * - */ -public abstract class JSFUtils { - /** - * The default name for the Faces servlet - */ - public static final String JSF_DEFAULT_SERVLET_NAME = "Faces Servlet"; //$NON-NLS-1$ - /** - * The default name of the Faces servlet class - */ - public static final String JSF_SERVLET_CLASS = "javax.faces.webapp.FacesServlet"; //$NON-NLS-1$ - /** - * The name of the context parameter used for JSF configuration files - */ - public static final String JSF_CONFIG_CONTEXT_PARAM = "javax.faces.CONFIG_FILES"; //$NON-NLS-1$ - - /** - * The name of the context parameter used for defining the default JSP file extension - */ - public static final String JSF_DEFAULT_SUFFIX_CONTEXT_PARAM = "javax.faces.DEFAULT_SUFFIX"; //$NON-NLS-1$ - - /** - * The path to the default application configuration file - */ - public static final String JSF_DEFAULT_CONFIG_PATH = "/WEB-INF/faces-config.xml"; //$NON-NLS-1$ - - /** - * Default URL mapping to faces servlet - */ - public static final String JSF_DEFAULT_URL_MAPPING = "/faces/*"; //$NON-NLS-1$ - - /** - * the key for implementation libraries in persistent properties - * TODO: should encapsulate the property somewhere and hide the constant - */ - public static final String PP_JSF_IMPLEMENTATION_LIBRARIES = "jsf.implementation.libraries"; //$NON-NLS-1$ - /** - * the key for component libraries in persistent properties - * TODO: should encapsulate the property somewhere and hide the constant - */ - public static final String PP_JSF_COMPONENT_LIBRARIES = "jsf.component.libraries"; //$NON-NLS-1$ - /** - * the key for implementation type in persistent properties - * TODO: should encapsulate the property somewhere and hide the constant - */ - public static final String PP_JSF_IMPLEMENTATION_TYPE = "jsf.implementation.type"; //$NON-NLS-1$ - /** - * Construct an array that hold paths for all JARs in a JSF library. - * However, archive files that no longer exist are filtered out. - * - * @param jsfLib - * @param logMissingJar true to log an error for each invalid JAR. - * @return elements - */ - public static IPath[] getJARPathforJSFLibwFilterMissingJars(JSFLibrary jsfLib, boolean logMissingJar) { - EList archiveFiles = jsfLib.getArchiveFiles(); - int numJars = numberofValidJar(archiveFiles); - IPath[] elements = new IPath[numJars]; - ArchiveFile ar = null; - int idxValidJar = 0; - for (int i= 0; i < archiveFiles.size(); i++) { - ar = (ArchiveFile)archiveFiles.get(i); - if ( !ar.exists() ) { - if (logMissingJar) { - logErroronMissingJAR(jsfLib, ar); - } - } else { - elements[idxValidJar] = new Path(((ArchiveFile)archiveFiles.get(i)).getResolvedSourceLocation()).makeAbsolute(); - idxValidJar++; - } - } - return elements; - } - - /** - * Construct an array that hold paths for all JARs in a JSF library. - * - * @param jsfLib - * @param logMissingJar true to log an error for each invalid JAR. - * @return elements - */ - public static IPath[] getJARPathforJSFLib(JSFLibrary jsfLib, boolean logMissingJar) { - EList archiveFiles = jsfLib.getArchiveFiles(); - int numJars = archiveFiles.size(); - IPath[] elements = new IPath[numJars]; - ArchiveFile ar = null; - for (int i= 0; i < numJars; i++) { - ar = (ArchiveFile)archiveFiles.get(i); - if ( !ar.exists() && logMissingJar ) { - logErroronMissingJAR(jsfLib, ar); - } - elements[i] = new Path(((ArchiveFile)archiveFiles.get(i)).getResolvedSourceLocation()).makeAbsolute(); - } - return elements; - } - - private static int numberofValidJar(EList archiveFiles) { - int total = 0; - final Iterator it = archiveFiles.iterator(); - ArchiveFile ar = null; - while(it.hasNext()) { - ar = (ArchiveFile) it.next(); - if (ar.exists()) { - total++; - } - } - return total; - } - - private static void logErroronMissingJAR(JSFLibrary jsfLib, ArchiveFile ar) { - String msg = NLS.bind(Messages.JSFUtils_MissingJAR, - ar.getName(), - jsfLib.getLabel()); - JSFCorePlugin.log(IStatus.ERROR, msg); - } - - - /** - * @param config - * @return servlet display name to use from wizard data model - */ - protected static String getDisplayName(IDataModel config) { - String displayName = config.getStringProperty(IJSFFacetInstallDataModelProperties.SERVLET_NAME); - if (displayName == null || displayName.trim().equals("")) //$NON-NLS-1$ - displayName = JSF_DEFAULT_SERVLET_NAME; - return displayName.trim(); - } - - /** - * @param config - * @return servlet display name to use from wizard data model - */ - protected static String getServletClassname(IDataModel config) { - String className = config.getStringProperty(IJSFFacetInstallDataModelProperties.SERVLET_CLASSNAME); - if (className == null || className.trim().equals("")) //$NON-NLS-1$ - className = JSF_SERVLET_CLASS; - return className.trim(); - } - - /** - * Servlet 2.3_SRV.11.2: a string that begins with a "/" and ends - * with "/*" is a prefix mapping - * - * @param mapping - * @return true if the mapping string represents a prefix mapping - */ - public static boolean isPrefixMapping(final String mapping) - { - if (mapping == null || mapping.length() < 4) - { - return false; - } - - return mapping.charAt(0) == '/' && mapping.endsWith("/*"); - } - - /** - * Servlet 2.3_SRV.11.2: a string that begins with "*." - * is an extension mapping - * - * @param mapping - * @return true if mapping is an extension mapping - */ - public static boolean isExtensionMapping(final String mapping) - { - if (mapping == null) - { - return false; - } - - return mapping.startsWith("*."); - } - - /** - * @param webProject - * @return IModelProvider - */ - public static IModelProvider getModelProvider(IProject webProject) { - IModelProvider provider = ModelProviderManager.getModelProvider(webProject); - Object webAppObj = provider.getModelObject(); - if (webAppObj == null){ - return null; - } - return provider; - } - - /** - * Search the list of servlet-mappings for the first extension and prefix mappings. The contents - * of mappings is assumed to be all url-pattern's. - * - * If prefExtMapping is not null, it is an extension mapping and - * it is in mappings, then it is returned. Otherwise, the first extension - * mapping in mappings is returned. Returns null if mappings does not - * contain an extension mapping. The same algorithm holds for prefPrefixMapping and - * corresponding prefix mapping. - * - * See isExtensionMapping and isPrefixMapping for more information on url patterns. - * - * @param mappings - * @param prefExtMapping - * @param prefPrefixMapping - * @return the result - */ - public static MappingSearchResult searchServletMappings( - final List<String> mappings, String prefExtMapping, - String prefPrefixMapping) { - String firstExtFound = null; - String firstPrefixFound = null; - boolean foundExtMapping = false; - boolean foundPrefixMapping = false; - - // if the caller has no preferredMapping, then - // set it to something guaranteed to be non-null - // and which is guaranteed not to match anything - // that pass isExtensionMapping - if (prefExtMapping == null) { - prefExtMapping = "NOTANEXTENSIONMAPPING"; - } - - // similarly, guarantee that if the caller has no - // preferred prefix mapping, that we set a non-null - // comp mapping - if (prefPrefixMapping == null) { - prefPrefixMapping = "NOTAPREFIXMAPPING"; - } - - SEARCH_LOOP: for (String mapping : mappings) { - if (isExtensionMapping(mapping)) { - // can assum that mapping is non-null since - // it is an ext mapping - if (prefExtMapping.equals(mapping.trim())) { - firstExtFound = prefExtMapping; - continue; - } - - if (firstExtFound == null) { - firstExtFound = mapping.trim(); - } - } else if (isPrefixMapping(mapping)) { - if (prefPrefixMapping.equals(mapping.trim())) { - firstPrefixFound = prefPrefixMapping; - continue; - } - - if (firstPrefixFound == null) { - firstPrefixFound = mapping.trim(); - } - } - - if (foundExtMapping && foundPrefixMapping) { - break SEARCH_LOOP; - } - } - - return new MappingSearchResult(firstExtFound, firstPrefixFound); - } - - /** - * The result of a servlet mapping search - * - */ - public static class MappingSearchResult { - private final String _extensionMapping; // may be null; - private final String _prefixMapping; // may be null - - MappingSearchResult(final String extensionMapping, - final String prefixMapping) { - _extensionMapping = extensionMapping; - _prefixMapping = prefixMapping; - } - - /** - * @return true if the search yielded a valid result - */ - public boolean isResult() { - return _extensionMapping != null || _prefixMapping != null; - } - - /** - * @return the first extension mapping matching search criteria or null - * if none - */ - public final String getExtensionMapping() { - return _extensionMapping; - } - - /** - * @return the first prefix mapping matching search criteria or null - * if none - */ - public final String getPrefixMapping() { - return _prefixMapping; - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/JSFUtils11.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/JSFUtils11.java deleted file mode 100644 index 8fa212fcd..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/JSFUtils11.java +++ /dev/null @@ -1,464 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.core.internal.project.facet; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.PrintWriter; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Path; -import org.eclipse.jst.j2ee.common.CommonFactory; -import org.eclipse.jst.j2ee.common.ParamValue; -import org.eclipse.jst.j2ee.web.componentcore.util.WebArtifactEdit; -import org.eclipse.jst.j2ee.webapplication.ContextParam; -import org.eclipse.jst.j2ee.webapplication.JSPType; -import org.eclipse.jst.j2ee.webapplication.Servlet; -import org.eclipse.jst.j2ee.webapplication.ServletMapping; -import org.eclipse.jst.j2ee.webapplication.ServletType; -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.jst.j2ee.webapplication.WebapplicationFactory; -import org.eclipse.jst.jsf.core.IJSFCoreConstants; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.core.internal.Messages; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; - -/** - * Utility file for JSF model v1.1 - * - * @author Gerry Kessler - Oracle - */ -public class JSFUtils11 extends JSFUtils { - - /** - * Convenience method for getting writeable WebApp model - * @param project - * @return WebArtifactEdit - * @deprecated - must use IModelProviders - */ - public static WebArtifactEdit getWebArtifactEditForWrite(final IProject project) { - return WebArtifactEdit.getWebArtifactEditForWrite(project); - } - - /** - * Convenience method for getting read-only WebApp model - * @param project - * @return WebArtifactEdit - * @deprecated - must use IModelProviders - */ - public static WebArtifactEdit getWebArtifactEditForRead(final IProject project) { - return WebArtifactEdit.getWebArtifactEditForRead(project); - } - - /** - * @param webApp as Object - * @return Servlet - the JSF Servlet for the specified WebApp or null if not present - */ - public static Servlet findJSFServlet(final Object webApp) { - Iterator it = null; - if (webApp == null) - return null; - else if (webApp instanceof WebApp) - it = ((WebApp)webApp).getServlets().iterator(); - else if (webApp instanceof org.eclipse.jst.javaee.web.WebApp) - it = ((org.eclipse.jst.javaee.web.WebApp)webApp).getServlets().iterator(); - else - return null; - - while (it.hasNext()) { - Servlet servlet = (Servlet) it.next(); - if (servlet != null && servlet.getWebType() != null) { - - if( servlet.getWebType().isServletType()) { - if (((ServletType) servlet.getWebType()).getClassName() != null && - ((ServletType) servlet.getWebType()).getClassName().trim().equals( - JSF_SERVLET_CLASS)) { - return servlet; - } - } else if (servlet.getWebType().isJspType()) { - if (((JSPType) servlet.getWebType()).getJspFile() != null && - ((JSPType) servlet.getWebType()).getJspFile().trim().equals( - JSF_SERVLET_CLASS)) { - return servlet; - } - } - } - } - - // if we get to here then we have finished the loop - // without finding the servlet we're looking for - return null; - } - - /** - * Creates a stubbed JSF configuration file for specified JSF version and path - * @param jsfVersion - * @param configPath - */ - public static void createConfigFile(final String jsfVersion, final IPath configPath) { - FileOutputStream os = null; - PrintWriter pw = null; - final String QUOTE = new String(new char[] { '"' }); - try { - IPath dirPath = configPath.removeLastSegments(1); - dirPath.toFile().mkdirs(); - File file = configPath.toFile(); - file.createNewFile(); - os = new FileOutputStream(file); - pw = new PrintWriter(os); - pw.write("<?xml version=" + QUOTE + "1.0" + QUOTE + " encoding=" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - + QUOTE + "UTF-8" + QUOTE + "?>\n\n"); //$NON-NLS-1$ //$NON-NLS-2$ - - if (jsfVersion.equals(IJSFCoreConstants.FACET_VERSION_1_1)) - { - pw.write("<!DOCTYPE faces-config PUBLIC\n"); //$NON-NLS-1$ - pw - .write(" " //$NON-NLS-1$ - + QUOTE - + "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN" //$NON-NLS-1$ - + QUOTE + "\n"); //$NON-NLS-1$ - pw.write(" " + QUOTE //$NON-NLS-1$ - + "http://java.sun.com/dtd/web-facesconfig_1_1.dtd" //$NON-NLS-1$ - + QUOTE + ">\n\n"); //$NON-NLS-1$ - - pw.write("<faces-config>\n\n"); //$NON-NLS-1$ - pw.write("</faces-config>\n"); //$NON-NLS-1$ - } - - pw.close(); - pw = null; - } catch (FileNotFoundException e) { - JSFCorePlugin.log(IStatus.ERROR, Messages.JSFUtils_ErrorCreatingConfigFile, e); - } catch (IOException e) { - JSFCorePlugin.log(IStatus.ERROR, Messages.JSFUtils_ErrorCreatingConfigFile, e); - } finally { - if (pw != null) - pw.close(); - if (os != null) { - try { - os.close(); - } catch (IOException e) { - JSFCorePlugin.log(IStatus.ERROR, Messages.JSFUtils_ErrorClosingConfigFile, e); - } - } - } - } - - /** - * Creates servlet reference in WebApp if not present or updates servlet name if found - * using the passed configuration. - * - * @param webApp - * @param config - * @param servlet - * @return Servlet servlet - if passed servlet was null, will return created servlet - */ - public static Servlet createOrUpdateServletRef(final WebApp webApp, - final IDataModel config, Servlet servlet) { - - String displayName = getDisplayName(config); - String className = getServletClassname(config); - - if (servlet == null){ - // Create the servlet instance and set up the parameters from data - // model - servlet = WebapplicationFactory.eINSTANCE.createServlet(); - servlet.setServletName(displayName); - - ServletType servletType = WebapplicationFactory.eINSTANCE - .createServletType(); - servletType.setClassName(className); - servlet.setWebType(servletType); - servlet.setLoadOnStartup(Integer.valueOf(1)); - // Add the servlet to the web application model - webApp.getServlets().add(servlet); - } else { - // update - updateServletMappings(webApp, servlet, servlet.getServletName().trim(), displayName); - servlet.setServletName(displayName); - servlet.setLoadOnStartup(Integer.valueOf(1)); - } - return servlet; - } - - private static void updateServletMappings(final WebApp webApp, final Servlet servlet, - final String servletName, final String newServletName) { - List<ServletMapping> mappings = findServletMappings(webApp, servlet, servletName); - for (ServletMapping map : mappings){ - map.setName(newServletName); - } - - } - - - private static List<ServletMapping> findServletMappings(final WebApp webApp, final Servlet servlet, final String servletName) { - List<ServletMapping> mappings = new ArrayList<ServletMapping>(); - List<ServletMapping> allMappings = webApp.getServletMappings(); - for (int i=allMappings.size()-1;i>=0;--i){ - ServletMapping mapping = allMappings.get(i); - if (mapping != null && - mapping.getServlet() != null && - mapping.getServlet().getServletName() != null && - mapping.getServlet().getServletName().trim().equals(servletName)) - mappings.add(mapping); - } - return mappings; - } - - /** - * @param webApp as Object - * @return true if webApp instanceof org.eclipse.jst.javaee.web.WebApp - */ - public static boolean isWebApp25(final Object webApp) { - if (webApp instanceof org.eclipse.jst.javaee.web.WebApp) - return true; - return false; - } - - /** - * Creates servlet-mappings for the servlet - * - * @param webApp - * @param urlMappingList - list of string values to be used in url-pattern for servlet-mapping - * @param servlet - */ - public static void setUpURLMappings(final WebApp webApp, final List urlMappingList, - final Servlet servlet) { - // Add mappings - Iterator it = urlMappingList.iterator(); - while (it.hasNext()) { - String pattern = (String) it.next(); - if (!(doesServletMappingExist(webApp, servlet, pattern))){ - ServletMapping mapping = WebapplicationFactory.eINSTANCE - .createServletMapping(); - mapping.setServlet(servlet); - mapping.setName(servlet.getServletName()); - mapping.setUrlPattern(pattern); - webApp.getServletMappings().add(mapping); - } - } - } - - - private static boolean doesServletMappingExist(final WebApp webApp, final Servlet servlet, - final String pattern) { - - List mappings = webApp.getServletMappings(); - String servletName = servlet.getServletName(); - if (servletName != null) { - for (int i=mappings.size()-1;i>=0;--i){ - ServletMapping mapping = (ServletMapping)mappings.get(i); - if (mapping != null && - mapping.getServlet() != null && - mapping.getServlet().getServletName() != null && - mapping.getServlet().getServletName().trim().equals(servletName) && - mapping.getUrlPattern() != null && - mapping.getUrlPattern().trim().equals(pattern)) { - return true; - } - } - } - return false; - } - - /** - * Removes servlet-mappings for servlet using servlet-name. - * @param webApp - * @param servlet - */ - public static void removeURLMappings(final WebApp webApp, final Servlet servlet) { - List mappings = webApp.getServletMappings(); - String servletName = servlet.getServletName(); - if (servletName != null) { - for (int i=mappings.size()-1;i>=0;--i){ - ServletMapping mapping = (ServletMapping)mappings.get(i); - if (mapping != null && - mapping.getServlet() != null && - mapping.getServlet().getServletName() != null && - mapping.getServlet().getServletName().trim() - .equals(servletName)) { - mappings.remove(mapping); - } - } - } - } - - /** - * Creates or updates config file context-param in v 2.3 WebApp if non default configuration file is specified. - * @param webApp - * @param config - */ - public static void setupConfigFileContextParamForV2_3(final WebApp webApp, - final IDataModel config) { - // if not default name and location, then add context param - ContextParam cp = null; - ContextParam foundCP = null; - boolean found = false; - if (!config.getStringProperty(IJSFFacetInstallDataModelProperties.CONFIG_PATH).equals(JSF_DEFAULT_CONFIG_PATH)) { - // check to see if present - Iterator it = webApp.getContexts().iterator(); - while (it.hasNext()) { - cp = (ContextParam) it.next(); - if (cp != null && - cp.getParamName() != null && - cp.getParamName().equals(JSF_CONFIG_CONTEXT_PARAM)) { - foundCP = cp; - found = true; - } - } - if (!found) { - cp = WebapplicationFactory.eINSTANCE.createContextParam(); - cp.setParamName(JSF_CONFIG_CONTEXT_PARAM); - cp.setParamValue(config.getStringProperty(IJSFFacetInstallDataModelProperties.CONFIG_PATH)); - webApp.getContexts().add(cp); - } else { - cp = foundCP; - if (cp.getParamValue().indexOf(config.getStringProperty(IJSFFacetInstallDataModelProperties.CONFIG_PATH)) < 0) { - String curVal = cp.getParamValue(); - String val = config.getStringProperty(IJSFFacetInstallDataModelProperties.CONFIG_PATH); - if (curVal != null && !"".equals(curVal.trim())) { //$NON-NLS-1$ - val = curVal + ",\n" + val; //$NON-NLS-1$ - } - cp.setParamValue(val); - } - } - } - } - /** - * Creates or updates config file context-param in v2.4 WebApp if non default configuration file is specified. - * @param webApp - * @param config - */ - public static void setupConfigFileContextParamForV2_4(final WebApp webApp, - final IDataModel config) { - // if not default name and location, then add context param - ParamValue foundCP = null; - ParamValue cp = null; - boolean found = false; - if (!config.getStringProperty(IJSFFacetInstallDataModelProperties.CONFIG_PATH).equals(JSF_DEFAULT_CONFIG_PATH)) { - // check to see if present - Iterator it = webApp.getContextParams().iterator(); - while (it.hasNext()) { - cp = (ParamValue) it.next(); - if (cp != null && - cp.getName() != null && - cp.getName().trim().equals(JSF_CONFIG_CONTEXT_PARAM)) { - foundCP = cp; - found = true; - } - } - if (!found) { - ParamValue pv = CommonFactory.eINSTANCE.createParamValue(); - pv.setName(JSF_CONFIG_CONTEXT_PARAM); - pv.setValue(config.getStringProperty(IJSFFacetInstallDataModelProperties.CONFIG_PATH)); - webApp.getContextParams().add(pv); - } else { - cp = foundCP; - if (cp.getValue().indexOf(config.getStringProperty(IJSFFacetInstallDataModelProperties.CONFIG_PATH)) < 0) { - String curVal = cp.getValue(); - String val = config.getStringProperty(IJSFFacetInstallDataModelProperties.CONFIG_PATH); - if (curVal != null && !"".equals(curVal.trim())) { //$NON-NLS-1$ - val = curVal + ",\n" + val; //$NON-NLS-1$ - } - cp.setValue(val); - } - } - } - } - - /** - * @param webAppObj as Object - * @return true if webApp instanceof org.eclipse.jst.j2ee.web.WebApp and versionID == 24 - */ - public static boolean isWebApp24(final Object webAppObj) { - if (webAppObj instanceof WebApp && - ((WebApp)webAppObj).getVersionID() == 24) - return true; - return false; - } - - /** - * @param webAppObj as Object - * @return true if webApp instanceof org.eclipse.jst.j2ee.web.WebApp and versionID == 23 - */ - public static boolean isWebApp23(final Object webAppObj) { - if (webAppObj instanceof WebApp && - ((WebApp)webAppObj).getVersionID() == 23) - return true; - return false; - } - - /** - * @param webApp - * @return the default file extension from the context param. Default is "jsp" if no context param. - */ - public static String getDefaultSuffix(final WebApp webApp) { - String defaultSuffix = "jsp"; //$NON-NLS-1$ - for (Iterator it = webApp.getContexts().iterator();it.hasNext();) { - ContextParam cp = (ContextParam) it.next(); - if (cp != null && - cp.getParamName() != null && - cp.getParamName().trim().equals(JSF_DEFAULT_SUFFIX_CONTEXT_PARAM)){ - String defSuffix = cp.getParamValue(); - if (defSuffix.startsWith(".")) //$NON-NLS-1$ - defSuffix = defSuffix.substring(1); - - return defSuffix; - } - } - return defaultSuffix; - } - - /** - * @param map - * @return prefix mapping. may return null. - */ - public static String getPrefixMapping(final ServletMapping map) { - IPath extPath = new Path(map.getUrlPattern()); - if (extPath != null){ - String ext = extPath.getFileExtension(); - if (ext == null){ - String lastSeg = extPath.lastSegment(); - if (lastSeg != null && - lastSeg.equals("*")) //$NON-NLS-1$ - { - return extPath.removeLastSegments(1).toString(); - } - - return extPath.toString(); - } - } - return null; - } - - /** - * @param map - * @return extension from map. Will return null if file extension not found in url patterns. - */ - public static String getFileExtensionFromMap(final ServletMapping map) { - IPath extPath = new Path(map.getUrlPattern()); - if (extPath != null){ - String ext = extPath.getFileExtension(); - if (ext != null && !ext.equals("")) //$NON-NLS-1$ - return ext; - } - return null; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/JSFUtils12.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/JSFUtils12.java deleted file mode 100644 index 71a2b2bff..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/JSFUtils12.java +++ /dev/null @@ -1,354 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2008 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.core.internal.project.facet; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.PrintWriter; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Path; -import org.eclipse.jst.javaee.core.JavaeeFactory; -import org.eclipse.jst.javaee.core.ParamValue; -import org.eclipse.jst.javaee.core.UrlPatternType; -import org.eclipse.jst.javaee.web.Servlet; -import org.eclipse.jst.javaee.web.ServletMapping; -import org.eclipse.jst.javaee.web.WebApp; -import org.eclipse.jst.javaee.web.WebAppVersionType; -import org.eclipse.jst.javaee.web.WebFactory; -import org.eclipse.jst.jsf.core.IJSFCoreConstants; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.core.internal.Messages; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; - -/** - * Utility file for JSF v1.2 model - * - * @author Gerry Kessler - Oracle - */ -public class JSFUtils12 extends JSFUtils { - - /** - * @param webApp - * @return Servlet - the JSF Servlet for the specified WebApp or null if not present - */ - public static Servlet findJSFServlet(final WebApp webApp) { - - Iterator it = webApp.getServlets().iterator(); - - while (it.hasNext()) { - Servlet servlet = (Servlet) it.next(); - if (servlet.getServletClass() != null && - servlet.getServletClass().trim().equals (JSF_SERVLET_CLASS)) { - return servlet; - } - } - - // if we get to here then we have finished the loop - // without finding the servlet we're looking for - return null; - } - - /** - * Creates a stubbed JSF v1.2 configuration file for specified JSF version and path - * @param jsfVersion - * @param configPath - */ - public static void createConfigFile(final String jsfVersion, final IPath configPath) { - FileOutputStream os = null; - PrintWriter pw = null; - final String QUOTE = new String(new char[] { '"' }); - try { - IPath dirPath = configPath.removeLastSegments(1); - dirPath.toFile().mkdirs(); - File file = configPath.toFile(); - file.createNewFile(); - os = new FileOutputStream(file); - pw = new PrintWriter(os); - pw.write("<?xml version=" + QUOTE + "1.0" + QUOTE + " encoding=" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - + QUOTE + "UTF-8" + QUOTE + "?>\n\n"); //$NON-NLS-1$ //$NON-NLS-2$ - - if (jsfVersion.equals(IJSFCoreConstants.FACET_VERSION_1_2)) - { - pw.write("<faces-config\n"); //$NON-NLS-1$ - pw.write(" " + "xmlns=" + QUOTE //$NON-NLS-1$ //$NON-NLS-2$ - + "http://java.sun.com/xml/ns/javaee" + QUOTE + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ - pw.write(" " + "xmlns:xsi=" + QUOTE //$NON-NLS-1$ //$NON-NLS-2$ - + "http://www.w3.org/2001/XMLSchema-instance" + QUOTE //$NON-NLS-1$ - + "\n"); //$NON-NLS-1$ - pw - .write(" " //$NON-NLS-1$ - + "xsi:schemaLocation=" //$NON-NLS-1$ - + QUOTE - + "http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd" //$NON-NLS-1$ - + QUOTE + "\n"); //$NON-NLS-1$ - pw.write(" " + "version=" + QUOTE + "1.2" + QUOTE + ">\n\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - pw.write("</faces-config>\n"); //$NON-NLS-1$ - } - - pw.close(); - pw = null; - } catch (FileNotFoundException e) { - JSFCorePlugin.log(IStatus.ERROR, Messages.JSFUtils_ErrorCreatingConfigFile, e); - } catch (IOException e) { - JSFCorePlugin.log(IStatus.ERROR, Messages.JSFUtils_ErrorCreatingConfigFile, e); - } finally { - if (pw != null) - pw.close(); - if (os != null) { - try { - os.close(); - } catch (IOException e) { - JSFCorePlugin.log(IStatus.ERROR, Messages.JSFUtils_ErrorClosingConfigFile, e); - } - } - } - } - - - /** - * Creates servlet reference in WebApp if not present or updates servlet name if found - * using the passed configuration. - * - * @param webApp - * @param config - * @param servlet - * @return Servlet servlet - if passed servlet was null, will return created servlet - */ - public static Servlet createOrUpdateServletRef(final WebApp webApp, - final IDataModel config, org.eclipse.jst.javaee.web.Servlet servlet) { - - String displayName = getDisplayName(config); - String className = getServletClassname(config); - - if (servlet == null){ - // Create the servlet instance and set up the parameters from data - // model - servlet = WebFactory.eINSTANCE.createServlet(); - servlet.setServletName(displayName); - servlet.setServletClass(className); - servlet.setLoadOnStartup(Integer.valueOf(1)); - // Add the servlet to the web application model - webApp.getServlets().add(servlet); - - } else { - updateServletMappings(webApp, servlet, displayName); - servlet.setServletName(displayName); - servlet.setLoadOnStartup(Integer.valueOf(1)); - } - return servlet; - } - - private static void updateServletMappings(final WebApp webApp, final Servlet servlet, - final String displayName) { - // update mappings for new name - ServletMapping mapping = findServletMapping(webApp, servlet); - if (mapping != null) { - mapping.setServletName(displayName); - } - - } - - /** - * @param webAppObj as Object - * @return true if webApp instanceof org.eclipse.jst.javaee.web.WebApp and WebAppVersionType._25 - */ - public static boolean isWebApp25(final Object webAppObj) { - if (webAppObj instanceof WebApp && - ((WebApp)webAppObj).getVersion() == WebAppVersionType._25_LITERAL) - return true; - return false; - } - - /** - * Creates servlet-mappings for the servlet for 2.5 WebModules or greated - * - * @param webApp - * @param urlMappingList - list of string values to be used in url-pattern for servlet-mapping - * @param servlet - */ - public static void setUpURLMappings(final WebApp webApp, final List urlMappingList, - final Servlet servlet) { - - if (urlMappingList.size() > 0) { - ServletMapping mapping = findServletMapping(webApp, servlet); - if (mapping == null){ - mapping = WebFactory.eINSTANCE.createServletMapping(); - mapping.setServletName(servlet.getServletName()); - webApp.getServletMappings().add(mapping); - } - // Add patterns - Iterator it = urlMappingList.iterator(); - while (it.hasNext()) { - String pattern = (String) it.next(); - if (!(doesServletMappingPatternExist(webApp, mapping, pattern))){ - UrlPatternType urlPattern = JavaeeFactory.eINSTANCE.createUrlPatternType(); - urlPattern.setValue(pattern); - mapping.getUrlPatterns().add(urlPattern); - } - } - } - } - - private static ServletMapping findServletMapping(final WebApp webApp, final Servlet servlet) { - for (Iterator it=webApp.getServletMappings().iterator();it.hasNext();){ - ServletMapping mapping = (ServletMapping)it.next(); - if (mapping.getServletName() != null && - servlet.getServletName() != null && - mapping.getServletName().trim().equals(servlet.getServletName().trim())) - return mapping; - } - return null; - } - - private static boolean doesServletMappingPatternExist(final WebApp webApp, final ServletMapping mapping, - final String pattern) { - for (Iterator it=mapping.getUrlPatterns().iterator();it.hasNext();){ - String patternTypeValue = ((UrlPatternType)it.next()).getValue(); - if( patternTypeValue != null && - pattern.equals(patternTypeValue.trim())) - return true; - } - return false; - } - - /** - * Removes servlet-mappings for servlet using servlet-name for >= 2.5 WebModules. - * @param webApp - * @param servlet - */ - public static void removeURLMappings(final WebApp webApp, final Servlet servlet) { - List mappings = webApp.getServletMappings(); - String servletName = servlet.getServletName(); - if (servletName != null) { - servletName = servletName.trim(); - for (int i=mappings.size()-1;i>=0;--i){ - ServletMapping mapping = (ServletMapping)mappings.get(i); - if (mapping != null && - mapping.getServletName() != null && - mapping.getServletName().trim() - .equals(servletName)) { - mappings.remove(mapping); - } - } - } - } - - /** - * Creates or updates config file context-param in v2.5 WebApp if non default configuration file is specified. - * @param webApp - * @param config - */ - public static void setupConfigFileContextParamForV2_5(final org.eclipse.jst.javaee.web.WebApp webApp, - final IDataModel config) { - // if not default name and location, then add context param - ParamValue foundCP = null; - ParamValue cp = null; - boolean found = false; - if (!config.getStringProperty(IJSFFacetInstallDataModelProperties.CONFIG_PATH).equals(JSF_DEFAULT_CONFIG_PATH)) { - // check to see if present - Iterator it = webApp.getContextParams().iterator(); - while (it.hasNext()) { - cp = (org.eclipse.jst.javaee.core.ParamValue) it.next(); - if (cp != null && - cp.getParamName()!= null && - cp.getParamName().trim().equals(JSF_CONFIG_CONTEXT_PARAM)) { - foundCP = cp; - found = true; - } - } - if (!found) { - ParamValue pv = JavaeeFactory.eINSTANCE.createParamValue(); - pv.setParamName(JSF_CONFIG_CONTEXT_PARAM); - pv.setParamValue(config.getStringProperty(IJSFFacetInstallDataModelProperties.CONFIG_PATH)); - webApp.getContextParams().add(pv); - } else { - cp = foundCP; - if (cp.getParamValue().indexOf(config.getStringProperty(IJSFFacetInstallDataModelProperties.CONFIG_PATH)) < 0) { - String curVal = cp.getParamValue(); - String val = config.getStringProperty(IJSFFacetInstallDataModelProperties.CONFIG_PATH); - if (curVal != null && !"".equals(curVal.trim())) { //$NON-NLS-1$ - val = curVal + ",\n" + val; //$NON-NLS-1$ - } - cp.setParamValue(val); - } - } - } - } - - /** - * @param webApp - * @return the default file extension from the context param. Default is "jsp" if no context param - */ - public static String getDefaultSuffix(final WebApp webApp) { - String defaultSuffix = "jsp"; //$NON-NLS-1$ - for (Iterator it = webApp.getContextParams().iterator();it.hasNext();) { - ParamValue cp = (ParamValue) it.next(); - if (cp != null && - cp.getParamName() != null && - cp.getParamName().trim().equals(JSF_DEFAULT_SUFFIX_CONTEXT_PARAM)){ - String defSuffix = cp.getParamValue(); - if (defSuffix.startsWith(".")) //$NON-NLS-1$ - defSuffix = defSuffix.substring(1); - - return defSuffix; - } - } - return defaultSuffix; - } - - /** - * @param map - * @return prefix mapping - */ - public static String getPrefixMapping(final ServletMapping map) { - List urls = map.getUrlPatterns(); - for (Iterator it=urls.iterator();it.hasNext();){ - IPath extPath = new Path(((UrlPatternType)it.next()).getValue()); - if (extPath != null){ - String ext = extPath.getFileExtension(); - if (ext == null){ - String lastSeg = extPath.lastSegment(); - if (lastSeg.equals("*")) //$NON-NLS-1$ - { - return extPath.removeLastSegments(1).toString(); - } - - return extPath.toString(); - } - } - } - return null; - } - - /** - * @param map - * @return extension from map. Will return null if file extension not found in url patterns. - */ - public static String getFileExtensionFromMap(final ServletMapping map) { - List urls = map.getUrlPatterns(); - for (Iterator it=urls.iterator();it.hasNext();){ - IPath extPath = new Path(((UrlPatternType)it.next()).getValue()); - if (extPath != null){ - String ext = extPath.getFileExtension(); - if (ext != null && !ext.equals("")) //$NON-NLS-1$ - return ext; - } - } - return null; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/LegacyJSFLibraryProviderDetector.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/LegacyJSFLibraryProviderDetector.java deleted file mode 100644 index e86a3a66a..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/LegacyJSFLibraryProviderDetector.java +++ /dev/null @@ -1,89 +0,0 @@ -/****************************************************************************** - * Copyright (c) 2008 Oracle - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Konstantin Komissarchik - initial implementation and ongoing maintenance - ******************************************************************************/ - -package org.eclipse.jst.jsf.core.internal.project.facet; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IPath; -import org.eclipse.jdt.core.IClasspathEntry; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jst.common.project.facet.core.libprov.ILibraryProvider; -import org.eclipse.jst.common.project.facet.core.libprov.LegacyLibraryProviderDetector; -import org.eclipse.jst.common.project.facet.core.libprov.LibraryProviderFramework; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.core.internal.jsflibraryconfig.JSFLibraryRegistryUtil; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary; -import org.eclipse.jst.jsf.core.jsflibraryconfiguration.JSFLibraryConfigurationHelper; -import org.eclipse.wst.common.project.facet.core.IProjectFacet; - -/** - * @author <a href="mailto:konstantin.komissarchik@oracle.com">Konstantin Komissarchik</a> - */ - -public final class LegacyJSFLibraryProviderDetector - - extends LegacyLibraryProviderDetector - -{ - private static final String LEGACY_JSF_LIBRARY_PROVIDER_ID - = "legacy-jsf-library-provider"; //$NON-NLS-1$ - - @Override - public ILibraryProvider detect( final IProject project, - final IProjectFacet facet ) - { - try - { - final IJavaProject jproj = JavaCore.create( project ); - - for( IClasspathEntry cpe : jproj.getRawClasspath() ) - { - if( detect( cpe ) ) - { - return LibraryProviderFramework.getProvider( LEGACY_JSF_LIBRARY_PROVIDER_ID ); - } - } - } - catch( Exception e ) - { - JSFCorePlugin.log( e, e.getMessage() ); - } - - return null; - } - - public static boolean detect( final IClasspathEntry cpe ) - { - if( cpe.getEntryKind() == IClasspathEntry.CPE_CONTAINER ) - { - final IPath path = cpe.getPath(); - - if( isJSFLibraryContainer( path ) ) - { - String libId = path.lastSegment(); - JSFLibrary ref = JSFLibraryRegistryUtil.getInstance().getJSFLibraryRegistry().getJSFLibraryByID(libId); - - if( ref != null && ref.isImplementation() ) - { - return true; - } - } - } - - return false; - } - - private static boolean isJSFLibraryContainer(IPath path) { - return path != null && path.segmentCount() == 2 && JSFLibraryConfigurationHelper.JSF_LIBRARY_CP_CONTAINER_ID.equals(path.segment(0)); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/LegacyJSFLibraryProviderUninstallOperation.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/LegacyJSFLibraryProviderUninstallOperation.java deleted file mode 100644 index 1d1eddc0e..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/LegacyJSFLibraryProviderUninstallOperation.java +++ /dev/null @@ -1,68 +0,0 @@ -/****************************************************************************** - * Copyright (c) 2008 Oracle - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Konstantin Komissarchik - initial implementation and ongoing maintenance - ******************************************************************************/ - -package org.eclipse.jst.jsf.core.internal.project.facet; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jdt.core.IClasspathEntry; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jst.common.project.facet.core.libprov.LibraryProviderOperation; -import org.eclipse.jst.common.project.facet.core.libprov.LibraryProviderOperationConfig; - -/** - * @author <a href="mailto:konstantin.komissarchik@oracle.com">Konstantin Komissarchik</a> - */ - -public final class LegacyJSFLibraryProviderUninstallOperation - - extends LibraryProviderOperation - -{ - public void execute( final LibraryProviderOperationConfig config, - final IProgressMonitor monitor ) - - throws CoreException - - { - monitor.beginTask( "", 1 ); - - try - { - final IProject project = config.getFacetedProject().getProject(); - final IJavaProject jproj = JavaCore.create( project ); - final List<IClasspathEntry> newcp = new ArrayList<IClasspathEntry>(); - - for( IClasspathEntry cpe : jproj.getRawClasspath() ) - { - if( ! LegacyJSFLibraryProviderDetector.detect( cpe ) ) - { - newcp.add( cpe ); - } - } - - final IClasspathEntry[] array = newcp.toArray( new IClasspathEntry[ newcp.size() ] ); - jproj.setRawClasspath( array, null ); - - monitor.worked( 1 ); - } - finally - { - monitor.done(); - } - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/region/Region2AttrAdapter.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/region/Region2AttrAdapter.java deleted file mode 100644 index cd29bb9bc..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/region/Region2AttrAdapter.java +++ /dev/null @@ -1,131 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -/** - * - */ -package org.eclipse.jst.jsf.core.internal.region; - -import org.eclipse.jst.jsf.common.dom.AttrDOMAdapter; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContextFactory; -import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr; -import org.w3c.dom.Node; - -/** - * A AttrDOMAdapter that adapts from a ITextRegions. Instances of class can only - * be obtained from and are always relative to, an owning Region2ElementAdapter - * - * @author cbateman - * - */ -public class Region2AttrAdapter extends AttrDOMAdapter -{ - private final Node _attr; - - /** - * @param owner - * @param attr - */ - Region2AttrAdapter(final Region2ElementAdapter owner, final Node attr) - { - super(owner); - _attr = attr; - } - - @Override - public Region2ElementAdapter getOwningElement() - { - return (Region2ElementAdapter) super.getOwningElement(); - } - - @Override - public String getLocalName() - { - return _attr.getLocalName(); - } - - @Override - public String getNodeName() - { - return _attr.getNodeName(); - } - - @Override - public String getPrefix() - { - return _attr.getPrefix(); - } - - @Override - public String getValue() - { - return _attr.getNodeValue(); - } - - /** - * @return the structured document context - */ - public IStructuredDocumentContext getDocumentContext() - { - return IStructuredDocumentContextFactory.INSTANCE.getContext - (getOwningElement().getDocumentContext().getStructuredDocument(), - getStartOffset()); - } - - /** - * @return the absolute document offset where the attribute starts. - */ - public int getStartOffset() - { - return getOwningElement().getTextRegion().getStartOffset()+getAttributeNameRegion().getStart(); - } - - /** - * Offsets in the region will be relative to the parent element, not the - * document - * - * @return the ITextRegion for the attribute name of the attribute adapted - * by attrAdapter - * @throws IllegalArgumentException - * if attrAdapter.getOwningElement != this - */ - // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=217523 for deprecation - @SuppressWarnings("deprecation") - public ITextRegion getAttributeNameRegion() - { - - return getDOMAttr(_attr).getNameRegion(); - } - - /** - * Offsets in the region will be relative to the parent element, not the - * document - * - * @return the ITextRegion for the attribute value of the attribute adapted - * by attrAdapter - * @throws IllegalArgumentException - * if attrAdapter.getOwningElement != this - */ - @SuppressWarnings("deprecation") - // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=217523 for deprecation - public ITextRegion getAttributeValueRegion() - { - return getDOMAttr(_attr).getValueRegion(); - } - - private IDOMAttr getDOMAttr(final Node attrAsNode) - { - assert attrAsNode instanceof IDOMAttr; - - return ((IDOMAttr) attrAsNode); - } -}
\ No newline at end of file diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/region/Region2ElementAdapter.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/region/Region2ElementAdapter.java deleted file mode 100644 index 21b4487af..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/region/Region2ElementAdapter.java +++ /dev/null @@ -1,249 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.internal.region; - -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.atomic.AtomicBoolean; - -import org.eclipse.jst.jsf.common.dom.ElementDOMAdapter; -import org.eclipse.jst.jsf.context.resolver.structureddocument.IDOMContextResolver; -import org.eclipse.jst.jsf.context.resolver.structureddocument.IStructuredDocumentContextResolverFactory; -import org.eclipse.jst.jsf.context.resolver.structureddocument.ITaglibContextResolver; -import org.eclipse.jst.jsf.context.resolver.structureddocument.internal.IStructuredDocumentContextResolverFactory2; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContextFactory; -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion; -import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion; -import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionCollection; -import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext; -import org.w3c.dom.Element; -import org.w3c.dom.NamedNodeMap; -import org.w3c.dom.Node; - -/** - * Adapt a region object for DOM element information. Does not implement entire - * DOM interface. Object is lazily initialized and not thread-safe. - * - * @author cbateman - * - */ -public class Region2ElementAdapter extends ElementDOMAdapter -{ - private final RegionProcessorStrategy _regionParser; - - /** - * Create a new adapter for this region. If the region does not contain - * enough information to construct a meaningful adapter, it will throw - * NoElementException. The adapter is lazily initialized and won't process - * the region until the first call to a get method is made. - * - * @param region - * @throws NoElementException - */ - public Region2ElementAdapter(final ITextRegion region) - throws NoElementException - { - _regionParser = new RegionProcessorStrategy(region); - } - - @Override - public Map<String, Region2AttrAdapter> getAttributes() - { - return _regionParser.getAttributes(); - } - - @Override - public String getNamespace() - { - return _regionParser.getNamespace(); - } - - @Override - public String getLocalName() - { - return _regionParser.getLocalName(); - } - - @Override - public String getNodeName() - { - return _regionParser.getNodeName(); - } - - @Override - public String getPrefix() - { - return _regionParser.getPrefix(); - } - - /** - * @return the structured document context - */ - public IStructuredDocumentContext getDocumentContext() - { - return _regionParser._context; - } - - /** - * @return an ITextRegion containing absolute offset information for this element - */ - public ITextRegionCollection getTextRegion() - { - return _regionParser._region; - } - - /** - * @return the element - */ - public Element getElement() - { - return (Element) _regionParser._node; - } - - private class RegionProcessorStrategy - { - private final AtomicBoolean _isInitialized = - new AtomicBoolean(false); - private final ITextRegionCollection _region; - - private Map<String, Region2AttrAdapter> _attributes; - private Node _node; - private IStructuredDocumentContext _context; - - RegionProcessorStrategy(final ITextRegion region) throws NoElementException - { - if (!(region instanceof ITextRegionCollection) - || ((ITextRegionCollection) region).getFirstRegion() - .getType() != DOMRegionContext.XML_TAG_OPEN) - { - throw new NoElementException( - "Region is not a collection with an open tag"); - } - - _region = (ITextRegionCollection) region; - - _context = - IStructuredDocumentContextFactory.INSTANCE.getContext( - ((IStructuredDocumentRegion) _region) - .getParentDocument(), _region - .getStartOffset()); - - if (_context == null) - { - throw new NoElementException( - "Couldn't acquire structured document context"); - } - - final IDOMContextResolver resolver = - IStructuredDocumentContextResolverFactory.INSTANCE - .getDOMContextResolver(_context); - - if (resolver == null) - { - throw new NoElementException("Couldn't acquire dom resolver"); - } - - _node = resolver.getNode(); - - if (_node == null) - { - throw new NoElementException("Couldn't get Node from region"); - } - } - - public String getLocalName() - { - return _node.getLocalName(); - } - - public String getNodeName() - { - return _node.getNodeName(); - } - - public String getPrefix() - { - return _node.getPrefix(); - } - - public String getNamespace() - { - final ITaglibContextResolver tagLibResolver = - IStructuredDocumentContextResolverFactory2.INSTANCE - .getTaglibContextResolverFromDelegates(_context); - - if (tagLibResolver != null) - { - return tagLibResolver.getTagURIForNodeName(_node); - } - - return null; - } - - public Map<String, Region2AttrAdapter> getAttributes() - { - mapAttributesOnlyOnce(); - return Collections.unmodifiableMap(_attributes); - } - public boolean isInitialized() - { - return _isInitialized.get(); - } - - private void mapAttributesOnlyOnce() - { - // only once - if (_attributes != null) - return; - - _attributes = Collections.EMPTY_MAP; - - final NamedNodeMap attributes = _node.getAttributes(); - - if (attributes != null) - { - final int numAttrs = attributes.getLength(); - _attributes = new HashMap<String, Region2AttrAdapter>( - (int) (numAttrs / 0.75f) + 1, 0.75f); - for (int i = 0; i < numAttrs; i++) - { - final Node nodeAttr = attributes.item(i); - Region2AttrAdapter attr = new Region2AttrAdapter( - Region2ElementAdapter.this, nodeAttr); - _attributes.put(attr.getLocalName(), attr); - } - } - } - } - - /** - * Indicates that construction of this adapter failed because an IRegion - * didn't have sufficient information (or didn't represent an element at - * all) - * - * @author cbateman - * - */ - public static class NoElementException extends Exception - { - /** - * serializable id - */ - private static final long serialVersionUID = -4479154049727036580L; - - private NoElementException(final String reason) - { - super(reason); - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/tld/AttributeIdentifierFactory.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/tld/AttributeIdentifierFactory.java deleted file mode 100644 index 2d675ce6c..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/tld/AttributeIdentifierFactory.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.internal.tld; - -import org.eclipse.jst.jsf.common.dom.AttributeIdentifier; -import org.eclipse.jst.jsf.common.dom.TagIdentifier; - -/** - * A factory for creating instances of AttributeIdentifier. Some results may be - * cached or otherwise based on shared instances. - * - * @author cbateman - * - */ -public final class AttributeIdentifierFactory -{ - /** - * @param tagId - * @param attributeName - * @return an attribute id based on the tagid and attribute name provided. - */ - public static AttributeIdentifier createAttributeIdentifier( - final TagIdentifier tagId, final String attributeName) - { - return new SimpleAttributeIdentifier(tagId, attributeName); - } - - private final static class SimpleAttributeIdentifier extends - AttributeIdentifier - { - private final TagIdentifier _tagId; - private final String _attributeName; - - public SimpleAttributeIdentifier(final TagIdentifier tagId, - String attributeName) - { - _tagId = tagId; - _attributeName = attributeName; - } - - @Override - public String getName() - { - return _attributeName; - } - - @Override - public TagIdentifier getTagIdentifier() - { - return _tagId; - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/tld/CMUtil.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/tld/CMUtil.java deleted file mode 100644 index b31f60929..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/tld/CMUtil.java +++ /dev/null @@ -1,204 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Sybase, Inc. and others. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.internal.tld; - -import java.util.Iterator; - -import org.eclipse.jface.text.IDocument; -import org.eclipse.jst.jsp.core.internal.contentmodel.TaglibController; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.TLDCMDocumentManager; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.TaglibTracker; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDDocument; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDElementDeclaration; -import org.eclipse.wst.html.core.internal.contentmodel.HTMLElementDeclaration; -import org.eclipse.wst.html.core.internal.provisional.HTMLCMProperties; -import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier; -import org.eclipse.wst.xml.core.internal.contentmodel.CMDocument; -import org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration; -import org.eclipse.wst.xml.core.internal.contentmodel.CMNode; -import org.eclipse.wst.xml.core.internal.provisional.contentmodel.CMNodeWrapper; -import org.eclipse.wst.xml.core.internal.ssemodelquery.ModelQueryAdapter; -import org.w3c.dom.Element; - -/** - * Utility class to content model related information. - * - * @author mengbo - */ -public final class CMUtil { - /** - * If the element is a custom tag, get the URI of it. If the element is a - * standard JSP tag, return null. If is not jsp tag, then return null - * @param decl - * - * @return the tag uri as a string - */ - public static String getTagURI(CMElementDeclaration decl) { - if (decl instanceof CMNodeWrapper) { - decl = (CMElementDeclaration) ((CMNodeWrapper) decl) - .getOriginNode(); - } - if (decl instanceof TLDElementDeclaration) { - CMDocument doc = ((TLDElementDeclaration) decl).getOwnerDocument(); - if (doc instanceof TLDDocument) { - return ((TLDDocument) doc).getUri(); - } - } - return null; - } - - /** - * Test whether this is the JSP core tag. - * - * @param decl - * @return true if decl is a jsp element declaration - */ - public static boolean isJSP(CMElementDeclaration decl) { - if (!decl.supports(HTMLCMProperties.IS_JSP)) { - return false; - } - Boolean b = (Boolean) decl.getProperty(HTMLCMProperties.IS_JSP); - return b.booleanValue(); - } - - /** - * @param decl - * @return true if the element declartion is a non-JSP html element - */ - public static boolean isHTML(CMElementDeclaration decl) { - if (!isJSP(decl) && (decl instanceof HTMLElementDeclaration)) { - return true; - } - return false; - } - - /** - * get element declaration of specified element - * - * @param element - * @return null if can't get it. - */ - public static CMElementDeclaration getElementDeclaration(Element element) { - if (element == null) { - return null; - } - INodeNotifier notifier = (INodeNotifier) element.getOwnerDocument(); - if (notifier == null) { - return null; - } - ModelQueryAdapter mqa = (ModelQueryAdapter) notifier - .getAdapterFor(ModelQueryAdapter.class); - if (mqa == null) { - return null; - } - return mqa.getModelQuery().getCMElementDeclaration(element); - } - - /** - * @param element - * @return the TLDElementDeclaration for element or null if not found - */ - public static TLDElementDeclaration getTLDElementDeclaration(Element element) { - CMNode decl = getElementDeclaration(element); - if (decl instanceof CMNodeWrapper) { - decl = ((CMNodeWrapper) decl).getOriginNode(); - } - if (decl instanceof TLDElementDeclaration) { - return (TLDElementDeclaration) decl; - } - return null; - } - - /** - * !!! NOTE: this function is intended to work around the problem that if your element - * has not yet been added to an IDOMModel, getElementDeclaration won't be able to find - * it. This method does nothing (unlike the ModelQuery-based approach in getElementDeclaration) - * to ensure that the namespace "uri" provided is valid in the structured document provided. It is - * therefore only advisable to use this method in cases where your node is not already a member of a - * IDOMModel. - * - * @param uri - * @param elementName - * @param document - * @return the TLDElementDeclaration for this required tag or null if there is nothing appropriate - */ - public static CMElementDeclaration getTLDElementDeclaration(final String uri, final String elementName, IDocument document) - { - TLDCMDocumentManager tldmgr = TaglibController.getTLDCMDocumentManager(document); - - if (tldmgr != null) - { - for (Iterator it = tldmgr.getTaglibTrackers().iterator();it.hasNext();) - { - TaglibTracker tracker = (TaglibTracker) it.next(); - - if (tracker.getURI().equals(uri)) - { - return (CMElementDeclaration) tracker.getElements().getNamedItem(tracker.getPrefix()+":"+elementName); - } - } - } - // fallthrough - return null; - } - - /** - * give an element, get its namespace URI. - * - * @param element - * @return the namespace URI - */ - public static String getElementNamespaceURI(Element element) { - //System.out.printf("uri for %s is %s\n", element.toString(), element.getNamespaceURI()); - - CMElementDeclaration decl = getElementDeclaration(element); - if (decl == null) { - - // if the content model has nothing, see if the element - // itself has an xml namespace - // TODO: should only apply this if the source document - // is a valid XML doc? - final String uri = element.getNamespaceURI(); - - // may be null which the default state - return uri; - } - - if (isJSP(decl)) { - return ITLDConstants.URI_JSP; - } else if (isHTML(decl)) { - return ITLDConstants.URI_HTML; - } - - return getTagURI(decl); - } - - /** - * @param element - * @return true if the element can have children - */ - public static boolean canHaveDirectTextChild(Element element) { - CMElementDeclaration decl = getElementDeclaration(element); - if (decl == null) { - return true; - } - int contentType = decl.getContentType(); - return contentType != CMElementDeclaration.ELEMENT - && contentType != CMElementDeclaration.EMPTY; - - } - - private CMUtil() - { - // util class, no external instantiation - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/tld/DocumentTagIdentifier.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/tld/DocumentTagIdentifier.java deleted file mode 100644 index 1af913f00..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/tld/DocumentTagIdentifier.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.internal.tld; - -import org.eclipse.jst.jsf.common.dom.TagIdentifier; -import org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration; -import org.w3c.dom.Element; - -/** - * A tag wrapper for a DOM element. This element may or may not be a JSP tag, - * but must be contained in a DOM tree. - * - * @author cbateman - * - */ -/*package*/ class DocumentTagIdentifier extends TagIdentifier -{ - private final Element _element; - - /** - * @param element - */ - public DocumentTagIdentifier(Element element) - { - _element = element; - } - - public String getTagName() - { - return _element.getLocalName(); - } - - public String getUri() { - String uri = CMUtil.getElementNamespaceURI(_element); - - // give the content model priority - if (uri == null) - { - uri = _element.getNamespaceURI(); - } - - return uri; - } - - public boolean isJSPTag() { - CMElementDeclaration elemDecl = getElementDeclaration(); - - if (elemDecl != null) - { - return CMUtil.isJSP(elemDecl); - } - - return false; - } - - /** - * @return the element declaration for this tag - */ - protected final CMElementDeclaration getElementDeclaration() - { - return CMUtil.getElementDeclaration(_element); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/tld/IJSFConstants.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/tld/IJSFConstants.java deleted file mode 100644 index 4f2ee35c6..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/tld/IJSFConstants.java +++ /dev/null @@ -1,979 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Sybase, Inc. and others. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.internal.tld; - -import org.eclipse.jst.jsf.common.dom.TagIdentifier; - -/** - * Constants covering the JSF Core and JSF HTML tag and tag attribute names - */ -public interface IJSFConstants -{ - - /** - * actionListener tagname - */ - final static public String TAG_ACTIONLISTENER = "actionListener"; - - /** - * attribute tagname - */ - final static public String TAG_ATTRIBUTE = "attribute"; - - /** - * convertDateTime tagname - */ - final static public String TAG_CONVERTDATETIME = "convertDateTime"; - - /** - * converter tagname - */ - final static public String TAG_CONVERTER = "converter"; - - /** - * convertNumber tagname - */ - final static public String TAG_CONVERTNUMBER = "convertNumber"; - - /** - * facet tagname - */ - final static public String TAG_FACET = "facet"; - - /** - * loadBundle tagname - */ - final static public String TAG_LOADBUNDLE = "loadBundle"; - - /** - * param tagname - */ - final static public String TAG_PARAM = "param"; - - /** - * phaseListener tagname - */ - final static public String TAG_PHASELISTENER = "phaseListener"; - - /** - * selectItem tagname - */ - final static public String TAG_SELECTITEM = "selectItem"; - - /** - * selectItems tagname - */ - final static public String TAG_SELECTITEMS = "selectItems"; - - /** - * setPropertyActionListener tagname - */ - final static public String TAG_SETPROPERTYACTIONLISTENER = "setPropertyActionListener"; - - /** - * subview tagname - */ - final static public String TAG_SUBVIEW = "subview"; - - /** - * validateDoubleRange tagname - */ - final static public String TAG_VALIDATEDOUBLERANGE = "validateDoubleRange"; - - /** - * validateLength tagname - */ - final static public String TAG_VALIDATELENGTH = "validateLength"; - - /** - * validateLongRange tagname - */ - final static public String TAG_VALIDATELONGRANGE = "validateLongRange"; - - /** - * validator tagname - */ - final static public String TAG_VALIDATOR = "validator"; - - /** - * valueChangeListener tagname - */ - final static public String TAG_VALUECHANGELISTENER = "valueChangeListener"; - - /** - * verbatim tagname - */ - final static public String TAG_VERBATIM = "verbatim"; - - /** - * view tagname - */ - final static public String TAG_VIEW = "view"; - - /** - * column tagname - */ - final static public String TAG_COLUMN = "column"; - - /** - * commandButton tagname - */ - final static public String TAG_COMMANDBUTTON = "commandButton"; - - /** - * commandLink tagname - */ - final static public String TAG_COMMANDLINK = "commandLink"; - - /** - * dataTable tagname - */ - final static public String TAG_DATATABLE = "dataTable"; - - /** - * form tagname - */ - final static public String TAG_FORM = "form"; - - /** - * graphicImage tagname - */ - final static public String TAG_GRAPHICIMAGE = "graphicImage"; - - /** - * inputHidden tagname - */ - final static public String TAG_INPUTHIDDEN = "inputHidden"; - - /** - * inputSecret tagname - */ - final static public String TAG_INPUTSECRET = "inputSecret"; - - /** - * inputText tagname - */ - final static public String TAG_INPUTTEXT = "inputText"; - - /** - * inputTextarea tagname - */ - final static public String TAG_INPUTTEXTAREA = "inputTextarea"; - - /** - * message tagname - */ - final static public String TAG_MESSAGE = "message"; - - /** - * messages tagname - */ - final static public String TAG_MESSAGES = "messages"; - - /** - * outputFormat tagname - */ - final static public String TAG_OUTPUTFORMAT = "outputFormat"; - - /** - * outputLabel tagname - */ - final static public String TAG_OUTPUTLABEL = "outputLabel"; - - /** - * outputLink tagname - */ - final static public String TAG_OUTPUTLINK = "outputLink"; - - /** - * outputText tagname - */ - final static public String TAG_OUTPUTTEXT = "outputText"; - - /** - * panelGrid tagname - */ - final static public String TAG_PANELGRID = "panelGrid"; - - /** - * panelGroup tagname - */ - final static public String TAG_PANELGROUP = "panelGroup"; - - /** - * selectBooleanCheckbox tagname - */ - final static public String TAG_SELECTBOOLEANCHECKBOX = "selectBooleanCheckbox"; - - /** - * selectManyCheckbox tagname - */ - final static public String TAG_SELECTMANYCHECKBOX = "selectManyCheckbox"; - - /** - * selectManyListbox tagname - */ - final static public String TAG_SELECTMANYLISTBOX = "selectManyListbox"; - - /** - * selectManyMenu tagname - */ - final static public String TAG_SELECTMANYMENU = "selectManyMenu"; - - /** - * selectOneListbox tagname - */ - final static public String TAG_SELECTONELISTBOX = "selectOneListbox"; - - /** - * selectOneMenu tagname - */ - final static public String TAG_SELECTONEMENU = "selectOneMenu"; - - /** - * selectOneMenu tagname - */ - final static public String TAG_SELECTONERADIO = "selectOneRadio"; - - // tag identifiers - /** - * TagIdentifier for TAG_VIEW - */ - final static TagIdentifier TAG_IDENTIFIER_VIEW = - TagIdentifierFactory.createJSPTagWrapper(ITLDConstants.URI_JSF_CORE, TAG_VIEW); - - /** - * TagIdentifier for TAG_LOADBUNDLE - */ - final static TagIdentifier TAG_IDENTIFIER_LOADBUNDLE = - TagIdentifierFactory.createJSPTagWrapper(ITLDConstants.URI_JSF_CORE, TAG_LOADBUNDLE); - - /** - * TagIdentifier for TAG_FACET - */ - final static TagIdentifier TAG_IDENTIFIER_FACET = - TagIdentifierFactory.createJSPTagWrapper(ITLDConstants.URI_JSF_CORE, TAG_FACET); - - /** - * TagIdentifier for TAG_VERBATIM - */ - final static TagIdentifier TAG_IDENTIFIER_VERBATIM = - TagIdentifierFactory.createJSPTagWrapper(ITLDConstants.URI_JSF_CORE, TAG_VERBATIM); - - /** - * TagIdentifier for TAG_DATATABLE - */ - final static TagIdentifier TAG_IDENTIFIER_DATA_TABLE = - TagIdentifierFactory.createJSPTagWrapper(ITLDConstants.URI_JSF_HTML, TAG_DATATABLE); - - /** - * TagIdentifier for TAG_PANELGRID - */ - final static TagIdentifier TAG_IDENTIFIER_PANEL_GRID = - TagIdentifierFactory.createJSPTagWrapper(ITLDConstants.URI_JSF_HTML, TAG_PANELGRID); - - /** - * TagIdentifier for TAG_COLUMN - */ - final static TagIdentifier TAG_IDENTIFIER_COLUMN = - TagIdentifierFactory.createJSPTagWrapper(ITLDConstants.URI_JSF_HTML, TAG_COLUMN); - - /** - * TagIdentifier for TAG_FORM - */ - final static TagIdentifier TAG_IDENTIFIER_FORM = - TagIdentifierFactory.createJSPTagWrapper(ITLDConstants.URI_JSF_HTML, TAG_FORM); - - /** - * TagIdentifier for TAG_INPUTTEXT - */ - final static TagIdentifier TAG_IDENTIFIER_INPUTTEXT = - TagIdentifierFactory.createJSPTagWrapper(ITLDConstants.URI_JSF_HTML, TAG_INPUTTEXT); - - /** - * TagIdentifier for TAG_INPUTSECRET - */ - final static TagIdentifier TAG_IDENTIFIER_INPUTSECRET = - TagIdentifierFactory.createJSPTagWrapper(ITLDConstants.URI_JSF_HTML, TAG_INPUTSECRET); - - /** - * TagIdentifier for TAG_INPUTTEXTAREA - */ - final static TagIdentifier TAG_IDENTIFIER_INPUTTEXTAREA = - TagIdentifierFactory.createJSPTagWrapper(ITLDConstants.URI_JSF_HTML, TAG_INPUTTEXTAREA); - - /** - * TagIdentifier for TAG_OUTPUTTEXT - */ - final static TagIdentifier TAG_IDENTIFIER_OUTPUTTEXT = - TagIdentifierFactory.createJSPTagWrapper(ITLDConstants.URI_JSF_HTML, TAG_OUTPUTTEXT); - - /** - * TagIdentifier for TAG_OUTPUTLABEL - */ - final static TagIdentifier TAG_IDENTIFIER_OUTPUTLABEL = - TagIdentifierFactory.createJSPTagWrapper(ITLDConstants.URI_JSF_HTML, TAG_OUTPUTLABEL); - - /** - * TagIdentifier for TAG_GRAPHICIMAGE - */ - final static TagIdentifier TAG_IDENTIFIER_GRAPHICIMAGE = - TagIdentifierFactory.createJSPTagWrapper(ITLDConstants.URI_JSF_HTML, TAG_GRAPHICIMAGE); - - /** - * TagIdentifier for TAG_COMMANDBUTTON - */ - final static TagIdentifier TAG_IDENTIFIER_COMMANDBUTTON = - TagIdentifierFactory.createJSPTagWrapper(ITLDConstants.URI_JSF_HTML, TAG_COMMANDBUTTON); - - /** - * TagIdentifier for TAG_COMMANDLINK - */ - final static TagIdentifier TAG_IDENTIFIER_COMMANDLINK = - TagIdentifierFactory.createJSPTagWrapper(ITLDConstants.URI_JSF_HTML, TAG_COMMANDLINK); - - /** - * TagIdentifier for TAG_INPUTHIDDEN - */ - final static TagIdentifier TAG_IDENTIFIER_INPUTHIDDEN = - TagIdentifierFactory.createJSPTagWrapper(ITLDConstants.URI_JSF_HTML, TAG_INPUTHIDDEN); - - /** - * TagIdentifier for TAG_MESSAGE - */ - final static TagIdentifier TAG_IDENTIFIER_MESSAGE = - TagIdentifierFactory.createJSPTagWrapper(ITLDConstants.URI_JSF_HTML, TAG_MESSAGE); - - /** - * TagIdentifier for TAG_MESSAGES - */ - final static TagIdentifier TAG_IDENTIFIER_MESSAGES = - TagIdentifierFactory.createJSPTagWrapper(ITLDConstants.URI_JSF_HTML, TAG_MESSAGES); - - /** - * TagIdentifier for TAG_OUTPUTFORMAT - */ - final static TagIdentifier TAG_IDENTIFIER_OUTPUTFORMAT = - TagIdentifierFactory.createJSPTagWrapper(ITLDConstants.URI_JSF_HTML, TAG_OUTPUTFORMAT); - - /** - * TagIdentifier for TAG_OUTPUTLINK - */ - final static TagIdentifier TAG_IDENTIFIER_OUTPUTLINK = - TagIdentifierFactory.createJSPTagWrapper(ITLDConstants.URI_JSF_HTML, TAG_OUTPUTLINK); - - /** - * TagIdentifier for TAG_PANELGROUP - */ - final static TagIdentifier TAG_IDENTIFIER_PANEL_GROUP = - TagIdentifierFactory.createJSPTagWrapper(ITLDConstants.URI_JSF_HTML, TAG_PANELGROUP); - - /** - * TagIdentifier for TAG_SELECTBOOLEANCHECKBOX - */ - final static TagIdentifier TAG_IDENTIFIER_SELECTBOOLEANCHECKBOX = - TagIdentifierFactory.createJSPTagWrapper(ITLDConstants.URI_JSF_HTML, TAG_SELECTBOOLEANCHECKBOX); - - /** - * TagIdentifier for TAG_SELECTMANYCHECKBOX - */ - final static TagIdentifier TAG_IDENTIFIER_SELECTMANYCHECKBOX = - TagIdentifierFactory.createJSPTagWrapper(ITLDConstants.URI_JSF_HTML, TAG_SELECTMANYCHECKBOX); - - /** - * TagIdentifier for TAG_SELECTMANYLISTBOX - */ - final static TagIdentifier TAG_IDENTIFIER_SELECTMANYLISTBOX = - TagIdentifierFactory.createJSPTagWrapper(ITLDConstants.URI_JSF_HTML, TAG_SELECTMANYLISTBOX); - - /** - * TagIdentifier for TAG_SELECTMANYMENU - */ - final static TagIdentifier TAG_IDENTIFIER_SELECTMANYMENU = - TagIdentifierFactory.createJSPTagWrapper(ITLDConstants.URI_JSF_HTML, TAG_SELECTMANYMENU); - - /** - * TagIdentifier for TAG_SELECTONELISTBOX - */ - final static TagIdentifier TAG_IDENTIFIER_SELECTONELISTBOX = - TagIdentifierFactory.createJSPTagWrapper(ITLDConstants.URI_JSF_HTML, TAG_SELECTONELISTBOX); - - /** - * TagIdentifier for TAG_SELECTONEMENU - */ - final static TagIdentifier TAG_IDENTIFIER_SELECTONEMENU = - TagIdentifierFactory.createJSPTagWrapper(ITLDConstants.URI_JSF_HTML, TAG_SELECTONEMENU); - - /** - * TagIdentifier for TAG_SELECTONERADIO - */ - final static TagIdentifier TAG_IDENTIFIER_SELECTONERADIO = - TagIdentifierFactory.createJSPTagWrapper(ITLDConstants.URI_JSF_HTML, TAG_SELECTONERADIO); - - /** - * TagIdentifier for TAG_ACTIONLISTENER - */ - final static TagIdentifier TAG_IDENTIFIER_ACTIONLISTENER = - TagIdentifierFactory.createJSPTagWrapper(ITLDConstants.URI_JSF_CORE, TAG_ACTIONLISTENER); - - /** - * TagIdentifier for TAG_ATTRIBUTE - */ - final static TagIdentifier TAG_IDENTIFIER_ATTRIBUTE = - TagIdentifierFactory.createJSPTagWrapper(ITLDConstants.URI_JSF_CORE, TAG_ATTRIBUTE); - - /** - * TagIdentifier for TAG_CONVERTDATETIME - */ - final static TagIdentifier TAG_IDENTIFIER_CONVERTDATETIME = - TagIdentifierFactory.createJSPTagWrapper(ITLDConstants.URI_JSF_CORE, TAG_CONVERTDATETIME); - - /** - * TagIdentifier for TAG_CONVERTNUMBER - */ - final static TagIdentifier TAG_IDENTIFIER_CONVERTNUMBER = - TagIdentifierFactory.createJSPTagWrapper(ITLDConstants.URI_JSF_CORE, TAG_CONVERTNUMBER); - - /** - * TagIdentifier for TAG_CONVERTER - */ - final static TagIdentifier TAG_IDENTIFIER_CONVERTER = - TagIdentifierFactory.createJSPTagWrapper(ITLDConstants.URI_JSF_CORE, TAG_CONVERTER); - - /** - * TagIdentifier for TAG_PARAM - */ - final static TagIdentifier TAG_IDENTIFIER_PARAM = - TagIdentifierFactory.createJSPTagWrapper(ITLDConstants.URI_JSF_CORE, TAG_PARAM); - - /** - * TagIdentifier for TAG_PHASELISTENER - */ - final static TagIdentifier TAG_IDENTIFIER_PHASELISTENER = - TagIdentifierFactory.createJSPTagWrapper(ITLDConstants.URI_JSF_CORE, TAG_PHASELISTENER); - - /** - * TagIdentifier for TAG_SELECTITEM - */ - final static TagIdentifier TAG_IDENTIFIER_SELECTITEM = - TagIdentifierFactory.createJSPTagWrapper(ITLDConstants.URI_JSF_CORE, TAG_SELECTITEM); - - /** - * TagIdentifier for TAG_SELECTITEMS - */ - final static TagIdentifier TAG_IDENTIFIER_SELECTITEMS = - TagIdentifierFactory.createJSPTagWrapper(ITLDConstants.URI_JSF_CORE, TAG_SELECTITEMS); - - /** - * TagIdentifier for TAG_SETPROPERTYACTIONLISTENER - */ - final static TagIdentifier TAG_IDENTIFIER_SETPROPERTYACTIONLISTENER = - TagIdentifierFactory.createJSPTagWrapper(ITLDConstants.URI_JSF_CORE, TAG_SETPROPERTYACTIONLISTENER); - - /** - * TagIdentifier for TAG_SUBVIEW - */ - final static TagIdentifier TAG_IDENTIFIER_SUBVIEW = - TagIdentifierFactory.createJSPTagWrapper(ITLDConstants.URI_JSF_CORE, TAG_SUBVIEW); - - /** - * TagIdentifier for TAG_VALIDATEDOUBLERANGE - */ - final static TagIdentifier TAG_IDENTIFIER_VALIDATEDOUBLERANGE = - TagIdentifierFactory.createJSPTagWrapper(ITLDConstants.URI_JSF_CORE, TAG_VALIDATEDOUBLERANGE); - - /** - * TagIdentifier for TAG_VALIDATELENGTH - */ - final static TagIdentifier TAG_IDENTIFIER_VALIDATELENGTH = - TagIdentifierFactory.createJSPTagWrapper(ITLDConstants.URI_JSF_CORE, TAG_VALIDATELENGTH); - - /** - * TagIdentifier for TAG_VALIDATELONGRANGE - */ - final static TagIdentifier TAG_IDENTIFIER_VALIDATELONGRANGE = - TagIdentifierFactory.createJSPTagWrapper(ITLDConstants.URI_JSF_CORE, TAG_VALIDATELONGRANGE); - - /** - * TagIdentifier for TAG_VALIDATOR - */ - final static TagIdentifier TAG_IDENTIFIER_VALIDATOR = - TagIdentifierFactory.createJSPTagWrapper(ITLDConstants.URI_JSF_CORE, TAG_VALIDATOR); - - /** - * TagIdentifier for TAG_VALUECHANGELISTENER - */ - final static TagIdentifier TAG_IDENTIFIER_VALUECHANGELISTENER = - TagIdentifierFactory.createJSPTagWrapper(ITLDConstants.URI_JSF_CORE, TAG_VALUECHANGELISTENER); - - // attribute names - /** - * accept tag attribute name - */ - final static public String ATTR_ACCEPT = "accept"; - - /** - * acceptcharset tag attribute name - */ - final static public String ATTR_ACCEPTCHARSET = "acceptcharset"; - - /** - * accesskey tag attribute name - */ - final static public String ATTR_ACCESSKEY = "accesskey"; - - /** - * action tag attribute name - */ - final static public String ATTR_ACTION = "action"; - - /** - * actionListener tag attribute name - */ - final static public String ATTR_ACTIONLISTENER = "actionListener"; - - /** - * alt tag attribute name - */ - final static public String ATTR_ALT = "alt"; - - /** - * basename tag attribute name - */ - final static public String ATTR_BASENAME = "basename"; - - /** - * bgcolor tag attribute name - */ - final static public String ATTR_BGCOLOR = "bgcolor"; - - /** - * binding tag attribute name - */ - final static public String ATTR_BINDING = "binding"; - - /** - * border tag attribute name - */ - final static public String ATTR_BORDER = "border"; - - /** - * cellpadding tag attribute name - */ - final static public String ATTR_CELLPADDING = "cellpadding"; - - /** - * cellspacing tag attribute name - */ - final static public String ATTR_CELLSPACING = "cellspacing"; - - /** - * charset tag attribute name - */ - final static public String ATTR_CHARSET = "charset"; - - /** - * cols tag attribute name - */ - final static public String ATTR_COLS = "cols"; - - /** - * columnClasses tag attribute name - */ - final static public String ATTR_COLUMNCLASSES = "columnClasses"; - - /** - * columns tag attribute name - */ - final static public String ATTR_COLUMNS = "columns"; - - /** - * converterId tag attribute name - */ - final static public String ATTR_CONVERTERID = "converterId"; - - /** - * coords tag attribute name - */ - final static public String ATTR_COORDS = "coords"; - - /** - * currencyCode tag attribute name - */ - final static public String ATTR_CURRENCYCODE = "currencyCode"; - - /** - * currencySymbol tag attribute name - */ - final static public String ATTR_CURRENCYSYMBOL = "currencySymbol"; - - /** - * dateStyle tag attribute name - */ - final static public String ATTR_DATESTYLE = "dateStyle"; - - /** - * dir tag attribute name - */ - final static public String ATTR_DIR = "dir"; - - /** - * disabled tag attribute name - */ - final static public String ATTR_DISABLED = "disabled"; - - /** - * errorClass tag attribute name - */ - final static public String ATTR_ERRORCLASS = "errorClass"; - - /** - * errorStyle tag attribute name - */ - final static public String ATTR_ERRORSTYLE = "errorStyle"; - - /** - * escape tag attribute name - */ - final static public String ATTR_ESCAPE = "escape"; - - /** - * fatalClass tag attribute name - */ - final static public String ATTR_FATALCLASS = "fatalClass"; - - /** - * fatalStyle tag attribute name - */ - final static public String ATTR_FATALSTYLE = "fatalStyle"; - - /** - * first tag attribute name - */ - final static public String ATTR_FIRST = "first"; - - /** - * footerClass tag attribute name - */ - final static public String ATTR_FOOTERCLASS = "footerClass"; - - /** - * for tag attribute name - */ - final static public String ATTR_FOR = "for"; - - /** - * frame tag attribute name - */ - final static public String ATTR_FRAME = "frame"; - - /** - * globalOnly tag attribute name - */ - final static public String ATTR_GLOBEONLY = "globalOnly"; - - /** - * headerClass tag attribute name - */ - final static public String ATTR_HEADERCLASS = "headerClass"; - - /** - * hreflang tag attribute name - */ - final static public String ATTR_HREFLANG = "hreflang"; - - /** - * id tag attribute name - */ - final static public String ATTR_ID = "id"; - - /** - * image tag attribute name - */ - final static public String ATTR_IMAGE = "image"; - - /** - * immediate tag attribute name - */ - final static public String ATTR_IMMEDIATE = "immediate"; - - /** - * infoClass tag attribute name - */ - final static public String ATTR_INFOCLASS = "infoClass"; - - /** - * infoStyle tag attribute name - */ - final static public String ATTR_INFOSTYLE = "infoStyle"; - - /** - * itemDescription tag attribute name - */ - final static public String ATTR_ITEMDESCRIPTION = "itemDescription"; - - /** - * itemDisabled tag attribute name - */ - final static public String ATTR_ITEMDISABLED = "itemDisabled"; - - /** - * itemLabel tag attribute name - */ - final static public String ATTR_ITEMLABEL = "itemLabel"; - - /** - * itemValue tag attribute name - */ - final static public String ATTR_ITEMVALUE = "itemValue"; - - /** - * lang tag attribute name - */ - final static public String ATTR_LANG = "lang"; - - /** - * layout tag attribute name - */ - final static public String ATTR_LAYOUT = "layout"; - - /** - * locale tag attribute name - */ - final static public String ATTR_LOCALE = "locale"; - - /** - * maximum tag attribute name - */ - final static public String ATTR_MAXIMUM = "maximum"; - - /** - * minimum tag attribute name - */ - final static public String ATTR_MINIMUM = "minimum"; - - /** - * name tag attribute name - */ - final static public String ATTR_NAME = "name"; - - /** - * onblur tag attribute name - */ - final static public String ATTR_ONBLUR = "onblur"; - - /** - * onchange tag attribute name - */ - final static public String ATTR_ONCHANGE = "onchange"; - - /** - * onclick tag attribute name - */ - final static public String ATTR_ONCLICK = "onclick"; - - /** - * ondblclick tag attribute name - */ - final static public String ATTR_ONDBLCLICK = "ondblclick"; - - /** - * onfocus tag attribute name - */ - final static public String ATTR_ONFOCUS = "onfocus"; - - /** - * onkeydown tag attribute name - */ - final static public String ATTR_ONKEYDOWN = "onkeydown"; - - /** - * onkeypress tag attribute name - */ - final static public String ATTR_ONKEYPRESS = "onkeypress"; - - /** - * onkeyup tag attribute name - */ - final static public String ATTR_ONKEYUP = "onkeyup"; - - /** - * onmousedown tag attribute name - */ - final static public String ATTR_ONMOUSEDOWN = "onmousedown"; - - /** - * onmousemove tag attribute name - */ - final static public String ATTR_ONMOUSEMOVE = "onmousemove"; - - /** - * onmouseout tag attribute name - */ - final static public String ATTR_ONMOUSEOUT = "onmouseout"; - - /** - * onmouseover tag attribute name - */ - final static public String ATTR_ONMOUSEOVER = "onmouseover"; - - /** - * onmouseup tag attribute name - */ - final static public String ATTR_ONMOUSEUP = "onmouseup"; - - /** - * onselect tag attribute name - */ - final static public String ATTR_ONSELECT = "onselect"; - - /** - * pattern tag attribute name - */ - final static public String ATTR_PATTERN = "pattern"; - - /** - * readonly tag attribute name - */ - final static public String ATTR_READONLY = "readonly"; - - /** - * rel tag attribute name - */ - final static public String ATTR_REL = "rel"; - - /** - * rendered tag attribute name - */ - final static public String ATTR_RENDERED = "rendered"; - - /** - * rev tag attribute name - */ - final static public String ATTR_REV = "rev"; - - /** - * rowClasses tag attribute name - */ - final static public String ATTR_ROWCLASSES = "rowClasses"; - - /** - * rows tag attribute name - */ - final static public String ATTR_ROWS = "rows"; - - /** - * rules tag attribute name - */ - final static public String ATTR_RULES = "rules"; - - /** - * shape tag attribute name - */ - final static public String ATTR_SHAPE = "shape"; - - /** - * showDetail tag attribute name - */ - final static public String ATTR_SHOWDETAIL = "showDetail"; - - /** - * showSummary tag attribute name - */ - final static public String ATTR_SHOWSUMMARY = "showSummary"; - - /** - * size tag attribute name - */ - final static public String ATTR_SIZE = "size"; - - /** - * style tag attribute name - */ - final static public String ATTR_STYLE = "style"; - - /** - * styleClass tag attribute name - */ - final static public String ATTR_STYLECLASS = "styleClass"; - - /** - * summary tag attribute name - */ - final static public String ATTR_SUMMARY = "summary"; - - /** - * tabindex tag attribute name - */ - final static public String ATTR_TABINDEX = "tabindex"; - - /** - * target tag attribute name - */ - final static public String ATTR_TARGET = "target"; - - /** - * timeStyle tag attribute name - */ - final static public String ATTR_TIMESTYLE = "timeStyle"; - - /** - * title tag attribute name - */ - final static public String ATTR_TITLE = "title"; - - /** - * tooltip tag attribute name - */ - final static public String ATTR_TOOLTIP = "tooltip"; - - /** - * type tag attribute name - */ - final static public String ATTR_TYPE = "type"; - - /** - * url tag attribute name - */ - final static public String ATTR_URL = "url"; - - /** - * validatorId tag attribute name - */ - final static public String ATTR_VALIDATORID = "validatorId"; - - /** - * value tag attribute name - */ - final static public String ATTR_VALUE = "value"; - - /** - * var tag attribute name - */ - final static public String ATTR_VAR = "var"; - - /** - * warnClass tag attribute name - */ - final static public String ATTR_WARNCLASS = "warnClass"; - - /** - * warnStyle tag attribute name - */ - final static public String ATTR_WARNSTYLE = "warnStyle"; - - /** - * width tag attribute name - */ - final static public String ATTR_WIDTH = "width"; - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/tld/ITLDConstants.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/tld/ITLDConstants.java deleted file mode 100644 index 3ec16f476..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/tld/ITLDConstants.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.internal.tld; - -/** - * Global tag library constants - * - * @author cbateman - * - */ -public interface ITLDConstants { - - /** - * The JSF core (f) component URI - */ - public static final String URI_JSF_CORE = "http://java.sun.com/jsf/core"; //$NON-NLS-1$ - /** - * The JSF html (h) component URI - */ - public static final String URI_JSF_HTML = "http://java.sun.com/jsf/html"; //$NON-NLS-1$ - /** - * The last component of the html uri - */ - public static final String URI_HTML = "html"; //$NON-NLS-1$ - /** - * The last component of the core uri - */ - public static final String URI_JSP = "jsp"; //$NON-NLS-1$ - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/tld/JSPTagIdentifier.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/tld/JSPTagIdentifier.java deleted file mode 100644 index 8546c38f2..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/tld/JSPTagIdentifier.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.internal.tld; - -import org.eclipse.jst.jsf.common.dom.TagIdentifier; - -/** - * A tag wrapper for a JSP tag. - * - * @author cbateman - * - */ -/*package*/ class JSPTagIdentifier extends TagIdentifier -{ - private final String _uri; - private final String _tagName; - - /** - * @param uri - * @param tagName - */ - public JSPTagIdentifier(final String uri, final String tagName) - { - _uri = uri; - _tagName = tagName; - } - public String getTagName() { - return _tagName; - } - - public String getUri() { - return _uri; - } - - public boolean isJSPTag() { - return true; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/tld/LoadBundleUtil.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/tld/LoadBundleUtil.java deleted file mode 100644 index daf4e7a82..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/tld/LoadBundleUtil.java +++ /dev/null @@ -1,297 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Sybase, Inc. and others. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.internal.tld; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; -import java.util.Locale; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IStorage; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.jdt.core.IClasspathEntry; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IPackageFragmentRoot; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.JavaModelException; - -/** - * @author mengbo - */ -public class LoadBundleUtil { - - private LoadBundleUtil() { - // no external instantiation - } - - - /** - * @param project - * @param baseName - * @return an IStorage pointing to the request bundle or null if not found - * @throws CoreException if the search for the file encounters a problem - */ - public static IStorage getLoadBundleResource(final IProject project, - final String baseName) throws CoreException { - if (project == null || baseName == null) { - return null; - } - IStorage loadBundleResource = null; - if (project.hasNature(JavaCore.NATURE_ID)) { - IJavaProject javaProject = JavaCore.create(project); - IFile sourceFile = getSourceFile(javaProject, baseName); - if (sourceFile == null || !sourceFile.exists()) { - loadBundleResource = getJarFile(javaProject, baseName); - } else { - loadBundleResource = sourceFile; - } - } - - return loadBundleResource; - } - - private static IFile getSourceFile(IJavaProject javaProject, String baseName) - throws JavaModelException { - IClasspathEntry[] classpathEntries = javaProject.getRawClasspath(); - for (int i = 0; i < classpathEntries.length; i++) { - if (classpathEntries[i].getEntryKind() == IClasspathEntry.CPE_SOURCE) { - IPath path = classpathEntries[i].getPath().append( - getFilePath(baseName)).removeFirstSegments(1); - path = javaProject.getProject().getFullPath().append(path); - IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile( - path); - if (file.exists()) { - return file; - } - } - } - return null; - } - - private static IPath getFilePath(String baseName) { - IPath path = new Path(baseName.replace('.', '/'));//$NON-NLS-1$ - path = path.addFileExtension("properties");//$NON-NLS-1$ - return path; - } - - private static IStorage getJarFile(IJavaProject javaProject, String baseName) - throws JavaModelException { - IClasspathEntry[] roots = javaProject.getRawClasspath(); - for (int i = 0; i < roots.length; i++) { - if (roots[i].getEntryKind() != IClasspathEntry.CPE_LIBRARY) { - continue; - } - - IPackageFragmentRoot[] packageFragmentRoots = javaProject - .findPackageFragmentRoots(roots[i]); - for (int j = 0; j < packageFragmentRoots.length; j++) { - String packageName = getPackageName(baseName); - Object[] resources = null; - if (packageName.length() == 0) { - resources = packageFragmentRoots[j].getNonJavaResources(); - } else { - IPackageFragment fragment = packageFragmentRoots[j] - .getPackageFragment(getPackageName(baseName)); - if (fragment != null && fragment.exists()) { - resources = fragment.getNonJavaResources(); - } - } - - if (resources != null && resources.length > 0) { - for (int k = 0; k < resources.length; k++) { - if (resources[k] instanceof IStorage) { - IStorage storage = (IStorage) resources[k]; - if (getFileName(baseName).equalsIgnoreCase( - storage.getName())) { - return storage; - } - } - } - } - } - } - return null; - } - - private static String getPackageName(String baseName) { - int index = baseName.lastIndexOf('.');//$NON-NLS-1$ - if (index == -1) { - return "";//$NON-NLS-1$ - } - return baseName.substring(0, index); - } - - private static String getFileName(String baseName) { - int index = baseName.lastIndexOf('.');//$NON-NLS-1$ - if (index == -1) { - return baseName + ".properties"; - } - return baseName.substring(index + 1).concat(".properties");//$NON-NLS-1$ - } - - /** - * Encapsulates the hiearchy of bundle data sources in the hierarchy - * for a ResourceBundle base name. In practice this is often simply - * a single IFile for a - * @author cbateman - * - */ -// public static class BundleHierarchy -// { -// // list in order from most specific (first queried) to least, -// // front to back -// //private final List _hierarchy; -// -// /** -// * Takes the list *by reference*. Does not take a copy. -// * @param hierarchy -// */ -// public BundleHierarchy(List hierarchy) -// { -// _hierarchy = hierarchy; -// } -// -// public BundleHierarchy() -// { -// _hierarchy = new ArrayList(); -// } -// } - - /** - * Used to describe the design time approximation of the locale lookup precendence - * that will be used by ResourceBundle to find a localized resource bundle. - * - * See the official JavaDoc for java.util.ResourceBundle.getBundle for docs on search - * order. - * - * @author cbateman - * - */ - public static class LocaleDescriptor - { - private Locale _locale; - private List _possibleSuffices; - - /** - * @param language -- must not be null - */ - public LocaleDescriptor(String language) - { - _locale = new Locale(language); - } - - /** - * All arguments must be non-null. To set a language only descriptor, - * see others. - * - * @param language -- must not be null - * @param country -- must not be null - */ - public LocaleDescriptor(String language, - String country) - { - _locale = new Locale(language, country); - } - - /** - * All arguments must be non-null. Null arguments will cause an exception. - * To create descriptor without variant and/or country set, see other constructors - * @param language -- must not be null - * @param country -- must not be null - * @param variant -- must not be null - */ - public LocaleDescriptor(String language, - String country, String variant) - { - _locale = new Locale(language, country, variant); - } - - /** - * @param baseName - * @return an iterator through all possible bundle names starting with the most - * specific and becoming more general for base name based on this locale. - * - * i.e. if baseName is "bundle" and the local is en_US_1 then in order the - * iterator will produce: - * - * bundle_en_US_1 - * bundle_en_US - * bundle_en - * bundle - * - * per the ResourceBundle API - * - */ - public Iterator getBundleNameIterator(final String baseName) - { - - return new Iterator() - { - final Iterator it = getPossibleBaseNameSuffices().iterator(); - - public boolean hasNext() { - return it.hasNext(); - } - - public Object next() { - return baseName+it.next(); - } - - public void remove() { - // delegate; should throw exception - it.remove(); - } - }; - } - - private synchronized List getPossibleBaseNameSuffices() - { - if (_possibleSuffices == null) - { - List possibleSuffices = new ArrayList(3); - - final String language = _locale.getLanguage(); - final String country = _locale.getCountry(); - final String variant = _locale.getVariant(); - - possibleSuffices.add(""); - possibleSuffices.add("_"+language); - if (country != null) - { - possibleSuffices.add(0, "_"+language + "_" + country); - if (variant != null) - { - possibleSuffices.add(0, "_"+language+"_"+country+"_"+variant); - } - } - _possibleSuffices = Collections.unmodifiableList(possibleSuffices); - } - - return _possibleSuffices; - } - - /** - * @return the local information as a standard locale object - */ - public Locale getLocale() - { - return _locale; - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/tld/TLDTagIdentifier.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/tld/TLDTagIdentifier.java deleted file mode 100644 index 97f946ace..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/tld/TLDTagIdentifier.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.internal.tld; - -import org.eclipse.jst.jsf.common.dom.TagIdentifier; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDDocument; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDElementDeclaration; - -final class TLDTagIdentifier extends TagIdentifier -{ - private final TLDElementDeclaration _tldDecl; - - public TLDTagIdentifier(final TLDElementDeclaration tldDecl) - { - _tldDecl = tldDecl; - } - - @Override - public String getTagName() - { - return _tldDecl.getElementName(); - } - - @Override - public String getUri() - { - return ((TLDDocument)_tldDecl.getOwnerDocument()).getUri(); - } - - @Override - public boolean isJSPTag() - { - return true; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/tld/TagIdentifierFactory.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/tld/TagIdentifierFactory.java deleted file mode 100644 index 013a973e5..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/tld/TagIdentifierFactory.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.internal.tld; - -import org.eclipse.jst.jsf.common.dom.TagIdentifier; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDDocument; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDElementDeclaration; -import org.w3c.dom.Element; - -/** - * Factory creating tag identifiers - * - * @author cbateman - * - */ -public final class TagIdentifierFactory -{ - /** - * Create a tag identifier based on a uri and tagName - * - * @param uri - * @param tagName - * @return a new tag identifier for (uri, tagName) - */ - public static TagIdentifier createJSPTagWrapper(final String uri, final String tagName) - { - return new JSPTagIdentifier(uri, tagName); - } - - /** - * @param element - * @return a tag identifier based on a DOM element - */ - public static TagIdentifier createDocumentTagWrapper(final Element element) - { - return new DocumentTagIdentifier(element); - } - - /** - * @param elementDecl - * @return a tag identifier that bridges a TLDElementDeclaration - */ - public static TagIdentifier createTLDTagWrapper(final TLDElementDeclaration elementDecl) - { - if (!(elementDecl.getOwnerDocument() instanceof TLDDocument)) - { - throw new IllegalArgumentException("Element decl must have a tlddoc for a parent: "+elementDecl.toString()); - } - return new TLDTagIdentifier(elementDecl); - } - - private TagIdentifierFactory() - { - // static class, no external instantiation - } -} - diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/AbstractJSFAppConfigLocater.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/AbstractJSFAppConfigLocater.java deleted file mode 100644 index 943fecb99..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/AbstractJSFAppConfigLocater.java +++ /dev/null @@ -1,172 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Ian Trimble - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.jsfappconfig; - -import java.util.Collections; -import java.util.Iterator; -import java.util.LinkedHashSet; -import java.util.Set; - -/** - * Abstract implementation of {@link IJSFAppConfigLocater} that provides common - * locater functionality. {@link IJSFAppConfigLocater} implementations should - * extend this class or provide similar functionality. - * - * <p><b>Provisional API - subject to change</b></p> - * - * @author Ian Trimble - Oracle - */ -public abstract class AbstractJSFAppConfigLocater implements IJSFAppConfigLocater { - - /** - * {@link JSFAppConfigManager} instance to which this locater belongs. - */ - protected JSFAppConfigManager manager = null; - - /** - * Set of known {@link IJSFAppConfigProvider} instances. - */ - protected Set configProviders = new LinkedHashSet(); - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.core.jsfappconfig.IJSFAppConfigLocater#setJSFAppConfigManager(org.eclipse.jst.jsf.core.jsfappconfig.JSFAppConfigManager) - */ - public void setJSFAppConfigManager(JSFAppConfigManager manager) { - this.manager = manager; - } - - /* - * (non-Javadoc) - * @see org.eclipse.jst.jsf.core.jsfappconfig.IJSFAppConfigLocater#getJSFAppConfigManager() - */ - public JSFAppConfigManager getJSFAppConfigManager() { - return manager; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.core.jsfappconfig.IJSFAppConfigLocater#startLocating() - */ - public abstract void startLocating(); - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.core.jsfappconfig.IJSFAppConfigLocater#stopLocating() - */ - public abstract void stopLocating(); - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.core.jsfappconfig.IJSFAppConfigLocater#getJSFAppConfigProviders() - */ - public Set getJSFAppConfigProviders() { - return configProviders; - } - - /** - * Adds an {@link IJSFAppConfigProvider} instance to the set of known - * instances and notifies {@link JSFAppConfigManager} instance of the - * addition if successful. - * - * @param configProvider {@link IJSFAppConfigProvider} instance to be - * added. - * @return true if instance was added, else false. - */ - protected boolean addConfigProvider(IJSFAppConfigProvider configProvider) { - boolean added = configProviders.add(configProvider); - if (added && manager != null) { - configProvider.setJSFAppConfigLocater(this); - manager.notifyJSFAppConfigProvidersChangeListeners( - configProvider, - JSFAppConfigProvidersChangeEvent.ADDED); - } - return added; - } - - /** - * Removes an {@link IJSFAppConfigProvider} instance from the set of known - * instances and notifies {@link JSFAppConfigManager} instance of the - * removal if successful. - * - * @param configProvider {@link IJSFAppConfigProvider} instance to be - * removed. - * @return true if instance was removed, else false. - */ - protected boolean removeConfigProvider(IJSFAppConfigProvider configProvider) { - if (configProvider != null) { - configProvider.releaseFacesConfigModel(); - } - boolean removed = configProviders.remove(configProvider); - if (removed && manager != null) { - manager.notifyJSFAppConfigProvidersChangeListeners( - configProvider, - JSFAppConfigProvidersChangeEvent.REMOVED); - } - return removed; - } - - /** - * Updates known set of {@link IJSFAppConfigProvider} instances by removing - * instances that are in the existing set but not in the passed set and - * adding instances that are in the passed set but not in the existing set. - * Instances that are in both the existing set and the passed set are left - * unchanged. The {@link JSFAppConfigManager} is notified of removals and - * additions, and no notification is sent for instances that are left - * unchanged. - * - * @param newConfigProviders New set of {@link IJSFAppConfigProvider} - * instances. - */ - protected void updateConfigProviders(Set newConfigProviders) { - if (newConfigProviders != null) { - LinkedHashSet oldConfigProviders = new LinkedHashSet(); - //iterate over existing set - Iterator itConfigProviders = configProviders.iterator(); - while (itConfigProviders.hasNext()) { - IJSFAppConfigProvider configProvider = (IJSFAppConfigProvider)itConfigProviders.next(); - //remove provider from new set if it is already in existing set - if (!newConfigProviders.remove(configProvider)) { - //stage removal of existing provider that is not in new set - oldConfigProviders.add(configProvider); - } - } - //remove providers that are not in new set from existing set - Iterator itOldConfigProviders = oldConfigProviders.iterator(); - while (itOldConfigProviders.hasNext()) { - IJSFAppConfigProvider configProvider = (IJSFAppConfigProvider)itOldConfigProviders.next(); - //call removeConfigProvider(...) method so manager's listeners are notified - removeConfigProvider(configProvider); - } - //add providers that are still in new set to existing set - Iterator itNewConfigProviders = newConfigProviders.iterator(); - while (itNewConfigProviders.hasNext()) { - IJSFAppConfigProvider configProvider = (IJSFAppConfigProvider)itNewConfigProviders.next(); - //call addConfigProvider(...) method so manager's listeners are notified - addConfigProvider(configProvider); - } - } - } - - /** - * Removes all {@link IJSFAppConfigProvider} instances from the known set, - * sending notification of all removals to the {@link JSFAppConfigManager} - * instance. - */ - protected void removeAllConfigProviders() { - updateConfigProviders(Collections.EMPTY_SET); - } - - /* - * (non-Javadoc) - * @see java.lang.Object#finalize() - */ - protected void finalize() { - removeAllConfigProviders(); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/AbstractJSFAppConfigProvider.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/AbstractJSFAppConfigProvider.java deleted file mode 100644 index baaf9e14e..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/AbstractJSFAppConfigProvider.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Ian Trimble - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.jsfappconfig; - -import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigType; - -/** - * Abstract implementation of {@link IJSFAppConfigProvider} that provides - * common provider functionality. {@link IJSFAppConfigProvider} instances - * should extend this class or provide similar functionality. - * - * <p><b>Provisional API - subject to change</b></p> - * - * @author Ian Trimble - Oracle - */ -public abstract class AbstractJSFAppConfigProvider implements IJSFAppConfigProvider { - - /** - * {@link IJSFAppConfigLocater} instance that located this instance. - */ - protected IJSFAppConfigLocater jsfAppConfigLocater = null; - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.core.jsfappconfig.IJSFAppConfigProvider#setJSFAppConfigLocater(org.eclipse.jst.jsf.core.jsfappconfig.IJSFAppConfigLocater) - */ - public void setJSFAppConfigLocater(IJSFAppConfigLocater locater) { - this.jsfAppConfigLocater = locater; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.core.jsfappconfig.IJSFAppConfigProvider#getFacesConfigModel() - */ - public abstract FacesConfigType getFacesConfigModel(); - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.core.jsfappconfig.IJSFAppConfigProvider#releaseFacesConfigModel() - */ - public abstract void releaseFacesConfigModel(); - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/ArtifactEditJSFAppConfigProvider.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/ArtifactEditJSFAppConfigProvider.java deleted file mode 100644 index 50ba81acb..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/ArtifactEditJSFAppConfigProvider.java +++ /dev/null @@ -1,137 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Ian Trimble - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.jsfappconfig; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IPath; -import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigType; -import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit; - -/** - * ArtifactEditJSFAppConfigProvider uses FacesConfigArtifactEdit to provide - * the root element of an application configuration model. - * - * <p><b>Provisional API - subject to change</b></p> - * - * @author Ian Trimble - Oracle - */ -public class ArtifactEditJSFAppConfigProvider extends AbstractJSFAppConfigProvider { - - /** - * IFile instance that represents an application configuration resource - * file. - */ - protected IFile appConfigFile = null; - - /** - * FacesConfigArtifactEdit instance used to get the application - * configuration model. - */ - protected FacesConfigArtifactEdit facesConfigArtifactEdit = null; - - /** - * Cached {@link FacesConfigType} instance. - */ - protected FacesConfigType facesConfig = null; - - /** - * Creates an instance, storing the passed IFile instance for subsequent - * processing. - * - * @param appConfigFile IFile instance that represents an application - * configuration resource file - */ - public ArtifactEditJSFAppConfigProvider(IFile appConfigFile) { - this.appConfigFile = appConfigFile; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.core.jsfappconfig.IJSFAppConfigProvider#getFacesConfigModel() - */ - public FacesConfigType getFacesConfigModel() { - if (facesConfig == null) { - if (appConfigFile != null) { - IProject project = appConfigFile.getProject(); - IPath appConfigFilePath = JSFAppConfigUtils.getWebContentFolderRelativePath(appConfigFile); - if (appConfigFilePath != null) { - facesConfigArtifactEdit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(project, appConfigFilePath.toString()); - if (facesConfigArtifactEdit != null) { - facesConfig = facesConfigArtifactEdit.getFacesConfig(); - if (facesConfig != null) { - jsfAppConfigLocater.getJSFAppConfigManager().addFacesConfigChangeAdapter(facesConfig); - } - } - } - } - } - return facesConfig; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.core.jsfappconfig.IJSFAppConfigProvider#releaseFacesConfigModel() - */ - public void releaseFacesConfigModel() { - jsfAppConfigLocater.getJSFAppConfigManager().removeFacesConfigChangeAdapter(facesConfig); - if (facesConfigArtifactEdit != null) { - facesConfigArtifactEdit.dispose(); - } - } - - /* - * (non-Javadoc) - * @see java.lang.Object#equals(java.lang.Object) - */ - public boolean equals(Object otherObject) { - boolean equals = false; - if (otherObject instanceof ArtifactEditJSFAppConfigProvider) { - IFile otherAppConfigFile = ((ArtifactEditJSFAppConfigProvider)otherObject).appConfigFile; - if (appConfigFile != null) { - equals = appConfigFile.equals(otherAppConfigFile); - } else { - equals = otherAppConfigFile == null; - } - } - return equals; - } - - /* - * (non-Javadoc) - * @see java.lang.Object#hashCode() - */ - public int hashCode() { - return appConfigFile != null ? appConfigFile.hashCode() : 0; - } - - /* - * (non-Javadoc) - * @see java.lang.Object#toString() - */ - public String toString() { - StringBuffer sb = new StringBuffer("ArtifactEditJSFAppConfigProvider["); //$NON-NLS-1$ - if (appConfigFile != null) { - sb.append(appConfigFile.toString()); - } else { - sb.append("null"); //$NON-NLS-1$ - } - sb.append("]"); //$NON-NLS-1$ - return sb.toString(); - } - - /* - * (non-Javadoc) - * @see java.lang.Object#finalize() - */ - protected void finalize() { - releaseFacesConfigModel(); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/ContextParamSpecifiedJSFAppConfigLocater.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/ContextParamSpecifiedJSFAppConfigLocater.java deleted file mode 100644 index 5df2941cb..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/ContextParamSpecifiedJSFAppConfigLocater.java +++ /dev/null @@ -1,305 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Ian Trimble - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.jsfappconfig; - -import java.util.Iterator; -import java.util.List; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.impl.AdapterImpl; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jst.j2ee.common.ParamValue; -import org.eclipse.jst.j2ee.model.IModelProvider; -import org.eclipse.jst.j2ee.model.ModelProviderManager; -import org.eclipse.jst.j2ee.webapplication.ContextParam; -import org.eclipse.jst.j2ee.webapplication.WebApp; - -/** - * ContextParamSpecifiedJSFAppConfigLocater attempts to locate application - * configuration files specified by the JSF CONFIG_FILES context parameter. - * - * <p><b>Provisional API - subject to change</b></p> - * - * @author Ian Trimble - Oracle - * TODO:cleanup once JavaEE API's stabilize - */ -public class ContextParamSpecifiedJSFAppConfigLocater extends WebContentRelativeJSFAppConfigLocater { - - /** - * Cached instance of ContextParamAdapter. - */ - protected ContextParamAdapter contextParamAdapter = null; - - /* - * (non-Javadoc) - * @see org.eclipse.jst.jsf.core.jsfappconfig.AbstractJSFAppConfigLocater#startLocating() - */ - public void startLocating() { - locateProviders(); - Object webAppObj = getModelObject(); - if (webAppObj != null){ - contextParamAdapter = new ContextParamAdapter(); - if (webAppObj instanceof WebApp) - startLocatingJ2EEConfigs((WebApp)webAppObj); - else if (webAppObj instanceof org.eclipse.jst.javaee.web.WebApp) - startLocatingJEEConfigs((org.eclipse.jst.javaee.web.WebApp)webAppObj); - } else { - //TODO should never get here. Log err? - } - } - - private Object getModelObject() { - IModelProvider provider = ModelProviderManager.getModelProvider(getJSFAppConfigManager().getProject()); - return provider.getModelObject(); - } - - /* - * (non-Javadoc) - * @see org.eclipse.jst.jsf.core.jsfappconfig.AbstractJSFAppConfigLocater#stopLocating() - */ - public void stopLocating() { - if (contextParamAdapter != null) { - Object webAppObj = getModelObject(); - if (webAppObj != null){ - if (webAppObj instanceof WebApp) - stopLocatingJ2EEConfigs((WebApp)webAppObj); - else if (webAppObj instanceof org.eclipse.jst.javaee.web.WebApp) - stopLocatingJEEConfigs((org.eclipse.jst.javaee.web.WebApp)webAppObj); - } else { - //TODO should never get here. Log err? - } - contextParamAdapter = null; - } - } - - private void startLocatingJ2EEConfigs(WebApp webApp){ - webApp.eAdapters().add(contextParamAdapter); - EList contexts = webApp.getContexts(); - if (contexts != null) { - Iterator itContexts = contexts.iterator(); - while (itContexts.hasNext()) { - ContextParam contextParam = (ContextParam)itContexts.next(); - contextParam.eAdapters().add(contextParamAdapter); - } - } - EList contextParams = webApp.getContextParams(); - if (contextParams != null) { - Iterator itContextParams = contextParams.iterator(); - while (itContextParams.hasNext()) { - ParamValue paramValue = (ParamValue)itContextParams.next(); - paramValue.eAdapters().add(contextParamAdapter); - } - } - } - - private void startLocatingJEEConfigs(org.eclipse.jst.javaee.web.WebApp webApp){ - ((EObject)webApp).eAdapters().add(contextParamAdapter); -// System.out.println(((EObject)webApp).eDeliver()); - List params = webApp.getContextParams(); - if (params != null) { - Iterator itContexts = params.iterator(); - while (itContexts.hasNext()) { - EObject contextParam = (EObject)itContexts.next(); - contextParam.eAdapters().add(contextParamAdapter); - } - } - } - - - private void stopLocatingJ2EEConfigs(WebApp webApp) { - webApp.eAdapters().remove(contextParamAdapter); - EList contexts = webApp.getContexts(); - if (contexts != null) { - Iterator itContexts = contexts.iterator(); - while (itContexts.hasNext()) { - ContextParam contextParam = (ContextParam)itContexts.next(); - contextParam.eAdapters().remove(contextParamAdapter); - } - } - EList contextParams = webApp.getContextParams(); - if (contextParams != null) { - Iterator itContextParams = contextParams.iterator(); - while (itContextParams.hasNext()) { - ParamValue paramValue = (ParamValue)itContextParams.next(); - paramValue.eAdapters().remove(contextParamAdapter); - } - } - } - - private void stopLocatingJEEConfigs(org.eclipse.jst.javaee.web.WebApp webApp) { - ((EObject)webApp).eAdapters().remove(contextParamAdapter); - List contextParams = webApp.getContextParams(); - if (contextParams != null) { - Iterator itContextParams = contextParams.iterator(); - while (itContextParams.hasNext()) { - EObject paramValue = (EObject)itContextParams.next(); - paramValue.eAdapters().remove(contextParamAdapter); - } - } - } - /* - * (non-Javadoc) - * @see org.eclipse.jst.jsf.core.jsfappconfig.WebContentRelativeJSFAppConfigLocater#getFilenames() - */ - protected List getFilenames() { - return JSFAppConfigUtils.getConfigFilesFromContextParam(manager.getProject()); - } - - /** - * Adapter implementation used to monitor addition/removal of context-param - * nodes and change in name of existing nodes in order to respond to - * changes to the JSF CONFIG_FILES context-param. - * - * @author Ian Trimble - Oracle - */ - class ContextParamAdapter extends AdapterImpl { - - /* - * (non-Javadoc) - * @see org.eclipse.emf.common.notify.impl.AdapterImpl#notifyChanged(org.eclipse.emf.common.notify.Notification) - */ - public void notifyChanged(Notification notification) { - Object objNotifier = notification.getNotifier(); -// System.out.println(objNotifier.toString()); - if (objNotifier instanceof WebApp || - objNotifier instanceof org.eclipse.jst.javaee.web.WebApp) { - int eventType = notification.getEventType(); - switch (eventType) { - case Notification.ADD: - Object objNewValue = notification.getNewValue(); - if (objNewValue instanceof ContextParam || - objNewValue instanceof org.eclipse.jst.javaee.core.ParamValue) { - contextParamAdded((EObject)objNewValue); - } else if (objNewValue instanceof ParamValue ) { - paramValueAdded((EObject)objNewValue); - } - break; - case Notification.REMOVE: - Object objOldValue = notification.getOldValue(); - if (objOldValue instanceof ContextParam || - objOldValue instanceof org.eclipse.jst.javaee.core.ParamValue) { - contextParamRemoved((EObject)objOldValue); - } else if (objOldValue instanceof ParamValue) { - paramValueRemoved((EObject)objOldValue); - } - break; - } - } else if (objNotifier instanceof ContextParam || - objNotifier instanceof org.eclipse.jst.javaee.core.ParamValue) { - if (notification.getEventType() != Notification.REMOVING_ADAPTER) { - locateProviders(); - } - } else if (objNotifier instanceof ParamValue) { - if (notification.getEventType() != Notification.REMOVING_ADAPTER) { - locateProviders(); - } - } - } - - /** - * Called when a new ContextParam instance is added. - * - * @param contextParam ContextParam instance. - */ - protected void contextParamAdded(EObject contextParam) { - if (isConfigFilesContextParam(contextParam)) { - locateProviders(); - } - contextParam.eAdapters().add(this); - } - - /** - * Called when a new ParamValue instance is added. - * - * @param paramValue ParamValue instance. - */ - protected void paramValueAdded(EObject paramValue) { - if (isConfigFilesParamValue(paramValue)) { - locateProviders(); - } - paramValue.eAdapters().add(this); - } - - /** - * Called when a ContextParam instance is removed. - * - * @param contextParam ContextParam instance. - */ - protected void contextParamRemoved(EObject contextParam) { - if (isConfigFilesContextParam(contextParam)) { - locateProviders(); - } - contextParam.eAdapters().remove(this); - } - - /** - * Called when a ParamValue instance is removed. - * - * @param paramValue ParamValue instance. - */ - protected void paramValueRemoved(EObject paramValue) { - if (isConfigFilesParamValue(paramValue)) { - locateProviders(); - } - paramValue.eAdapters().remove(this); - } - - /** - * Tests if the passed ContextParam instance is the JSF CONFIG_FILES - * context parameter. - * - * @param contextParam ContextParam instance. - * @return true if the passed ContextParam instance is the JSF - * CONFIG_FILES context parameter, else false - */ - protected boolean isConfigFilesContextParam(EObject contextParam) { - boolean isConfigFiles = false; - if (contextParam != null) { - String name = null; - if (contextParam instanceof ContextParam) - name = ((ContextParam)contextParam).getParamName(); - else if (contextParam instanceof org.eclipse.jst.javaee.core.ParamValue) - name = ((org.eclipse.jst.javaee.core.ParamValue)contextParam).getParamName(); - - if (name != null && name.equals(JSFAppConfigUtils.CONFIG_FILES_CONTEXT_PARAM_NAME)) { - isConfigFiles = true; - } - } - return isConfigFiles; - } - - /** - * Tests if the passed ParamValue instance is the JSF CONFIG_FILES - * context parameter. - * - * @param paramVal as EObject ParamValue instance. - * @return true if the passed ParamValue instance is the JSF - * CONFIG_FILES context parameter, else false - */ - protected boolean isConfigFilesParamValue(EObject paramVal) { - boolean isConfigFiles = false; - if (paramVal != null) { - String name = null; - if (paramVal instanceof ParamValue) - name = ((ParamValue)paramVal).getName(); - else if (paramVal instanceof org.eclipse.jst.javaee.core.ParamValue) - name = ((org.eclipse.jst.javaee.core.ParamValue)paramVal).getParamName(); - - if (name != null && name.equals(JSFAppConfigUtils.CONFIG_FILES_CONTEXT_PARAM_NAME)) { - isConfigFiles = true; - } - } - return isConfigFiles; - } - - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/DefaultJSFAppConfigLocater.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/DefaultJSFAppConfigLocater.java deleted file mode 100644 index 4cc953df5..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/DefaultJSFAppConfigLocater.java +++ /dev/null @@ -1,150 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Ian Trimble - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.jsfappconfig; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResourceChangeEvent; -import org.eclipse.core.resources.IResourceChangeListener; -import org.eclipse.core.resources.IResourceDelta; -import org.eclipse.core.resources.IResourceDeltaVisitor; -import org.eclipse.core.resources.IWorkspace; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.wst.common.componentcore.resources.IVirtualFolder; -import org.eclipse.wst.common.componentcore.resources.IVirtualResource; - -/** - * DefaultJSFAppConfigLocater attempts to locate the default application - * configuration file, located at "/WEB-INF/faces-config.xml". - * - * <p><b>Provisional API - subject to change</b></p> - * - * @author Ian Trimble - Oracle - */ -public class DefaultJSFAppConfigLocater extends WebContentRelativeJSFAppConfigLocater - implements IResourceChangeListener { - - /** - * Web content folder-relative name of the default application - * configuration resource file. - */ - public static final String DEF_APPCONFIGRESOURCE_FILENAME = "WEB-INF/faces-config.xml"; //$NON-NLS-1$ - - /* - * (non-Javadoc) - * @see org.eclipse.jst.jsf.core.jsfappconfig.AbstractJSFAppConfigLocater#startLocating() - */ - public void startLocating() { - locateProviders(); - IWorkspace workspace = ResourcesPlugin.getWorkspace(); - workspace.addResourceChangeListener(this, IResourceChangeEvent.POST_BUILD); - } - - /* - * (non-Javadoc) - * @see org.eclipse.jst.jsf.core.jsfappconfig.AbstractJSFAppConfigLocater#stopLocating() - */ - public void stopLocating() { - IWorkspace workspace = ResourcesPlugin.getWorkspace(); - workspace.removeResourceChangeListener(this); - } - - /* - * (non-Javadoc) - * @see org.eclipse.jst.jsf.core.jsfappconfig.WebContentRelativeJSFAppConfigLocater#getFilenames() - */ - protected List getFilenames() { - List filenames = new ArrayList(); - filenames.add(DEF_APPCONFIGRESOURCE_FILENAME); - return filenames; - } - - /** - * Responds to resource change events. - * - * @param event IResourceChangeEvent instance. - */ - public void resourceChanged(IResourceChangeEvent event) { - IResourceDelta delta = event.getDelta(); - try { - delta.accept(new ResourceDeltaVisitor()); - } catch (CoreException cex) { - JSFCorePlugin.log( - IStatus.WARNING, - cex.getLocalizedMessage(), - cex); - } - } - - /** - * ResourceDeltaVisitor is used to visit an IResourceDelta instance to - * discover if the default application configuration resource file has - * been added or removed. - * - * @author Ian Trimble - Oracle - */ - class ResourceDeltaVisitor implements IResourceDeltaVisitor { - - /** - * Cached IPath instance for default configuration resource file. - */ - protected IPath defConfigPath = null; - - /* - * (non-Javadoc) - * @see org.eclipse.core.resources.IResourceDeltaVisitor#visit(org.eclipse.core.resources.IResourceDelta) - */ - public boolean visit(IResourceDelta delta) { - boolean visitChildren = false; - initDefConfigPath(); - if (defConfigPath != null) { - IPath deltaPath = delta.getFullPath(); - if (deltaPath != null) { - if (defConfigPath.equals(deltaPath)) { - locateProviders(); - } else if (deltaPath.isPrefixOf(defConfigPath)) { - visitChildren = true; - } - } - } else { - locateProviders(); - } - return visitChildren; - } - - /** - * Determines IPath instance for default configuration resource file - * and caches in class member. - */ - protected void initDefConfigPath() { - if (defConfigPath == null) { - IProject project = manager.getProject(); - if (project != null) { - IVirtualFolder webContentFolder = JSFAppConfigUtils.getWebContentFolder(project); - if (webContentFolder != null) { - IVirtualResource defConfigFile = webContentFolder.findMember(DEF_APPCONFIGRESOURCE_FILENAME); - if (defConfigFile != null) { - defConfigPath = defConfigFile.getWorkspaceRelativePath(); - } - } - } - } - } - - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/IFacesConfigChangeListener.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/IFacesConfigChangeListener.java deleted file mode 100644 index 7f40db6c7..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/IFacesConfigChangeListener.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Ian Trimble - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.jsfappconfig; - -import org.eclipse.emf.common.notify.Notification; - -/** - * IFacesConfigChangeListener is the interface that must be implemented by - * objects interested in receiving notification of changes to application - * configuration models. - * - * <p><b>Provisional API - subject to change</b></p> - * - * @author Ian Trimble - Oracle - */ -public interface IFacesConfigChangeListener { - - /** - * Called when a change in an application configuration model for which - * this listener has been registered occurs. - * - * @param notification EMF {@link Notification} instance that describes the - * model change. - */ - public void notifyChanged(Notification notification); - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/IJSFAppConfigLocater.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/IJSFAppConfigLocater.java deleted file mode 100644 index 6c0a6a2a5..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/IJSFAppConfigLocater.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Ian Trimble - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.jsfappconfig; - -import java.util.Set; - -/** - * IJSFAppConfigLocater is the interface that Objects capable of locating - * and providing JSF application configuration resources must implement. - * - * <p><b>Provisional API - subject to change</b></p> - * - * @author Ian Trimble - Oracle - */ -public interface IJSFAppConfigLocater { - - /** - * Sets the {@link JSFAppConfigManager} instance to which this locater - * belongs. - * - * @param manager {@link JSFAppConfigManager} instance to be set. - */ - public void setJSFAppConfigManager(JSFAppConfigManager manager); - - /** - * Gets the {@link JSFAppConfigManager} instance to which this locater - * belongs. - * - * @return {@link JSFAppConfigManager} instance to which this locater - * belongs. - */ - public JSFAppConfigManager getJSFAppConfigManager(); - - /** - * Starts locating JSF application configuration resources. - */ - public void startLocating(); - - /** - * Stops locating JSF application configuration resources. - */ - public void stopLocating(); - - /** - * Gets the set of {@link IJSFAppConfigProvider} instances that this - * locater has located. - * - * @return set of {@link IJSFAppConfigProvider} instances. - */ - public Set getJSFAppConfigProviders(); - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/IJSFAppConfigProvider.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/IJSFAppConfigProvider.java deleted file mode 100644 index a351eaa4d..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/IJSFAppConfigProvider.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Ian Trimble - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.jsfappconfig; - -import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigType; - -/** - * IJSFAppConfigProvider is the interface that Objects capable of providing - * JSF application configuration models must implement. - * - * <p><b>Provisional API - subject to change</b></p> - * - * @author Ian Trimble - Oracle - */ -public interface IJSFAppConfigProvider { - - /** - * Sets the {@link IJSFAppConfigLocater} instance that located this - * instance. - * - * @param locater {@link IJSFAppConfigLocater} instance that located this - * instance. - */ - public void setJSFAppConfigLocater(IJSFAppConfigLocater locater); - - /** - * Gets the root element of the application configuration model for read - * access. - * - * @return FacesConfigType instance, which is the root element of an - * application configuration model. - */ - public FacesConfigType getFacesConfigModel(); - - /** - * Releases resources associated with acquiring the application - * configuration model (if any). - */ - public void releaseFacesConfigModel(); - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/IJSFAppConfigProvidersChangeListener.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/IJSFAppConfigProvidersChangeListener.java deleted file mode 100644 index d8282c90f..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/IJSFAppConfigProvidersChangeListener.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Ian Trimble - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.jsfappconfig; - -/** - * Interface that an Object wishing to be notified about changes to the Set of - * IJSFAppConfigProvider instances implements. - * - * <p><b>Provisional API - subject to change</b></p> - * - * @author Ian Trimble - Oracle. - */ -public interface IJSFAppConfigProvidersChangeListener { - - /** - * Callback method indicating a change in the Set of JSFAppConfigProvider - * instances. - * - * @param event JSFAppConfigProvidersChangeEvent instance. - */ - public void changedJSFAppConfigProviders(JSFAppConfigProvidersChangeEvent event); - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/ImplicitRuntimeJSFAppConfigLocater.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/ImplicitRuntimeJSFAppConfigLocater.java deleted file mode 100644 index eddcfeb95..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/ImplicitRuntimeJSFAppConfigLocater.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Ian Trimble - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.jsfappconfig; - -import java.util.LinkedHashSet; -import java.util.Set; - -/** - * ImplicitRuntimeJSFAppConfigLocater creates an {@link IJSFAppConfigProvider} - * instance that provides an application configuration model that contains - * implicit configuration elements that are specified as required to be - * provided by a JSF implementation. - * - * <p><b>Provisional API - subject to change</b></p> - * - * @author Ian Trimble - Oracle - */ -public class ImplicitRuntimeJSFAppConfigLocater extends AbstractJSFAppConfigLocater { - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.core.jsfappconfig.AbstractJSFAppConfigLocater#startLocating() - */ - public void startLocating() { - locateProviders(); - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.core.jsfappconfig.AbstractJSFAppConfigLocater#stopLocating() - */ - public void stopLocating() { - //nothing to do - } - - /** - * Adds an {@link IJSFAppConfigProvider} instance that provides an - * application configuration model that contains implicit configuration - * objects provided by a JSF implementation at runtime. - */ - public void locateProviders() { - Set newConfigProviders = new LinkedHashSet(); - newConfigProviders.add(new ImplicitRuntimeJSFAppConfigProvider()); - updateConfigProviders(newConfigProviders); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/ImplicitRuntimeJSFAppConfigProvider.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/ImplicitRuntimeJSFAppConfigProvider.java deleted file mode 100644 index 7a1e581c5..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/ImplicitRuntimeJSFAppConfigProvider.java +++ /dev/null @@ -1,295 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Ian Trimble - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.jsfappconfig; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.jst.jsf.facesconfig.emf.ComponentClassType; -import org.eclipse.jst.jsf.facesconfig.emf.ComponentType; -import org.eclipse.jst.jsf.facesconfig.emf.ComponentTypeType; -import org.eclipse.jst.jsf.facesconfig.emf.ConverterClassType; -import org.eclipse.jst.jsf.facesconfig.emf.ConverterForClassType; -import org.eclipse.jst.jsf.facesconfig.emf.ConverterIdType; -import org.eclipse.jst.jsf.facesconfig.emf.ConverterType; -import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigFactory; -import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigType; -import org.eclipse.jst.jsf.facesconfig.emf.ValidatorClassType; -import org.eclipse.jst.jsf.facesconfig.emf.ValidatorIdType; -import org.eclipse.jst.jsf.facesconfig.emf.ValidatorType; - -/** - * ImplicitRuntimeJSFAppConfigProvider provides an application configuration - * model that contains implicit configuration objects provided by a JSF - * implementation at runtime. - * - * <p><b>Provisional API - subject to change</b></p> - * - * @author Ian Trimble - Oracle - */ -public class ImplicitRuntimeJSFAppConfigProvider extends AbstractJSFAppConfigProvider { - - /** - * Cached {@link FacesConfigType} instance. - */ - protected FacesConfigType facesConfig = null; - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.core.jsfappconfig.IJSFAppConfigProvider#getFacesConfigModel() - */ - public FacesConfigType getFacesConfigModel() { - if (facesConfig == null) { - createModel(); - if (facesConfig != null) { - jsfAppConfigLocater.getJSFAppConfigManager().addFacesConfigChangeAdapter(facesConfig); - } - } - return facesConfig; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.core.jsfappconfig.IJSFAppConfigProvider#releaseFacesConfigModel() - */ - public void releaseFacesConfigModel() { - jsfAppConfigLocater.getJSFAppConfigManager().removeFacesConfigChangeAdapter(facesConfig); - facesConfig = null; - } - - /** - * Creates the application configuration model and assigns it to the - * facesConfig property. - */ - protected void createModel() { - facesConfig = FacesConfigFactory.eINSTANCE.createFacesConfigType(); - //create and add converters by id - EList converters = facesConfig.getConverter(); - converters.add(createConverter("BigDecimal")); //$NON-NLS-1$ - converters.add(createConverter("BigInteger")); //$NON-NLS-1$ - converters.add(createConverter("Boolean")); //$NON-NLS-1$ - converters.add(createConverter("Byte")); //$NON-NLS-1$ - converters.add(createConverter("Character")); //$NON-NLS-1$ - converters.add(createConverter("DateTime")); //$NON-NLS-1$ - converters.add(createConverter("Double")); //$NON-NLS-1$ - converters.add(createConverter("Float")); //$NON-NLS-1$ - converters.add(createConverter("Integer")); //$NON-NLS-1$ - converters.add(createConverter("Long")); //$NON-NLS-1$ - converters.add(createConverter("Number")); //$NON-NLS-1$ - converters.add(createConverter("Short")); //$NON-NLS-1$ - // converters by for-class (see spec 3.3.3 -- Standard Converter Implementions - converters.add(createForClassConverter("java.lang.Boolean", "javax.faces.convert.BooleanConverter")); - converters.add(createForClassConverter("java.lang.Byte", "javax.faces.convert.ByteConverter")); - converters.add(createForClassConverter("java.lang.Character", "javax.faces.convert.CharacterConverter")); - converters.add(createForClassConverter("java.lang.Double", "javax.faces.convert.DoubleConverter")); - converters.add(createForClassConverter("java.lang.Float", "javax.faces.convert.FloatConverter")); - converters.add(createForClassConverter("java.lang.Integer", "javax.faces.convert.IntegerConverter")); - converters.add(createForClassConverter("java.lang.Long", "javax.faces.convert.LongConverter")); - converters.add(createForClassConverter("java.lang.Short", "javax.faces.converter.ShortConverter")); - //create and add validators - EList validators = facesConfig.getValidator(); - validators.add(createValidator("DoubleRange")); //$NON-NLS-1$ - validators.add(createValidator("Length")); //$NON-NLS-1$ - validators.add(createValidator("LongRange")); //$NON-NLS-1$ - //create and add UI components - EList components = facesConfig.getComponent(); - components.add(createUIComponent("Column")); //$NON-NLS-1$ - components.add(createUIComponent("Command")); //$NON-NLS-1$ - components.add(createUIComponent("Data")); //$NON-NLS-1$ - components.add(createUIComponent("Form")); //$NON-NLS-1$ - components.add(createUIComponent("Graphic")); //$NON-NLS-1$ - components.add(createUIComponent("Input")); //$NON-NLS-1$ - components.add(createUIComponent("Message")); //$NON-NLS-1$ - components.add(createUIComponent("Messages")); //$NON-NLS-1$ - components.add(createUIComponent("NamingContainer")); //$NON-NLS-1$ - components.add(createUIComponent("Output")); //$NON-NLS-1$ - components.add(createUIComponent("Panel")); //$NON-NLS-1$ - components.add(createUIComponent("Parameter")); //$NON-NLS-1$ - components.add(createUIComponent("SelectBoolean")); //$NON-NLS-1$ - components.add(createUIComponent("SelectItem")); //$NON-NLS-1$ - components.add(createUIComponent("SelectItems")); //$NON-NLS-1$ - components.add(createUIComponent("SelectMany")); //$NON-NLS-1$ - components.add(createUIComponent("SelectOne")); //$NON-NLS-1$ - components.add(createUIComponent("ViewRoot")); //$NON-NLS-1$ - //create and add HTML components - components.add(createHTMLComponent("HtmlCommandButton")); //$NON-NLS-1$ - components.add(createHTMLComponent("HtmlCommandLink")); //$NON-NLS-1$ - components.add(createHTMLComponent("HtmlDataTable")); //$NON-NLS-1$ - components.add(createHTMLComponent("HtmlForm")); //$NON-NLS-1$ - components.add(createHTMLComponent("HtmlGraphicImage")); //$NON-NLS-1$ - components.add(createHTMLComponent("HtmlInputHidden")); //$NON-NLS-1$ - components.add(createHTMLComponent("HtmlInputSecret")); //$NON-NLS-1$ - components.add(createHTMLComponent("HtmlInputText")); //$NON-NLS-1$ - components.add(createHTMLComponent("HtmlInputTextarea")); //$NON-NLS-1$ - components.add(createHTMLComponent("HtmlMessage")); //$NON-NLS-1$ - components.add(createHTMLComponent("HtmlMessages")); //$NON-NLS-1$ - components.add(createHTMLComponent("HtmlOutputFormat")); //$NON-NLS-1$ - components.add(createHTMLComponent("HtmlOutputLabel")); //$NON-NLS-1$ - components.add(createHTMLComponent("HtmlOutputLink")); //$NON-NLS-1$ - components.add(createHTMLComponent("HtmlOutputText")); //$NON-NLS-1$ - components.add(createHTMLComponent("HtmlPanelGrid")); //$NON-NLS-1$ - components.add(createHTMLComponent("HtmlPanelGroup")); //$NON-NLS-1$ - components.add(createHTMLComponent("HtmlSelectBooleanCheckbox")); //$NON-NLS-1$ - components.add(createHTMLComponent("HtmlSelectManyCheckbox")); //$NON-NLS-1$ - components.add(createHTMLComponent("HtmlSelectManyListbox")); //$NON-NLS-1$ - components.add(createHTMLComponent("HtmlSelectManyMenu")); //$NON-NLS-1$ - components.add(createHTMLComponent("HtmlSelectOneListbox")); //$NON-NLS-1$ - components.add(createHTMLComponent("HtmlSelectOneMenu")); //$NON-NLS-1$ - components.add(createHTMLComponent("HtmlSelectOneRadio")); //$NON-NLS-1$ - } - - /** - * Creates a {@link ConverterType} instance. - * - * @param name Base name of converter from which converter-id and - * converter-class are formed. - * @return {@link ConverterType} instance. - */ - protected ConverterType createConverter(String name) { - ConverterType converterType = FacesConfigFactory.eINSTANCE.createConverterType(); - //set converter-id - ConverterIdType converterIdType = FacesConfigFactory.eINSTANCE.createConverterIdType(); - StringBuffer sb = new StringBuffer(); - sb.append("javax.faces."); //$NON-NLS-1$ - sb.append(name); - converterIdType.setTextContent(sb.toString()); - converterType.setConverterId(converterIdType); - //set converter-class - ConverterClassType converterClassType = FacesConfigFactory.eINSTANCE.createConverterClassType(); - sb = new StringBuffer(); - sb.append("javax.faces.convert."); //$NON-NLS-1$ - sb.append(name); - sb.append("Converter"); //$NON-NLS-1$ - converterClassType.setTextContent(sb.toString()); - converterType.setConverterClass(converterClassType); - return converterType; - } - - private ConverterType createForClassConverter(String forClass, String converterClass) - { - ConverterType converterType = FacesConfigFactory.eINSTANCE.createConverterType(); - //set converter-id - ConverterForClassType converterForClass = FacesConfigFactory.eINSTANCE.createConverterForClassType(); - converterForClass.setTextContent(forClass); - converterType.setConverterForClass(converterForClass); - //set converter-class - ConverterClassType converterClassType = FacesConfigFactory.eINSTANCE.createConverterClassType(); - converterClassType.setTextContent(converterClass); - converterType.setConverterClass(converterClassType); - return converterType; - } - - /** - * Creates a {@link ValidatorType} instance. - * - * @param name Base name of validator from which validator-id and - * validator-class are formed. - * @return {@link ValidatorType} instance. - */ - protected ValidatorType createValidator(String name) { - ValidatorType validatorType = FacesConfigFactory.eINSTANCE.createValidatorType(); - //set validator-id - ValidatorIdType validatorIdType = FacesConfigFactory.eINSTANCE.createValidatorIdType(); - StringBuffer sb = new StringBuffer(); - sb.append("javax.faces."); //$NON-NLS-1$ - sb.append(name); - validatorIdType.setTextContent(sb.toString()); - validatorType.setValidatorId(validatorIdType); - //set validator-class - ValidatorClassType validatorClassType = FacesConfigFactory.eINSTANCE.createValidatorClassType(); - sb = new StringBuffer(); - sb.append("javax.faces.validator."); //$NON-NLS-1$ - sb.append(name); - sb.append("Validator"); //$NON-NLS-1$ - validatorClassType.setTextContent(sb.toString()); - validatorType.setValidatorClass(validatorClassType); - return validatorType; - } - - /** - * Creates a {@link ComponentType} instance to represent a standard UI - * component. - * - * @param name Base name of component from which component-type and - * component-class are formed. - * @return {@link ComponentType} instance. - */ - protected ComponentType createUIComponent(String name) { - ComponentType componentType = FacesConfigFactory.eINSTANCE.createComponentType(); - //set component-type - ComponentTypeType componentTypeType = FacesConfigFactory.eINSTANCE.createComponentTypeType(); - StringBuffer sb = new StringBuffer(); - sb.append("javax.faces."); //$NON-NLS-1$ - sb.append(name); - componentTypeType.setTextContent(sb.toString()); - componentType.setComponentType(componentTypeType); - //set component-class - ComponentClassType componentClassType = FacesConfigFactory.eINSTANCE.createComponentClassType(); - sb = new StringBuffer(); - sb.append("javax.faces.component.UI"); //$NON-NLS-1$ - sb.append(name); - componentClassType.setTextContent(sb.toString()); - componentType.setComponentClass(componentClassType); - return componentType; - } - - /** - * Creates a {@link ComponentType} instance to represent a concrete HTML - * component. - * - * @param name Base name of component from which component-type and - * component-class are formed. - * @return {@link ComponentType} instance. - */ - protected ComponentType createHTMLComponent(String name) { - ComponentType componentType = FacesConfigFactory.eINSTANCE.createComponentType(); - //set component-type - ComponentTypeType componentTypeType = FacesConfigFactory.eINSTANCE.createComponentTypeType(); - StringBuffer sb = new StringBuffer(); - sb.append("javax.faces."); //$NON-NLS-1$ - sb.append(name); - componentTypeType.setTextContent(sb.toString()); - componentType.setComponentType(componentTypeType); - //set component-class - ComponentClassType componentClassType = FacesConfigFactory.eINSTANCE.createComponentClassType(); - sb = new StringBuffer(); - sb.append("javax.faces.component.html."); //$NON-NLS-1$ - sb.append(name); - componentClassType.setTextContent(sb.toString()); - componentType.setComponentClass(componentClassType); - return componentType; - } - - /* - * (non-Javadoc) - * @see java.lang.Object#equals(java.lang.Object) - */ - public boolean equals(Object otherObject) { - boolean equals = false; - if (otherObject instanceof ImplicitRuntimeJSFAppConfigProvider) { - equals = true; - } - return equals; - } - - /* - * (non-Javadoc) - * @see java.lang.Object#hashCode() - */ - public int hashCode() { - return ImplicitRuntimeJSFAppConfigProvider.class.getName().hashCode(); - } - - /* - * (non-Javadoc) - * @see java.lang.Object#toString() - */ - public String toString() { - return "ImplicitRuntimeJSFAppConfigProvider[]"; //$NON-NLS-1$ - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/JARFileJSFAppConfigProvider.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/JARFileJSFAppConfigProvider.java deleted file mode 100644 index 3d967f97c..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/JARFileJSFAppConfigProvider.java +++ /dev/null @@ -1,254 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Ian Trimble - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.jsfappconfig; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.Collections; -import java.util.jar.JarFile; -import java.util.zip.ZipEntry; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.core.internal.Messages; -import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigType; -import org.eclipse.jst.jsf.facesconfig.util.FacesConfigResourceFactory; -import org.eclipse.osgi.util.NLS; - -/** - * JARFileJSFAppConfigProvider provides the root element of an application - * configuration model by loading the model from a /META-INF/faces-config.xml - * entry in a JAR file. - * - * <p><b>Provisional API - subject to change</b></p> - * - * @author Ian Trimble - Oracle - */ -public class JARFileJSFAppConfigProvider extends AbstractJSFAppConfigProvider { - - /** - * Prefix required to turn filename into a JAR URI. - */ - public static final String JARFILE_URI_PREFIX = "jar:file:///"; - - /** - * Suffix required to turn filename into a JAR URI. - */ - public static final String FACES_CONFIG_IN_JAR_SUFFIX = "!/META-INF/faces-config.xml"; - - /** - * Name of a JAR file that contains a /META-INF/faces-config.xml entry. - */ - protected String filename = null; - - /** - * Cached {@link FacesConfigType} instance. - */ - protected FacesConfigType facesConfig = null; - - /** - * Flag to track if load error has been logged at least once. - */ - protected boolean loadErrorLogged = false; - - /** - * Creates an instance, storing the passed IProject instance and file name - * String to be used for subsequent processing. - * - * @param filename Name of a JAR file that contains a - * /META-INF/faces-config.xml entry. - */ - public JARFileJSFAppConfigProvider(String filename) { - this.filename = filename; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.core.jsfappconfig.IJSFAppConfigProvider#getFacesConfigModel() - */ - public FacesConfigType getFacesConfigModel() { - // TODO: should this job be pushed into the model? - if (facesConfig == null && filename != null) - { - facesConfig = getFacesConfig(); - - if (facesConfig != null) - { - jsfAppConfigLocater.getJSFAppConfigManager().addFacesConfigChangeAdapter(facesConfig); - } - } - return facesConfig; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.core.jsfappconfig.IJSFAppConfigProvider#releaseFacesConfigModel() - */ - public void releaseFacesConfigModel() { - jsfAppConfigLocater.getJSFAppConfigManager().removeFacesConfigChangeAdapter(facesConfig); - } - - /** - * Called to log a load error; load error will be logged once only per - * instance, per VM session. - * - * @param ex Throwable instance to be logged. - */ - protected void logLoadError(Throwable ex) { - if (!loadErrorLogged) { - JSFCorePlugin.log( - IStatus.ERROR, - NLS.bind(Messages.JARFileJSFAppConfigProvider_ErrorLoadingModel, JARFILE_URI_PREFIX + filename + FACES_CONFIG_IN_JAR_SUFFIX), - ex); - loadErrorLogged = true; - } - } - - /* - * (non-Javadoc) - * @see java.lang.Object#equals(java.lang.Object) - */ - public boolean equals(Object otherObject) { - boolean equals = false; - if (otherObject instanceof JARFileJSFAppConfigProvider) { - String otherFilename = ((JARFileJSFAppConfigProvider)otherObject).filename; - if (filename != null) { - equals = filename.equals(otherFilename); - } else { - equals = otherFilename == null; - } - } - return equals; - } - - /* - * (non-Javadoc) - * @see java.lang.Object#hashCode() - */ - public int hashCode() { - return filename != null ? filename.hashCode() : 0; - } - - /* - * (non-Javadoc) - * @see java.lang.Object#toString() - */ - public String toString() { - StringBuffer sb = new StringBuffer("JARFileJSFAppConfigProvider["); //$NON-NLS-1$ - if (filename != null) { - sb.append(filename); - } else { - sb.append("null"); //$NON-NLS-1$ - } - sb.append("]"); //$NON-NLS-1$ - return sb.toString(); - } - - private FacesConfigType getFacesConfig() - { - JarFile jarFile = null; - File tempFile = null; - OutputStream tempFileStream = null; - - try - { - jarFile = new JarFile(filename, false); - ZipEntry entry = jarFile.getEntry("META-INF/faces-config.xml"); - - if (entry != null) - { - InputStream stream = jarFile.getInputStream(entry); - - tempFile = File.createTempFile("tempfile", ".xml"); - tempFileStream = new FileOutputStream(tempFile); - - int read = 0; - byte[] buffer = new byte[4096]; - - while ((read = stream.read(buffer)) != -1) - { - tempFileStream.write(buffer, 0, read); - } - - tempFileStream.close(); - tempFileStream = null; - - FacesConfigResourceFactory factory = FacesConfigResourceFactory.createResourceFactoryForJar(); - //FacesConfigResourceFactory.register(tempFile.toURI().toString()); - Resource resource = factory.createResource(URI.createFileURI(tempFile.getAbsolutePath())); - - try { - if (resource != null) { - resource.load(Collections.EMPTY_MAP); - EList resourceContents = resource.getContents(); - if (resourceContents != null && resourceContents.size() > 0) { - facesConfig = (FacesConfigType)resourceContents.get(0); - if (facesConfig != null) { - jsfAppConfigLocater.getJSFAppConfigManager().addFacesConfigChangeAdapter(facesConfig); - } - } - } - } catch(IllegalStateException ise) { - //log error - logLoadError(ise); - } catch(IOException ioe) { - //log error - logLoadError(ioe); - } - } - - return facesConfig; - } - catch (IOException ioe) - { - logLoadError(ioe); - return null; - } - finally - { - if (jarFile != null) - { - try - { - jarFile.close(); - } - catch (IOException ioe) - { - logLoadError(ioe); - } - } - - if (tempFileStream != null) - { - try - { - tempFileStream.close(); - } - catch(IOException ioe) - { - logLoadError(ioe); - } - } - - if (tempFile != null && tempFile.exists()) - { - if (!tempFile.delete()) - { - tempFile.deleteOnExit(); - } - } - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/JSFAppConfigManager.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/JSFAppConfigManager.java deleted file mode 100644 index 04d2ce4a7..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/JSFAppConfigManager.java +++ /dev/null @@ -1,804 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Ian Trimble - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.jsfappconfig; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IResourceChangeEvent; -import org.eclipse.core.resources.IResourceChangeListener; -import org.eclipse.core.resources.IResourceDelta; -import org.eclipse.core.resources.IWorkspace; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.QualifiedName; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.util.EContentAdapter; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.facesconfig.emf.ApplicationType; -import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigType; -import org.eclipse.jst.jsf.facesconfig.emf.FromViewIdType; -import org.eclipse.jst.jsf.facesconfig.emf.NavigationRuleType; -import org.eclipse.jst.jsf.facesconfig.emf.PropertyResolverType; -import org.eclipse.jst.jsf.facesconfig.emf.VariableResolverType; - -/** - * JSFAppConfigManager provides an entry point to an entire JSF application - * configuration, which is defined in one or more application configuration - * resource files. - * - * <p><b>Provisional API - subject to change</b></p> - * - * @author Ian Trimble - Oracle - */ -public class JSFAppConfigManager implements IResourceChangeListener { - - /** - * Key that is used for the IProject instance's session property that - * holds a JSFAppConfigManager instance. - */ - public static final QualifiedName KEY_SESSIONPROPERTY = - new QualifiedName(JSFCorePlugin.PLUGIN_ID, "JSFAppConfigManager"); //$NON-NLS-1$ - - /** - * IProject instance to which this JSFAppConfigManager instance is keyed. - */ - protected IProject project = null; - - /** - * Collection of {@link IJSFAppConfigLocater} instances. - */ - protected List configLocaters = null; - - /** - * Collection of {@link IJSFAppConfigProvidersChangeListener} instances. - */ - protected List configProvidersChangeListeners = null; - - /** - * Map of application configuration model EMF classes to - * {@link IFacesConfigChangeListener} instances. - */ - protected Map facesConfigChangeListeners = null; - - /** - * Single {@link FacesConfigChangeAdapter} instance. - */ - protected FacesConfigChangeAdapter facesConfigChangeAdapter = null; - - /** - * Gets a JSFAppConfigManager instance that is keyed to the passed IProject - * parameter. May return null if the project is not valid or if a - * CoreException is thrown while attempting to get or set the instance as - * a session property. - * - * @param project IProject instance to which the returned - * JSFAppConfigManager instance is keyed. - * @return JSFAppConfigManager instance, or null. - */ - public static synchronized JSFAppConfigManager getInstance(IProject project) { - JSFAppConfigManager manager = null; - if (JSFAppConfigUtils.isValidJSFProject(project)) { - manager = getFromSessionProperty(project); - if (manager == null) { - manager = new JSFAppConfigManager(project); - } - } - return manager; - } - - /** - * Attempts to get a JSFAppConfigManager instance from a session property - * of the passed IProject instance. Will return null if the session - * property has not yet been set. - * - * @param project IProject instance from which to retrieve the - * JSFAppConfigManager instance. - * @return JSFAppConfigManager instance, or null. - */ - protected static JSFAppConfigManager getFromSessionProperty(IProject project) { - JSFAppConfigManager manager = null; - try { - Object obj = project.getSessionProperty(KEY_SESSIONPROPERTY); - if (obj instanceof JSFAppConfigManager) { - manager = (JSFAppConfigManager)obj; - } - } catch(CoreException ce) { - //log error - JSFCorePlugin.log(IStatus.ERROR, ce.getLocalizedMessage(), ce); - } - return manager; - } - - /** - * Sets this JSFAppConfigManager instance as a session property of its - * IProject instance. - */ - protected void setAsSessionProperty() { - if (project != null && project.isAccessible()) { - try { - project.setSessionProperty(KEY_SESSIONPROPERTY, this); - } catch(CoreException ce) { - //log error - JSFCorePlugin.log(IStatus.ERROR, ce.getLocalizedMessage(), ce); - } - } - } - - /** - * Unsets this JSFAppConfigManager instance as a session property of its - * IProject instance. - */ - protected void unsetAsSessionProperty() { - if (project != null && project.isAccessible()) { - try { - project.setSessionProperty(KEY_SESSIONPROPERTY, null); - } catch(CoreException ce) { - //log error - JSFCorePlugin.log(IStatus.ERROR, ce.getLocalizedMessage(), ce); - } - } - } - - /** - * Constructor is private to prevent direct instantiation; call - * getInstance(IProject). - * - * @param project IProject instance to which the new JSFAppConfigManager - * instance is keyed. - */ - private JSFAppConfigManager(IProject project) { - this.project = project; - initialize(); - } - - /** - * Gets this instance's IProject instance. - * - * @return This instance's IProject instance. - */ - public IProject getProject() { - return project; - } - - /** - * Initializes instance by: - * <ul> - * <li>creating facesConfigChangeListeners collection, </li> - * <li>creating configProvidersChangeListeners collection, </li> - * <li>creating and populating configLocaters collection, </li> - * <li>invoking the startLocating() method on all configLocaters, </li> - * <li>setting instance as a session property of the IProject instance, </li> - * <li>adding a resource change listener to the workspace.</li> - * </ul> - */ - protected void initialize() { - //create collections - facesConfigChangeListeners = new HashMap(); - configProvidersChangeListeners = new ArrayList(); - configLocaters = new ArrayList(); - //populate initial set of locaters - populateConfigLocaters(); - //instruct locaters to start locating - startConfigLocaters(); - //set as session property of project - setAsSessionProperty(); - //add resource change listener - IWorkspace workspace = ResourcesPlugin.getWorkspace(); - workspace.addResourceChangeListener(this, IResourceChangeEvent.POST_CHANGE); - } - - /** - * Populates configLocaters Set with "built-in" set of - * {@link IJSFAppConfigLocater} implementations. - */ - protected void populateConfigLocaters() { - //implicit runtime-provided configuration - IJSFAppConfigLocater implicitRuntimeConfigLocater = new ImplicitRuntimeJSFAppConfigLocater(); - implicitRuntimeConfigLocater.setJSFAppConfigManager(this); - configLocaters.add(implicitRuntimeConfigLocater); - //default ("/WEB-INF/faces-config.xml") locater - IJSFAppConfigLocater defaultConfigLocater = new DefaultJSFAppConfigLocater(); - defaultConfigLocater.setJSFAppConfigManager(this); - configLocaters.add(defaultConfigLocater); - //web.xml context-parameter specified locater - IJSFAppConfigLocater contextParamConfigLocater = new ContextParamSpecifiedJSFAppConfigLocater(); - contextParamConfigLocater.setJSFAppConfigManager(this); - configLocaters.add(contextParamConfigLocater); - //runtime classpath locater - IJSFAppConfigLocater classpathConfigLocater = new RuntimeClasspathJSFAppConfigLocater(); - classpathConfigLocater.setJSFAppConfigManager(this); - configLocaters.add(classpathConfigLocater); - } - - /** - * Instructs set of {@link IJSFAppConfigLocater} instances to start - * locating JSF application configuration resources. - */ - protected void startConfigLocaters() { - Iterator itConfigLocaters = configLocaters.iterator(); - while (itConfigLocaters.hasNext()) { - IJSFAppConfigLocater configLocater = (IJSFAppConfigLocater)itConfigLocaters.next(); - configLocater.startLocating(); - } - } - - /** - * Instructs set of {@link IJSFAppConfigLocater} instances to stop - * locating JSF application configuration resources. - */ - protected void stopConfigLocaters() { - Iterator itConfigLocaters = configLocaters.iterator(); - while (itConfigLocaters.hasNext()) { - IJSFAppConfigLocater configLocater = (IJSFAppConfigLocater)itConfigLocaters.next(); - configLocater.stopLocating(); - } - } - - /* - * (non-Javadoc) - * @see org.eclipse.core.resources.IResourceChangeListener#resourceChanged(org.eclipse.core.resources.IResourceChangeEvent) - */ - public void resourceChanged(IResourceChangeEvent event) { - IResourceDelta delta = event.getDelta(); - if (delta.getKind() == IResourceDelta.CHANGED) { - IResourceDelta[] removedDeltas = delta.getAffectedChildren(IResourceDelta.REMOVED); - if (removedDeltas.length == 1) { - IResourceDelta removedDelta = removedDeltas[0]; - IResource removedResource = removedDelta.getResource(); - if (removedResource != null && removedResource == project) { - IResourceDelta[] addedDeltas = delta.getAffectedChildren(IResourceDelta.ADDED); - if (addedDeltas.length == 1) { - IResourceDelta addedDelta = addedDeltas[0]; - IResource addedResource = addedDelta.getResource(); - if (addedResource instanceof IProject) { - changeProject((IProject)addedResource); - } - } - } - } - } - } - - /** - * Called to respond to a change in the IProject instance to which this - * instance belongs. Changes the cached IProject instance, stops all config - * locaters, starts all config locaters. - * - * @param newProject New IProject instance to which this manager belongs. - */ - protected void changeProject(IProject newProject) { - this.project = newProject; - stopConfigLocaters(); - startConfigLocaters(); - } - - /** - * Adds an instance of {@link IJSFAppConfigProvidersChangeListener}. - * - * @param listener An instance of {@link IJSFAppConfigProvidersChangeListener}. - * @return true if added, else false. - */ - public boolean addJSFAppConfigProvidersChangeListener(IJSFAppConfigProvidersChangeListener listener) { - return configProvidersChangeListeners.add(listener); - } - - /** - * Removes an instance of {@link IJSFAppConfigProvidersChangeListener}. - * - * @param listener an instance of {@link IJSFAppConfigProvidersChangeListener}. - * @return true if removed, else false. - */ - public boolean removeJSFAppConfigProvidersChangeListener(IJSFAppConfigProvidersChangeListener listener) { - return configProvidersChangeListeners.remove(listener); - } - - /** - * Notifies all {@link IJSFAppConfigProvidersChangeListener} instances of - * a change in the Set of {@link IJSFAppConfigProvider} instances. - * - * @param configProvider {@link IJSFAppConfigProvider} instance that has - * changed. - * @param eventType Event type. - */ - public void notifyJSFAppConfigProvidersChangeListeners(IJSFAppConfigProvider configProvider, int eventType) { - JSFAppConfigProvidersChangeEvent event = new JSFAppConfigProvidersChangeEvent(configProvider, eventType); - Iterator itListeners = configProvidersChangeListeners.iterator(); - while (itListeners.hasNext()) { - IJSFAppConfigProvidersChangeListener listener = - (IJSFAppConfigProvidersChangeListener)itListeners.next(); - listener.changedJSFAppConfigProviders(event); - } - } - - /** - * Adds an instance of {@link IFacesConfigChangeListener}. <br> - * <br> - * <b>NOTE:</b> Calling this method will cause all application - * configuration models to be loaded, to ensure that a - * {@link FacesConfigChangeAdapter} has been added to each model. - * - * @param emfClass EMF class in which the listener is interested. - * @param listener {@link IFacesConfigChangeListener} instance. - * @return Previous {@link IFacesConfigChangeListener}, or null. - */ - public Object addFacesConfigChangeListener(Class emfClass, IFacesConfigChangeListener listener) { - /* - * Get all models, which will ensure that each one has had a - * FacesConfigChangeAdapter added to it. - */ - getFacesConfigModels(); - return facesConfigChangeListeners.put(emfClass, listener); - } - - /** - * Removes an instance of {@link IFacesConfigChangeListener}. - * - * @param emfClass EMF class in which the listener was interested. - * @return Removed {@link IFacesConfigChangeListener}, or null. - */ - public Object removeFacesConfigChangeListener(Class emfClass) { - return facesConfigChangeListeners.remove(emfClass); - } - - /** - * Notifies {@link IFacesConfigChangeListener} instances of model changes - * in which they registered interest. - * - * @param notification EMF {@link Notification} instance that describes the - * model change. - */ - public void notifyFacesConfigChangeListeners(Notification notification) { - Object emfFeature = notification.getFeature(); - if (emfFeature instanceof EStructuralFeature) { - Class emfClass = ((EStructuralFeature)emfFeature).getEType().getInstanceClass(); - IFacesConfigChangeListener listener = (IFacesConfigChangeListener)facesConfigChangeListeners.get(emfClass); - if (listener != null) { - listener.notifyChanged(notification); - } - } - } - - /** - * Gets all {@link IJSFAppConfigProvider} instances from all - * {@link IJSFAppConfigLocater} instances. - * - * @return Set of all {@link IJSFAppConfigProvider} instances. - */ - public Set getJSFAppConfigProviders() { - Set allConfigProviders = new LinkedHashSet(); - Iterator itConfigLocaters = configLocaters.iterator(); - while (itConfigLocaters.hasNext()) { - IJSFAppConfigLocater configLocater = (IJSFAppConfigLocater)itConfigLocaters.next(); - allConfigProviders.addAll(configLocater.getJSFAppConfigProviders()); - } - return allConfigProviders; - } - - /** - * Gets all {@link FacesConfigType} instances from all - * {@link IJSFAppConfigProvider} instances. - * - * @return List of all {@link FacesConfigType} instances. - */ - public List getFacesConfigModels() { - List facesConfigModels = new ArrayList(); - Iterator itConfigProviders = getJSFAppConfigProviders().iterator(); - while (itConfigProviders.hasNext()) { - IJSFAppConfigProvider configProvider = (IJSFAppConfigProvider)itConfigProviders.next(); - FacesConfigType facesConfig = configProvider.getFacesConfigModel(); - if (facesConfig != null) { - facesConfigModels.add(facesConfig); - } - } - return facesConfigModels; - } - - /* - * (non-Javadoc) - * @see java.lang.Object#finalize() - */ - protected void finalize() { - //remove resource change listener - IWorkspace workspace = ResourcesPlugin.getWorkspace(); - workspace.removeResourceChangeListener(this); - //remove session property from project - unsetAsSessionProperty(); - //instruct locaters to stop locating - stopConfigLocaters(); - //clear collections - configLocaters.clear(); - configProvidersChangeListeners.clear(); - facesConfigChangeListeners.clear(); - } - - /** - * Gets list of all ManagedBeanType instances from all known faces-config - * models; list may be empty. - * - * @return List of all ManagedBeanType instances from all known - * faces-config models (list may be empty). - */ - public List getManagedBeans() { - List allManagedBeans = new ArrayList(); - List facesConfigs = getFacesConfigModels(); - Iterator itFacesConfigs = facesConfigs.iterator(); - while (itFacesConfigs.hasNext()) { - FacesConfigType facesConfig = (FacesConfigType)itFacesConfigs.next(); - EList managedBeans = facesConfig.getManagedBean(); - allManagedBeans.addAll(managedBeans); - } - return allManagedBeans; - } - - /** - * @return List of all variable resolver class names registered. - */ - public final List<String> getPropertyResolvers() - { - final List<String> allPropertyResolvers = new ArrayList<String>(); - final List applications = getApplications(); - final Iterator appIterator = applications.iterator(); - while (appIterator.hasNext()) - { - final ApplicationType application = (ApplicationType) appIterator.next(); - for (final Iterator it = application.getPropertyResolver().iterator(); it.hasNext();) - { - final PropertyResolverType propRes = (PropertyResolverType) it.next(); - String propClass = propRes.getTextContent(); - if (propClass != null) - { - propClass = propClass.trim(); - if (!"".equals(propClass)) - { - allPropertyResolvers.add(propClass); - } - } - } - } - return allPropertyResolvers; - } - - /** - * Gets list of all ValidatorType instances from all known faces-config - * models; list may be empty. - * - * @return List of all ValidatorType instances from all known faces-config - * models (list may be empty). - */ - public List getValidators() { - List allValidators = new ArrayList(); - List facesConfigs = getFacesConfigModels(); - Iterator itFacesConfigs = facesConfigs.iterator(); - while (itFacesConfigs.hasNext()) { - FacesConfigType facesConfig = (FacesConfigType)itFacesConfigs.next(); - EList validators = facesConfig.getValidator(); - allValidators.addAll(validators); - } - return allValidators; - } - - /** - * @return List of all variable resolver class names registered. - */ - public final List<String> getVariableResolvers() - { - final List<String> allVariableResolvers = new ArrayList<String>(); - final List applications = getApplications(); - final Iterator appIterator = applications.iterator(); - while (appIterator.hasNext()) - { - final ApplicationType application = (ApplicationType) appIterator.next(); - for (final Iterator it = application.getVariableResolver().iterator(); it.hasNext();) - { - final VariableResolverType varRes = (VariableResolverType) it.next(); - String varClass = varRes.getTextContent(); - if (varClass != null) - { - varClass = varClass.trim(); - if (!"".equals(varClass)) - { - allVariableResolvers.add(varClass); - } - } - } - } - return allVariableResolvers; - } - - /** - * Gets list of all ConverterType instances from all known faces-config - * models; list may be empty. - * - * @return List of all ConverterType instances from all known faces-config - * models (list may be empty). - */ - public List getConverters() { - List allConverters = new ArrayList(); - List facesConfigs = getFacesConfigModels(); - Iterator itFacesConfigs = facesConfigs.iterator(); - while (itFacesConfigs.hasNext()) { - FacesConfigType facesConfig = (FacesConfigType)itFacesConfigs.next(); - EList converters = facesConfig.getConverter(); - allConverters.addAll(converters); - } - return allConverters; - } - - /** - * Gets list of all NavigationRuleType instances from all known - * faces-config models; list may be empty. - * - * @return List of all NavigationRuleType instances from all known - * faces-config models (list may be empty). - */ - public List getNavigationRules() { - List allNavigationRules = new ArrayList(); - List facesConfigs = getFacesConfigModels(); - Iterator itFacesConfigs = facesConfigs.iterator(); - while (itFacesConfigs.hasNext()) { - FacesConfigType facesConfig = (FacesConfigType)itFacesConfigs.next(); - EList navigationRules = facesConfig.getNavigationRule(); - allNavigationRules.addAll(navigationRules); - } - return allNavigationRules; - } - - /** - * Gets list of all NavigationRuleType instances from all known - * faces-config models where the navigation-rule's from-view-id value - * matches the web content folder-relative value of the passed IFile - * instance; list may be empty. Matching is performed in the same manner - * as for a JSF implementation's default NavigationHandler. - * - * @param pageFile IFile instance to match against the from-view-id value - * of all NavigationRuleType instances. File is assumed to be relative to - * the web content folder, but may be expressed in a more complete form; - * its path will be calculated relative to the web content folder. - * @return List of all NavigationRuleType instances from all known - * faces-config models where the navigation-rule's from-view-id value - * matches the web content folder-relative value of the passed IFile - * instance (list may be empty). - */ - public List getNavigationRulesForPage(IFile pageFile) { - List navigationRulesForPage = new ArrayList(); - IPath pageFilePath = JSFAppConfigUtils.getWebContentFolderRelativePath(pageFile); - if (pageFilePath != null) { - String pageFileString = pageFilePath.toString(); - if (!pageFileString.startsWith("/")) { - pageFileString = "/" + pageFileString; - } - List navigationRules = getNavigationRules(); - Iterator itNavigationRules = navigationRules.iterator(); - while (itNavigationRules.hasNext()) { - NavigationRuleType navigationRule = (NavigationRuleType)itNavigationRules.next(); - FromViewIdType fromViewIdType = navigationRule.getFromViewId(); - if (fromViewIdType != null) { - String fromViewId = fromViewIdType.getTextContent(); - if (fromViewId != null && fromViewId.length() > 0) { - if (!fromViewId.equals("*")) { //$NON-NLS-1$ - if (fromViewId.equals(pageFileString)) { - //exact match - navigationRulesForPage.add(navigationRule); - } else if (fromViewId.endsWith("*")) { //$NON-NLS-1$ - String prefixFromViewId = fromViewId.substring(0, fromViewId.length() - 1); - if (pageFileString.startsWith(prefixFromViewId)) { - //prefix match - navigationRulesForPage.add(navigationRule); - } - } - } else { - //from-view-id == "*" - matches all pages - navigationRulesForPage.add(navigationRule); - } - } - } else { - //no from-view-id element - matches all pages - navigationRulesForPage.add(navigationRule); - } - } - } - return navigationRulesForPage; - } - - /** - * Gets list of all ApplicationType instances from all known - * faces-config models; list may be empty. - * - * @return List of all ApplicationType instances from all known - * faces-config models (list may be empty). - */ - public List getApplications() { - List allApplications = new ArrayList(); - List facesConfigs = getFacesConfigModels(); - Iterator itFacesConfigs = facesConfigs.iterator(); - while (itFacesConfigs.hasNext()) { - FacesConfigType facesConfig = (FacesConfigType)itFacesConfigs.next(); - EList applications = facesConfig.getApplication(); - allApplications.addAll(applications); - } - return allApplications; - } - - /** - * Gets list of all FactoryType instances from all known faces-config - * models; list may be empty. - * - * @return List of all FactoryType instances from all known faces-config - * models (list may be empty). - */ - public List getFactories() { - List allFactories = new ArrayList(); - List facesConfigs = getFacesConfigModels(); - Iterator itFacesConfigs = facesConfigs.iterator(); - while (itFacesConfigs.hasNext()) { - FacesConfigType facesConfig = (FacesConfigType)itFacesConfigs.next(); - EList factories = facesConfig.getFactory(); - allFactories.addAll(factories); - } - return allFactories; - } - - /** - * Gets list of all ComponentType instances from all known faces-config - * models; list may be empty. - * - * @return List of all ComponentType instances from all known faces-config - * models (list may be empty). - */ - public List getComponents() { - List allComponents = new ArrayList(); - List facesConfigs = getFacesConfigModels(); - Iterator itFacesConfigs = facesConfigs.iterator(); - while (itFacesConfigs.hasNext()) { - FacesConfigType facesConfig = (FacesConfigType)itFacesConfigs.next(); - EList components = facesConfig.getComponent(); - allComponents.addAll(components); - } - return allComponents; - } - - /** - * Gets list of all ReferencedBeanType instances from all known - * faces-config models; list may be empty. - * - * @return List of all ReferencedBeanType instances from all known - * faces-config models (list may be empty). - */ - public List getReferencedBeans() { - List allReferencedBeans = new ArrayList(); - List facesConfigs = getFacesConfigModels(); - Iterator itFacesConfigs = facesConfigs.iterator(); - while (itFacesConfigs.hasNext()) { - FacesConfigType facesConfig = (FacesConfigType)itFacesConfigs.next(); - EList referencedBeans = facesConfig.getReferencedBean(); - allReferencedBeans.addAll(referencedBeans); - } - return allReferencedBeans; - } - - /** - * Gets list of all RenderKitType instances from all known faces-config - * models; list may be empty. - * - * @return List of all RenderKitType instances from all known faces-config - * models (list may be empty). - */ - public List getRenderKits() { - List allRenderKits = new ArrayList(); - List facesConfigs = getFacesConfigModels(); - Iterator itFacesConfigs = facesConfigs.iterator(); - while (itFacesConfigs.hasNext()) { - FacesConfigType facesConfig = (FacesConfigType)itFacesConfigs.next(); - EList renderKits = facesConfig.getRenderKit(); - allRenderKits.addAll(renderKits); - } - return allRenderKits; - } - - /** - * Gets list of all LifecycleType instances from all known faces-config - * models; list may be empty. - * - * @return List of all LifecycleType instances from all known faces-config - * models (list may be empty). - */ - public List getLifecycles() { - List allLifecycles = new ArrayList(); - List facesConfigs = getFacesConfigModels(); - Iterator itFacesConfigs = facesConfigs.iterator(); - while (itFacesConfigs.hasNext()) { - FacesConfigType facesConfig = (FacesConfigType)itFacesConfigs.next(); - EList lifecycles = facesConfig.getLifecycle(); - allLifecycles.addAll(lifecycles); - } - return allLifecycles; - } - - /** - * @return the list of all resource bundles declared in all the FacesConfig - * configurations found. - */ - public List getResourceBundles() - { - List allResourceBundles = new ArrayList(); - List facesConfigs = getFacesConfigModels(); - Iterator itFacesConfigs = facesConfigs.iterator(); - while (itFacesConfigs.hasNext()) { - FacesConfigType facesConfig = (FacesConfigType)itFacesConfigs.next(); - for (final Iterator applicationIt = facesConfig.getApplication().iterator(); applicationIt.hasNext();) - { - ApplicationType appType = (ApplicationType) applicationIt.next(); - allResourceBundles.addAll(appType.getResourceBundle()); - } - } - return allResourceBundles; - } - - /** - * Adds this instance's {@link FacesConfigChangeAdapter} instance to the - * passed application configuration model's adapters collection. - * - * @param facesConfig Application configuration model's root object. - */ - public void addFacesConfigChangeAdapter(FacesConfigType facesConfig) { - if (facesConfig != null) { - if (facesConfigChangeAdapter == null) { - facesConfigChangeAdapter = new FacesConfigChangeAdapter(); - } - facesConfig.eAdapters().add(facesConfigChangeAdapter); - } - } - - /** - * Removes this instance's {@link FacesConfigChangeAdapter} instance from - * the passed application configuration model's adapters collection. - * - * @param facesConfig Application configuration model's root object. - */ - public void removeFacesConfigChangeAdapter(FacesConfigType facesConfig) { - if (facesConfig != null && facesConfigChangeAdapter != null) { - facesConfig.eAdapters().remove(facesConfigChangeAdapter); - } - } - - /** - * FacesConfigChangeAdapter is an EMF adapter which provides a mechanism - * for notification of changes to features in any application configuration - * model for which {@link IFacesConfigChangeListener} instances have - * registered an interest. - * - * @author Ian Trimble - Oracle - */ - class FacesConfigChangeAdapter extends EContentAdapter { - /* - * (non-Javadoc) - * @see org.eclipse.emf.ecore.util.EContentAdapter#notifyChanged(org.eclipse.emf.common.notify.Notification) - */ - public void notifyChanged(Notification notification) { - super.notifyChanged(notification); - notifyFacesConfigChangeListeners(notification); - } - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/JSFAppConfigProvidersChangeEvent.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/JSFAppConfigProvidersChangeEvent.java deleted file mode 100644 index a946e4c02..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/JSFAppConfigProvidersChangeEvent.java +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Ian Trimble - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.jsfappconfig; - -/** - * JSFAppConfigProvidersChangeEvent provides change information to instances of - * IJSFAppConfigProvidersChangeListener. - * - * <p><b>Provisional API - subject to change</b></p> - * - * @author Ian Trimble - Oracle - */ -public class JSFAppConfigProvidersChangeEvent { - - /** - * Event type; instance of IJSFAppConfigProvider was added (value == 1). - */ - public static final int ADDED = 1; - - /** - * Event type; instance of IJSFAppConfigProvider was removed (value == 2). - */ - public static final int REMOVED = 2; - - /** - * Instance of IJSFAppConfigProvider that was added or removed. - */ - protected IJSFAppConfigProvider configProvider = null; - - /** - * Event type. - */ - protected int eventType; - - /** - * Constructs an instance. - * - * @param configProvider Instance of IJSFAppConfigProvider that was added - * or removed - * @param eventType Event type - */ - public JSFAppConfigProvidersChangeEvent(IJSFAppConfigProvider configProvider, int eventType) { - this.configProvider = configProvider; - this.eventType = eventType; - } - - /** - * Gets the instance of IJSFAppConfigProvider that was added or removed. - * - * @return Instance of IJSFAppConfigProvider that was added or removed - */ - public IJSFAppConfigProvider getJSFAppConfigProvider() { - return configProvider; - } - - /** - * Gets the event type. - * - * @return Event type - */ - public int getEventType() { - return eventType; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/JSFAppConfigUtils.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/JSFAppConfigUtils.java deleted file mode 100644 index c74b44e08..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/JSFAppConfigUtils.java +++ /dev/null @@ -1,372 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Ian Trimble - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.jsfappconfig; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.Iterator; -import java.util.List; -import java.util.Set; -import java.util.StringTokenizer; -import java.util.jar.JarEntry; -import java.util.jar.JarFile; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IWorkspaceRoot; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.emf.common.util.EList; -import org.eclipse.jdt.core.IClasspathEntry; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jst.j2ee.common.ParamValue; -import org.eclipse.jst.j2ee.internal.J2EEVersionConstants; -import org.eclipse.jst.j2ee.model.IModelProvider; -import org.eclipse.jst.j2ee.model.ModelProviderManager; -import org.eclipse.jst.j2ee.web.componentcore.util.WebArtifactEdit; -import org.eclipse.jst.j2ee.webapplication.ContextParam; -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.jst.jsf.core.IJSFCoreConstants; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.core.internal.Messages; -import org.eclipse.osgi.util.NLS; -import org.eclipse.wst.common.componentcore.ComponentCore; -import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; -import org.eclipse.wst.common.componentcore.resources.IVirtualFolder; -import org.eclipse.wst.common.project.facet.core.IFacetedProject; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; -import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager; - -/** - * JSFAppConfigUtils provides utility methods useful in processing of a JSF - * application configuration. - * - * <p><b>Provisional API - subject to change</b></p> - * - * @author Ian Trimble - Oracle - */ -public class JSFAppConfigUtils { - - /** - * Name of JSF CONFIG_FILES context parameter ("javax.faces.CONFIG_FILES"). - */ - public static final String CONFIG_FILES_CONTEXT_PARAM_NAME = "javax.faces.CONFIG_FILES"; //$NON-NLS-1$ - - /** - * Location in JAR file of application configuration resource file - * ("META-INF/faces-config.xml"). - */ - public static final String FACES_CONFIG_IN_JAR_PATH = "META-INF/faces-config.xml"; //$NON-NLS-1$ - - - /** - * @param project - * @param minVersion - * @return true if project is a JSF facet project and the version of the project - * is at least minVersion. - */ - public static boolean isValidJSFProject(IProject project, String minVersion) - { - boolean isValid = false; - - final IProjectFacetVersion projectFacetVersion = getProjectFacet(project); - - if (projectFacetVersion != null) - { - try - { - final String versionString = - projectFacetVersion.getVersionString(); - final Comparator comparator = - projectFacetVersion.getProjectFacet().getVersionComparator(); - final int compareToMin = - comparator.compare(versionString, minVersion); - - if (compareToMin >=0) - { - return true; - } - } - catch (CoreException ce) - { - JSFCorePlugin.log(ce, "Error checking facet version"); //$NON-NLS-1$ - } - } - return isValid; - } - - /** - * Tests if the passed IProject instance is a valid JSF project in the - * following ways: - * <ul> - * <li>project is not null and is accessible, </li> - * <li>project has the JSF facet set on it.</li> - * </ul> - * - * @param project IProject instance to be tested. - * @return true if the IProject instance is a valid JSF project, else - * false. - */ - public static boolean isValidJSFProject(IProject project) { - boolean isValid = false; - IProjectFacetVersion projectFacet = getProjectFacet(project); - if (projectFacet != null) - { - isValid = true; - } - return isValid; - } - /** - * Get the facet version for the project - * @param project - * @return the project facet version or null if could not be found or if - * project is not accessible - */ - public static IProjectFacetVersion getProjectFacet(IProject project) - { - //check for null or inaccessible project - if (project != null && project.isAccessible()) { - //check for JSF facet on project - try { - IFacetedProject facetedProject = ProjectFacetsManager.create(project); - if (facetedProject != null) { - Set projectFacets = facetedProject.getProjectFacets(); - Iterator itProjectFacets = projectFacets.iterator(); - while (itProjectFacets.hasNext()) { - IProjectFacetVersion projectFacetVersion = (IProjectFacetVersion)itProjectFacets.next(); - if (IJSFCoreConstants.JSF_CORE_FACET_ID.equals(projectFacetVersion.getProjectFacet().getId())) - { - return projectFacetVersion; - } - } - } - } catch(CoreException ce) { - //log error - JSFCorePlugin.log(IStatus.ERROR, ce.getLocalizedMessage(), ce); - } - } - return null; - } - - /** - * Gets an IVirtualFolder instance which represents the root context's - * web content folder. - * - * @param project IProject instance for which to get the folder. - * @return IVirtualFolder instance which represents the root context's - * web content folder. - */ - public static IVirtualFolder getWebContentFolder(IProject project) { - IVirtualFolder folder = null; - IVirtualComponent component = ComponentCore.createComponent(project); - if (component != null) { - folder = component.getRootFolder(); - } - return folder; - } - - /** - * Gets an IPath instance representing the path of the passed IFile - * instance relative to the web content folder. - * - * @param file IFile instance for which a path is required. - * @return IPath instance representing the path relative to the web content - * folder. - */ - public static IPath getWebContentFolderRelativePath(IFile file) { - IPath path = null; - if (file != null) { - IVirtualFolder webContentFolder = getWebContentFolder(file.getProject()); - if (webContentFolder != null) { - IPath webContentPath = webContentFolder.getProjectRelativePath(); - IPath filePath = file.getProjectRelativePath(); - int matchingFirstSegments = webContentPath.matchingFirstSegments(filePath); - path = filePath.removeFirstSegments(matchingFirstSegments); - } - } - return path; - } - - /** - * Gets list of application configuration file names as listed in the JSF - * CONFIG_FILES context parameter ("javax.faces.CONFIG_FILES"). Will return - * an empty list if WebArtifactEdit is null, if WebApp is null, if context - * parameter does not exist, or if trimmed context parameter's value is - * an empty String. - * - * @param project IProject instance for which to get the context - * parameter's value. - * @return List of application configuration file names as listed in the - * JSF CONFIG_FILES context parameter ("javax.faces.CONFIG_FILES"); list - * may be empty. - */ - public static List getConfigFilesFromContextParam(IProject project) { - List filesList = Collections.EMPTY_LIST; - if (isValidJSFProject(project)) { - IModelProvider provider = ModelProviderManager.getModelProvider(project); - Object webAppObj = provider.getModelObject(); - if (webAppObj != null){ - if (webAppObj instanceof WebApp) - filesList = getConfigFilesForJ2EEApp(project); - else if (webAppObj instanceof org.eclipse.jst.javaee.web.WebApp) - filesList = getConfigFilesForJEEApp((org.eclipse.jst.javaee.web.WebApp)webAppObj); - } - - } - return filesList; - } - - private static List getConfigFilesForJEEApp(org.eclipse.jst.javaee.web.WebApp webApp) { - String filesString = null; - List contextParams = webApp.getContextParams(); - Iterator itContextParams = contextParams.iterator(); - while (itContextParams.hasNext()) { - org.eclipse.jst.javaee.core.ParamValue paramValue = (org.eclipse.jst.javaee.core.ParamValue)itContextParams.next(); - if (paramValue.getParamName().equals(CONFIG_FILES_CONTEXT_PARAM_NAME)) { - filesString = paramValue.getParamValue(); - break; - } - } - return parseFilesString(filesString); - } - - private static List getConfigFilesForJ2EEApp(IProject project){ - List filesList = new ArrayList(); - WebArtifactEdit webArtifactEdit = WebArtifactEdit.getWebArtifactEditForRead(project); - if (webArtifactEdit != null) { - try { - WebApp webApp = null; - try { - webApp = webArtifactEdit.getWebApp(); - } catch(ClassCastException cce) { - //occasionally thrown from WTP code in RC3 and possibly later - JSFCorePlugin.log(IStatus.ERROR, cce.getLocalizedMessage(), cce); - return filesList; - } - if (webApp != null) { - String filesString = null; - //need to branch here due to model version differences (BugZilla #119442) - if (webApp.getVersionID() == J2EEVersionConstants.WEB_2_3_ID) { - EList contexts = webApp.getContexts(); - Iterator itContexts = contexts.iterator(); - while (itContexts.hasNext()) { - ContextParam contextParam = (ContextParam)itContexts.next(); - if (contextParam.getParamName().equals(CONFIG_FILES_CONTEXT_PARAM_NAME)) { - filesString = contextParam.getParamValue(); - break; - } - } - } else { - EList contextParams = webApp.getContextParams(); - Iterator itContextParams = contextParams.iterator(); - while (itContextParams.hasNext()) { - ParamValue paramValue = (ParamValue)itContextParams.next(); - if (paramValue.getName().equals(CONFIG_FILES_CONTEXT_PARAM_NAME)) { - filesString = paramValue.getValue(); - break; - } - } - } - filesList = parseFilesString(filesString); - } - } finally { - webArtifactEdit.dispose(); - } - } - - return filesList; - } - - private static List parseFilesString(String filesString) { - List filesList = new ArrayList(); - if (filesString != null && filesString.trim().length() > 0) { - StringTokenizer stFilesString = new StringTokenizer(filesString, ","); //$NON-NLS-1$ - while (stFilesString.hasMoreTokens()) { - String configFile = stFilesString.nextToken().trim(); - filesList.add(configFile); - } - } - return filesList; - } - - /** - * Gets list of JAR file names, where each file name represents a JAR on - * the classpath that contains a /META-INF/faces-config.xml entry. Will - * return an empty list if no such JAR files are located. - * - * @param project IProject instance for which to scan the classpath. - * @return List of JAR file names, where each file name represents a JAR - * on the classpath that contains a ...META-INF/faces-config.xml entry; - * list may be empty. - * @throws CoreException Thrown when underlying calls into JavaCore fail. - * @throws IOException Thrown when attempt to open JAR to determine if it - * contains a /META-INF/faces-config.xml entry fails. - */ - public static List getConfigFileJARsFromClasspath(IProject project) throws CoreException, IOException { - ArrayList JARsList = new ArrayList(); - if (project.isAccessible() - && project.hasNature(JavaCore.NATURE_ID)) { - IJavaProject javaProject = JavaCore.create(project); - if (javaProject != null) { - IClasspathEntry[] classpathEntries = javaProject.getResolvedClasspath(true); - if (classpathEntries != null && classpathEntries.length > 0) { - IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot(); - for (int i = 0; i < classpathEntries.length; i++) { - IClasspathEntry classpathEntry = classpathEntries[i]; - if (classpathEntry.getEntryKind() == IClasspathEntry.CPE_LIBRARY) { - IPath libraryPath = classpathEntry.getPath(); - if (libraryPath.getFileExtension() != null && libraryPath.getFileExtension().length() > 0) { - if (libraryPath.getDevice() == null && workspaceRoot.getProject(libraryPath.segment(0)).exists()) { - libraryPath = workspaceRoot.getFile(libraryPath).getLocation(); - } - String libraryPathString = libraryPath.toString(); - JarFile jarFile = null; - try { - //check existence first [222249] - File file = new File(libraryPathString); - if (file.exists()) { - jarFile = new JarFile(file, false); - if (jarFile != null) { - JarEntry jarEntry = jarFile.getJarEntry(FACES_CONFIG_IN_JAR_PATH); - if (jarEntry != null) { - JARsList.add(libraryPathString); - } - } - } - } catch (FileNotFoundException fnfex) { - //should not get here, but eat error since this could only occur in under strange circumstances [222249] - } catch(IOException ioe) { - JSFCorePlugin.log( - IStatus.ERROR, - NLS.bind(Messages.JSFAppConfigUtils_ErrorOpeningJarFile, libraryPathString), - ioe); - } finally { - if (jarFile != null) { - jarFile.close(); - } - } - } - } - } - } - } - } - return JARsList; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/RuntimeClasspathJSFAppConfigLocater.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/RuntimeClasspathJSFAppConfigLocater.java deleted file mode 100644 index 7cb04b06b..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/RuntimeClasspathJSFAppConfigLocater.java +++ /dev/null @@ -1,119 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Ian Trimble - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.jsfappconfig; - -import java.io.IOException; -import java.util.Iterator; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Set; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jdt.core.ElementChangedEvent; -import org.eclipse.jdt.core.IElementChangedListener; -import org.eclipse.jdt.core.IJavaElementDelta; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; - -/** - * RuntimeClasspathJSFAppConfigLocater attempts to locate application - * configuration files in JAR files on the runtime classpath. The runtime - * classpath includes the server runtime classpath and the JAR files that will - * be deployed to the web application's /WEB-INF/lib folder. - * - * <p><b>Provisional API - subject to change</b></p> - * - * @author Ian Trimble - Oracle - */ -public class RuntimeClasspathJSFAppConfigLocater extends AbstractJSFAppConfigLocater - implements IElementChangedListener { - - /* - * (non-Javadoc) - * @see org.eclipse.jst.jsf.core.jsfappconfig.AbstractJSFAppConfigLocater#startLocating() - */ - public void startLocating() { - locateProviders(); - JavaCore.addElementChangedListener(this); - } - - /* - * (non-Javadoc) - * @see org.eclipse.jst.jsf.core.jsfappconfig.AbstractJSFAppConfigLocater#stopLocating() - */ - public void stopLocating() { - JavaCore.removeElementChangedListener(this); - } - - /** - * Locates application configuration resources specified in JAR files on - * the runtime classpath, and updates the set of - * {@link IJSFAppConfigProvider} instances accordingly. - */ - public void locateProviders() { - try { - List JARs = JSFAppConfigUtils.getConfigFileJARsFromClasspath(manager.getProject()); - Iterator itJARs = JARs.iterator(); - Set newConfigProviders = new LinkedHashSet(); - while (itJARs.hasNext()) { - String JARFilename = (String)itJARs.next(); - JARFileJSFAppConfigProvider configProvider = new JARFileJSFAppConfigProvider(JARFilename); - newConfigProviders.add(configProvider); - } - updateConfigProviders(newConfigProviders); - } catch(CoreException ce) { - //log error - JSFCorePlugin.log(IStatus.ERROR, ce.getLocalizedMessage(), ce); - } catch(IOException ioe) { - //log error - JSFCorePlugin.log(IStatus.ERROR, ioe.getLocalizedMessage(), ioe); - } - } - - /** - * Called when a Java element has changed. - * - * @param event ElementChangedEvent instance describing the change. - */ - public void elementChanged(ElementChangedEvent event) { - if (classpathChanged(event.getDelta())) { - locateProviders(); - } - } - - /** - * Recursively tests if the passed IJavaElementDelta instance or any of its - * descendents indicate a classpath change has occurred. - * - * @param delta IJavaElement instance to be tested. - * @return true if a claspath change has occurred, else false. - */ - protected boolean classpathChanged(IJavaElementDelta delta) { - int deltaFlags = delta.getFlags(); - if (((deltaFlags & IJavaElementDelta.F_ADDED_TO_CLASSPATH) == IJavaElementDelta.F_ADDED_TO_CLASSPATH) || - ((deltaFlags & IJavaElementDelta.F_ARCHIVE_CONTENT_CHANGED) == IJavaElementDelta.F_ARCHIVE_CONTENT_CHANGED) || - ((deltaFlags & IJavaElementDelta.F_REMOVED_FROM_CLASSPATH) == IJavaElementDelta.F_REMOVED_FROM_CLASSPATH)) { - return true; - } - boolean changed = false; - IJavaElementDelta[] childDeltas = delta.getAffectedChildren(); - if (childDeltas != null) { - for (int i = 0; i < childDeltas.length; i++) { - if (classpathChanged(childDeltas[i])) { - changed = true; - break; - } - } - } - return changed; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/WebContentRelativeJSFAppConfigLocater.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/WebContentRelativeJSFAppConfigLocater.java deleted file mode 100644 index 4359d216c..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/WebContentRelativeJSFAppConfigLocater.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Ian Trimble - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.jsfappconfig; - -import java.util.Iterator; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Set; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.wst.common.componentcore.resources.IVirtualFolder; -import org.eclipse.wst.common.componentcore.resources.IVirtualResource; - -/** - * WebContentRelativeJSFAppConfigLocater is an abstract base class that - * attempts to locate specified application configuration files relative to a - * web content folder. Subclasses must override the getFilenames() method to - * return a list of filenames that the locateProviders() method will attempt to - * locate, and call locateProviders(). - * - * <p><b>Provisional API - subject to change</b></p> - * - * @author Ian Trimble - Oracle - */ -public abstract class WebContentRelativeJSFAppConfigLocater extends AbstractJSFAppConfigLocater { - - /** - * Locates application configuration resources specified by the filenames - * (relative to the web content folder) returned by getFilenames(), and - * updates the set of {@link IJSFAppConfigProvider} instances accordingly. - */ - public void locateProviders() { - IProject project = manager.getProject(); - IVirtualFolder webContentFolder = JSFAppConfigUtils.getWebContentFolder(project); - if (webContentFolder != null) { - List filenames = getFilenames(); - Iterator itFilenames = filenames.iterator(); - Set newConfigProviders = new LinkedHashSet(); - while (itFilenames.hasNext()) { - String filename = (String)itFilenames.next(); - IVirtualResource appConfigResource = webContentFolder.findMember(filename); - if (appConfigResource != null && appConfigResource.getType() == IVirtualResource.FILE) { - IFile file = (IFile)appConfigResource.getUnderlyingResource(); - if (file != null && file.exists()) { - ArtifactEditJSFAppConfigProvider configProvider = new ArtifactEditJSFAppConfigProvider(file); - newConfigProviders.add(configProvider); - } - } - } - updateConfigProviders(newConfigProviders); - } - } - - /** - * Gets a list of Strings representing the filenames (relative to the web - * content folder) that locateProviders() will attempt to locate. - * - * @return A list of Strings representing the filenames (relative to the - * web content folder) that locateProviders() will attempt to locate. - */ - protected abstract List getFilenames(); - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/package-info.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/package-info.java deleted file mode 100644 index f1a3d1350..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/package-info.java +++ /dev/null @@ -1,18 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - * - ********************************************************************************/ - -/** - * Project-level support for JSF application configuration files. - * - * <p><b>Provisional API - subject to change</b></p> - */ -package org.eclipse.jst.jsf.core.jsfappconfig; diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsflibraryconfiguration/JSFLibraryConfigurationHelper.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsflibraryconfiguration/JSFLibraryConfigurationHelper.java deleted file mode 100644 index 4e73b2b13..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsflibraryconfiguration/JSFLibraryConfigurationHelper.java +++ /dev/null @@ -1,89 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.jsflibraryconfiguration; - -import java.util.Collection; -import java.util.HashSet; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IPath; -import org.eclipse.jdt.core.IClasspathEntry; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.core.jsflibraryconfiguration.internal.JSFLibraryReferenceFacadeFactory; - -/** - * Helper class for adopters needing to deal with JSF Library References - * - * <p><b>Provisional API - subject to change</b></p> - * @since WTP JSF 1.0 - * @deprecated - */ -public final class JSFLibraryConfigurationHelper { - /** - * container id for JSF Library Classpath Containers - */ - public static final String JSF_LIBRARY_CP_CONTAINER_ID="org.eclipse.jst.jsf.core.internal.jsflibrarycontainer"; - - /** - * @param project - * @return collection of references - */ - public static Collection<JSFLibraryReference> getJSFLibraryReferences(IProject project) { - Collection<JSFLibraryReference> results = new HashSet<JSFLibraryReference>(); - IJavaProject jproj = JavaCore.create(project); - try { - IClasspathEntry[] entries = jproj.getRawClasspath(); - boolean foundImpl = false; - for (int i=0;i<entries.length;i++){ - JSFLibraryReference ref = JSFLibraryReferenceFacadeFactory.create(entries[i]); - if (ref != null){ - results.add(ref); - if (ref.isJSFImplementation()) - foundImpl = true; - } - } - if (! foundImpl){ - results.add(JSFLibraryReferenceFacadeFactory.createServerSuppliedJSFLibRef()); - } - } catch (JavaModelException e) { - JSFCorePlugin.log(e, "Exception occurred calling getJSFLibraryReferences for "+project.getName()); - } - return results; - } - - /** - * @param cpEntry - * @return boolean indicating that the classpath entry is a JSF Libary Classpath Container - */ - public static boolean isJSFLibraryContainer(IClasspathEntry cpEntry) { - if (cpEntry.getEntryKind() != IClasspathEntry.CPE_CONTAINER) - return false; - - IPath path = cpEntry.getPath(); - return path != null && path.segmentCount() == 2 && JSF_LIBRARY_CP_CONTAINER_ID.equals(path.segment(0)); - } - - /** - * @param project - * @return true if the JSF Faceted project is configured to use system supplied implementation - */ - public static boolean isConfiguredForSystemSuppliedImplementation(IProject project) { - Collection<JSFLibraryReference> refs = getJSFLibraryReferences(project); - for(JSFLibraryReference ref : refs){ - if (ref instanceof JSFLibraryReferenceServerSupplied) - return true; - } - return false; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsflibraryconfiguration/JSFLibraryReference.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsflibraryconfiguration/JSFLibraryReference.java deleted file mode 100644 index 17fe475aa..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsflibraryconfiguration/JSFLibraryReference.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.jsflibraryconfiguration; - -import java.util.Collection; - -import org.eclipse.jdt.core.IClasspathEntry; - -/** - * Represents a reference to a JSF Library on a project - * - * <p><b>Provisional API - subject to change</b></p> - * @deprecated - */ -public abstract interface JSFLibraryReference { - /** - * @return id for the library - */ - public String getId(); - /** - * @return name - */ - public String getName(); - /** - * @return collection of jars as {@link IClasspathEntry}s - */ - public Collection<IClasspathEntry> getJars(); - /** - * @return {@link JSFVersion} value - */ - public JSFVersion getMaxSupportedVersion(); - /** - * @return label user sees for this library - */ - public String getLabel(); - /** - * @return flag - */ - public boolean isJSFImplementation(); - /** - * @return is deployed (marked as J2EE Module Dependency) - */ - public boolean isDeployed(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsflibraryconfiguration/JSFLibraryReferencePluginProvided.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsflibraryconfiguration/JSFLibraryReferencePluginProvided.java deleted file mode 100644 index efa98e0b7..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsflibraryconfiguration/JSFLibraryReferencePluginProvided.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.jsflibraryconfiguration; - -/** - * A reference to a plugin-defined JSF Library - * - * <p><b>Provisional API - subject to change</b></p> - * - * @deprecated - */ -@SuppressWarnings("deprecation") -public interface JSFLibraryReferencePluginProvided extends JSFLibraryReferenceUserSpecified, JSFLibraryReferenceUserDefined { - /** - * @return plugin id. May return null if plugin id cannot be determined. - */ - public String getPluginId(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsflibraryconfiguration/JSFLibraryReferenceServerSupplied.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsflibraryconfiguration/JSFLibraryReferenceServerSupplied.java deleted file mode 100644 index 5ae119f30..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsflibraryconfiguration/JSFLibraryReferenceServerSupplied.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.jsflibraryconfiguration; - -/** - * A reference to a JSF Library where the implementation library is presumed to be coming from the - * server - * - * <p><b>Provisional API - subject to change</b></p> - * - * @deprecated - */ -public interface JSFLibraryReferenceServerSupplied extends - JSFLibraryReference { - - /** - * Constant used for server supplied virtual JSF Library referencew - */ - public static final String ID = "_ServerSupplied_"; - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsflibraryconfiguration/JSFLibraryReferenceUserDefined.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsflibraryconfiguration/JSFLibraryReferenceUserDefined.java deleted file mode 100644 index f5e69d373..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsflibraryconfiguration/JSFLibraryReferenceUserDefined.java +++ /dev/null @@ -1,20 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.jsflibraryconfiguration; - - -/** - * Represents an reference to a user specified JSF Library - * @deprecated use JSFLibraryReferenceUserSpecified - */ -public interface JSFLibraryReferenceUserDefined extends JSFLibraryReference { - // -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsflibraryconfiguration/JSFLibraryReferenceUserSpecified.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsflibraryconfiguration/JSFLibraryReferenceUserSpecified.java deleted file mode 100644 index a65cbab44..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsflibraryconfiguration/JSFLibraryReferenceUserSpecified.java +++ /dev/null @@ -1,23 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.jsflibraryconfiguration; - - -/** - * Represents an reference to a user specified JSF Library - * - * <p><b>Provisional API - subject to change</b></p> - * - * @deprecated - */ -public interface JSFLibraryReferenceUserSpecified extends JSFLibraryReference { - // -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsflibraryconfiguration/JSFVersion.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsflibraryconfiguration/JSFVersion.java deleted file mode 100644 index 244f00c19..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsflibraryconfiguration/JSFVersion.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.jsflibraryconfiguration; - -/** - * Enumeration of JavaServer Faces Versions - * - * <p><b>Provisional API - subject to change</b></p> - * - * @deprecated - */ -public enum JSFVersion { - - /** - * Unknown version support - */ - UNKNOWN, - /** - * Supports JSF Version 1.0 - */ - V1_0, - /** - * Supports JSF Version 1.1 - */ - V1_1, - /** - * Supports JSF Version 1.1 - */ - V1_2; - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsflibraryconfiguration/internal/AbstractJSFLibraryReferenceImpl.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsflibraryconfiguration/internal/AbstractJSFLibraryReferenceImpl.java deleted file mode 100644 index c6d5cf948..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsflibraryconfiguration/internal/AbstractJSFLibraryReferenceImpl.java +++ /dev/null @@ -1,158 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.jsflibraryconfiguration.internal; - - - - -import java.util.Collection; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -import org.eclipse.core.runtime.Path; -import org.eclipse.jdt.core.IClasspathEntry; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jst.jsf.core.internal.jsflibraryconfig.JSFLibraryInternalReference; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.ArchiveFile; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary; -import org.eclipse.jst.jsf.core.jsflibraryconfiguration.JSFLibraryReference; -import org.eclipse.jst.jsf.core.jsflibraryconfiguration.JSFVersion; -/** - * @author gekessle - * @deprecated - */ -public abstract class AbstractJSFLibraryReferenceImpl implements JSFLibraryReference { - - /** - * The {@link org.eclipse.jst.jsf.core.internal.jsflibraryconfig.JSFLibraryInternalReference} being wrapped - */ - protected JSFLibraryInternalReference libRef; - private String _id; - private String _label; - private boolean _isImplementation; - private boolean _isDeloyed; - - /** - * Constructor for "virtual" JSF Library References like "ServerSupplied" - * @param id - * @param label - * @param isImplementation - */ - public AbstractJSFLibraryReferenceImpl(String id, String label, boolean isImplementation){ - _id = id; - _label = label; - _isImplementation = isImplementation; - } - - /** - * Constructor non-virtual library references - * @param libRef - * @param isDeployed - */ - public AbstractJSFLibraryReferenceImpl(JSFLibraryInternalReference libRef, boolean isDeployed){ - this.libRef = libRef; - _isDeloyed = isDeployed; - } - - public String getId() { - if (libRef != null) - return libRef.getID(); - - return _id; - } - - public String getLabel() { - if (libRef != null) - return libRef.getLabel(); - - return _label; - } - - public boolean isDeployed() { - return _isDeloyed; - } - - public boolean isJSFImplementation() { - if (libRef != null) - return libRef.isImplementation(); - - return _isImplementation; - } - - /** - * @return the JSFLibrary underpinning the reference. - * May be null if the library is missing or cannot be resolved from the registry. - */ - protected JSFLibrary getLibrary(){ - return libRef.getLibrary(); - } - - public Collection<IClasspathEntry> getJars() { - Set<IClasspathEntry> results = new HashSet<IClasspathEntry>(); - if (getLibrary() != null){ - List jars = getLibrary().getArchiveFiles(); - for (Iterator it= jars.iterator();it.hasNext();){ - ArchiveFile jar = (ArchiveFile)it.next(); - String path = jar.getResolvedSourceLocation(); - results.add(JavaCore.newLibraryEntry(new Path(path), null, null)); - } - } - return results; - } - - public JSFVersion getMaxSupportedVersion() { - if (getLibrary() != null) - return adaptVersion(getLibrary().getJSFVersion()); - return null; - } - - private JSFVersion adaptVersion( - org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFVersion version) { - - switch (version.getValue()){ - case org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFVersion.V1_1: - return JSFVersion.V1_1; - case org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFVersion.V1_2: - return JSFVersion.V1_2; - default: - return JSFVersion.UNKNOWN; - - } - } - - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.core.jsflibraryconfiguration.JSFLibraryReference#getName() - */ - public String getName() { - if (getLibrary()!= null) { - return getLibrary().getName(); - } - return getId(); - } - - public String toString(){ - StringBuffer buf = new StringBuffer("id: "); - buf.append(getId()); - buf.append(", label: "); - buf.append(getLabel()); - buf.append(", isDeployed: "); - buf.append(isDeployed()); - buf.append(", isImpl: "); - buf.append(isJSFImplementation()); - buf.append(", version: "); - buf.append(getMaxSupportedVersion().name()); - - return buf.toString(); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsflibraryconfiguration/internal/JSFLibraryReferenceFacadeFactory.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsflibraryconfiguration/internal/JSFLibraryReferenceFacadeFactory.java deleted file mode 100644 index 5205610b1..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsflibraryconfiguration/internal/JSFLibraryReferenceFacadeFactory.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.jsflibraryconfiguration.internal; - -import org.eclipse.jdt.core.IClasspathAttribute; -import org.eclipse.jdt.core.IClasspathEntry; -import org.eclipse.jst.j2ee.classpathdep.IClasspathDependencyConstants; -import org.eclipse.jst.jsf.core.internal.jsflibraryconfig.JSFLibraryRegistryUtil; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.PluginProvidedJSFLibrary; -import org.eclipse.jst.jsf.core.jsflibraryconfiguration.JSFLibraryConfigurationHelper; -import org.eclipse.jst.jsf.core.jsflibraryconfiguration.JSFLibraryReference; -import org.eclipse.jst.jsf.core.jsflibraryconfiguration.JSFLibraryReferenceServerSupplied; - -/** - * Factory for producing facade objects for references to the internal EMF JSF Library classes - * @deprecated - */ -public class JSFLibraryReferenceFacadeFactory { - /** - * Returns a JSFLibraryReferenceUserSpecified (or JSFLibraryReferenceUserDefined}) or JSFLibraryReferencePluginProvided instance. - * Will not create a JSFLibraryReferenceServerSupplied as there is no cp entry. Use createServerSuppliedJSFLibRef instead. - * @param classpathEntry - * @return an instance of JSFLibraryInternalReference. Null will be returned if the cpEntry is not a JSF Library reference. - */ - public static JSFLibraryReference create(final IClasspathEntry classpathEntry) { - if (JSFLibraryConfigurationHelper.isJSFLibraryContainer(classpathEntry)){ - return createReference(classpathEntry); - } - return null; - } - - /** - * @return instance of {@link JSFLibraryReferenceServerSupplied} - */ - public static JSFLibraryReferenceServerSupplied createServerSuppliedJSFLibRef(){ - return new JSFLibraryReferenceServerSuppliedImpl(); - } - - - /** - * @param classpathEntry - * @return {@link JSFLibraryReference} - */ - private static JSFLibraryReference createReference( - final IClasspathEntry classpathEntry) { - - String libID = classpathEntry.getPath().segment(1); - org.eclipse.jst.jsf.core.internal.jsflibraryconfig.JSFLibraryInternalReference libRef = JSFLibraryRegistryUtil.getInstance().getJSFLibraryReferencebyID(libID); - if (libRef!= null){ - boolean isDeployed = getJ2EEModuleDependency(classpathEntry); - if (libRef.getLibrary() instanceof PluginProvidedJSFLibrary) - return new JSFLibraryReferencePluginProvidedImpl(libRef, isDeployed); - - return new JSFLibraryReferenceUserSpecifiedImpl(libRef, isDeployed); - } - return null; - } - - private static boolean getJ2EEModuleDependency(IClasspathEntry classpathEntry) { - IClasspathAttribute[] attrs = classpathEntry.getExtraAttributes(); - for (int i=0;i<attrs.length;i++){ - IClasspathAttribute attr = attrs[i]; - if (attr.getName().equals(IClasspathDependencyConstants.CLASSPATH_COMPONENT_DEPENDENCY)){ - return true; - } - } - return false; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsflibraryconfiguration/internal/JSFLibraryReferencePluginProvidedImpl.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsflibraryconfiguration/internal/JSFLibraryReferencePluginProvidedImpl.java deleted file mode 100644 index bde1b6bf4..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsflibraryconfiguration/internal/JSFLibraryReferencePluginProvidedImpl.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.jsflibraryconfiguration.internal; - -import org.eclipse.jst.jsf.core.internal.jsflibraryconfig.JSFLibraryInternalReference; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.PluginProvidedJSFLibrary; -import org.eclipse.jst.jsf.core.jsflibraryconfiguration.JSFLibraryReferencePluginProvided; - -/** - * @deprecated - */ -public class JSFLibraryReferencePluginProvidedImpl extends AbstractJSFLibraryReferenceImpl implements JSFLibraryReferencePluginProvided { - - /** - * Constructor - * @param libRef - * @param isDeployed - */ - public JSFLibraryReferencePluginProvidedImpl(JSFLibraryInternalReference libRef, boolean isDeployed) { - super(libRef, isDeployed); - } - - public String getPluginId() { - if (getLibrary() != null) - return ((PluginProvidedJSFLibrary) getLibrary()).getPluginID(); - - return null; - } - - public String toString() { - StringBuffer buf = new StringBuffer("PluginProvided: ("); - buf.append(super.toString()); - - return buf.toString(); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsflibraryconfiguration/internal/JSFLibraryReferenceServerSuppliedImpl.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsflibraryconfiguration/internal/JSFLibraryReferenceServerSuppliedImpl.java deleted file mode 100644 index b85543a6e..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsflibraryconfiguration/internal/JSFLibraryReferenceServerSuppliedImpl.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.jsflibraryconfiguration.internal; - -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary; -import org.eclipse.jst.jsf.core.jsflibraryconfiguration.JSFLibraryReferenceServerSupplied; -import org.eclipse.jst.jsf.core.jsflibraryconfiguration.JSFVersion; - -/** - * @author gekessle - * @deprecated - */ -public class JSFLibraryReferenceServerSuppliedImpl - extends AbstractJSFLibraryReferenceImpl - implements JSFLibraryReferenceServerSupplied { - - /** - * Constructor - */ - public JSFLibraryReferenceServerSuppliedImpl(){ - //TODO: replace label with constant - super(JSFLibraryReferenceServerSupplied.ID, "Server Supplied", true); - } - - public String toString() { - StringBuffer buf = new StringBuffer("ServerSupplied: ("); - buf.append(super.toString()); - buf.append(")"); - - return buf.toString(); - } - - protected JSFLibrary getLibrary(){ - return null; - } - - public JSFVersion getMaxSupportedVersion() { - return JSFVersion.UNKNOWN; - } -// -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsflibraryconfiguration/internal/JSFLibraryReferenceUserSpecifiedImpl.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsflibraryconfiguration/internal/JSFLibraryReferenceUserSpecifiedImpl.java deleted file mode 100644 index 46522774e..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsflibraryconfiguration/internal/JSFLibraryReferenceUserSpecifiedImpl.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.jsflibraryconfiguration.internal; - -import org.eclipse.jst.jsf.core.internal.jsflibraryconfig.JSFLibraryInternalReference; -import org.eclipse.jst.jsf.core.jsflibraryconfiguration.JSFLibraryReferenceUserDefined; -import org.eclipse.jst.jsf.core.jsflibraryconfiguration.JSFLibraryReferenceUserSpecified; - -/** - * Implementation of a reference to a user specified JSF Library - * @deprecated - */ -@SuppressWarnings("deprecation") -public class JSFLibraryReferenceUserSpecifiedImpl extends AbstractJSFLibraryReferenceImpl implements JSFLibraryReferenceUserSpecified, JSFLibraryReferenceUserDefined{ - /** - * @param libRef of type {@link JSFLibraryInternalReference} - * @param isDeployed - */ - public JSFLibraryReferenceUserSpecifiedImpl( - JSFLibraryInternalReference libRef, boolean isDeployed) { - - super(libRef, isDeployed); - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.core.jsflibraryconfiguration.internal.AbstractJSFLibraryReferenceImpl#toString() - */ - public String toString() { - StringBuffer buf = new StringBuffer("UserSpecified: ("); - buf.append(super.toString()); - buf.append(")"); - - return buf.toString(); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsflibraryconfiguration/package-info.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsflibraryconfiguration/package-info.java deleted file mode 100644 index d17bacc75..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsflibraryconfiguration/package-info.java +++ /dev/null @@ -1,18 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - * - ********************************************************************************/ - -/** - * API for configuring JSF Library References. - * - * <p><b>Provisional API - subject to change</b></p> - */ -package org.eclipse.jst.jsf.core.jsflibraryconfiguration; diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsflibraryregistry/InvalidArchiveFilesCreationException.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsflibraryregistry/InvalidArchiveFilesCreationException.java deleted file mode 100644 index d76849ca2..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsflibraryregistry/InvalidArchiveFilesCreationException.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.jsflibraryregistry; - -/** - * Exception class thrown by PluginProvidedJSFLibraryCreationHelper. - * - * <p><b>Provisional API - subject to change</b></p> - * - * @deprecated - */ -public class InvalidArchiveFilesCreationException extends Exception { - private static final long serialVersionUID = 1L; - - /** - * Creates an instance with the specified message. - * @param msg This instance's message - */ - public InvalidArchiveFilesCreationException(String msg) { - super(msg); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsflibraryregistry/JSFLibraryArchiveFilesDelegate.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsflibraryregistry/JSFLibraryArchiveFilesDelegate.java deleted file mode 100644 index e4422b2e9..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsflibraryregistry/JSFLibraryArchiveFilesDelegate.java +++ /dev/null @@ -1,140 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.jsflibraryregistry; - -import java.util.Collection; - -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.ArchiveFile; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistryFactory; -import org.osgi.framework.Bundle; - -/** - * Abstract delegate class used by jsfLibraries ext-pt to return collection of - * ArchiveFiles to PluginProvidedJSFLibraryCreationHelper. - * - * Caller must first setConfigurationElement(IConfigurationElement element) - * before a call to getArchiveFiles(). - * - * <p><b>Provisional API - subject to change</b></p> - * - * @deprecated along with the jsflibraries extension-point - */ -public abstract class JSFLibraryArchiveFilesDelegate { - private IConfigurationElement extPtElement; - private String libID = null; - private IPath pluginPath = null; - private String pluginID; - private String relativeDestLocation = "WEB-INF/lib"; //$NON-NLS-1$ - - /** - * Returns a Collection of <code>org.eclipse.jst.jsf.core.internal.jsflibraryregistry.ArchiveFile</code> - * instances. - * - * @return A Collection of <code>org.eclipse.jst.jsf.core.internal.jsflibraryregistry.ArchiveFile</code> - * instances - */ - public abstract Collection getArchiveFiles(); - - /** - * Sets the IConfigurationElement instance to be subsequently used to get - * the plugin ID and the name defined for the JSF Library. - * - * @param extPtElement IConfigurationElement instance - */ - public final void setConfigurationElement(IConfigurationElement extPtElement){ - this.extPtElement = extPtElement; - } - - /** - * Constructs an instance. - */ - public JSFLibraryArchiveFilesDelegate() { - super(); - } - - /** - * Sets the relative destination location subsequently used to set the - * corresponding property on each created ArchiveFile. - * - * @param relPath Relative destination location for ArchiveFile instances - */ - protected void setRelativeDestinationLocation(String relPath){ - relativeDestLocation = relPath; - } - - /** - * Returns ArchiveFile where the location is set relative to the plugin. - * As long as the ArchiveFile is on the local machine somewhere, it should - * be locatable. - * - * @param relativePathFileName Relative location of the ArchiveFile - * @return ArchiveFile instance. - */ - protected ArchiveFile createArchiveFile(String relativePathFileName){ - ArchiveFile file = JSFLibraryRegistryFactory.eINSTANCE.createArchiveFile(); - file.setRelativeToWorkspace(false); - file.setSourceLocation(relativePathFileName); - file.setRelativeDestLocation(relativeDestLocation); - return file; - } - -// protected ArchiveFile createArchiveFileWithAbsolutePath(String fullPath){ -// ArchiveFile file = JSFLibraryRegistryFactory.eINSTANCE.createArchiveFile(); -// file.setRelativeToWorkspace(false); -// file.setSourceLocation(fullPath); -// file.setRelativeDestLocation(relativeDestLocation); -// return file; -// } - - /** - * Returns the JSFLibrary ID as set on the extension point. - * - * @return JSFLibrary ID - */ - protected String getLibID(){ - if (libID == null){ - StringBuffer buf = new StringBuffer(getPluginID()); - buf.append("/").append(extPtElement.getAttribute(PluginProvidedJSFLibraryCreationHelper.NAME)); //$NON-NLS-1$ - libID = buf.toString(); - } - return libID; - } - - /** - * Returns the plugin's path. - * - * @return The plugin's path. - */ - protected IPath getPluginPath(){ - if (pluginPath == null){ - Bundle bundle = Platform.getBundle(getPluginID()); - pluginPath = new Path(bundle.getLocation()); - } - return pluginPath; - } - - /** - * Returns the plugin's ID. - * - * @return The plugin's ID. - */ - private String getPluginID() { - if (pluginID == null){ - pluginID = extPtElement.getDeclaringExtension().getContributor().getName(); - } - return pluginID; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsflibraryregistry/PluginProvidedJSFLibraryArchiveFilesDelegate.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsflibraryregistry/PluginProvidedJSFLibraryArchiveFilesDelegate.java deleted file mode 100644 index a298df4f3..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsflibraryregistry/PluginProvidedJSFLibraryArchiveFilesDelegate.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.jsflibraryregistry; - -import org.eclipse.jst.jsf.core.jsflibraryregistry.internal.PluginProvidedJSFLibraryCreationHelper2; - -/** - * Abstract class to be used for supplying the jar file names for a plugin provided jsf library. - * <br>Adopters must implement getArchiveFiles() making use of the addArchiveFile(String pluginRootRelativePath) method. - * <br><em>Note: A plugin providing jsf libraries cannot be jarred at this time. </em> - * <br><br>ex. - * <br> <pre><code>public void getArchiveFiles() { - addArchiveFile("/lib/JAR1.jar"); - addArchiveFile("/lib/JAR2.jar"); - } - </code> - </pre> - * - * <p><b>Provisional API - subject to change</b></p> - * - * @deprecated - */ -public abstract class PluginProvidedJSFLibraryArchiveFilesDelegate { - private PluginProvidedJSFLibraryCreationHelper2 helper; - - /** - * Constructs an instance. - */ - public PluginProvidedJSFLibraryArchiveFilesDelegate() { - super(); - } - - /** - * Concrete delegate must implement this method to define jars in the library. - * Use addJarFile(String pluginRootRelativePath) within this method to add jars to the library. - */ - public abstract void getArchiveFiles(); - - /** - * Adds jar file to the library. Verification of file existence does not occur at this point. - * - * Jar must be specified as being relative to the plugin. - * ex. "/lib/MyJar.jar" where the lib directory is a child of the root. - * - * @param pluginRootRelativePath - */ - protected void addArchiveFile(String pluginRootRelativePath) { - helper.addArchiveFile(pluginRootRelativePath);//getArchiveFiles().add(helper.createArchiveFile(pluginRootRelativePath)); - } - - /** - * Not to be implemented by subclasses - * @param helper - */ - public void setCreationHelper( - PluginProvidedJSFLibraryCreationHelper2 helper) { - this.helper = helper; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsflibraryregistry/PluginProvidedJSFLibraryCreationHelper.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsflibraryregistry/PluginProvidedJSFLibraryCreationHelper.java deleted file mode 100644 index cda0083cb..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsflibraryregistry/PluginProvidedJSFLibraryCreationHelper.java +++ /dev/null @@ -1,136 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.jsflibraryregistry; - -import java.util.Collection; -import java.util.Iterator; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.core.internal.Messages; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.ArchiveFile; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistryFactory; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFVersion; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.PluginProvidedJSFLibrary; -import org.eclipse.osgi.util.NLS; - -/** - * Helper class used to create JSF Libraries from the - * <code>org.eclipse.jst.jsf.core.jsflibraries</code> extension-point. - * - * <p><b>Provisional API - subject to change</b></p> - * - * @deprecated - clients should not use - */ -public final class PluginProvidedJSFLibraryCreationHelper { - private IConfigurationElement config_element; - - /** - * Key of the 'name' attribute of the extension point. - */ - public final static String NAME = "name"; //$NON-NLS-1$ - /** - * Key of the 'isImplementation' attribute of the extension point. - */ - public final static String IS_IMPL = "isImplementation"; //$NON-NLS-1$ - /** - * Key of the 'maxVersionSupported' attribute of the extension point. - */ - public final static String VERSION = "maxVersionSupported"; //$NON-NLS-1$ - /** - * Key of the 'archiveFilesDelegate' attribute of the extension point. - */ - public final static String DELEGATE = "archiveFilesDelegate"; //$NON-NLS-1$ - - /** - * Creates an instance with the specified IConfigurationElement instance. - * - * @param jsfLibrary IConfigurationElement instance - */ - public PluginProvidedJSFLibraryCreationHelper (IConfigurationElement jsfLibrary){ - this.config_element = jsfLibrary; - } - - /** - * Creates a new PluginProvidedJSFLibrary from the JSFLibrary extension point. - * - * @return PluginProvidedJSFLibrary instance. - */ - public JSFLibrary create(){ - PluginProvidedJSFLibrary newLib = JSFLibraryRegistryFactory.eINSTANCE.createPluginProvidedJSFLibrary(); -// newLib.setID(getLibID()); - newLib.setPluginID(getPluginID()); - newLib.setName(config_element.getAttribute(NAME)); - newLib.setImplementation(config_element.getAttribute(IS_IMPL).equals("true") ? true : false); //$NON-NLS-1$ - newLib.setJSFVersion(JSFVersion.getJSFVersion(config_element.getAttribute(VERSION))); - - try { - addArchives(newLib); - return newLib; - } catch (Exception e) { - JSFCorePlugin.log( - e, - NLS.bind( - Messages.PluginProvidedJSFLibraryCreationHelper_ErrorCreating, - newLib.getName())); - } - return null; - } - - /** - * Adds ArchiveFile instances to the specified JSFLibrary instance. - * - * @param newLib JSFLibrary instance - * @throws InvalidArchiveFilesCreationException on attempt to create - * multiple instances at same location. - * @throws CoreException on core failure. - */ - private void addArchives(JSFLibrary newLib) throws InvalidArchiveFilesCreationException, CoreException { - JSFLibraryArchiveFilesDelegate jarCol = null; - ArchiveFile jar = null; - - jarCol = (JSFLibraryArchiveFilesDelegate)config_element.createExecutableExtension(DELEGATE); - if (jarCol != null){ - jarCol.setConfigurationElement(config_element); - Collection jars = jarCol.getArchiveFiles(); - if (jars == null)//TODO: better validation and error handling - return; - Iterator it = jars.iterator(); - while (it.hasNext()){ - Object aJar = it.next(); - if (aJar instanceof ArchiveFile){//for now check to see ArchiveFiles were being returned - jar = (ArchiveFile)aJar; - if (!newLib.containsArchiveFile(jar.getSourceLocation())) - newLib.getArchiveFiles().add(jar); - } - else { - throw new InvalidArchiveFilesCreationException( - NLS.bind( - Messages.PluginProvidedJSFLibraryCreationHelper_ErrorMultipleDefinition, - jar.getSourceLocation(), - config_element.getName())); - } - - } - } - } - - /** - * Returns the plugin's ID. - * - * @return The plugin's ID - */ - private String getPluginID() { - return config_element.getDeclaringExtension().getContributor().getName(); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsflibraryregistry/internal/PluginProvidedJSFLibraryCreationHelper2.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsflibraryregistry/internal/PluginProvidedJSFLibraryCreationHelper2.java deleted file mode 100644 index 723f0cd4b..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsflibraryregistry/internal/PluginProvidedJSFLibraryCreationHelper2.java +++ /dev/null @@ -1,147 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.jsflibraryregistry.internal; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.core.internal.Messages; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.ArchiveFile; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistryFactory; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFVersion; -import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.PluginProvidedJSFLibrary; -import org.eclipse.jst.jsf.core.jsflibraryregistry.PluginProvidedJSFLibraryArchiveFilesDelegate; -import org.eclipse.osgi.util.NLS; - -/** - * Helper class used to create plugin-rovided JSF Libraries from the - * <code>org.eclipse.jst.jsf.core.pluginProvidedJsfLibraries</code> extension-point. - * <br> - * - * @author Gerry Kessler - Oracle - * @deprecated - */ -public final class PluginProvidedJSFLibraryCreationHelper2 { - private PluginProvidedJSFLibrary newLib; - private IConfigurationElement config_element; - private String relativeDestLocation = "WEB-INF/lib"; //$NON-NLS-1$ - - /** - * Key of the 'name' attribute of the extension point. - */ - public final static String NAME = "name"; //$NON-NLS-1$ - /** - * Key of the 'isImplementation' attribute of the extension point. - */ - public final static String IS_IMPL = "isImplementation"; //$NON-NLS-1$ - /** - * Key of the 'maxVersionSupported' attribute of the extension point. - */ - public final static String VERSION = "maxVersionSupported"; //$NON-NLS-1$ - /** - * Key of the 'archiveFilesDelegate' attribute of the extension point. - */ - public final static String DELEGATE = "archiveFilesDelegate"; //$NON-NLS-1$ - /** - * Key of the 'label' attribute of the extension point. - */ - public final static String LABEL = "label"; //$NON-NLS-1$ - - /** - * Creates an instance with the specified IConfigurationElement instance. - * - * @param jsfLibrary IConfigurationElement instance - */ - public PluginProvidedJSFLibraryCreationHelper2 (IConfigurationElement jsfLibrary){ - this.config_element = jsfLibrary; - } - - /** - * Add a jar file to the library - * @param pluginRootRelativePath - */ - public void addArchiveFile(String pluginRootRelativePath) { - ArchiveFile jar = createArchiveFile(pluginRootRelativePath); - if (!newLib.containsArchiveFile(jar.getSourceLocation())) - newLib.getArchiveFiles().add(jar); - } - - /** - * Creates a new PluginProvidedJSFLibrary from the JSFLibrary extension point. - * - * @return PluginProvidedJSFLibrary instance. - */ - public JSFLibrary create(){ - newLib = JSFLibraryRegistryFactory.eINSTANCE.createPluginProvidedJSFLibrary(); - newLib.setPluginID(getPluginID()); - newLib.setName(config_element.getAttribute(NAME)); - String label = config_element.getAttribute(LABEL); - if (label != null && label.length() > 0){ - newLib.setLabel(label); - } - newLib.setImplementation(config_element.getAttribute(IS_IMPL).equals("true") ? true : false); //$NON-NLS-1$ - newLib.setJSFVersion(JSFVersion.getJSFVersion(config_element.getAttribute(VERSION))); - - try { - addArchives(); - return newLib; - } catch (Exception e) { - JSFCorePlugin.log( - e, - NLS.bind( - Messages.PluginProvidedJSFLibraryCreationHelper_ErrorCreating, - newLib.getName())); - } - return null; - } - - /** - * Adds ArchiveFile instances to the specified JSFLibrary instance. - * - * @param newLib JSFLibrary instance - * @throws CoreException on core failure. - */ - private void addArchives() throws CoreException { - PluginProvidedJSFLibraryArchiveFilesDelegate jarCol = null; - - jarCol = (PluginProvidedJSFLibraryArchiveFilesDelegate)config_element.createExecutableExtension(DELEGATE); - if (jarCol != null){ - jarCol.setCreationHelper(this); - jarCol.getArchiveFiles(); - } - } - /** - * Returns ArchiveFile where the location is set relative to the plugin. - * As long as the ArchiveFile is on the local machine somewhere, it should - * be locatable. - * - * @param relativePathFileName Relative location of the ArchiveFile - * @return ArchiveFile instance. - */ - private ArchiveFile createArchiveFile(String pluginRootRelativePath){ - ArchiveFile file = JSFLibraryRegistryFactory.eINSTANCE.createArchiveFile(); - file.setRelativeToWorkspace(false); - file.setSourceLocation(pluginRootRelativePath); - file.setRelativeDestLocation(relativeDestLocation); - return file; - } - - /** - * Returns the plugin's ID. - * - * @return The plugin's ID - */ - private String getPluginID() { - return config_element.getDeclaringExtension().getContributor().getName(); - } - -}
\ No newline at end of file diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsflibraryregistry/package-info.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsflibraryregistry/package-info.java deleted file mode 100644 index 3eb240d97..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsflibraryregistry/package-info.java +++ /dev/null @@ -1,18 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - * - ********************************************************************************/ - -/** - * API for configuring JSF Library References. - * - * <p><b>Provisional API - subject to change</b></p> - */ -package org.eclipse.jst.jsf.core.jsflibraryregistry; diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/metadata/internal/HTMLContentModelMetaDataTranslator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/metadata/internal/HTMLContentModelMetaDataTranslator.java deleted file mode 100644 index 64e707e84..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/metadata/internal/HTMLContentModelMetaDataTranslator.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.core.metadata.internal; - -import org.eclipse.jst.jsf.common.metadata.internal.AbstractTagLibDomainContentModelMetaDataTranslator; -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataModelMergeAssistant; -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataSourceModelProvider; -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataTranslator; -import org.eclipse.wst.html.core.internal.contentmodel.HTMLCMDocument; -import org.eclipse.wst.xml.core.internal.contentmodel.CMDocument; - -/** - * Translates the HTML CMDocument to standard metadata model entities and traits - */ -public class HTMLContentModelMetaDataTranslator extends AbstractTagLibDomainContentModelMetaDataTranslator implements IMetaDataTranslator { - - public boolean canTranslate(IMetaDataSourceModelProvider modelProvider) { - if (modelProvider != null && - modelProvider.getSourceModel() instanceof HTMLCMDocument) - return true; - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.internal.IMetaDataTranslator#translate(org.eclipse.jst.jsf.common.metadata.internal.IMetaDataModelMergeAssistant) - */ - public void translate(final IMetaDataModelMergeAssistant assistant) { - _assistant = assistant; - CMDocument doc = getSourceModel(); - if (doc instanceof HTMLCMDocument){ - doTranslate(doc); - } - } - - /** - * @return getURIDisplayLabel() - */ - protected String getURIDescription() { - return getURIDisplayLabel(); - } - - /** - * return "HTML 4.0" - */ - protected String getURIDisplayLabel() { - return "HTML 4.0"; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/metadata/internal/JSPContentModelMetaDataTranslator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/metadata/internal/JSPContentModelMetaDataTranslator.java deleted file mode 100644 index 95ed2a0b4..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/metadata/internal/JSPContentModelMetaDataTranslator.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.core.metadata.internal; - -import org.eclipse.jst.jsf.common.metadata.internal.AbstractTagLibDomainContentModelMetaDataTranslator; -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataModelMergeAssistant; -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataSourceModelProvider; -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataTranslator; -import org.eclipse.wst.html.core.internal.contentmodel.JSPCMDocument; -import org.eclipse.wst.xml.core.internal.contentmodel.CMDocument; - -/** - * Translates the JSP CMDocument to standard metadata model entities and traits - */ -public class JSPContentModelMetaDataTranslator extends AbstractTagLibDomainContentModelMetaDataTranslator implements IMetaDataTranslator { - - public boolean canTranslate(IMetaDataSourceModelProvider modelProvider) { - if (modelProvider != null && - modelProvider.getSourceModel() instanceof JSPCMDocument) - return true; - return false; - } - - public void translate(final IMetaDataModelMergeAssistant assistant) { - setAssistant(assistant); - CMDocument doc = getSourceModel(); - if (doc instanceof JSPCMDocument){ - doTranslate(doc); - } - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.internal.AbstractTagLibDomainContentModelMetaDataTranslator#getURIDescription() - */ - protected String getURIDescription() { - return "JSP Tags"; - } - - @Override - protected String getURIDisplayLabel() { - return "JSP"; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/metadata/internal/TaglibMetaDataLocator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/metadata/internal/TaglibMetaDataLocator.java deleted file mode 100644 index 0275afcb5..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/metadata/internal/TaglibMetaDataLocator.java +++ /dev/null @@ -1,170 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.core.metadata.internal; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.jsf.common.metadata.internal.AbstractMetaDataLocator; -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataLocator; -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataSourceModelProvider; -import org.eclipse.jst.jsf.common.metadata.internal.IPathSensitiveMetaDataLocator; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.CMDocumentFactoryTLD; -import org.eclipse.jst.jsp.core.taglib.ITaglibRecord; -import org.eclipse.jst.jsp.core.taglib.TaglibIndex; -import org.eclipse.wst.html.core.internal.contentmodel.HTMLCMDocumentFactory; -import org.eclipse.wst.xml.core.internal.contentmodel.CMDocument; -import org.eclipse.wst.xml.core.internal.provisional.contentmodel.CMDocType; - -/** - * Locator of tag library meta data - * - */ -public class TaglibMetaDataLocator extends AbstractMetaDataLocator implements IPathSensitiveMetaDataLocator{ - //project must be set to the current project context during locate only... should not be used when noifying observers - private IProject project; - private TaglibMetaDataSource source; - - /** - * Constructor - */ - public TaglibMetaDataLocator(){ - super(); - } - - public List/*<IMetaDataModelProvider>*/ locateMetaDataModelProviders(String uri) { - List ret = new ArrayList(); - CMDocument doc = null; - - if (uri == null){ - return ret; - } - else if (uri.equalsIgnoreCase(CMDocType.HTML_DOC_TYPE)){ - doc = HTMLCMDocumentFactory.getCMDocument(CMDocType.HTML_DOC_TYPE); - } - else if (uri.equalsIgnoreCase(CMDocType.JSP11_DOC_TYPE)){ - doc = HTMLCMDocumentFactory.getCMDocument(CMDocType.JSP11_DOC_TYPE); - } - else if (uri.equalsIgnoreCase(CMDocType.JSP12_DOC_TYPE)){ - doc = HTMLCMDocumentFactory.getCMDocument(CMDocType.JSP12_DOC_TYPE); - } - else if (uri.equalsIgnoreCase(CMDocType.JSP20_DOC_TYPE)){ - doc = HTMLCMDocumentFactory.getCMDocument(CMDocType.JSP20_DOC_TYPE); - } - else if (project != null ){//TLD - CMDocumentFactoryTLD factory = new CMDocumentFactoryTLD(); - ITaglibRecord[] tldRecs = TaglibIndex.getAvailableTaglibRecords(project.getFullPath()); - ITaglibRecord tldRec = findTLD(tldRecs, uri); - if (tldRec != null) - doc = factory.createCMDocument(tldRec); - } - - if (doc != null){ - source = new TaglibMetaDataSource(doc); - ret.add(source); - } - - return ret; - } - - private ITaglibRecord findTLD(ITaglibRecord[] tldRecs, String uri) { - for (int i=0;i<tldRecs.length;i++){ - ITaglibRecord tld = tldRecs[i]; - if (uri.equals(tld.getDescriptor().getURI())) - return tld; - } - return null; - } - - public void startLocating() { -// TaglibIndex.addTaglibIndexListener(this); - } - public void stopLocating() { -// TaglibIndex.removeTaglibIndexListener(this);//non-api call.... danger - } - - //not currently listening, so will not be called -// public void indexChanged(ITaglibDescriptor event) { -// if (event.getURI() != null && event.getURI().equals(uri)){ -// if (!_notificationEventOccuring){ -// _notificationEventOccuring = true; -// int type = adaptTagLibEvent(event); -// IMetaDataChangeNotificationEvent mdEvent = new MetaDataChangeNotificationEvent(this, uri, type); -// fireEvent(mdEvent); -// _notificationEventOccuring = false; -// } -// } -// } - -// private int adaptTagLibEvent(ITaglibRecordEvent event) { -// switch (event.getType()){ -// case ITaglibRecordEvent.ADDED: -// return IMetaDataChangeNotificationEvent.ADDED; -// case ITaglibRecordEvent.REMOVED: -// return IMetaDataChangeNotificationEvent.REMOVED; -// default: -// return IMetaDataChangeNotificationEvent.CHANGED; -// } -// } - -// private void fireEvent(final IMetaDataChangeNotificationEvent event) { -// SafeRunnable.run(new ISafeRunnable(){ -// -// public void handleException(Throwable exception) { -// // TODO Auto-generated method stub -// } -// -// public void run() throws Exception { -// Iterator it = getObservers().iterator(); -// while (it.hasNext()){ -// IMetaDataObserver observer = (IMetaDataObserver)it.next(); -// observer.notifyMetadataChanged(event); -// } -// } -// -// }); -// -// } - - public void setProjectContext(IProject project) { - this.project = project; - } - - private class TaglibMetaDataSource implements IMetaDataSourceModelProvider{ - - private CMDocument doc; - private IMetaDataLocator locator; - - TaglibMetaDataSource(CMDocument doc){ - super(); - this.doc = doc; - } - - public Object getSourceModel() { - return doc; - } - - public IMetaDataLocator getLocator() { - return locator; - } - - public void setLocator(IMetaDataLocator locator) { - this.locator = locator; - } - - public Object getAdapter(Class klass) { - return null; - } - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/metadata/internal/TaglibMetaDataTLDTranslator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/metadata/internal/TaglibMetaDataTLDTranslator.java deleted file mode 100644 index 73696daad..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/metadata/internal/TaglibMetaDataTLDTranslator.java +++ /dev/null @@ -1,143 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.core.metadata.internal; - -import org.eclipse.jst.jsf.common.metadata.internal.AbstractTagLibDomainContentModelMetaDataTranslator; -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataModelMergeAssistant; -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataSourceModelProvider; -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataTranslator; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDAttributeDeclaration; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDDocument; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDElementDeclaration; -import org.eclipse.wst.xml.core.internal.contentmodel.CMAttributeDeclaration; -import org.eclipse.wst.xml.core.internal.contentmodel.CMDocument; -import org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration; - -/** - * Translates a TLD CMDocument to standard metadata model entities and traits - * - */ -public class TaglibMetaDataTLDTranslator extends AbstractTagLibDomainContentModelMetaDataTranslator implements IMetaDataTranslator { - - public boolean canTranslate(IMetaDataSourceModelProvider modelProvider) { - if (modelProvider != null && - modelProvider.getSourceModel() instanceof TLDDocument) - return true; - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.internal.IMetaDataTranslator#translate(org.eclipse.jst.jsf.common.metadata.internal.IMetaDataModelMergeAssistant) - */ - public void translate(final IMetaDataModelMergeAssistant assistant) { - setAssistant(assistant); - CMDocument doc = getSourceModel(); - if (doc instanceof TLDDocument){ - doTranslate(doc); - - } - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.internal.AbstractTagLibDomainContentModelMetaDataTranslator#getURIDefaultPrefix() - */ - protected String getURIDefaultPrefix(){ - return getTLDDocument().getShortname(); - } - - /** - * @param tag - * @return the tag.getDisplayName() if available - */ - protected String getTagDisplayLabel(CMElementDeclaration tag){ - String label = ((TLDElementDeclaration)tag).getDisplayName(); - if (label == null) - label = super.getTagDisplayName(tag); - return label; - } - - /** - * @param tag - * @return the tag.getDescription() if available - */ - protected String getTagDescription(CMElementDeclaration tag){ - String desc = ((TLDElementDeclaration)tag).getDescription(); - if (desc == null) - desc = super.getTagDescription(tag); - return desc; - } - - /** - * @param tag - * @return the tag.getSmallIcon() if available - */ - protected String getTagSmallIcon(CMElementDeclaration tag){ - String smallIcon = ((TLDElementDeclaration)tag).getSmallIcon(); - if (smallIcon == null) - smallIcon = super.getTagSmallIcon(tag); - return smallIcon; - } - - /** - * @param tag - * @return the tag.getLargeIcon() if available - */ - protected String getTagLargeIcon(CMElementDeclaration tag){ - String largeIcon = ((TLDElementDeclaration)tag).getLargeIcon(); - if (largeIcon == null) - largeIcon = super.getTagLargeIcon(tag); - return largeIcon; - } - - /** - * @return the tag.getDescription() if available - */ - protected String getURIDescription() { - return getTLDDocument().getDescription(); - } - - /** - * @return the tag.getDisplayName() - */ - protected String getURIDisplayLabel() { - return getTLDDocument().getDisplayName(); - } - - /** - * @return the tld document for the source model - */ - protected TLDDocument getTLDDocument(){ - return (TLDDocument)getSourceModel(); - } - - @Override - protected String getTagAttributeDescription(CMAttributeDeclaration cmAttr) { - String desc = ((TLDAttributeDeclaration)cmAttr).getDescription(); - if (desc == null) - desc = super.getTagAttributeDescription(cmAttr); - return desc; - } - - @Override - protected boolean getTagAttributeIsRequired(CMAttributeDeclaration cmAttr) { - // TODO Auto-generated method stub - return super.getTagAttributeIsRequired(cmAttr); - } - - @Override - protected String getTagAttributeDefaultValue(CMAttributeDeclaration cmAttr) { - String val = ((TLDAttributeDeclaration)cmAttr).getAttrType().generateInstanceValue(); - if (val == null) - val = super.getTagAttributeDefaultValue(cmAttr); - return val; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/package-info.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/package-info.java deleted file mode 100644 index d12392b5d..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/package-info.java +++ /dev/null @@ -1,16 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - * - ********************************************************************************/ - -/** - * JSF Core Framework API. - */ -package org.eclipse.jst.jsf.core; diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/set/constraint/MemberConstraint.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/set/constraint/MemberConstraint.java deleted file mode 100644 index e6e69ca7d..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/set/constraint/MemberConstraint.java +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.set.constraint; - -import org.eclipse.emf.common.util.BasicDiagnostic; -import org.eclipse.emf.common.util.Diagnostic; -import org.eclipse.jst.jsf.common.sets.AxiomaticSet; -import org.eclipse.jst.jsf.common.sets.constraint.AbstractSetConstraint; - -/** - * A set constraint that is satisfied if a test set contains all of the specified - * mustBeMembers. - * - * <p><b>Provisional API - subject to change</b></p> - * - * @author cbateman - * - */ -public class MemberConstraint extends AbstractSetConstraint -{ - private final AxiomaticSet _mustBeMembers; - - /** - * @param mustBeMembers -- the set of objects that must occur in the - * input set for the constraint to satisfy. - */ - public MemberConstraint(AxiomaticSet mustBeMembers) - { - _mustBeMembers = mustBeMembers; - } - - /** - * Members of set must be comparable with thos in mustBeMembers using equals() - * @param set - * @return whether or not the constraint is satisfied. If not satisfied, the - * diagnostic's data array will contain the objects that are missing. - */ - public Diagnostic isSatisfied(AxiomaticSet set) - { - // the constraint is satisfied iff _mustBeMembers is a subset - // of set. In other words, if every member of _mustBeMembers - // is also in set. - - // we want to take _mustBeMembers - set. If the result is empty, then - // all of the required elements are members of set. If the set is non-empty, - // this tells us what is missing - final AxiomaticSet complement = _mustBeMembers.subtract(set); - - if (complement.isEmpty()) - { - return Diagnostic.OK_INSTANCE; - } - - return new BasicDiagnostic(Diagnostic.ERROR, this.getClass().getName(), - 0, "Failed membership constraint", complement.toArray()); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/set/constraint/package-info.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/set/constraint/package-info.java deleted file mode 100644 index 27a36920f..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/set/constraint/package-info.java +++ /dev/null @@ -1,18 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - * - ********************************************************************************/ - -/** - * JSF Core Set Constraints. - * - * <p><b>Provisional API - subject to change</b></p> - */ -package org.eclipse.jst.jsf.core.set.constraint; diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/set/mapping/ElementToTagIdentifierMapping.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/set/mapping/ElementToTagIdentifierMapping.java deleted file mode 100644 index 5af60bf39..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/set/mapping/ElementToTagIdentifierMapping.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.set.mapping; - -import org.eclipse.jst.jsf.common.sets.mapping.AbstractObjectInjectiveSetMapping; -import org.eclipse.jst.jsf.core.internal.tld.TagIdentifierFactory; -import org.w3c.dom.Element; - -/** - * Converts a set of DOM element's to a set of (object) injective set - * of TagIdentifiers. If the element is a JSP tag, the tag uri will - * be looked up. - * - * IMPORTANT: the returned TagIdentifiers are wrapper objects, so they only - * maintain immutability and idempotency as long as the input dom elements - * do not change. - * - * <p><b>Provisional API - subject to change</b></p> - * - * @author cbateman - * - */ -public class ElementToTagIdentifierMapping extends - AbstractObjectInjectiveSetMapping -{ - public Object map(Object element) { - Element domElement = (Element) element; - return TagIdentifierFactory.createDocumentTagWrapper(domElement); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/set/mapping/package-info.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/set/mapping/package-info.java deleted file mode 100644 index 52c667a02..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/set/mapping/package-info.java +++ /dev/null @@ -1,18 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - * - ********************************************************************************/ - -/** - * JSF Core Set Mapping. - * - * <p><b>Provisional API - subject to change</b></p> - */ -package org.eclipse.jst.jsf.core.set.mapping; diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/tagmatcher/EvaluationException.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/tagmatcher/EvaluationException.java deleted file mode 100644 index 0774212d4..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/tagmatcher/EvaluationException.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.tagmatcher; - -/** - * Wraps an exception thrown during algorithm evaluation - * - * <p><b>Provisional API - subject to change</b></p> - * - * @author cbateman - * - */ -public class EvaluationException extends RuntimeException { - - /** - * - */ - private static final long serialVersionUID = -3250608181004283586L; - - /** - * - */ - public EvaluationException() { - super(); - } - - /** - * @param message - */ - public EvaluationException(String message) { - super(message); - } - - /** - * @param cause - */ - public EvaluationException(Throwable cause) { - super(cause); - } - - /** - * @param message - * @param cause - */ - public EvaluationException(String message, Throwable cause) { - super(message, cause); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/tagmatcher/InvalidExpressionException.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/tagmatcher/InvalidExpressionException.java deleted file mode 100644 index 2651db8bf..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/tagmatcher/InvalidExpressionException.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.tagmatcher; - -/** - * Indicates an exception trapped while compiling or evaluating an - * expression. - * - * <p><b>Provisional API - subject to change</b></p> - * - * @author cbateman - * - */ -public class InvalidExpressionException extends RuntimeException { - /** - * - */ - private static final long serialVersionUID = 1445871263234840885L; - - /** - * @see RuntimeException - */ - public InvalidExpressionException() { - super(); - } - - /** - * @param message - * @param cause - */ - public InvalidExpressionException(String message, Throwable cause) { - super(message, cause); - } - - /** - * @param message - */ - public InvalidExpressionException(String message) { - super(message); - } - - /** - * @param cause - */ - public InvalidExpressionException(Throwable cause) { - super(cause); - } - - - - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/tagmatcher/TagMatchingAlgorithm.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/tagmatcher/TagMatchingAlgorithm.java deleted file mode 100644 index 11bce8649..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/tagmatcher/TagMatchingAlgorithm.java +++ /dev/null @@ -1,121 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.tagmatcher; - -import org.eclipse.jst.jsf.common.sets.AxiomaticSet; -import org.w3c.dom.Node; - -/** - * An algorithm that can be applied at a particular DOM node. The result - * may be expressed as a boolean or a set of matching nodes. The following - * are equivalent: - * - * false and empty set - * true and non-empty set - * - * Concrete implementations must be idempotent on evaluate(): - * - * 1) evaluate(node) must always return the same set if called repeatedly on - * the same node in the same DOM tree. - * 2) evaluate must be able to be called on any number of nodes in order and always - * produce the same result independent of what was called before and in what order. - * - * <p><b>Provisional API - subject to change</b></p> - * - * @author cbateman - * - */ -public abstract class TagMatchingAlgorithm -{ - private boolean _isInvalid; // = false; - - private boolean _isInitialized; - /** - * The expression being passed to the algorithm - */ - protected final String _expression; - - /** - * Constructor. - * - * @param expression - */ - protected TagMatchingAlgorithm(String expression) - { - _expression = expression; - } - - /** - * Called exactly once to initialize any pre-evaluation setup for - * the expression set for the algorithm. This is public to allow - * the client control when this initialization occurs in case it is expensive. - * evaluate() will call this method automatically if it has never been called - * @throws InvalidExpressionException if the underlying algorithm throws an - * exception during init - * @throws IllegalStateException if it has already been determined that the - * expression is invalid. - */ - public final void initialize() - { - if (_isInvalid) - { - throw new IllegalStateException("Expression: "+_expression+" has already been determined to be invalid"); - } - - if (!_isInitialized) - { - try - { - doInitialize(); - } - catch (Exception e) - { - _isInvalid = true; - throw new InvalidExpressionException(e); - } - _isInitialized = true; - } - } - - /** - * @param applyTo - * @return the set matching the configured expression applied to applyTo - * using the algorithm represented by this instance. - * @throws InvalidExpressionException of a problem occurs initializing the expression - * @throws EvaluationException if the internal algorithm throws an exception while - * evaluating. - * @throws IllegalStateException if evaluate is called again once InvalidExpressionException - * has already been thrown. - */ - public final AxiomaticSet evaluate(Node applyTo) - { - initialize(); - return doEvaluate(applyTo); - } - - /** - * Implementers must override to the evaluation of the target,expression pair - * @param target - * @return the algorithm evaluated with - */ - protected abstract AxiomaticSet doEvaluate(Node target); - - /** - * Do any initialization that is required before the algorithm is used - * to evaluate an expression on any node. This will get called exactly once and - * is guaranteed to be called, at latest, immediately before doEvaluate - * - * Method may throw runtime exceptions. These will be repropagated as - * InvalidExpressionException's with the original exception wrapped. - * @throws Exception - */ - protected abstract void doInitialize() throws Exception; -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/tagmatcher/XPathMatchingAlgorithm.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/tagmatcher/XPathMatchingAlgorithm.java deleted file mode 100644 index 9ce74dddb..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/tagmatcher/XPathMatchingAlgorithm.java +++ /dev/null @@ -1,87 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.core.tagmatcher; - -import javax.xml.xpath.XPath; -import javax.xml.xpath.XPathConstants; -import javax.xml.xpath.XPathExpression; -import javax.xml.xpath.XPathExpressionException; -import javax.xml.xpath.XPathFactory; - -import org.eclipse.jst.jsf.common.sets.AxiomaticSet; -import org.eclipse.jst.jsf.common.sets.ConcreteAxiomaticSet; -import org.eclipse.jst.jsf.common.sets.NodeSet; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - -/** - * A algorithm that uses an XPath expression to evaluate a result. The - * algorithm assumes (although cannot verify beforehand) that the expression - * provided can be evaluated with a node set return type (see JAXP). If the - * algorithm's underlying XPath evaluator throws an exception indicating that - * the return type cannot be coerced to a node set, the algorithm will return - * an empty set (no match) unless the strictMatching flag is set to true, in which - * case it will re-throw the exception wrapped as an unchecked EvaluationException. - * - * <p><b>Provisional API - subject to change</b></p> - * - * @author cbateman - * - */ -public class XPathMatchingAlgorithm extends TagMatchingAlgorithm -{ - private final boolean _isStrictMatching; - private final XPath _xpath; - private XPathExpression _compiledExpr; - - /** - * @param expression - */ - public XPathMatchingAlgorithm(String expression) - { - this(expression, false); - } - - /** - * @param expression - * @param isStrictMatching - */ - public XPathMatchingAlgorithm(String expression, boolean isStrictMatching) - { - super(expression); - _isStrictMatching = isStrictMatching; - _xpath = XPathFactory.newInstance().newXPath(); - } - - protected AxiomaticSet doEvaluate(Node target) - { - try - { - NodeList nodeList = - (NodeList) _compiledExpr.evaluate(target, XPathConstants.NODESET); - return new NodeSet(nodeList); - } - catch (XPathExpressionException xpam) - { - if (_isStrictMatching) - { - throw new EvaluationException(xpam); - } - // if not strict checking, return empty set - return new ConcreteAxiomaticSet(); - } - } - - protected void doInitialize() throws XPathExpressionException { - // compile the xpath expr - _compiledExpr = _xpath.compile(_expression); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/tagmatcher/package-info.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/tagmatcher/package-info.java deleted file mode 100644 index 6f1afd539..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/tagmatcher/package-info.java +++ /dev/null @@ -1,18 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - * - ********************************************************************************/ - -/** - * JSF Core Tag Matching Support. - * - * <p><b>Provisional API - subject to change</b></p> - */ -package org.eclipse.jst.jsf.core.tagmatcher; diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/DTAppManagerUtil.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/DTAppManagerUtil.java deleted file mode 100644 index 8d9781573..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/DTAppManagerUtil.java +++ /dev/null @@ -1,171 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.jst.jsf.context.resolver.structureddocument.IStructuredDocumentContextResolverFactory; -import org.eclipse.jst.jsf.context.resolver.structureddocument.IWorkspaceContextResolver; -import org.eclipse.jst.jsf.context.resolver.structureddocument.internal.IStructuredDocumentContextResolverFactory2; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.designtime.context.DTFacesContext; -import org.eclipse.jst.jsf.designtime.internal.view.IDTViewHandler; -import org.eclipse.jst.jsf.designtime.internal.view.IViewDefnAdapter; -import org.eclipse.jst.jsf.designtime.internal.view.IViewDefnAdapterFactory; -import org.eclipse.jst.jsf.designtime.internal.view.IViewRootHandle; -import org.eclipse.jst.jsf.designtime.internal.view.XMLViewDefnAdapter; -import org.eclipse.jst.jsf.designtime.internal.view.IDTViewHandler.ViewHandlerException; - -/** - * Utility methods for dealing with {@link DesignTimeApplicationManager} - * - * @author cbateman - * - */ -public class DTAppManagerUtil -{ - /** - * @param context - * @return the view adapter for context or null if none. - */ - public static XMLViewDefnAdapter getXMLViewDefnAdapter( - final IStructuredDocumentContext context) - { - final IWorkspaceContextResolver wkResolver = - IStructuredDocumentContextResolverFactory.INSTANCE - .getWorkspaceContextResolver(context); - - final IProject project = wkResolver.getProject(); - final IResource res = wkResolver.getResource(); - - if (project != null && res instanceof IFile) - { - return getXMLViewDefnAdapter(project, (IFile) res); - } - // not found - return null; - } - - /** - * Equivalent to getXMLViewDefnAdapter(file.getProject(), file) - * - * @param file - * @return the XMLViewDefnAdapter or null - */ - public static XMLViewDefnAdapter getXMLViewDefnAdapter(final IFile file) - { - return getXMLViewDefnAdapter(file.getProject(), file); - } - - /** - * @param project - * @param file - * @return an XMLViewDefnAdapter for file in project or null if not - * applicable - */ - public static XMLViewDefnAdapter getXMLViewDefnAdapter( - final IProject project, final IFile file) - { - final DesignTimeApplicationManager manager = - DesignTimeApplicationManager.getInstance(project); - - if (manager == null) - { - return null; - } - final IDTViewHandler viewHandler = - DesignTimeApplicationManager.getInstance(project) - .getViewHandler(); - try - { - final DTFacesContext facesContext = manager.getFacesContext(file); - - if (facesContext != null) - { - final IViewDefnAdapterFactory factory = - viewHandler.getViewMetadataAdapterFactory(facesContext); - final IViewDefnAdapter adapter = - factory.createAdapter(facesContext, viewHandler.getViewId( - facesContext, file)); - - if (adapter instanceof XMLViewDefnAdapter) - { - return (XMLViewDefnAdapter) adapter; - } - } - } - catch (final ViewHandlerException e) - { - JSFCorePlugin.log(e, ""); - } - return null; - } - - /** - * @param project - * @return the view handler for project or null if none. - */ - public static IDTViewHandler getViewHandler(final IProject project) - { - final DesignTimeApplicationManager manager = - DesignTimeApplicationManager.getInstance(project); - - if (manager == null) - { - return null; - } - return DesignTimeApplicationManager.getInstance(project) - .getViewHandler(); - } - - /** - * @param context - * @return the view root handle from this context or null if can't get one. - * - */ - public static IViewRootHandle getViewRootHandle(final IStructuredDocumentContext context) - { - final IWorkspaceContextResolver resolver = IStructuredDocumentContextResolverFactory2.INSTANCE - .getWorkspaceContextResolver(context); - - if (resolver == null) - { - return null; - } - IProject project = null; - project = resolver.getProject(); - - if (project == null) - { - return null; - } - - final DesignTimeApplicationManager manager = DesignTimeApplicationManager - .getInstance(project); - - if (manager != null) - { - final IResource res = resolver.getResource(); - if (res instanceof IFile) - { - final DTFacesContext facesContext = manager - .getFacesContext((IFile) res); - if (facesContext != null) - { - return facesContext.getViewRootHandle(); - } - } - } - return null; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/DesignTimeApplicationManager.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/DesignTimeApplicationManager.java deleted file mode 100644 index f3a379018..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/DesignTimeApplicationManager.java +++ /dev/null @@ -1,840 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.designtime; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.HashMap; -import java.util.Map; -import java.util.Properties; -import java.util.concurrent.atomic.AtomicBoolean; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IWorkspace; -import org.eclipse.core.resources.IWorkspaceRunnable; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.QualifiedName; -import org.eclipse.core.runtime.Status; -import org.eclipse.jst.jsf.common.internal.resource.IResourceLifecycleListener; -import org.eclipse.jst.jsf.common.internal.resource.LifecycleListener; -import org.eclipse.jst.jsf.common.internal.resource.ResourceLifecycleEvent; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.core.jsfappconfig.JSFAppConfigUtils; -import org.eclipse.jst.jsf.designtime.context.AbstractDTExternalContextFactory; -import org.eclipse.jst.jsf.designtime.context.DTFacesContext; -import org.eclipse.jst.jsf.designtime.context.IExternalContextFactoryLocator; -import org.eclipse.jst.jsf.designtime.el.AbstractDTMethodResolver; -import org.eclipse.jst.jsf.designtime.el.AbstractDTPropertyResolver; -import org.eclipse.jst.jsf.designtime.el.AbstractDTVariableResolver; -import org.eclipse.jst.jsf.designtime.internal.BasicExtensionFactory.ExtensionData; -import org.eclipse.jst.jsf.designtime.internal.view.AbstractDTViewHandler; -import org.eclipse.jst.jsf.designtime.internal.view.IDTViewHandler; - -/** - * Per-web-application manager that manages design time information for a - * corresponding project. - * - * TODO: migrate to managed singleton - * - * @author cbateman - * - */ -public final class DesignTimeApplicationManager -{ - private static final String SETTINGS_DIR_NAME = ".settings"; - private static final String ORG_ECLIPSE_JST_JSF_DESIGNTIME_APPMGR_PREFS = "org.eclipse.jst.jsf.designtime.appmgr.prefs"; - - private static final String PROPERTY_QUALIFIER = "org.eclipse.jst.jsf.designtime.internal"; //$NON-NLS-1$ - private static final String SESSION_PROPERTY_NAME_PROJECT = "DesignTimeApplicationManager"; //$NON-NLS-1$ - private static final QualifiedName SESSION_PROPERTY_KEY_PROJECT = new QualifiedName( - PROPERTY_QUALIFIER, - SESSION_PROPERTY_NAME_PROJECT); - - private static final String PERSIST_PROPERTY_NAME_EXTERNAL_CONTEXT_PROVIDER = "ExternalContextProvider"; //$NON-NLS-1$ - private static final QualifiedName PERSIST_PROPERTY_KEY_EXTERNAL_CONTEXT_PROVIDER = new QualifiedName( - PROPERTY_QUALIFIER, - PERSIST_PROPERTY_NAME_EXTERNAL_CONTEXT_PROVIDER); - - private static final String PERSIST_PROPERTY_NAME_VARIABLE_RESOLVER_PROVIDER = "VariableResolverProvider"; //$NON-NLS-1$ - private static final QualifiedName PERSIST_PROPERTY_KEY_VARIABLE_RESOLVER_PROVIDER = new QualifiedName( - PROPERTY_QUALIFIER, - PERSIST_PROPERTY_NAME_VARIABLE_RESOLVER_PROVIDER); - - private static final String PERSIST_PROPERTY_NAME_PROPERTY_RESOLVER_PROVIDER = "PropertyResolverProvider"; //$NON-NLS-1$ - private static final QualifiedName PERSIST_PROPERTY_KEY_PROPERTY_RESOLVER_PROVIDER = new QualifiedName( - PROPERTY_QUALIFIER, - PERSIST_PROPERTY_NAME_PROPERTY_RESOLVER_PROVIDER); - - private static final String PERSIST_PROPERTY_NAME_METHOD_RESOLVER_PROVIDER = "MethodResolverProvider"; //$NON-NLS-1$ - private static final QualifiedName PERSIST_PROPERTY_KEY_METHOD_RESOLVER_PROVIDER = new QualifiedName( - PROPERTY_QUALIFIER, - PERSIST_PROPERTY_NAME_METHOD_RESOLVER_PROVIDER); - - private static final String PERSIST_PROPERTY_NAME_VIEW_HANDLER = "ViewHandler"; //$NON-NLS-1$ - - private static final String DEFAULT_EXTERNAL_CONTEXT_ID = "org.eclipse.jst.jsf.core.externalcontext.default"; //$NON-NLS-1$ - - private static final String DEFAULT_VARIABLE_RESOLVER_ID = "org.eclipse.jst.jsf.core.variableresolver.default.decorative"; //$NON-NLS-1$ - - private static final String DEFAULT_PROPERTY_RESOLVER_ID = "org.eclipse.jst.jsf.core.propertyresolver.default.decorative"; //$NON-NLS-1$ - - private static final String DEFAULT_METHOD_RESOLVER_ID = "org.eclipse.jst.jsf.core.methodresolver.default"; //$NON-NLS-1$ - - private static final String DEFAULT_VIEW_HANDLER_ID = "org.eclipse.jst.jsf.designtime.view.jspviewhandler"; //$NON-NLS-1$ - - private static final Object GET_INSTANCE_LOCK = new Object(); - - /** - * @param project - * @return the app manager associated with project - */ - public static DesignTimeApplicationManager getInstance( - final IProject project) - { - if (!hasJSFDesignTime(project)) - { - return null; - } - - try - { - synchronized (GET_INSTANCE_LOCK) - { - DesignTimeApplicationManager manager = (DesignTimeApplicationManager) project - .getSessionProperty(SESSION_PROPERTY_KEY_PROJECT); - - if (manager != null && !project.equals(manager._project)) - { - if (!manager._isDisposed.get()) - { - manager.dispose(); - } - // bug 147729: pretend we starting with a new project (we kind of are) - manager = null; - } - - if (manager == null) - { - manager = new DesignTimeApplicationManager(project); - project.setSessionProperty(SESSION_PROPERTY_KEY_PROJECT, - manager); - } - - return manager; - } - } - catch (final CoreException ce) - { - Platform - .getLog(JSFCorePlugin.getDefault().getBundle()) - .log( - new Status( - IStatus.ERROR, - JSFCorePlugin.getDefault().getBundle() - .getSymbolicName(), - 0, - "Problem loading design time appmanager", new Exception(ce))); //$NON-NLS-1$ - } - - return null; - } - -// private void checkAndMaybeUpdateProject(final IProject project) -// { -// boolean needsPropertyStore = false; -// -// synchronized(this) -// { -// if (!project.equals(_project)) -// { -// _lifecycleListener.removeResource(_project); -// _project = project; -// _lifecycleListener.addResource(_project); -// _properties.setProject(project); -// needsPropertyStore = true; -// } -// } -// -// if (needsPropertyStore) -// { -// _properties.store(); -// } -// } - - private synchronized void dispose() - { - if (_isDisposed.compareAndSet(false, true)) - { - // dispose viewhandler - removeViewHandler(); - _lifecycleListener.dispose(); - _facesContexts.clear(); - } - } - - /** - * <p> - * The criteria for a project having a JSF design time are: - * </p> - * - * <ul> - * <li>project is non-null.</li> - * <li>project is accessible (project.isAccessible() == true)</li> - * <li>project has a JSF facet (this implies that it's dependent facets are - * also present).</li> - * </ul> - * - * @param project - * @return true if project can have a JSF DesignTimeApplicationManager - * associated with it. getInstance(project) uses this determine if - * should construct an instance for a project. - */ - public static boolean hasJSFDesignTime(final IProject project) - { - return project != null && project.isAccessible() - && JSFAppConfigUtils.isValidJSFProject(project); - } - - // instance definition - // _project must be writable in case the manager needs to be retargetted - // after a rename/move etc. - private final IProject _project; - private final IExternalContextFactoryLocator _locator; - private final LifecycleListener _lifecycleListener; - private final AtomicBoolean _isDisposed; - private final ViewHandlerManager _viewHandlerManager; - private final Map<IFile, DTFacesContext> _facesContexts; - - private DesignTimeApplicationManager(final IProject project) - { - _project = project; - _locator = new MyExternalContextFactoryLocator(); - _isDisposed = new AtomicBoolean(); - _lifecycleListener = new LifecycleListener(_project); - _lifecycleListener.addListener(new IResourceLifecycleListener() - { - public EventResult acceptEvent(final ResourceLifecycleEvent event) - { - if (event.getAffectedResource() == _project) - { - if (event.getEventType() == ResourceLifecycleEvent.EventType.RESOURCE_INACCESSIBLE - && event.getReasonType() == ResourceLifecycleEvent.ReasonType.RESOURCE_PROJECT_CLOSED) - { - dispose(); - } - } - return EventResult.getDefaultEventResult(); - } - }); - - final PropertyFileManager properties = new PropertyFileManager(_project); - - _viewHandlerManager = new ViewHandlerManager(properties); - _facesContexts = new HashMap<IFile, DTFacesContext>(); - } - - /** - * Method is thread-safe and may block the caller. - * - * @param file - * must not be null - * @return the faces context for the file or null if not found - */ - public DTFacesContext getFacesContext(final IFile file) - { - checkIsDisposed(); - if (!hasDTFacesContext(file)) - { - return null; - } - - synchronized (_facesContexts) - { - DTFacesContext context = _facesContexts.get(file); - if (context == null) - { - context = new DTFacesContext(file, _locator); - context.initialize(_lifecycleListener); - _facesContexts.put(file, context); - } - return context; - } - } - - /** - * Method is thread-safe and may block the caller. - * - * Only files for which a runtime request context will be generated have a - * corresponding design time context. This is generally confined to view - * definition files such as JSP's. - * - * General criteria for a file to have a design time faces context are: - - * the file is non-null and isAccessible() - the file has designtime view - * handler (getViewHandler(file) != null) and it supports the content type - * of file. - * - * getFacesContext uses this to decide whether to generate a context for an - * IFile. - * - * @param file - * @return true if file has a design time faces context - */ - public boolean hasDTFacesContext(final IFile file) - { - checkIsDisposed(); - final IDTViewHandler viewHandler = getViewHandler(); - - if (file != null && file.isAccessible() && viewHandler != null - && viewHandler.supportsViewDefinition(file)) - { - return true; - } - return false; - } - - /** - * Method is thread-safe and may block the caller. - * - * @return the design time view handler for this webapp (project). - */ - public IDTViewHandler getViewHandler() - { - checkIsDisposed(); - /* NOTE: it is critical that view handler calls _NEVER_ take the - DesignTimeApplicationManager lock. let ViewHandlerManager manage it - instead.*/ - return _viewHandlerManager.getViewHandler(_project, _lifecycleListener); - } - - /** - * Remove and dispose of any currently registered view handler - */ - private void removeViewHandler() - { - /* NOTE: it is critical that view handler calls _NEVER_ take the - DesignTimeApplicationManager lock. let ViewHandlerManager manage it - instead.*/ - _viewHandlerManager.removeViewHandler(_project); - } - - /** - * Method is thread-safe and may block the caller. - * - * Sets the persistent id on this project that will be used to load the view - * handler. - * - * @param viewHandlerId - */ - public void setViewHandlerId(final String viewHandlerId) - { - checkIsDisposed(); - /* NOTE: it is critical that view handler calls _NEVER_ take the - DesignTimeApplicationManager lock. let ViewHandlerManager manage it - instead.*/ - _viewHandlerManager.setViewHandlerId(_project, viewHandlerId); - } - - /** - * Method is thread-safe and may block the caller. - * - * @param resolverPluginId - * @throws CoreException - */ - public synchronized void setExternalContextProvider( - final String resolverPluginId) throws CoreException - { - checkIsDisposed(); - _project.setPersistentProperty( - PERSIST_PROPERTY_KEY_EXTERNAL_CONTEXT_PROVIDER, - resolverPluginId); - } - - /** - * Method is thread-safe and may block the caller. - * - * @return the id of the active design time external context provider - */ - public synchronized String getExternalContextProvider() - { - checkIsDisposed(); - return getResolverId(PERSIST_PROPERTY_KEY_EXTERNAL_CONTEXT_PROVIDER, - DEFAULT_EXTERNAL_CONTEXT_ID); - } - - /** - * Method is thread-safe and may block the caller. - * - * @return the designtime variable resolver for this application - */ - public synchronized AbstractDTVariableResolver getVariableResolver() - { - checkIsDisposed(); - ExtensionData<AbstractDTVariableResolver> extData = null; - - final String id = getResolverId_OLD(PERSIST_PROPERTY_KEY_VARIABLE_RESOLVER_PROVIDER); - if (id != null) - { - extData = JSFCorePlugin.getVariableResolvers(id); - } - - if (extData == null) - { - extData = JSFCorePlugin - .getVariableResolvers(DEFAULT_VARIABLE_RESOLVER_ID); - } - - return extData.getInstance(_project); - } - - /** - * Method is thread-safe and may block the caller. - * - * Sets the plugin used to determine the designtime variable resolver. To - * reset to the default, pass null. - * - * @param resolverPluginId - * @throws CoreException -- - * if the setting the new value fails - */ - public synchronized void setVariableResolverProvider( - final String resolverPluginId) throws CoreException - { - checkIsDisposed(); - _project.setPersistentProperty( - PERSIST_PROPERTY_KEY_VARIABLE_RESOLVER_PROVIDER, - resolverPluginId); - } - - /** - * Method is thread-safe and may block the caller. - * - * @return the id of the active design time variable resolver - */ - public synchronized String getVariableResolverProvider() - { - checkIsDisposed(); - return getResolverId(PERSIST_PROPERTY_KEY_VARIABLE_RESOLVER_PROVIDER, - DEFAULT_VARIABLE_RESOLVER_ID); - } - - /** - * Method is thread-safe and may block the caller. - * - * @return the default property resolver that will be used if no other is - * provided. The default property resolver is intended to match the - * similar resolver used by the runtime. - */ - public synchronized AbstractDTPropertyResolver getDefaultPropertyResolver() - { - checkIsDisposed(); - return JSFCorePlugin.getPropertyResolver(DEFAULT_PROPERTY_RESOLVER_ID) - .getInstance(_project); - } - - /** - * Method is thread-safe and may block the caller. - * - * @return the designtime property resolver for this application - */ - public synchronized AbstractDTPropertyResolver getPropertyResolver() - { - checkIsDisposed(); - - ExtensionData<AbstractDTPropertyResolver> extData = null; - - final String id = getResolverId_OLD(PERSIST_PROPERTY_KEY_PROPERTY_RESOLVER_PROVIDER); - if (id != null) - { - extData = JSFCorePlugin.getPropertyResolver(id); - } - - if (extData == null) - { - extData = JSFCorePlugin - .getPropertyResolver(DEFAULT_PROPERTY_RESOLVER_ID); - } - - return extData.getInstance(_project); - } - - /** - * Method is thread-safe and may block the caller. - * - * @param resolverPluginId - * @throws CoreException -- - * if setting the provider fails - */ - public synchronized void setPropertyResolverProvider( - final String resolverPluginId) throws CoreException - { - checkIsDisposed(); - _project.setPersistentProperty( - PERSIST_PROPERTY_KEY_PROPERTY_RESOLVER_PROVIDER, - resolverPluginId); - } - - /** - * Method is thread-safe and may block the caller. - * - * @return the id of the active design time variable resolver - */ - public synchronized String getPropertyResolverProvider() - { - checkIsDisposed(); - return getResolverId(PERSIST_PROPERTY_KEY_PROPERTY_RESOLVER_PROVIDER, - DEFAULT_PROPERTY_RESOLVER_ID); - } - - /** - * Method is thread-safe and may block the caller. - * - * @return the designtime method resolver for this application - */ - public synchronized AbstractDTMethodResolver getMethodResolver() - { - checkIsDisposed(); - ExtensionData<AbstractDTMethodResolver> extData = null; - - final String id = getResolverId_OLD(PERSIST_PROPERTY_KEY_METHOD_RESOLVER_PROVIDER); - if (id != null) - { - extData = JSFCorePlugin.getMethodResolvers(id); - } - - if (extData == null) - { - extData = JSFCorePlugin - .getMethodResolvers(DEFAULT_METHOD_RESOLVER_ID); - } - - return extData.getInstance(_project); - } - - /** - * Method is thread-safe and may block the caller. - * - * @param resolverPluginId - * @throws CoreException -- - * if setting the plugin fails - */ - public synchronized void setMethodResolverProvider( - final String resolverPluginId) throws CoreException - { - checkIsDisposed(); - _project - .setPersistentProperty( - PERSIST_PROPERTY_KEY_METHOD_RESOLVER_PROVIDER, - resolverPluginId); - } - - /** - * Method is thread-safe and may block the caller. - * - * @return the id of the active design time variable resolver - */ - public synchronized String getMethodResolverProvider() - { - checkIsDisposed(); - return getResolverId(PERSIST_PROPERTY_KEY_METHOD_RESOLVER_PROVIDER, - DEFAULT_METHOD_RESOLVER_ID); - } - - private String getResolverId_OLD(final QualifiedName pluginKey) - { - String pluginId = null; - - try - { - pluginId = _project.getPersistentProperty(pluginKey); - } - catch (final CoreException ce) - { - JSFCorePlugin.getDefault().getLog().log( - new Status(IStatus.ERROR, JSFCorePlugin.PLUGIN_ID, 0, - "Error getting plugin property", //$NON-NLS-1$ - ce)); - pluginId = null; - // fall-through and use the default - } - - return pluginId; - } - - private String getResolverId(final QualifiedName key, - final String defaultValue) - { - String id = defaultValue; - - try - { - final String userId = _project.getPersistentProperty(key); - - if (userId != null) - { - id = userId; - } - } - catch (final CoreException ce) - { - // do nothing; fall through and return default - } - - return id; - } - - private class MyExternalContextFactoryLocator implements - IExternalContextFactoryLocator - { - public AbstractDTExternalContextFactory getFactory() - { - ExtensionData<AbstractDTExternalContextFactory> extData = null; - - final String id = getResolverId_OLD(PERSIST_PROPERTY_KEY_EXTERNAL_CONTEXT_PROVIDER); - if (id != null) - { - extData = JSFCorePlugin.getExternalContextProviders(id); - } - - if (extData == null) - { - extData = JSFCorePlugin - .getExternalContextProviders(DEFAULT_EXTERNAL_CONTEXT_ID); - } - - return extData.getInstance(_project); - } - } - - private void checkIsDisposed() - { - // TODO: need to add isDisposed to this and throw an exception - // for now, we just log what's happening to aid debugging - if (_isDisposed.get()) - { - JSFCorePlugin - .log( - "A call to a disposed DesignTimeApplicationManager was attempted", - new Throwable( - "This exception is only to record a stack trace")); - } - } - - private static class ViewHandlerManager - { - private final PropertyFileManager _propertyFileManager; - - ViewHandlerManager(final PropertyFileManager properties) - { - _propertyFileManager = properties; - } - - public synchronized void removeViewHandler(final IProject project) - { - final String viewHandlerId = _propertyFileManager - .getProperty(PERSIST_PROPERTY_NAME_VIEW_HANDLER, - DEFAULT_VIEW_HANDLER_ID); - - if (viewHandlerId != null) - { - final ExtensionData<AbstractDTViewHandler> extData = - JSFCorePlugin.getViewHandlers(viewHandlerId); - - if (extData != null) - { - final AbstractDTViewHandler handler = extData.removeInstance(project); - if (handler != null) - { - handler.dispose(); - } - } - } - } - - public synchronized IDTViewHandler getViewHandler( - final IProject project, final LifecycleListener listener) - { - final String viewHandlerId = _propertyFileManager - .getProperty(PERSIST_PROPERTY_NAME_VIEW_HANDLER, - DEFAULT_VIEW_HANDLER_ID); - - if (viewHandlerId != null) - { - ExtensionData<AbstractDTViewHandler> viewHandlers = JSFCorePlugin - .getViewHandlers(viewHandlerId); - if (viewHandlers == null) - { - viewHandlers = JSFCorePlugin - .getViewHandlers(DEFAULT_VIEW_HANDLER_ID); - } - - final AbstractDTViewHandler viewHandler = viewHandlers - .getInstance(project); - viewHandler.setLifecycleListener(listener); - return viewHandler; - } - return null; - } - - public void setViewHandlerId(final IProject project, - final String viewHandlerId) - { - // remove any previous handler before the id is lost - removeViewHandler(project); - _propertyFileManager.setProperty( - PERSIST_PROPERTY_NAME_VIEW_HANDLER, viewHandlerId); - } - } - - private static class PropertyFileManager - { - private final Properties _properties; - private IProject _project; - - PropertyFileManager(final IProject project) - { - _project = project; - _properties = new Properties(); - load(_project, _properties); - } - - private synchronized IProject getProject() - { - return _project; - } - - public void setProperty(final String key, final String value) { - _properties.setProperty(key, value); - store(); - } - - public String getProperty(final String key, final String defaultValue) { - return _properties.getProperty(key, defaultValue); - } - - public void store() - { - final IWorkspaceRunnable storeJob = new IWorkspaceRunnable() - { - public void run(IProgressMonitor monitor) throws CoreException { - IFile propFile; - - try { - propFile = getPropsFile(getProject()); - if (propFile != null) { - final ByteArrayOutputStream outstream = new ByteArrayOutputStream(); - // properties will thread-safe save to the array - // stream - // no further locking is needed since we have - // already have a lock - // on the workspace sub-tree for the settings file - // if this job - // is running. - _properties.store(outstream, null); - propFile.setContents(new ByteArrayInputStream( - outstream.toByteArray()), true, true, null); - } - } catch (final CoreException e) { - JSFCorePlugin.log(e, "Problem storing properties"); - } catch (final IOException e) { - JSFCorePlugin.log(e, "Problem storing properties"); - } - } - }; - - final IWorkspace workspace = ResourcesPlugin.getWorkspace(); - - try - { - // need to lock the project tree, since may need to create - // .settings directory - workspace.run(storeJob, getProject(), IWorkspace.AVOID_UPDATE, - null); - } catch (CoreException ce) - { - JSFCorePlugin.log(ce, "Problem storing properties"); - } - } - - private static void load(final IProject project, - final Properties properties) - { - try - { - final IFile propFile = getPropsFileHandle(project); - - if (propFile != null && propFile.isAccessible()) - { - InputStream inStream = null; - - try - { - inStream = propFile.getContents(); - properties.load(inStream); - } - finally - { - if (inStream != null) - { - inStream.close(); - } - } - } - } - catch (final CoreException ce) - { - JSFCorePlugin.log(ce, "Problem loading properties"); - } - catch (final IOException ce) - { - JSFCorePlugin.log(ce, "Problem loading properties"); - } - } - - private static IFile getPropsFile(final IProject project) throws CoreException - { - final IFolder folder = project.getFolder(new Path(SETTINGS_DIR_NAME)); - if (!folder.exists()) - { - folder.create(false, true, null); - } - - final IFile file = folder.getFile(new Path(ORG_ECLIPSE_JST_JSF_DESIGNTIME_APPMGR_PREFS)); - - if (!file.exists()) - { - file.create(new ByteArrayInputStream(new byte[0]), false, null); - } - - return file; - } - - /** - * @param project - * @return the file handle for the properties file. Doesn't create the - * resource if it doesn't exist - */ - private static IFile getPropsFileHandle(final IProject project) - { - return project.getFile(new Path(SETTINGS_DIR_NAME).append(ORG_ECLIPSE_JST_JSF_DESIGNTIME_APPMGR_PREFS)); - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/context/AbstractDTExternalContext.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/context/AbstractDTExternalContext.java deleted file mode 100644 index b0bac6a3c..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/context/AbstractDTExternalContext.java +++ /dev/null @@ -1,99 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.context; - -import java.util.Collections; -import java.util.Map; - -import org.eclipse.jst.jsf.context.symbol.ISymbol; -import org.eclipse.jst.jsf.context.symbol.source.ISymbolConstants; - -/** - * The parent of all IDTExternalContext implementations - * - * Clients must sub-class to create IDTExternalContext implementations - * - * @author cbateman - * - */ -public abstract class AbstractDTExternalContext implements IDTExternalContext -{ - - /** - * Return a map of available symbols in each of the masked scopes - * indexed by symbol name - * - * Called by {@link #getMapForScope(int)} to satify the interface. - * If null is returned {@link #getMapForScope(int)} will automatically - * return an EMPTY_MAP. - * - * @param scopeMask - * @return the map of symbols - */ - protected abstract Map<String, ISymbol> doGetMapForScope(int scopeMask); - - - public final Map<String, ISymbol> getMapForScope(final int scopeMask) - { - Map<String, ISymbol> mapForScope = doGetMapForScope(scopeMask); - - if (mapForScope == null) - { - mapForScope = Collections.EMPTY_MAP; - } - else - { - mapForScope = Collections.unmodifiableMap(mapForScope); - } - return mapForScope; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.designtime.context.IDTExternalContext#getRequestMap() - */ - public final Map<String, ISymbol> getRequestMap() - { - return getMapForScope(ISymbolConstants.SYMBOL_SCOPE_REQUEST); - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.designtime.context.IDTExternalContext#getSessionMap() - */ - public final Map<String, ISymbol> getSessionMap() - { - return getMapForScope(ISymbolConstants.SYMBOL_SCOPE_SESSION); - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.designtime.context.IDTExternalContext#getApplicationMap() - */ - public final Map<String, ISymbol> getApplicationMap() - { - return getMapForScope(ISymbolConstants.SYMBOL_SCOPE_APPLICATION); - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.designtime.context.IDTExternalContext#getNoneMap() - */ - public final Map<String, ISymbol> getNoneMap() - { - return getMapForScope(ISymbolConstants.SYMBOL_SCOPE_NONE); - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.designtime.context.IDTExternalContext#getRequestContextPath() - */ - public String getRequestContextPath() - { - // API: do we need to support default behaviour here? - return null; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/context/AbstractDTExternalContextFactory.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/context/AbstractDTExternalContextFactory.java deleted file mode 100644 index b2fbbbf13..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/context/AbstractDTExternalContextFactory.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.designtime.context; - -import org.eclipse.core.runtime.IAdaptable; - -/** - * Super-class of all external context factories - * - * @author cbateman - * - */ -public abstract class AbstractDTExternalContextFactory -{ - /** - * @param containerContext - * @return a new IDTExternalContext for the containerContext refered - * to by containerContext. - */ - public abstract IDTExternalContext create(IAdaptable containerContext); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/context/AbstractExternalContextFactoryLocator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/context/AbstractExternalContextFactoryLocator.java deleted file mode 100644 index 77ae0861d..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/context/AbstractExternalContextFactoryLocator.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.context; - -/** - * Parent of all implementers of IExternalContextFactoryLocator - * @author cbateman - * - */ -public abstract class AbstractExternalContextFactoryLocator implements - IExternalContextFactoryLocator -{ - /** - * @return the current external context factory - */ - public abstract AbstractDTExternalContextFactory getFactory(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/context/DTFacesContext.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/context/DTFacesContext.java deleted file mode 100644 index ccecca520..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/context/DTFacesContext.java +++ /dev/null @@ -1,206 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.designtime.context; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.jst.jsf.common.internal.resource.IResourceLifecycleListener; -import org.eclipse.jst.jsf.common.internal.resource.LifecycleListener; -import org.eclipse.jst.jsf.common.internal.resource.ResourceLifecycleEvent; -import org.eclipse.jst.jsf.common.internal.resource.ResourceLifecycleEvent.EventType; -import org.eclipse.jst.jsf.designtime.DesignTimeApplicationManager; -import org.eclipse.jst.jsf.designtime.internal.view.IDTViewHandler; -import org.eclipse.jst.jsf.designtime.internal.view.IViewRootHandle; - -/** - * Represents a design-time version of the JSF FacesContext for a particular web - * application. - * - * Client may not sub-class. - * - * @author cbateman - * - */ -public final class DTFacesContext -{ - private final IExternalContextFactoryLocator _locator; - private final IAdaptable _contextObject; - private final ViewRootHolder _viewRootHolder; - private LifecycleListener _lifecycleListener; - private IResourceLifecycleListener _listener; - - /** - * @param contextObject - * @param locator - */ - public DTFacesContext(final IAdaptable contextObject, - final IExternalContextFactoryLocator locator) - { - _contextObject = contextObject; - _locator = locator; - - // init last -- NOTE: it is essential that the new Object be unique - _viewRootHolder = new ViewRootHolder(this, new Object()); - } - - /** - * @param locator - * @deprecated Use DTFacesContext(IAdaptable, - * IExternalContextFactoryLocator) - */ - @Deprecated - public DTFacesContext(final IExternalContextFactoryLocator locator) - { - _locator = locator; - _contextObject = null; - - // init last -- NOTE: it is essential that the new Object be unique - _viewRootHolder = new ViewRootHolder(this, new Object()); - } - - /** - * THIS IS NOT AN API METHOD. External clients must not call. - * - * initilaize the faces context. - * @param lifecycleListener - */ - public void initialize(final LifecycleListener lifecycleListener) - { - final IResource res = adaptContextObject(); - _lifecycleListener = lifecycleListener; - - if (res != null && _lifecycleListener != null) - { - _listener = new IResourceLifecycleListener() - { - public EventResult acceptEvent(ResourceLifecycleEvent event) - { - if (res.equals(event.getAffectedResource())) - { - if (event.getEventType() == EventType.RESOURCE_INACCESSIBLE) - { - _lifecycleListener.removeResource(res); - } - } - return EventResult.getDefaultEventResult(); - } - }; - - _lifecycleListener.addResource(res); - _lifecycleListener.addListener(_listener); - } - } - - /** - * @param contextObject -- - * the object corresponding to the external context. Usually an - * IFile point to a file containing the external context. It must - * be adaptable to an IFile. - * - * @return the designtime external context or null if one is not defined for - * this contextObject - */ - public IDTExternalContext getDTExternalContext( - final IAdaptable contextObject) - { - IDTExternalContext externalContext = null; - - // if the context object is an IFile or can be adapted to one, create a - // new externalContext for it - if (contextObject instanceof IFile - || (contextObject != null && contextObject - .getAdapter(IFile.class) != null)) - { - - final AbstractDTExternalContextFactory factory = _locator - .getFactory(); - externalContext = factory.create(contextObject); - } - return externalContext; - } - - /** - * <p> - * Returns a new copy of the view root handle. - * </p> - * - * return null if the value of the view root - * - * @return the cached view root. May be null. - */ - public IViewRootHandle getViewRootHandle() - { - return _viewRootHolder.clone(); - } - - /** - * @deprecated - */ - @Deprecated - private String _localeString = ""; //$NON-NLS-1$ - - /** - * @return the current locale string - * @deprecated Use IDTViewHandler.calculateLocale instead - */ - @Deprecated - public String getLocaleString() - { - return _localeString; - } - - /** - * @param newLocaleString - * @deprecated Use IDTViewHandler.calculateLocale instead - */ - @Deprecated - public void setLocaleString(final String newLocaleString) - { - _localeString = newLocaleString; - } - - /** - * @return the resource correspondinng to context object or null if it - * cannot be adapted to an IResource - */ - public IResource adaptContextObject() - { - if (_contextObject instanceof IResource) - { - return (IResource) _contextObject; - } - else if (_contextObject != null - && _contextObject.getAdapter(IResource.class) != null) - { - return (IResource) _contextObject.getAdapter(IResource.class); - } - return null; - } - - IDTViewHandler getViewHandler(final IResource res) - { - IDTViewHandler viewHandler = null; - - if (res != null) - { - final DesignTimeApplicationManager manager = DesignTimeApplicationManager - .getInstance(res.getProject()); - if (manager != null) - { - viewHandler = manager.getViewHandler(); - } - } - return viewHandler; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/context/DTJSPExternalContext.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/context/DTJSPExternalContext.java deleted file mode 100644 index 8c870d1c8..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/context/DTJSPExternalContext.java +++ /dev/null @@ -1,173 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.designtime.context; - -import java.io.PrintStream; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.jst.j2ee.web.componentcore.util.WebArtifactEdit; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; -import org.eclipse.jst.jsf.context.symbol.ISymbol; -import org.eclipse.jst.jsf.context.symbol.source.ISymbolConstants; -import org.eclipse.jst.jsf.context.symbol.source.ISymbolSourceProvider; -import org.eclipse.jst.jsf.context.symbol.source.ISymbolSourceProviderFactory; - - -/** - * A designtime proxy for the Faces ExternalContext - * - * Clients may sub-class. - * - * @author cbateman - * - */ -public class DTJSPExternalContext extends AbstractDTExternalContext -{ - /** - * - */ - private final IFile _jspFile; - - /** - * Construct a default external context - * - * @param jspFile - */ - protected DTJSPExternalContext(final IAdaptable jspFile) - { - if (jspFile instanceof IFile) - { - _jspFile = (IFile) jspFile; - } - else if (jspFile != null) - { - IFile file = (IFile) jspFile.getAdapter(IFile.class); - - if (file != null) - { - _jspFile = file; - } - else - { - _jspFile = null; - throw new AssertionError("jspFile must be adapable to an IFile"); //$NON-NLS-1$ - } - } - else - { - _jspFile = null; - throw new AssertionError("jspFile must be adapable to an IFile"); //$NON-NLS-1$ - } - } - - @Override - protected Map doGetMapForScope(final int scopeMask) - { - final Map map = new HashMap(); - - for (final Iterator it = JSFCommonPlugin.getSymbolSourceProviders().iterator(); it.hasNext();) - { - final ISymbolSourceProviderFactory factory = (ISymbolSourceProviderFactory) it.next(); - final ISymbolSourceProvider provider = factory.createInstance(_jspFile.getProject()); - - final ISymbol[] symbols = provider.getSymbols(_jspFile, scopeMask); - - for (int i = 0; i < symbols.length; i++) - { - map.put(symbols[i].getName(), symbols[i]); - } - } - - return map; - } - - /** - * @param stream - */ - public final void trace(PrintStream stream) - { - String[] scopeNames = {ISymbolConstants.SYMBOL_SCOPE_REQUEST_STRING, - ISymbolConstants.SYMBOL_SCOPE_SESSION_STRING, - ISymbolConstants.SYMBOL_SCOPE_APPLICATION_STRING, - ISymbolConstants.SYMBOL_SCOPE_NONE_STRING - }; - Map[] symbolMaps = {getRequestMap(), getSessionMap(), getApplicationMap(), getNoneMap()}; - - for (int i = 0; i < scopeNames.length; i++) - { - stream.println("--------------"); //$NON-NLS-1$ - stream.println(scopeNames[i]+" Scope:"); //$NON-NLS-1$ - stream.println("--------------"); //$NON-NLS-1$ - - for (final Iterator it = symbolMaps[i].values().iterator(); it.hasNext();) - { - ISymbol symbol = (ISymbol) it.next(); - System.out.println(symbol.getName()); - } - } - } - - @Override - public String getRequestContextPath() - { - WebArtifactEdit artifactEdit = null; - String path = null; - - try - { - // TODO: EARs? - artifactEdit = - WebArtifactEdit.getWebArtifactEditForRead(_jspFile.getProject()); - path = artifactEdit.getServerContextRoot(); - } - finally - { - if (artifactEdit != null) - { - artifactEdit.dispose(); - } - } - return path; - } - -// @Override -// public String getRequestPathInfo() { -// // TODO Auto-generated method stub -// return super.getRequestPathInfo(); -// } -// -// @Override -// public String getRequestServletPath() { -// // TODO Auto-generated method stub -// return super.getRequestServletPath(); -// } - -// private void getWebApp() -// { -// final IProject project = _jspFile.getProject(); -// -// final IModelProvider provider = -// ModelProviderManager.getModelProvider(project); -// Object webAppObj = provider.getModelObject(); -// -// if (webAppObj != null) -// { -// // -// } -// -// } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/context/DefaultDTExternalContextFactory.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/context/DefaultDTExternalContextFactory.java deleted file mode 100644 index 1d2af78b3..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/context/DefaultDTExternalContextFactory.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.designtime.context; - -import org.eclipse.core.runtime.IAdaptable; - -/** - * Creates external contexts for JSPs - * - * Clients may sub-class - * - * @author cbateman - * - */ -public class DefaultDTExternalContextFactory extends - AbstractDTExternalContextFactory -{ - - /** - * @param containerContext -- must be adaptable to an IFile of content type - * JSP - * - * @return a new DT external context - */ - public IDTExternalContext create(final IAdaptable containerContext) - { - return new DTJSPExternalContext(containerContext); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/context/IDTExternalContext.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/context/IDTExternalContext.java deleted file mode 100644 index 2b76cb8af..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/context/IDTExternalContext.java +++ /dev/null @@ -1,82 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.designtime.context; - -import java.util.Map; - -import org.eclipse.jst.jsf.context.symbol.ISymbol; - -/** - * Interface that must be implemented by all design time external contexts - * - * Clients must not implement or sub-class. Sub-class AbstractDTExternalContext instead. - * - * @author cbateman - * - */ -public interface IDTExternalContext -{ - /** - * @param scopeMask -- the scope for which to return the symbol map - * @return a map of ISymbols representing the currently available - * scope variables. Never null, empty if no symbols - * - * Map is unmodifiable (throws exception on mutation operations) - */ - Map<String, ISymbol> getMapForScope(int scopeMask); - - /** - * @return a map of ISymbols representing the currently available - * request scope variables. Never null, empty if no symbols - * - * Map is unmodifiable (throws exception on mutation operations) - */ - Map<String, ISymbol> getRequestMap(); - - /** - * @return a map of ISymbols representing the currently available - * session scope variables. Never null, empty if no symbols - * Map is unmodifiable (throws exception on mutation operations) - */ - Map<String, ISymbol> getSessionMap(); - - /** - * @return a map of ISymbols representing the currently available - * application scope variables. Never null, empty if no symbols - * Map is unmodifiable (throws exception on mutation operations) - */ - Map<String, ISymbol> getApplicationMap(); - - /** - * @return a map of ISymbols representing the currently available - * none scope variables. Never null, empty if no symbols - * Map is unmodifiable (throws exception on mutation operations) - */ - Map<String, ISymbol> getNoneMap(); - - /** - * Servlet 2.3_SRV.4.4: The context path of the application. - * - * @return the request context path - */ - String getRequestContextPath(); - - /** - * Find all of the possible url-pattern's in the container that - * could match the underlying resource. Normally this will be single - * element list. It will only - * - * @return - */ -// List<String> getAllContainerMappings(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/context/IExternalContextFactoryLocator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/context/IExternalContextFactoryLocator.java deleted file mode 100644 index 0842ed8b4..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/context/IExternalContextFactoryLocator.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.designtime.context; - -/** - * This interface is used to decouple the faces context from the - * DesignTimeApplicationManager - * - * Client must NOT implement or subclass. - * Extend AbstractExternalContextFactoryLocator instead - * - * @author cbateman - * - */ -public interface IExternalContextFactoryLocator -{ - /** - * @return the current external context factory - */ - AbstractDTExternalContextFactory getFactory(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/context/ViewRootHolder.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/context/ViewRootHolder.java deleted file mode 100644 index 93821e5ab..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/context/ViewRootHolder.java +++ /dev/null @@ -1,192 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -/** - * - */ -package org.eclipse.jst.jsf.designtime.context; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.resources.IResource; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.designtime.internal.view.DTUIViewRoot; -import org.eclipse.jst.jsf.designtime.internal.view.IDTViewHandler; -import org.eclipse.jst.jsf.designtime.internal.view.IViewRootHandle; -import org.eclipse.jst.jsf.designtime.internal.view.DTUIViewRoot.StalenessListener; -import org.eclipse.jst.jsf.designtime.internal.view.IDTViewHandler.ViewHandlerException; - -/* package */ final class ViewRootHolder implements IViewRootHandle, Cloneable -{ - private final Object _recalcViewRootExclusion; - private final DTFacesContext _facesContext; - private DTUIViewRoot _viewRoot; - private final List<StalenessListener> _waitingToAdd; - private final List<StalenessListener> _waitingToRemove; - - public ViewRootHolder(final DTFacesContext facesContext, final Object recalcViewRootExclusion) - { - _facesContext = facesContext; - _recalcViewRootExclusion = recalcViewRootExclusion; - _waitingToAdd = new ArrayList<StalenessListener>(); - _waitingToRemove = new ArrayList<StalenessListener>(); - } - - private ViewRootHolder(ViewRootHolder cloneFrom) - { - _recalcViewRootExclusion = cloneFrom._recalcViewRootExclusion; - _facesContext = cloneFrom._facesContext; - _viewRoot = cloneFrom.getCachedViewRoot(); - - // create brand new copies - _waitingToAdd = new ArrayList<StalenessListener>(); - _waitingToRemove = new ArrayList<StalenessListener>(); - } - - public synchronized DTUIViewRoot getCachedViewRoot() - { - return _viewRoot; - } - - public DTUIViewRoot updateViewRoot() - { - DTUIViewRoot viewRoot = null; - final IResource contextResource = _facesContext.adaptContextObject(); - - // we create this additional exclusion so that we avoid a - // situation - // where two threads enter and start recalculating the same view - // root in parallel. Only one thread may be working on creating - // a new view root for a particular view at any given time. Note - // that due to read/write lock on the value, there is nothing - // to stop readers from simultaneous getting the old value until - // the new value is ready and has been set. - synchronized (_recalcViewRootExclusion) - { - viewRoot = getCachedViewRoot(); - - if (viewRoot == null || viewRoot.isStale()) - { - // if the view root hasn't been created, then do so - // and populate it - final IDTViewHandler viewHandler = _facesContext - .getViewHandler(contextResource); - - if (viewHandler != null) - { - final String viewId = viewHandler.getViewId( - _facesContext, contextResource); - - try - { - viewRoot = viewHandler.createView(_facesContext, - viewId); - if (viewRoot != null) - { - setCachedViewRoot(viewRoot); - } - - // do adds first, let remove trump all - for (final StalenessListener addListener : _waitingToAdd) - { - viewRoot.addListener(addListener); - } - - for (final StalenessListener removeListener : _waitingToRemove) - { - viewRoot.removeListener(removeListener); - } - } - catch (final ViewHandlerException e) - { - JSFCorePlugin.log(e, - "While creating dt viewroot for viewId: " - + viewId); - } - } - } - } - // return the copy. NEVER return _viewRoot directly since we are not - // synchronized here. - return viewRoot; - } - - private synchronized void setCachedViewRoot( - final DTUIViewRoot newViewRoot) - { - if (!Thread.holdsLock(_recalcViewRootExclusion)) - { - throw new IllegalStateException( - "Must hold _recalcViewRootExclusion to modify view root"); - } - _viewRoot = newViewRoot; - } - - @Override - protected synchronized IViewRootHandle clone() - { - return new ViewRootHolder(this); - } - - public void addListener(StalenessListener listener) - { - if (_viewRoot != null) - { - synchronized(this) - { - _viewRoot.addListener(listener); - } - } - else - { - // ensure that if we calculating a new view root, then there isn't - // an issue. - synchronized(_recalcViewRootExclusion) - { - synchronized(this) - { - _waitingToAdd.add(listener); - } - } - } - } - - public void removeListener(StalenessListener listener) - { - DTUIViewRoot viewRoot = null; - - synchronized(this) - { - viewRoot = _viewRoot; - } - - if (viewRoot != null) - { - synchronized(this) - { - viewRoot.removeListener(listener); - } - } - else - { - // ensure that if we calculating a new view root, then there isn't - // an issue. - // always acquire the recalcViewRootExclusion first - synchronized(_recalcViewRootExclusion) - { - synchronized(this) - { - _waitingToAdd.add(listener); - } - } - } - } -}
\ No newline at end of file diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/context/package-info.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/context/package-info.java deleted file mode 100644 index 82480ed5f..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/context/package-info.java +++ /dev/null @@ -1,16 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - * - ********************************************************************************/ - -/** - * JSF Design Time Context Simulation Classes. - */ -package org.eclipse.jst.jsf.designtime.context; diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/el/AbstractDTMethodResolver.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/el/AbstractDTMethodResolver.java deleted file mode 100644 index da115122b..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/el/AbstractDTMethodResolver.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.designtime.el; - -import org.eclipse.jst.jsf.context.symbol.IMethodSymbol; -import org.eclipse.jst.jsf.context.symbol.IObjectSymbol; -import org.eclipse.jst.jsf.context.symbol.ISymbol; - -/** - * Sub-class of all design time method resolvers - * - * @author cbateman - * - */ -public abstract class AbstractDTMethodResolver -{ - /** - * Returns a symbol encapsulating the method on base with the name - * methodId - * - * @param base - * @param methodId - * @return the symbol for the named methodId or null if not found - */ - public abstract IMethodSymbol getMethod(IObjectSymbol base, Object methodId); - - - /** - * @param base - * @return all method binding symbols for base - */ - public abstract ISymbol[] getMethods(IObjectSymbol base); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/el/AbstractDTPropertyResolver.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/el/AbstractDTPropertyResolver.java deleted file mode 100644 index 33ab9bb53..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/el/AbstractDTPropertyResolver.java +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.designtime.el; - -import org.eclipse.jst.jsf.context.symbol.ISymbol; - -/** - * Super-class of all design time property resolvers - * - * @author cbateman - * - */ -public abstract class AbstractDTPropertyResolver -{ - /** - * Returns a symbol encapsulating the property on base with the name - * properyId. Note that getProperty may return *more* property symbols - * for the same 'base' because some ISymbol's have unconstrained type - * descriptors. For example, a bean that implements java.util.Map, - * may have any number of possible properties added at runtime that cannot - * be determined at design time. It is up to implementers of this interface - * to decide how (whether) to return these objects at design time - * - * @param base - * @param propertyId - * @return the symbol for the named propertyId or null if not found - */ - public abstract ISymbol getProperty(ISymbol base, Object propertyId); - - /** - * @param base - * @param offset - * @return the symbol for the property referred to by the offset - * into base when it is treated as either an array or a list. - * The symbol returned is *not* found in the getAllProperties list. - */ - public abstract ISymbol getProperty(ISymbol base, int offset); - - /** - * @param base - * @return all properties of base that can be determined concretely - * at designtime. Note that getProperty(base, x) may return non-null - * for objects not found in the return from this method. @see getProperty - */ - public abstract ISymbol[] getAllProperties(ISymbol base); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/el/AbstractDTVariableResolver.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/el/AbstractDTVariableResolver.java deleted file mode 100644 index 532fc5d99..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/el/AbstractDTVariableResolver.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.designtime.el; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.jst.jsf.context.symbol.ISymbol; -import org.eclipse.jst.jsf.designtime.context.DTFacesContext; - -/** - * Super-class of all design-time variable resolver. A design time variable - * resolver - * - * Clients may sub-class. - * - * @author cbateman - * - */ -public abstract class AbstractDTVariableResolver -{ - /** - * @param context - * @param name - * @param externalContextKey -- an adapter that identifies the external application - * context within which to resolve name. For example, this could be an IFile - * representing a JavaServer Page in which we want to resolve the symbol name - * @return the symbol corresponding to name in the faces context or null - * if not found - */ - public abstract ISymbol resolveVariable(DTFacesContext context, String name, IAdaptable externalContextKey); - - /** - * @param facesContext - * @param externalContextKey - * @return all variables - */ - public abstract ISymbol[] getAllVariables(DTFacesContext facesContext, - IAdaptable externalContextKey); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/el/DefaultDTMethodResolver.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/el/DefaultDTMethodResolver.java deleted file mode 100644 index bc6814bd4..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/el/DefaultDTMethodResolver.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.designtime.el; - -import java.util.Iterator; - -import org.eclipse.jst.jsf.context.symbol.IMethodSymbol; -import org.eclipse.jst.jsf.context.symbol.IObjectSymbol; -import org.eclipse.jst.jsf.context.symbol.ISymbol; - -/** - * This resolver has no direct analogue at runtime. JSF Components implement - * method bindings at runtime in a runtime specific way. But at design time - * we have no direct DTComponent so instead we use this resolver to resolve - * an IInstanceSymbol and method name to an IMethodSymbol (if one exists). - * - * Clients may sub-class - * - * @author cbateman - * - */ -public class DefaultDTMethodResolver extends AbstractDTMethodResolver -{ - /** - * Returns a symbol encapsulating the method on base with the name - * methodId - * - * @param base - * @param methodId - * @return the symbol for the named methodId or null if not found - */ - public IMethodSymbol getMethod(IObjectSymbol base, Object methodId) - { - for (final Iterator it = base.getTypeDescriptor().getMethods().iterator(); it.hasNext();) - { - IMethodSymbol element = (IMethodSymbol) it.next(); - if (element.getName().equals(methodId)) - { - return element; - } - } - - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.designtime.el.AbstractDTMethodResolver#getMethods(org.eclipse.jst.jsf.context.symbol.IInstanceSymbol) - */ - public ISymbol[] getMethods(IObjectSymbol base) - { - return (ISymbol[]) - base.getTypeDescriptor().getMethods(). - toArray(new ISymbol[0]); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/el/DefaultDTPropertyResolver.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/el/DefaultDTPropertyResolver.java deleted file mode 100644 index d4a5eee1c..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/el/DefaultDTPropertyResolver.java +++ /dev/null @@ -1,280 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.designtime.el; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.emf.common.util.BasicEList; -import org.eclipse.emf.common.util.EList; -import org.eclipse.jdt.core.Signature; -import org.eclipse.jst.jsf.common.internal.types.StringLiteralType; -import org.eclipse.jst.jsf.common.internal.types.TypeConstants; -import org.eclipse.jst.jsf.common.internal.types.ValueType; -import org.eclipse.jst.jsf.context.symbol.IBoundedTypeDescriptor; -import org.eclipse.jst.jsf.context.symbol.IObjectSymbol; -import org.eclipse.jst.jsf.context.symbol.ISymbol; -import org.eclipse.jst.jsf.context.symbol.ITypeDescriptor; - -/** - * A design time proxy for the runtime PropertyResolver. This is used to - * resolve all but the first element of a var.prop.prop2 type of sub-expression in - * a JSF EL expression. @see DefaultDTVariableResolver for how to resolve 'var' at - * designtime - * - * Clients may implement - * - * @author cbateman - */ -public class DefaultDTPropertyResolver extends AbstractDTPropertyResolver -{ - /** - * Returns a symbol encapsulating the property on base with the name - * properyId - * - * @param base - * @param propertyId - * @return the symbol for the named propertyId or null if not found - */ - public ISymbol getProperty(ISymbol base, Object propertyId) - { - ITypeDescriptor typeDesc = null; - - Object[] factoredProperties = new Object[] {propertyId}; - - // check for expected interface types per JSP.2.3.4 - if (base instanceof IObjectSymbol) - { - final IObjectSymbol objSymbol = (IObjectSymbol) base; - typeDesc = objSymbol.getTypeDescriptor(); - - // although not stated explicitly stated by the spec, in practice (based on Sun RI), - // a list cannot have non-numeric indexed properties - // note: due to remove(Object) having different return types - // an object can't be both a List and a Map! So we can consider - // a List instanceof out of order - if (objSymbol.supportsCoercion(TypeConstants.TYPE_LIST)) - { - typeDesc = null; - } - // per JSP.2.3.4, if instance of map (unconstrained in our terminology) - else if (objSymbol.supportsCoercion(TypeConstants.TYPE_MAP)) - { - EList<ValueType> args = new BasicEList<ValueType>(); - args.add(new StringLiteralType(propertyId.toString())); - - ISymbol prop = objSymbol.call("get", args, propertyId.toString()); //$NON-NLS-1$ - - if (prop != null) - { - return prop; - } - - typeDesc = objSymbol.coerce(TypeConstants.TYPE_MAP); - - // handle string keys into maps that contain dots. Because type descriptor - // handle dotted property ids (i.e. 'x.y.z') as separate properties with - // intermediate parts, we need to handle this specially. - if (propertyId instanceof String && ((String)propertyId).indexOf('.')>-1) - { - factoredProperties = factorKey(propertyId); - } - } - - // check unconstrained type - if (typeDesc instanceof IBoundedTypeDescriptor) - { - // TODO: propertyId may need to change when supporting - // template types - if (((IBoundedTypeDescriptor)typeDesc).isUnboundedForType(TypeConstants.TYPE_JAVAOBJECT)) - { - // the most we know is that it could be an Object - return ((IBoundedTypeDescriptor)typeDesc).getUnboundedProperty(propertyId, TypeConstants.TYPE_JAVAOBJECT); - } - } - } - - int i = 0; - ISymbol matchedSymbol; - - do - { - matchedSymbol = null; // always reset so if the for completes without setting, the - // while ends - SEARCH_SEGMENT: for (final Iterator it = getIterator(typeDesc); it.hasNext();) - { - final ISymbol element = (ISymbol) it.next(); - - if (element.getName().equals(factoredProperties[i]) - && element instanceof IObjectSymbol) - { - matchedSymbol = element; - typeDesc = ((IObjectSymbol)matchedSymbol).getTypeDescriptor(); - break SEARCH_SEGMENT; - } - } - } while(++i < factoredProperties.length && matchedSymbol != null); - - // may be null if none matched - return matchedSymbol; - } - - /** - * @param base - * @return all properties of base - */ - public ISymbol[] getAllProperties(ISymbol base) - { - // if nothing found, return an empty array - List symbolsList = Collections.EMPTY_LIST; - - if (base instanceof IObjectSymbol) - { - ITypeDescriptor typeDesc = null; - - // per JSP.2.3.4, if instance of map (unconstrained in our terminology) - if (((IObjectSymbol)base).supportsCoercion(TypeConstants.TYPE_MAP)) - { - typeDesc = - ((IObjectSymbol)base).coerce(TypeConstants.TYPE_MAP); - } - // Lists have no properties, even if they are also beans - else if (((IObjectSymbol)base).supportsCoercion(TypeConstants.TYPE_LIST)) - { - typeDesc = null; - } - else - { - typeDesc = ((IObjectSymbol)base).getTypeDescriptor(); - - } - - if (typeDesc != null) - { - symbolsList = typeDesc.getProperties(); - } - } - - return (ISymbol[]) symbolsList.toArray(ISymbol.EMPTY_SYMBOL_ARRAY); - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.designtime.el.AbstractDTPropertyResolver#getProperty(org.eclipse.jst.jsf.context.symbol.ISymbol, int) - */ - public ISymbol getProperty(ISymbol base, int offset) - { - ITypeDescriptor typeDesc = null; - - if (offset < 0) - { - // should never be called with offset < 0 - throw new AssertionError("offsets must be >=0 to be valid"); //$NON-NLS-1$ - } - - // check for expected interface types per JSP.2.3.4 - if (base instanceof IObjectSymbol) - { - - final IObjectSymbol objSymbol = (IObjectSymbol) base; - typeDesc = objSymbol.getTypeDescriptor(); - - // per JSP.2.3.4, if instance of array (unconstrained in our terminology) - if (typeDesc.isArray()) - { - ISymbol arrayElement = typeDesc.getArrayElement(); - // reset the name - arrayElement.setName(base.getName()+"["+offset+"]"); //$NON-NLS-1$ //$NON-NLS-2$ - return arrayElement; - } - - // per JSP.2.3.4, if instance of list (unbounded in our terminology) - if (objSymbol.supportsCoercion(TypeConstants.TYPE_LIST)) - { - //typeDesc = objSymbol.coerce(TypeConstants.TYPE_LIST); - final EList<ValueType> args = new BasicEList<ValueType>(); - args.add(new ValueType(Signature.SIG_INT, ValueType.ASSIGNMENT_TYPE_RHS)); - return objSymbol.call("get", args, base.getName()+"["+offset+"]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - } - - // check unconstrained type -// if (typeDesc instanceof IBoundedTypeDescriptor) -// { -// // TODO: propertyId may need to change when supporting -// // template types -// if (((IBoundedTypeDescriptor)typeDesc).isUnboundedForType(TypeConstants.TYPE_BOXED_INTEGER)) -// { - // the most we know is that it could be an Object -// return ((IBoundedTypeDescriptor)typeDesc) -// .getUnboundedProperty -// (new Integer(offset), TypeConstants.TYPE_BOXED_INTEGER); -// final EList<Object> args = new BasicEList<Object>(); -// args.add(offset); -// return ((IBoundedTypeDescriptor)typeDesc) -// .call("get", args, base.getName()+"["+offset+"]"); -// } -// } - } - - return null; - } - - /** - * @param typeDesc - * @return the type descriptor's property iterator or empty list - * if null - */ - protected final Iterator getIterator(ITypeDescriptor typeDesc) - { - if (typeDesc != null) - { - return typeDesc.getProperties().iterator(); - } - return Collections.EMPTY_LIST.iterator(); - } - - /** - * Takes a key expression and factors it down to into all property segments it contains. - * Property segments occur mainly when String keys contain '.' characters, indicating that - * more one than property actually must be traversed to evaluate the whole expr. - * @param key - * @return an array containing all property segments of the key. If the key contains only - * one property, then this is returned a single element in the array - */ - protected final Object[] factorKey(Object key) - { - if (key instanceof String) - { - List segments = new ArrayList(); - - String stringKey = (String) key; - int nextPos = -1; - - while ((nextPos = stringKey.indexOf('.')) > -1) - { - segments.add(stringKey.substring(0, nextPos)); - stringKey = stringKey.substring(nextPos+1); - } - - if (stringKey != null && stringKey.length() > 0) - { - segments.add(stringKey); - } - - return segments.toArray(); - } - - return new Object[] {key}; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/el/DefaultDTVariableResolver.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/el/DefaultDTVariableResolver.java deleted file mode 100644 index 44d53a24f..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/el/DefaultDTVariableResolver.java +++ /dev/null @@ -1,177 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.designtime.el; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.jst.jsf.context.symbol.ISymbol; -import org.eclipse.jst.jsf.context.symbol.source.ISymbolConstants; -import org.eclipse.jst.jsf.designtime.context.DTFacesContext; -import org.eclipse.jst.jsf.designtime.context.IDTExternalContext; -import org.eclipse.jst.jsf.designtime.symbols.DefaultBeanSymbolSourceProvider; -import org.eclipse.jst.jsf.designtime.symbols.DefaultBuiltInSymbolProvider; - -/** - * A design time proxy for the runtime VariableResolver. This is used to - * resolve the first element of a var.prop.prop2 type of sub-expression in - * a JSF EL expression - * - * Clients may sub-class - * - * @author cbateman - * - */ -public class DefaultDTVariableResolver extends AbstractDTVariableResolver -{ - /** - * Tries to mirror the JSF 1.1 runtime VariableResolver - * - * @see org.eclipse.jst.jsf.designtime.el.AbstractDTVariableResolver#resolveVariable(org.eclipse.jst.jsf.designtime.context.DTFacesContext, java.lang.String, org.eclipse.core.runtime.IAdaptable) - */ - public ISymbol resolveVariable(DTFacesContext context, String name, IAdaptable externalContextKey) - { - // check implicits first - final DefaultBuiltInSymbolProvider builtins = - DefaultBuiltInSymbolProvider.getInstance(); - - ISymbol symbol = builtins.getSymbol(name, externalContextKey, ISymbolConstants.SYMBOL_SCOPE_ALL); - - if (symbol != null) - { - return symbol; - } - - // next check the scope maps from request up to application - final IDTExternalContext externalContext = - context.getDTExternalContext(externalContextKey); - - if (externalContext == null) - { - // TODO: try to find bean here? - return null; - } - - symbol = externalContext.getRequestMap().get(name); - - // check request scope - if (symbol == null) - { - symbol = externalContext.getSessionMap().get(name); - - // then check session scope - if (symbol == null) - { - symbol = externalContext.getApplicationMap().get(name); - - // if the symbol is not found at any scope, then look for a - // a bean. - if (symbol == null) - { - final DefaultBeanSymbolSourceProvider beanProvider = - DefaultBeanSymbolSourceProvider.getInstance(); - - symbol = beanProvider.getSymbol(name, externalContextKey, - ISymbolConstants.SYMBOL_SCOPE_ALL); - } - } - } - - return symbol; - } - - /** - * @param facesContext - * @param externalContextKey - * @return all variables - */ - public ISymbol[] getAllVariables(DTFacesContext facesContext, - IAdaptable externalContextKey) - { - final List allSymbols = new ArrayList(); - - addBuiltins(allSymbols, externalContextKey); - - final IDTExternalContext externalContext = - facesContext.getDTExternalContext(externalContextKey); - - if (externalContext != null) - { - addExternalContextSymbols(allSymbols, externalContext); - } - - addBeanSymbols(allSymbols, externalContextKey); - - return (ISymbol[]) allSymbols.toArray(ISymbol.EMPTY_SYMBOL_ARRAY); - } - - /** - * Adds the built-in symbols to the list. This behaviour is standarized and should - * not be overriden in general. However, you may wish to change the default - * built-in symbol provider with your own. - * - * @param list - * @param externalContextKey - */ - protected void addBuiltins(final List list, final IAdaptable externalContextKey) - { - // check implicits first - final DefaultBuiltInSymbolProvider builtins = - DefaultBuiltInSymbolProvider.getInstance(); - - list.addAll(Arrays.asList(builtins.getSymbols(externalContextKey, - ISymbolConstants.SYMBOL_SCOPE_ALL))); - } - - /** - * Simulate resolution of symbols from the request, session, application and none - * scope maps. Use a symbol provider instead if you simply want to add - * new symbols for a tag variable or other symbol source. - * - * @param list - * @param externalContext - */ - protected void addExternalContextSymbols(final List list, - final IDTExternalContext externalContext) - { - if (externalContext != null) - { - final ISymbol[] externalContextSymbols = - externalContext.getMapForScope - (ISymbolConstants.SYMBOL_SCOPE_ALL).values(). - toArray(ISymbol.EMPTY_SYMBOL_ARRAY); - list.addAll(Arrays.asList(externalContextSymbols)); - } - } - - /** - * Gets all the bean symbols. If you wish to override it would be advisable - * to look at and/or sub-class the default bean symbol source provider - * - * @param list - * @param externalContextKey - */ - protected void addBeanSymbols(final List list, final IAdaptable externalContextKey) - { - final DefaultBeanSymbolSourceProvider beanProvider = - DefaultBeanSymbolSourceProvider.getInstance(); - - final ISymbol[] beanSymbols = - beanProvider.getSymbols(externalContextKey, - ISymbolConstants.SYMBOL_SCOPE_ALL); - - list.addAll(Arrays.asList(beanSymbols)); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/el/IDecorativeResolver.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/el/IDecorativeResolver.java deleted file mode 100644 index 2c50134c6..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/el/IDecorativeResolver.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.designtime.el; - -/** - * Tagging interface that must be implemented by all resolvers that want to participate - * in result decoration (i.e. variable and property resolvers) via the - * forRuntimeClass extension. - * - * Clients may implement. - * - * @author cbateman - * - */ -public interface IDecorativeResolver -{ - // purposefully empty -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/el/IInstancePerProjectResolver.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/el/IInstancePerProjectResolver.java deleted file mode 100644 index 41bcff88b..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/el/IInstancePerProjectResolver.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.designtime.el; - -import org.eclipse.core.resources.IProject; - -/** - * See the variable and properyresolver extension points attribute instancePerProject. - * - * Clients may implement. - * - * @author cbateman - * - */ -public interface IInstancePerProjectResolver -{ - /** - * Called by the design time application manager before using the - * resolver with the project it associated with. Resolvers need not - * implement unless they wish to be instancePerProject resolvers. - * - * @param project - */ - void setProject(final IProject project); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/el/package-info.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/el/package-info.java deleted file mode 100644 index f71433762..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/el/package-info.java +++ /dev/null @@ -1,16 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - * - ********************************************************************************/ - -/** - * JSF Design Time EL Resolvers. - */ -package org.eclipse.jst.jsf.designtime.el; diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/BasicExtensionFactory.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/BasicExtensionFactory.java deleted file mode 100644 index 233a1a6e6..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/BasicExtensionFactory.java +++ /dev/null @@ -1,309 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.designtime.internal; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtension; -import org.eclipse.core.runtime.IExtensionPoint; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.designtime.el.IInstancePerProjectResolver; -import org.osgi.framework.Bundle; - -/** - * @author cbateman - * @param <EXTENSIONTYPE> - * - */ -public class BasicExtensionFactory<EXTENSIONTYPE> -{ - private final Bundle _bundle; - private final String _extName; - private Map<String, ExtensionData<EXTENSIONTYPE>> _registeredResolvers; - private final String _elementName; - private final ExtensionDataFactory _extensionDataFactory; - private final boolean _alwaysPerProject; - - /** - * @param bundle - * @param extName - * @param elementName - * @param alwaysPerProject - */ - public BasicExtensionFactory(final Bundle bundle, final String extName, - final String elementName, final boolean alwaysPerProject) - { - _bundle = bundle; - _extName = extName; - _elementName = elementName; - _extensionDataFactory = new ExtensionDataFactory<EXTENSIONTYPE>(); - _alwaysPerProject = alwaysPerProject; - } - - /** - * @return the resolvers. Lazily initialized. - */ - public final Map<String, ExtensionData<EXTENSIONTYPE>> getExtensions() - { - if (_registeredResolvers == null) - { - _registeredResolvers = loadRegisteredExtensions(); - } - - return _registeredResolvers; - } - - /** - * @return the map of extensions by id. - */ - protected Map<String, ExtensionData<EXTENSIONTYPE>> loadRegisteredExtensions() - { - final Map<String, ExtensionData<EXTENSIONTYPE>> resolvers = new HashMap<String, ExtensionData<EXTENSIONTYPE>>(); - - final IExtensionPoint point = Platform.getExtensionRegistry() - .getExtensionPoint(_bundle.getSymbolicName(), _extName); - - final IExtension[] extensions = point.getExtensions(); - - for (final IExtension extension : extensions) - { - final IConfigurationElement[] elements = extension - .getConfigurationElements(); - - for (final IConfigurationElement element : elements) - { - if (_elementName.equals(element.getName()) - && element.getAttribute("class") != null //$NON-NLS-1$ - && element.getAttribute("id") != null) //$NON-NLS-1$ - { - final ExtensionData extData = processExtension(element, _alwaysPerProject); - - if (extData != null) - { - resolvers.put(extData.getId(), extData); - } - } - } - } - return resolvers; - } - - /** - * @param element - * @param alwaysPerProject - * @return the extension data for the extension or null if can't be created - */ - protected ExtensionData processExtension(final IConfigurationElement element, final boolean alwaysPerProject) - { - return _extensionDataFactory.createExtensionData(element, alwaysPerProject); - } - - /** - * @author cbateman - * - * @param <EXTENSIONTYPE> - */ - protected static class ExtensionDataFactory<EXTENSIONTYPE> - { - ExtensionData createExtensionData(final IConfigurationElement element, - final boolean alwaysPerProject) - { - if (isPerProjectExtension(element, alwaysPerProject)) - { - return new PerProjectExtensionData<EXTENSIONTYPE>(element); - } - return new SingleInstanceExtensionData<EXTENSIONTYPE>(element); - } - - static boolean isPerProjectExtension(final IConfigurationElement element, final boolean alwaysPerProject) - { - if (alwaysPerProject) - { - return true; - } - final String flag = element.getAttribute("instancePerProject"); - // must check for null for backward compatibility, since - // this attribute wasn't part of the original. - if (flag != null) - { - return Boolean.valueOf(flag).booleanValue(); - } - return false; - } - } - - /** - * @param <EXTENSIONTYPE> - */ - protected static class PerProjectExtensionData<EXTENSIONTYPE> extends - ExtensionData<EXTENSIONTYPE> - { - private Map<IProject, EXTENSIONTYPE> _extensions; - - /** - * @param element - */ - protected PerProjectExtensionData(IConfigurationElement element) - { - super(element); - } - - @Override - public EXTENSIONTYPE getInstance(final IProject project) - { - if (!project.isAccessible()) - { - _extensions.remove(project); - return null; - } - - if (_extensions == null) - { - _extensions = new HashMap<IProject, EXTENSIONTYPE>(); - } - - EXTENSIONTYPE instance = _extensions.get(project); - - if (instance == null) - { - try - { - instance = createInstance(); - if (instance instanceof IInstancePerProjectResolver) - { - ((IInstancePerProjectResolver) instance) - .setProject(project); - } - _extensions.put(project, instance); - } - catch (Exception e) - { - JSFCorePlugin.log(e, - "Instantiating extension class for id: " + getId()); - } - } - return instance; - } - - @Override - public EXTENSIONTYPE removeInstance(IProject project) - { - if (_extensions != null) - { - return _extensions.remove(project); - } - return null; - } - } - - /** - * @param <EXTENSIONTYPE> - * - */ - protected static class SingleInstanceExtensionData<EXTENSIONTYPE> extends - ExtensionData<EXTENSIONTYPE> - { - private EXTENSIONTYPE _instance; - - /** - * @param element - */ - protected SingleInstanceExtensionData(IConfigurationElement element) - { - super(element); - } - - @Override - public EXTENSIONTYPE getInstance(final IProject project) - { - if (_instance == null) - { - try - { - _instance = createInstance(); - } - catch (CoreException e) - { - JSFCorePlugin.log(e, - "Instantiating extension class for id: " + getId()); - } - } - return _instance; - } - - @Override - public EXTENSIONTYPE removeInstance(IProject project) - { - final EXTENSIONTYPE removedItem = _instance; - _instance = null; - return removedItem; - } - } - - /** - * Extension data - * - * @param <EXTENSIONTYPE> - * - */ - public abstract static class ExtensionData<EXTENSIONTYPE> - { - private final IConfigurationElement _element; - - /** - * @param element - */ - protected ExtensionData(final IConfigurationElement element) - { - super(); - _element = element; - } - - /** - * @return the unique id of the variable resolver extension - */ - public String getId() - { - return _element.getAttribute("id"); //$NON-NLS-1$ - } - - /** - * @param project - * @return the instance. project may be ignored if there is only one - * global instance for this factory. - */ - public abstract EXTENSIONTYPE getInstance(final IProject project); - - /** - * @param project - * @return the extension for the project, removing from any internal - * caching. May return null if getInstance was never called for - * project. - */ - public abstract EXTENSIONTYPE removeInstance(final IProject project); - - /** - * @return the resolver - * @throws CoreException - */ - protected EXTENSIONTYPE createInstance() throws CoreException - { - return (EXTENSIONTYPE) _element.createExecutableExtension("class"); - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/DecoratableExtensionFactory.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/DecoratableExtensionFactory.java deleted file mode 100644 index 15d53086a..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/DecoratableExtensionFactory.java +++ /dev/null @@ -1,115 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.designtime.internal; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.runtime.IConfigurationElement; -import org.osgi.framework.Bundle; - -/** - * Factory for extensions that include a runtime class for which they decorate. - * - * @author cbateman - * - * @param <EXTENSIONTYPE> - */ -public class DecoratableExtensionFactory<EXTENSIONTYPE> extends - BasicExtensionFactory<EXTENSIONTYPE> -{ - private static final String DECORATOR_ATTRIBUTE_NAME = "forRuntimeClass"; - private final Map<String, List<String>> _forNameToId; - - /** - * @param bundle - * @param extName - * @param elementName - * @param alwaysPerProject - */ - public DecoratableExtensionFactory(final Bundle bundle, - final String extName, final String elementName, final boolean alwaysPerProject) - { - super(bundle, extName, elementName, alwaysPerProject); - _forNameToId = new HashMap<String, List<String>>(); - } - - /** - * @param name - * @return a canonically sorted list of ids of extensions registered by the - * name. - */ - public List<String> getIdsForName(final String name) - { - List<String> ids = _forNameToId.get(name); - if (ids == null) - { - ids = Collections.EMPTY_LIST; - } - return ids; - } - - /** - * @return the number of runtime resolvers for which there is at least one - * declarative variable resolver registered. - */ - public int getNumDecorativeResolvers() - { - return _forNameToId.size(); - } - - @Override - protected Map<String, ExtensionData<EXTENSIONTYPE>> loadRegisteredExtensions() - { - Map<String, ExtensionData<EXTENSIONTYPE>> extensions = super - .loadRegisteredExtensions(); - - // canonically sort forName's - for (final Map.Entry<String, List<String>> entry : _forNameToId - .entrySet()) - { - Collections.sort(entry.getValue()); - } - - return extensions; - } - - - @Override - protected ExtensionData processExtension(IConfigurationElement element, boolean alwaysPerProject) - { - final ExtensionData data = super.processExtension(element, alwaysPerProject); - final String forRuntimeClass = element - .getAttribute(DECORATOR_ATTRIBUTE_NAME); - if (forRuntimeClass != null && !"".equals(forRuntimeClass.trim())){ - addRuntimeClassMapping(data.getId(), forRuntimeClass); - } - return data; - } - - private void addRuntimeClassMapping(final String id, - final String forRuntimeClass) - { - List mappings = _forNameToId.get(forRuntimeClass); - - if (mappings == null) - { - mappings = new ArrayList<String>(2); - _forNameToId.put(forRuntimeClass, mappings); - } - mappings.add(id); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/Messages.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/Messages.java deleted file mode 100644 index fa06bbda0..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/Messages.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.eclipse.jst.jsf.designtime.internal; - -import org.eclipse.osgi.util.NLS; - -/** - * NLS messages. - * - * @author cbateman - * - */ -public class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.jst.jsf.designtime.internal.messages"; //$NON-NLS-1$ - /** - * see messages.properties - */ - public static String DefaultJSPTagResolver_DisplayName; - /** - * see messages.properties - */ - public static String PersistedDataTagStrategy_DisplayName; - /** - * see messages.properties - */ - public static String TagIntrospectingStrategy_DisplayName; - static { - // initialize resource bundle - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/jsp/AdditionalContextSymbolInfo.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/jsp/AdditionalContextSymbolInfo.java deleted file mode 100644 index 4755fa829..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/jsp/AdditionalContextSymbolInfo.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.designtime.internal.jsp; - -import org.eclipse.jst.jsf.context.symbol.source.IAdditionalContextSymbolInfo; - -/** - * - * NOT API. Use IAdditionalContextSymbolInfo. - * - * @author cbateman - * - */ -/*package*/ final class AdditionalContextSymbolInfo implements IAdditionalContextSymbolInfo -{ - private final String _symbolTypeSignature; - private final String _valueExpressionAttributeName; - - /** - * @param symbolTypeSignature - */ - /*package*/ AdditionalContextSymbolInfo(final String symbolTypeSignature, - String valueExpressionAttributeName) - { - super(); - this._symbolTypeSignature = symbolTypeSignature; - this._valueExpressionAttributeName = valueExpressionAttributeName; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.context.symbol.source.IAdditionalContextSymbolInfo#getSymbolTypeSignature() - */ - public String getSymbolTypeSignature() - { - return _symbolTypeSignature; - } - - public String getValueExpressionAttributeName() - { - return _valueExpressionAttributeName; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/jsp/DataModelVariableFactory.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/jsp/DataModelVariableFactory.java deleted file mode 100644 index 95cde302c..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/jsp/DataModelVariableFactory.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.jsp; - -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext; -import org.eclipse.jst.jsf.context.symbol.ISymbol; -import org.eclipse.jst.jsf.core.internal.tld.IJSFConstants; -import org.eclipse.jst.jsf.designtime.symbols.AbstractDataModelVariableFactory; -import org.eclipse.jst.jsf.designtime.symbols.DefaultDataTableSymbolFactory; -import org.w3c.dom.Element; - -/** - * Constructs an EL IObjectSymbol for a particular data table row access variable - * based on the type of the bound data (the value attribute) - * - * - * @author cbateman - * - */ -class DataModelVariableFactory extends DefaultDataTableSymbolFactory -{ - private static DataModelVariableFactory INSTANCE; - - /** - * @return an instance of the factory - */ - public synchronized static DataModelVariableFactory getInstance() - { - if (INSTANCE == null) - { - INSTANCE = new DataModelVariableFactory(); - } - - return INSTANCE; - } - - @Override - public ISymbol createSymbolForDataTableValue(String symbolName, - Element dataTableElement, IStructuredDocumentContext context) - { - if (!IJSFConstants.TAG_DATATABLE.equals(dataTableElement.getLocalName())) - { - throw new AssertionError("dataTableElement must be a dataTable"); //$NON-NLS-1$ - } - - return super.createSymbolForDataTableValue(symbolName, dataTableElement, context); - } - - //private String getELText(IStructuredDocumentConte) - private DataModelVariableFactory() - { - // no external instantiation - super(new MyDataModelVariableFactory()); - } - - private static class MyDataModelVariableFactory extends AbstractDataModelVariableFactory - { - @Override - protected String getVariableSourceName() { - return "dataTable"; //$NON-NLS-1$ - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/jsp/JSPDefaultSymbolFactory.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/jsp/JSPDefaultSymbolFactory.java deleted file mode 100644 index 4e7094214..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/jsp/JSPDefaultSymbolFactory.java +++ /dev/null @@ -1,217 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.designtime.internal.jsp; - -import java.io.IOException; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jst.jsf.common.internal.types.TypeConstants; -import org.eclipse.jst.jsf.context.resolver.structureddocument.IDOMContextResolver; -import org.eclipse.jst.jsf.context.resolver.structureddocument.IStructuredDocumentContextResolverFactory; -import org.eclipse.jst.jsf.context.resolver.structureddocument.ITaglibContextResolver; -import org.eclipse.jst.jsf.context.resolver.structureddocument.IWorkspaceContextResolver; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext; -import org.eclipse.jst.jsf.context.symbol.IBoundedJavaTypeDescriptor; -import org.eclipse.jst.jsf.context.symbol.IComponentSymbol; -import org.eclipse.jst.jsf.context.symbol.IMapTypeDescriptor; -import org.eclipse.jst.jsf.context.symbol.ISymbol; -import org.eclipse.jst.jsf.context.symbol.SymbolFactory; -import org.eclipse.jst.jsf.context.symbol.source.AbstractContextSymbolFactory; -import org.eclipse.jst.jsf.context.symbol.source.IAdditionalContextSymbolInfo; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.core.internal.tld.IJSFConstants; -import org.eclipse.jst.jsf.core.internal.tld.ITLDConstants; -import org.eclipse.jst.jsf.designtime.internal.symbols.ResourceBundleMapSourceFactory; -import org.w3c.dom.Attr; -import org.w3c.dom.Element; -import org.w3c.dom.NamedNodeMap; -import org.w3c.dom.Node; - -/** - * @author cbateman - * - */ -public class JSPDefaultSymbolFactory extends AbstractContextSymbolFactory -{ - protected ISymbol internalCreate(String symbolName,int scope,IAdaptable context,List problems, IAdditionalContextSymbolInfo additionInfo) - { - final IStructuredDocumentContext sContext = - (IStructuredDocumentContext) - context.getAdapter(IStructuredDocumentContext.class); - - final IDOMContextResolver domResolver = - IStructuredDocumentContextResolverFactory.INSTANCE.getDOMContextResolver(sContext); - - if (domResolver != null) - { - final Node curNode = domResolver.getNode(); - - if (curNode instanceof Attr) - { - final Attr attr = (Attr) curNode; - final Node owningElement = attr.getOwnerElement(); - - if (owningElement != null) - { - return handleSymbolCreation(symbolName, sContext, attr, owningElement, problems); - } - } - } - - return null; - } - - - private ISymbol handleSymbolCreation(final String symbolName, - final IStructuredDocumentContext context, - final Attr attr, - final Node owningElement, - final List problems) - { - final ITaglibContextResolver resolver = - IStructuredDocumentContextResolverFactory.INSTANCE.getTaglibContextResolver(context); - - - if (resolver == null - || !resolver.canResolveContext(context)) - { - return null; - } - - final String uri = resolver.getTagURIForNodeName(owningElement); - - // process core taglib - if (ITLDConstants.URI_JSF_CORE.equals(uri)) - { - return handleCoreTags(symbolName, owningElement, attr, context, problems); - } - else if (ITLDConstants.URI_JSF_HTML.equals(uri)) - { - return handleHtmlTags(symbolName, owningElement, attr, context, problems); - } - - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.context.symbol.source.AbstractContextSymbolFactory#supports(org.eclipse.core.runtime.IAdaptable) - */ - public boolean supports(IAdaptable context) - { - return context != null && - context.getAdapter(IStructuredDocumentContext.class) != null; - } - - private ISymbol handleHtmlTags(String symbolName, Node owningElement, Attr attr, IStructuredDocumentContext context, List problems) - { - final String elementName = owningElement.getLocalName(); - final String attrName = attr.getName(); - - if (IJSFConstants.TAG_DATATABLE.equals(elementName)) - { - if (IJSFConstants.ATTR_VAR.equals(attrName)) - { - return DataModelVariableFactory.getInstance() - .createSymbolForDataTableValue(symbolName, (Element) owningElement, context); - } - } - - return null; - } - - private ISymbol handleCoreTags(String symbolName, Node owningElement, Attr attr, IStructuredDocumentContext context, List problems) - { - final String elementName = owningElement.getLocalName(); - - if (IJSFConstants.TAG_LOADBUNDLE.equals(elementName)) - { -// long startTime = System.currentTimeMillis(); - ISymbol symbol = handleLoadBundleTag(symbolName, owningElement, attr, context, problems); - -// long endTime = System.currentTimeMillis(); -// long totalTime = endTime-startTime; - //System.out.println("Loadbundle resolution for symbol "+symbolName+" took: "+totalTime+"ms"); - return symbol; - } - return null; - } - - private ISymbol handleLoadBundleTag(String symbolName, Node owningElement, Attr attr, IStructuredDocumentContext context, List problems) - { - final String attrName = attr.getName(); - if (IJSFConstants.ATTR_VAR.equals(attrName)) - { - final NamedNodeMap attrMap = owningElement.getAttributes(); - final Node baseNameNode = attrMap.getNamedItem(IJSFConstants.ATTR_BASENAME); - - - if (baseNameNode != null) - { - try - { - final IWorkspaceContextResolver wkspaceResolver = - IStructuredDocumentContextResolverFactory.INSTANCE.getWorkspaceContextResolver(context); - IProject project = wkspaceResolver.getProject(); - - if (project == null) - { - throw new RuntimeException("Error acquiring project"); //$NON-NLS-1$ - } - - final Map source = - ResourceBundleMapSourceFactory - .getResourceBundleMapSource(project, baseNameNode.getNodeValue()); - final IMapTypeDescriptor typeDesc = - SymbolFactory.eINSTANCE.createIMapTypeDescriptor(); - typeDesc.setMapSource(source); - final IComponentSymbol symbol = - SymbolFactory.eINSTANCE.createIComponentSymbol(); - symbol.setName(symbolName); - symbol.setTypeDescriptor(typeDesc); - symbol.setDetailedDescription(Messages.getString("JSPDefaultSymbolFactory.Resource.bundle.map.detailedDescription")+baseNameNode.getNodeValue()+"</i>"); //$NON-NLS-1$ //$NON-NLS-2$ - - return symbol; - } - catch (IOException ioe) - { - problems.add(new Status(IStatus.ERROR, JSFCorePlugin.PLUGIN_ID, 0,Messages.getString("JSPDefaultSymbolFactory.Problem.ErrorCreatingVariable"), ioe)); //$NON-NLS-1$ - } - catch (JavaModelException jme) - { - problems.add(new Status(IStatus.ERROR, JSFCorePlugin.PLUGIN_ID, 0,Messages.getString("JSPDefaultSymbolFactory.Problem.ErrorCreatingVariable"), jme)); //$NON-NLS-1$ - } - catch (CoreException ce) - { - problems.add(new Status(IStatus.ERROR, JSFCorePlugin.PLUGIN_ID, 0,Messages.getString("JSPDefaultSymbolFactory.Problem.ErrorCreatingVariable"), ce)); //$NON-NLS-1$ - } - - final IBoundedJavaTypeDescriptor typeDesc = SymbolFactory.eINSTANCE.createIBoundedJavaTypeDescriptor(); - typeDesc.setTypeSignatureDelegate( TypeConstants.TYPE_JAVAOBJECT ); - final IComponentSymbol symbol = SymbolFactory.eINSTANCE.createIComponentSymbol(); - symbol.setName(symbolName); - symbol.setTypeDescriptor(typeDesc); - symbol.setDetailedDescription(Messages.getString("JSPDefaultSymbolFactory.Resource.bundle.map.detailedDescription")+baseNameNode.getNodeValue()+"</i>"); //$NON-NLS-1$ //$NON-NLS-2$ - - return symbol; - } - } - return null; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/jsp/JSPModelProcessor.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/jsp/JSPModelProcessor.java deleted file mode 100644 index d64a6ecd4..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/jsp/JSPModelProcessor.java +++ /dev/null @@ -1,726 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.designtime.internal.jsp; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.locks.ReentrantLock; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.Status; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; -import org.eclipse.jst.jsf.common.internal.resource.IResourceLifecycleListener; -import org.eclipse.jst.jsf.common.internal.resource.LifecycleListener; -import org.eclipse.jst.jsf.common.internal.resource.ResourceLifecycleEvent; -import org.eclipse.jst.jsf.common.internal.resource.ResourceLifecycleEvent.EventType; -import org.eclipse.jst.jsf.common.internal.resource.ResourceLifecycleEvent.ReasonType; -import org.eclipse.jst.jsf.common.metadata.Trait; -import org.eclipse.jst.jsf.common.metadata.internal.TraitValueHelper; -import org.eclipse.jst.jsf.common.metadata.query.ITaglibDomainMetaDataModelContext; -import org.eclipse.jst.jsf.common.metadata.query.TaglibDomainMetaDataQueryHelper; -import org.eclipse.jst.jsf.context.resolver.structureddocument.IStructuredDocumentContextResolverFactory; -import org.eclipse.jst.jsf.context.resolver.structureddocument.ITaglibContextResolver; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContextFactory; -import org.eclipse.jst.jsf.context.symbol.IComponentSymbol; -import org.eclipse.jst.jsf.context.symbol.ISymbol; -import org.eclipse.jst.jsf.context.symbol.SymbolFactory; -import org.eclipse.jst.jsf.context.symbol.source.AbstractContextSymbolFactory; -import org.eclipse.jst.jsf.context.symbol.source.ISymbolConstants; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.designtime.DesignTimeApplicationManager; -import org.eclipse.jst.jsf.designtime.context.DTFacesContext; -import org.eclipse.wst.html.core.internal.document.DOMStyleModelImpl; -import org.eclipse.wst.sse.core.StructuredModelManager; -import org.eclipse.wst.sse.core.internal.provisional.IModelManager; -import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - - -/** - * Processes a JSP model to determine information of interest about it such - * as what tags are currently in use. Listens to the model and updates it's - * information when the model changes. - * - * @author cbateman - * - */ -public class JSPModelProcessor -{ - private final static Map<IFile, JSPModelProcessor> RESOURCE_MAP = - new HashMap<IFile, JSPModelProcessor>(); - private final static java.util.concurrent.locks.Lock CRITICAL_SECTION = - new ReentrantLock(); - private static LifecycleListener LIFECYCLE_LISTENER; - - /** - * @param file The file to get the model processor for - * @return the processor for a particular model, creating it if it does not - * already exist - * @throws CoreException if an attempt to get the model associated with file - * fails due to reasons other than I/O problems - */ - public static JSPModelProcessor get(IFile file) throws CoreException - { - CRITICAL_SECTION.lock(); - try - { - if (!file.isAccessible()) - { - throw new CoreException(new Status(IStatus.ERROR, JSFCorePlugin.PLUGIN_ID, "File must be accessible")); //$NON-NLS-1$ - } - - JSPModelProcessor processor = RESOURCE_MAP.get(file); - - if (processor == null) - { - if (LIFECYCLE_LISTENER == null) - { - LIFECYCLE_LISTENER = new LifecycleListener(file); - } - else - { - LIFECYCLE_LISTENER.addResource(file); - } - - processor = new JSPModelProcessor(file,LIFECYCLE_LISTENER); - RESOURCE_MAP.put(file, processor); - } - - return processor; - } - finally - { - CRITICAL_SECTION.unlock(); - } - } - - /** - * Disposes of the JSPModelProcessor associated with model - * @param file the model processor to be disposed - */ - private static void dispose(IFile file) - { - CRITICAL_SECTION.lock(); - try - { - JSPModelProcessor processor = RESOURCE_MAP.get(file); - - if (processor != null) - { - RESOURCE_MAP.remove(file); - - if (!processor.isDisposed()) - { - processor.dispose(); - LIFECYCLE_LISTENER.removeResource(file); - } - - } - - if (RESOURCE_MAP.size() == 0) - { - // if we no longer have any resources being tracked, - // then dispose the lifecycle listener - LIFECYCLE_LISTENER.dispose(); - LIFECYCLE_LISTENER = null; - } - } - finally - { - CRITICAL_SECTION.unlock(); - } - } - - private final IFile _file; - private LifecycleListener _lifecycleListener; - private IResourceLifecycleListener _resListener; - private boolean _isDisposed; - private Map<Object, ISymbol> _requestMap; - private Map<Object, ISymbol> _sessionMap; - private Map<Object, ISymbol> _applicationMap; - private Map<Object, ISymbol> _noneMap; - private long _lastModificationStamp; - - // used to avoid infinite recursion in refresh. Must never be null - private final CountingMutex _lastModificationStampMonitor = new CountingMutex(); - - /** - * Construct a new JSPModelProcessor for model - * - * @param model - */ - private JSPModelProcessor(final IFile file, final LifecycleListener lifecycleListener) - { - //_model = getModelForFile(file); - //_modelListener = new ModelListener(); - //_model.addModelLifecycleListener(_modelListener); - _file = file; - _lifecycleListener = lifecycleListener; - _resListener = new IResourceLifecycleListener() - { - public EventResult acceptEvent(ResourceLifecycleEvent event) - { - final EventResult result = EventResult.getDefaultEventResult(); - - // not interested - if (!_file.equals(event.getAffectedResource())) - { - return result; - } - - if (event.getEventType() == EventType.RESOURCE_INACCESSIBLE) - { - dispose(_file); - } - else if (event.getEventType() == EventType.RESOURCE_CHANGED) - { - // if the file has changed contents on disk, then - // invoke an unforced refresh of the JSP file - if (event.getReasonType() == ReasonType.RESOURCE_CHANGED_CONTENTS) - { - refresh(false); - } - } - - return result; - } - }; - - lifecycleListener.addListener(_resListener); - - // a negative value guarantees that refresh(false) will - // force a refresh on the first run - _lastModificationStamp = -1; - } - - private DOMStyleModelImpl getModelForFile(final IFile file) - throws CoreException, IOException - { - final IModelManager modelManager = - StructuredModelManager.getModelManager(); - - IStructuredModel model = modelManager.getModelForRead(file); - - if (model instanceof DOMStyleModelImpl) - { - return (DOMStyleModelImpl) model; - } - else if (model != null) - { - // only release from read if we don't find a DOMModelForJSP - // if the model is correct, it will be released in dispose - model.releaseFromRead(); - } - - throw new CoreException - (new Status(IStatus.ERROR - , "org.eclipse.blah" //$NON-NLS-1$ - , 0 //$NON-NLS-1$ - ,"model not of expected type" //$NON-NLS-1$ - , new Throwable())); //$NON-NLS-1$ - } - - private void dispose() - { - if (!_isDisposed) - { - // ensure the resource listener is disposed - _lifecycleListener.removeListener(_resListener); - _resListener = null; - _lifecycleListener = null; - - if (_requestMap != null) - { - _requestMap.clear(); - _requestMap = null; - } - - if (_sessionMap != null) - { - _sessionMap.clear(); - _sessionMap = null; - } - - if (_applicationMap != null) - { - _applicationMap.clear(); - _applicationMap = null; - } - - if (_noneMap != null) - { - _noneMap.clear(); - _noneMap = null; - } - - // mark as disposed - _isDisposed = true; - } - } - - /** - * @return true if this model processor has been disposed. Disposed - * processors should not be used. - */ - public boolean isDisposed() - { - return _isDisposed; - } - - /** - * If isModelDirty() returns true, then it means that a call - * to refresh(false) will trigger a reprocess of the underlying document. - * - * @return true if the underlying JSP model is considered to be dirty - */ - public boolean isModelDirty() - { - final long currentModificationStamp = _file.getModificationStamp(); - return _lastModificationStamp != currentModificationStamp; - } - - /** - * Updates the internal model - * @param forceRefresh -- if true, always refreshes, if false, - * then it only refreshes if the file's modification has changed - * since the last refresh - * @throws IllegalStateException if isDisposed() == true - */ - public void refresh(final boolean forceRefresh) - { - if (isDisposed()) - { - throw new IllegalStateException("Processor is disposed for file: "+_file.toString()); //$NON-NLS-1$ - } - - synchronized(_lastModificationStampMonitor) - { - if (_lastModificationStampMonitor.isSignalled()) - { - // if this calls succeeds, then this thread has obtained the - // lock already and has called through here before. - // return immediately to ensure that we don't recurse infinitely - return; - } - - DOMStyleModelImpl model = null; - try - { - _lastModificationStampMonitor.setSignalled(true); - - - // only refresh if forced or if the underlying file has changed - // since the last run - if (forceRefresh - || isModelDirty()) - { - model = getModelForFile(_file); - refreshInternal(model); - _lastModificationStamp = _file.getModificationStamp(); - } - } - catch (CoreException e) { - JSFCorePlugin.log(new RuntimeException(e), "Error refreshing internal model"); //$NON-NLS-1$ - } catch (IOException e) { - JSFCorePlugin.log(new RuntimeException(e), "Error refreshing internal model"); //$NON-NLS-1$ - } - // make sure that we unsignal the monitor before releasing the - // mutex - finally - { - if (model != null) - { - model.releaseFromRead(); - } - _lastModificationStampMonitor.setSignalled(false); - } - } - } - - private void refreshInternal(DOMStyleModelImpl model) - { - final IStructuredDocumentContext context = - IStructuredDocumentContextFactory.INSTANCE.getContext(model.getStructuredDocument(), -1); - final ITaglibContextResolver taglibResolver = - IStructuredDocumentContextResolverFactory.INSTANCE.getTaglibContextResolver(context); - IDOMDocument document = model.getDocument(); - getApplicationMap().clear(); - getRequestMap().clear(); - getSessionMap().clear(); - //long curTime = System.currentTimeMillis(); - recurseChildNodes(model, document.getChildNodes(), taglibResolver); - //long netTime = System.currentTimeMillis() - curTime; - //System.out.println("Net time to recurse document: "+netTime); - } - - private void recurseChildNodes(final IDOMModel model, - final NodeList nodes, - final ITaglibContextResolver taglibResolver) - { - for (int i = 0; i < nodes.getLength(); i++) - { - final Node child = nodes.item(i); - - // process attributes at this node before recursing - processAttributes(model, child, taglibResolver); - recurseChildNodes(model, child.getChildNodes(), taglibResolver); - } - } - - private void processAttributes(final IDOMModel model, final Node node, - final ITaglibContextResolver taglibResolver) - { - if (taglibResolver.hasTag(node)) - { - final String uri = - taglibResolver.getTagURIForNodeName(node); - final String elementName = node.getLocalName(); - - for (int i = 0; i < node.getAttributes().getLength(); i++) - { - final Node attribute = node.getAttributes().item(i); - - processSymbolContrib(model, uri, elementName, attribute); - processSetsLocale(uri, elementName, attribute); - } - } - } - - private void processSymbolContrib(final IDOMModel model, final String uri, final String elementName, Node attribute) - { - final SymbolContribAggregator aggregator = - SymbolContribAggregator. - create(_file.getProject(), uri, elementName, attribute.getLocalName()); - - if (aggregator != null) - { - final AbstractContextSymbolFactory factory = aggregator.getFactory(); - final String symbolName = attribute.getNodeValue(); - - if (factory != null) - { -// long curTime = System.currentTimeMillis(); - final IStructuredDocumentContext context = - IStructuredDocumentContextFactory.INSTANCE. - getContext(model.getStructuredDocument(), - attribute); - - if (factory.supports(context)) - { - final List problems = new ArrayList(); - ISymbol symbol = - factory.create(symbolName, - ISymbolConstants.SYMBOL_SCOPE_REQUEST, //TODO: - context, - problems, - // TODO: add meta-data for signature - new AdditionalContextSymbolInfo(aggregator.getStaticType(), aggregator.getValueExpressionAttr())); - - // long netTime = System.currentTimeMillis() - curTime; - // System.out.println("Time to process loadBundle: "+netTime); - - if (symbol != null) - { - updateMap(symbol, aggregator.getScope()); - } - } - } - else - { - IComponentSymbol componentSymbol = - SymbolFactory.eINSTANCE.createIComponentSymbol(); - componentSymbol.setName(symbolName); - - updateMap(componentSymbol, aggregator.getScope()); - } - } - } - - @SuppressWarnings("deprecation") //$NON-NLS-1$ - private void processSetsLocale(final String uri, final String elementName, Node attribute) - { - LocaleSetAggregator aggregator = LocaleSetAggregator.create(_file.getProject(), uri, elementName, attribute.getLocalName()); - - if (aggregator != null) - { - DesignTimeApplicationManager dtAppMgr = - DesignTimeApplicationManager.getInstance(_file.getProject()); - - if (dtAppMgr != null) - { - DTFacesContext facesContext = dtAppMgr.getFacesContext(_file); - - if (facesContext != null) - { - facesContext.setLocaleString(attribute.getNodeValue()); - } - } - } - } - - /** - * @param scopeName - one of "request", "session" or "application" - * @return an unmodifable map containing all known symbols for - * that scope. If scopeName is not found, returns the empty map. - */ - public Map<Object, ISymbol> getMapForScope(String scopeName) - { - final Map<Object, ISymbol> map = getMapForScopeInternal(scopeName); - - if (map != null) - { - return Collections.unmodifiableMap(map); - } - - return Collections.EMPTY_MAP; - } - - private void updateMap(ISymbol symbol, String scopeName) - { - final Map<Object, ISymbol> map = getMapForScopeInternal(scopeName); - - if (map != null) - { - map.put(symbol.getName(), symbol); - } - else - { - Platform.getLog(JSFCorePlugin.getDefault().getBundle()).log(new Status(IStatus.ERROR, JSFCorePlugin.PLUGIN_ID, 0, "Scope not found: "+scopeName, new Throwable())); //$NON-NLS-1$ - } - } - - private Map<Object, ISymbol> getMapForScopeInternal(String scopeName) - { - if (ISymbolConstants.SYMBOL_SCOPE_REQUEST_STRING.equals(scopeName)) - { - return getRequestMap(); - } - else if (ISymbolConstants.SYMBOL_SCOPE_SESSION_STRING.equals(scopeName)) - { - return getSessionMap(); - } - else if (ISymbolConstants.SYMBOL_SCOPE_APPLICATION_STRING.equals(scopeName)) - { - return getApplicationMap(); - } - else if (ISymbolConstants.SYMBOL_SCOPE_NONE_STRING.equals(scopeName)) - { - return getNoneMap(); - } - - Platform.getLog(JSFCorePlugin.getDefault().getBundle()).log(new Status(IStatus.ERROR, JSFCorePlugin.PLUGIN_ID, 0, "Scope not found: "+scopeName, new Throwable())); //$NON-NLS-1$ - return null; - - } - - private Map getRequestMap() - { - if (_requestMap == null) - { - _requestMap = new HashMap<Object, ISymbol>(); - } - - return _requestMap; - } - - private Map<Object, ISymbol> getSessionMap() - { - if (_sessionMap == null) - { - _sessionMap = new HashMap<Object, ISymbol>(); - } - - return _sessionMap; - } - - private Map<Object, ISymbol> getApplicationMap() - { - if (_applicationMap == null) - { - _applicationMap = new HashMap<Object, ISymbol>(); - } - - return _applicationMap; - } - - private Map<Object, ISymbol> getNoneMap() - { - if (_noneMap == null) - { - _noneMap = new HashMap<Object, ISymbol>(); - } - - return _noneMap; - } - - /** - * Aggregates the sets-locale meta-data - * - * @author cbateman - */ - private static class LocaleSetAggregator - { - private final static String SETS_LOCALE = "sets-locale"; //$NON-NLS-1$ - - static LocaleSetAggregator create(IProject project, - final String uri, - final String elementName, final String attributeName) - { - final ITaglibDomainMetaDataModelContext mdContext = TaglibDomainMetaDataQueryHelper.createMetaDataModelContext(project, uri); - Trait trait = TaglibDomainMetaDataQueryHelper.getTrait(mdContext, elementName+"/"+attributeName, SETS_LOCALE); //$NON-NLS-1$ - - if (TraitValueHelper.getValueAsBoolean(trait)) - { - return new LocaleSetAggregator(); - } - - return null; - } - } - - /** - * Aggregates all the symbol contributor meta-data into a single object - * - * @author cbateman - * - */ - private static class SymbolContribAggregator - { - private final static String CONTRIBUTES_VALUE_BINDING = - "contributes-value-binding"; //$NON-NLS-1$ - private final static String VALUE_BINDING_SCOPE = "value-binding-scope"; //$NON-NLS-1$ - private final static String VALUE_BINDING_SYMBOL_FACTORY = - "value-binding-symbol-factory"; //$NON-NLS-1$ - private final static String STATIC_TYPE_KEY = "optional-value-binding-static-type"; //$NON-NLS-1$ - private final static String VALUEEXPRESSION_ATTR_NAME_KEY = "optional-value-binding-valueexpr-attr"; //$NON-NLS-1$ - - /** - * @param attributeName - * @return a new instance only if attributeName is a symbol contributor - */ - static SymbolContribAggregator create(final IProject project, - final String uri, - final String elementName, - final String attributeName) - { - final String entityKey = elementName+"/"+attributeName; //$NON-NLS-1$ - final ITaglibDomainMetaDataModelContext mdContext = TaglibDomainMetaDataQueryHelper.createMetaDataModelContext(project, uri); - Trait trait = TaglibDomainMetaDataQueryHelper.getTrait(mdContext, entityKey, CONTRIBUTES_VALUE_BINDING); - - boolean contribsValueBindings = TraitValueHelper.getValueAsBoolean(trait); - - if (contribsValueBindings) - { - String scope = null; - String symbolFactory = null; - - trait = TaglibDomainMetaDataQueryHelper.getTrait(mdContext, entityKey, VALUE_BINDING_SCOPE); - scope = TraitValueHelper.getValueAsString(trait); - - if (scope != null && !scope.equals("")) //$NON-NLS-1$ - { - trait = TaglibDomainMetaDataQueryHelper.getTrait(mdContext, entityKey, VALUE_BINDING_SYMBOL_FACTORY); - symbolFactory = TraitValueHelper.getValueAsString(trait); - } - - trait = TaglibDomainMetaDataQueryHelper.getTrait(mdContext, entityKey, STATIC_TYPE_KEY); - - String staticType = null; - - if (trait != null) - { - staticType = TraitValueHelper.getValueAsString(trait); - } - - trait = TaglibDomainMetaDataQueryHelper.getTrait(mdContext, entityKey, VALUEEXPRESSION_ATTR_NAME_KEY); - - String valueExprAttr = null; - if (trait != null) - { - valueExprAttr = TraitValueHelper.getValueAsString(trait); - } - - return new SymbolContribAggregator(scope, symbolFactory, staticType, valueExprAttr); - } - - return null; - } - - private final Map<String, String> _metadata = new HashMap<String, String>(4); - - SymbolContribAggregator(final String scope, final String factory, final String staticType, final String valueExprAttr) - { - _metadata.put("scope", scope); //$NON-NLS-1$ - _metadata.put("factory", factory); //$NON-NLS-1$ - _metadata.put("staticType", staticType); //$NON-NLS-1$ - _metadata.put("valueExprAttr", valueExprAttr); //$NON-NLS-1$ - } - - /** - * @return the scope - */ - public String getScope() - { - return _metadata.get("scope"); //$NON-NLS-1$ - } - - /** - * @return the factory - */ - public AbstractContextSymbolFactory getFactory() - { - return JSFCommonPlugin.getSymbolFactories().get(_metadata.get("factory")); //$NON-NLS-1$ - } - - public String getStaticType() - { - return _metadata.get("staticType"); //$NON-NLS-1$ - } - - public String getValueExpressionAttr() - { - return _metadata.get("valueExprAttr"); //$NON-NLS-1$ - } - } - - private static class CountingMutex extends Object - { - private boolean _signalled = false; - - /** - * @return true if the state of mutex is signalled - */ - public synchronized boolean isSignalled() { - return _signalled; - } - - /** - * @param signalled - */ - public synchronized void setSignalled(boolean signalled) { - this._signalled = signalled; - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/jsp/Messages.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/jsp/Messages.java deleted file mode 100644 index de41104a9..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/jsp/Messages.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2007 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.designtime.internal.jsp; - -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -/** - * Message resource class - * - * @author cbateman - * - */ -/*package*/ final class Messages { - private static final String BUNDLE_NAME = "org.eclipse.jst.jsf.designtime.messages"; //$NON-NLS-1$ - - private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle - .getBundle(BUNDLE_NAME); - - private Messages() { - // no external instatiation - } - - /** - * @param key - * @return the message string for key or !key! if not found - */ - public static String getString(String key) { - try { - return RESOURCE_BUNDLE.getString(key); - } catch (MissingResourceException e) { - return '!' + key + '!'; - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/jsp/StartupHandler.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/jsp/StartupHandler.java deleted file mode 100644 index b3b437742..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/jsp/StartupHandler.java +++ /dev/null @@ -1,208 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.designtime.internal.jsp; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jst.jsf.common.internal.JSPUtil; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.core.jsfappconfig.JSFAppConfigUtils; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IEditorReference; -import org.eclipse.ui.IPartListener2; -import org.eclipse.ui.IStartup; -import org.eclipse.ui.IWindowListener; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchPartReference; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.PlatformUI; - -/** - * On workbench startup, registers a part listener that triggers when - * a JSP editor opens. - * - * @author cbateman - * - */ -public class StartupHandler implements IStartup -{ - private final JSPEditorListener _partListener = new JSPEditorListener(); - - public void earlyStartup() - { - PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() - { - public void run() - { - IWorkbenchWindow windows[] = - PlatformUI.getWorkbench().getWorkbenchWindows(); - - for (int i = 0; i < windows.length; i++) - { - IWorkbenchPage pages[] = windows[i].getPages(); - for (int j = 0; j < pages.length; j++) - { - IEditorReference[] editorReferences = - pages[j].getEditorReferences(); - - for (int k = 0; k < editorReferences.length; k++) - { - if (_partListener.isValidJSPEditor(editorReferences[k])) - { - _partListener.setJSPModelListener(editorReferences[k]); - } - } - } - windows[i].getPartService().addPartListener(_partListener); - } - - // TODO: register with all windows? - PlatformUI.getWorkbench().addWindowListener(new IWindowListener() - { - public void windowActivated(IWorkbenchWindow window) { - // do nothing - } - - public void windowDeactivated(IWorkbenchWindow window) { - // do nothing - } - - public void windowClosed(IWorkbenchWindow window) { - window.getPartService().removePartListener(_partListener); - } - - public void windowOpened(IWorkbenchWindow window) { - window.getPartService().addPartListener(_partListener); - } - }); - } - }); - } - - private static class JSPEditorListener implements IPartListener2 - { - private JSPModelProcessor _processor; - - public void partActivated(IWorkbenchPartReference partRef) { - // do nothing - } - - public void partBroughtToTop(IWorkbenchPartReference partRef) { - // do nothing - } - - public void partClosed(IWorkbenchPartReference partRef) { - // do nothing - } - - public void partDeactivated(IWorkbenchPartReference partRef) { - // do nothing - } - - public void partOpened(IWorkbenchPartReference partRef) { - if (isValidJSPEditor(partRef)) - { - setJSPModelListener((IEditorReference)partRef); - } - } - - public void partHidden(IWorkbenchPartReference partRef) { - // do nothing - } - - public void partVisible(IWorkbenchPartReference partRef) { - // do nothing - } - - public void partInputChanged(IWorkbenchPartReference partRef) { - // do nothing - } - - private boolean isJSPEditor(IEditorReference editorRef) - { - IFile file = getIFile(editorRef); - - if (file != null) - { - return JSPUtil.isJSPContentType(file); - } - - return false; - } - - /** - * @param editorRef - * @return true if the editor is editing the JSP content type and - * the owning project is a JSF project - */ - boolean isValidJSPEditor(IEditorReference editorRef) - { - final IFile file = getIFile(editorRef); - - return file != null && - JSFAppConfigUtils.isValidJSFProject(file.getProject()) && - isJSPEditor(editorRef); - } - - boolean isValidJSPEditor(IWorkbenchPartReference partRef) - { - if (partRef instanceof IEditorReference) - { - return isValidJSPEditor((IEditorReference)partRef); - } - - return false; - } - - void setJSPModelListener(IEditorReference editorRef) - { - IFile file = getIFile(editorRef); - - if (file != null) - { - try - { - // implicitly creates if not present - _processor = JSPModelProcessor.get(file); - _processor.refresh(false); - } - catch (Exception e) - { - JSFCorePlugin.getDefault().getLog().log(new Status(IStatus.ERROR, JSFCorePlugin.PLUGIN_ID, 0, "Error acquiring model processor",e)); //$NON-NLS-1$ - } - } - } - - IFile getIFile(IEditorReference editorRef) - { - try - { - IEditorInput editorInput = editorRef.getEditorInput(); - Object adapt = editorInput.getAdapter(IFile.class); - - if (adapt instanceof IFile) - { - return (IFile) adapt; - } - } - catch (PartInitException excp) - { - JSFCorePlugin.getDefault().getLog().log(new Status(IStatus.ERROR, JSFCorePlugin.PLUGIN_ID, 0, "Error acquiring editor input",excp)); //$NON-NLS-1$ - } - - return null; - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/messages.properties b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/messages.properties deleted file mode 100644 index f4a8f98ef..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/messages.properties +++ /dev/null @@ -1,3 +0,0 @@ -DefaultJSPTagResolver_DisplayName=Meta-data Driven Resolver -PersistedDataTagStrategy_DisplayName=Cached Data Tag Resolver -TagIntrospectingStrategy_DisplayName=Introspecting Tag Resolver diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/resolver/ViewBasedTaglibResolverFactory.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/resolver/ViewBasedTaglibResolverFactory.java deleted file mode 100644 index 3ed3716cf..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/resolver/ViewBasedTaglibResolverFactory.java +++ /dev/null @@ -1,235 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.resolver; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagElement; -import org.eclipse.jst.jsf.context.IModelContext; -import org.eclipse.jst.jsf.context.resolver.structureddocument.IDOMContextResolver; -import org.eclipse.jst.jsf.context.resolver.structureddocument.IMetadataContextResolver; -import org.eclipse.jst.jsf.context.resolver.structureddocument.IStructuredDocumentContextResolverFactory; -import org.eclipse.jst.jsf.context.resolver.structureddocument.ITaglibContextResolver; -import org.eclipse.jst.jsf.context.resolver.structureddocument.IWorkspaceContextResolver; -import org.eclipse.jst.jsf.context.resolver.structureddocument.internal.ITextRegionContextResolver; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.designtime.DTAppManagerUtil; -import org.eclipse.jst.jsf.designtime.internal.view.XMLViewDefnAdapter; -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument; -import org.w3c.dom.Attr; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - -/** - * A Taglib resolver that delegates to the design tieme view handler so that it - * is independent of the tag definition type in use. Document must still be an - * IStructuredDocument. - * - */ -public class ViewBasedTaglibResolverFactory implements -IStructuredDocumentContextResolverFactory, IAdaptable -{ - public IDOMContextResolver getDOMContextResolver( - final IStructuredDocumentContext context) - { - // no dom resolver - return null; - } - - public IMetadataContextResolver getMetadataContextResolver( - final IStructuredDocumentContext context) - { - // no metadata resolver - return null; - } - - public ITaglibContextResolver getTaglibContextResolver( - final IStructuredDocumentContext context) - { - if (context.getStructuredDocument() instanceof IStructuredDocument) - { - final IWorkspaceContextResolver resolver = INSTANCE - .getWorkspaceContextResolver(context); - if (resolver != null) - { - final IProject project = resolver.getProject(); - final IResource res = resolver.getResource(); - - if (project != null && res instanceof IFile) - { - final IFile file = (IFile) res; - - try - { - return new ViewBasedTaglibResolver(context, file, - project); - } - catch (final IllegalArgumentException e) - { - // the constructor will throw this if the view - // definition - // adapter for file is not of the base type it needs - // just fall through, no need to log - } - } - } - } - - return null; - } - - /** - * A taglib resolver that goes through the design time view handler to - * resolve tags. This allows us to abstract the definition format (XML) from - * the kind of tag handlers that process it (JSP vs. Facelets vs. others). - * - */ - private static class ViewBasedTaglibResolver implements - ITaglibContextResolver - { - private final IProject _project; - private final IFile _file; - private final IStructuredDocumentContext _context; - - /** - * @param context - * @param file - * @param project - */ - private ViewBasedTaglibResolver( - final IStructuredDocumentContext context, final IFile file, - final IProject project) - { - super(); - _context = context; - _file = file; - _project = project; - - if (DTAppManagerUtil.getXMLViewDefnAdapter(project, file) == null) - { - throw new IllegalArgumentException( - "View definition adapter not found"); - } - } - - public String getTagPrefixForURI(final String uri) - { - final XMLViewDefnAdapter adapter = DTAppManagerUtil - .getXMLViewDefnAdapter(_file); - - if (adapter != null) - { - return adapter.getPrefix(uri, _context.getStructuredDocument()); - } - return null; - } - - public String getTagURIForNodeName(final Node node) - { - final XMLViewDefnAdapter adapter = DTAppManagerUtil - .getXMLViewDefnAdapter(_file); - final Element element = getElement(node); - if (element != null && adapter != null) - { - return adapter.getNamespace(element, _context.getStructuredDocument()); - } - return null; - } - - public NodeList getTagsByNamespaceURI(final String uri, - final String tagName) - { - // TODO: what is the purpose of this API? deprecate? - return null; - } - - public boolean hasTag(final Node node) - { - // it is sufficient to check that the view adapter will give us - // a non-null tag element - return getTagElement(node) != null; - } - - public boolean canResolveContext(final IModelContext modelContext) - { - // must be a JSP page - final Object adapter = modelContext.getAdapter(IStructuredDocumentContext.class); - - if (adapter instanceof IStructuredDocumentContext) - { - return ((IStructuredDocumentContext)adapter).getStructuredDocument() instanceof IStructuredDocument; - } - return false; - } - - private Element getElement(final Node node) - { - Element checkNode = null; - - if (node instanceof Element) - { - checkNode = (Element) node; - } - else if (node instanceof Attr) - { - checkNode = ((Attr) node).getOwnerElement(); - } - return checkNode; - } - - private ITagElement getTagElement(final Node node) - { - final Element element = getElement(node); - - final XMLViewDefnAdapter adapter = - DTAppManagerUtil.getXMLViewDefnAdapter(_project, _file); - - if (element != null && adapter != null) - { - return adapter.mapToTagElement(element, _context - .getStructuredDocument()); - } - // shouldn't happen since the constuctor throws an exceptino - // if can't get the adapter - JSFCorePlugin.log("Unexpected case", - new Throwable(_file.toString())); - return null; - } - } - - - public ITextRegionContextResolver getTextRegionResolver( - final IStructuredDocumentContext context) - { - // no text region resolver - return null; - } - - public IWorkspaceContextResolver getWorkspaceContextResolver( - final IStructuredDocumentContext context) - { - // no workspace resolver - return null; - } - - public Object getAdapter(final Class adapter) - { - if (adapter.isInstance(this)) - { - return this; - } - return null; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/symbols/ConfigBasedDTPropertyResolver.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/symbols/ConfigBasedDTPropertyResolver.java deleted file mode 100644 index 2564e311d..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/symbols/ConfigBasedDTPropertyResolver.java +++ /dev/null @@ -1,231 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Xiaonan Jiang/IBM -- extracted from https://bugs.eclipse.org/bugs/show_bug.cgi?id=206514 - * Cameron Bateman/Oracle - integrated. - * - ********************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.symbols; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.jsf.context.symbol.ISymbol; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.core.jsfappconfig.JSFAppConfigManager; -import org.eclipse.jst.jsf.designtime.el.AbstractDTPropertyResolver; -import org.eclipse.jst.jsf.designtime.el.DefaultDTPropertyResolver; -import org.eclipse.jst.jsf.designtime.el.IDecorativeResolver; -import org.eclipse.jst.jsf.designtime.el.IInstancePerProjectResolver; - -/** - * A design time proxy for the runtime ProperyResolver. - * - * @author xnjiang - * - */ -public class ConfigBasedDTPropertyResolver extends DefaultDTPropertyResolver - implements IInstancePerProjectResolver -{ - private IProject _project; - - /** - * Constructor - * - */ - public ConfigBasedDTPropertyResolver() - { - super(); - } - - @Override - public ISymbol[] getAllProperties(final ISymbol base) - { - final Map<String, ISymbol> allSymbols = new HashMap<String, ISymbol>(); - final ISymbol[] superSymbols = super.getAllProperties(base); - for (final ISymbol superSymbol : superSymbols) - { - allSymbols.put(superSymbol.getName(), superSymbol); - } - - if (JSFCorePlugin.hasDecorativePropertyResolvers()) - { - final List<AbstractDTPropertyResolver> resolvers = retrieveDecorativePropertyResolvers(_project); - for (final AbstractDTPropertyResolver resolver : resolvers) - { - final ISymbol[] otherSymbols = resolver.getAllProperties(base); - for (final ISymbol otherSymbol : otherSymbols) - { - // allow subsequent resolvers to replace symbols by name - // added previously - allSymbols.put(otherSymbol.getName(), otherSymbol); - } - } - } - return allSymbols.values().toArray(ISymbol.EMPTY_SYMBOL_ARRAY); - - } - - @Override - public ISymbol getProperty(final ISymbol base, final int offset) - { - if (JSFCorePlugin.hasDecorativePropertyResolvers()) - { - final List<AbstractDTPropertyResolver> resolvers = retrieveDecorativePropertyResolvers(_project); - - // we need to iterate backwards through the resolvers, since - // the we take the first answer we receive. - for (int i = resolvers.size() - 1; i >= 0; i--) - { - final ISymbol symbol = resolvers.get(i).getProperty(base, - offset); - if (symbol != null) - { - return symbol; - } - } - } - return super.getProperty(base, offset); - } - - @Override - public ISymbol getProperty(final ISymbol base, final Object propertyId) - { - if (JSFCorePlugin.hasDecorativePropertyResolvers()) - { - final List<AbstractDTPropertyResolver> resolvers = retrieveDecorativePropertyResolvers(_project); - - // we need to iterate backwards through the resolvers, since - // the we take the first answer we receive. - for (int i = resolvers.size() - 1; i >= 0; i--) - { - final ISymbol symbol = resolvers.get(i).getProperty(base, - propertyId); - if (symbol != null) - { - return symbol; - } - } - } - return super.getProperty(base, propertyId); - } - - private List<AbstractDTPropertyResolver> retrieveDecorativePropertyResolvers( - final IProject project) - { - final JSFAppConfigManager manager = JSFAppConfigManager - .getInstance(project); - final List<String> propertyResolvers = manager.getPropertyResolvers(); - final List<AbstractDTPropertyResolver> resolvers = new ArrayList<AbstractDTPropertyResolver>(); - for (final String propertyResolver : propertyResolvers) - { - final List<String> ids = JSFCorePlugin - .getPropertyResolversForName(propertyResolver); - - for (final String id : ids) - { - final AbstractDTPropertyResolver resolver = JSFCorePlugin - .getPropertyResolver(id).getInstance(_project); - if (resolver instanceof IDecorativeResolver) - { - resolvers.add(resolver); - } - else - { - JSFCorePlugin.log(new Exception(), String.format("resolver %s must implement the IDecorativeResolver interface to be used", id)); - } - } - } - return resolvers; - } - - public void setProject(final IProject project) - { - _project = project; - } - - // private void retrievePropertyResolver() { - // try { - // String str = - // project.getPersistentProperty(PERSIST_PROPERTY_KEY_PROPERTY_RESOLVERS); - // if (str != null) { - // resolvers = new ArrayList<AbstractDTPropertyResolver>(); - // StringTokenizer tokenizer = new StringTokenizer(str, ",");//$NON-NLS-1$ - // while (tokenizer.hasMoreTokens()) { - // AbstractDTPropertyResolver resolver = - // JSFCorePlugin.getPropertyResolvers().get(tokenizer.nextToken()); - // if (resolver != null) { - // resolvers.add(resolver); - // } - // } - // } else { - // checkFacesConfigForPropertyResolver(); - // } - // } catch (CoreException e) { - // checkFacesConfigForPropertyResolver(); - // } - // } - // - // private void checkFacesConfigForPropertyResolver() { - // resolvers = new ArrayList<AbstractDTPropertyResolver>(); - // String str = "";//$NON-NLS-1$ - // boolean bFirst = true; - // List facesConfigs = - // JSFAppConfigManager.getInstance(project).getFacesConfigModels(); - // Iterator itFacesConfigs = facesConfigs.iterator(); - // while (itFacesConfigs.hasNext()) { - // FacesConfigType facesConfig = (FacesConfigType)itFacesConfigs.next(); - // EList applications = facesConfig.getApplication(); - // for (int i=0;i<applications.size();i++) { - // EList resolvers2 = - // ((ApplicationType)applications.get(i)).getPropertyResolver(); - // for (int j=0;j<resolvers2.size();j++) { - // PropertyResolverType resolverType = - // (PropertyResolverType)resolvers2.get(i); - // AbstractDTPropertyResolver resolver = - // JSFCorePlugin.getPropertyResolvers().get(resolverType.getTextContent()); - // if (resolver != null) { - // resolvers.add(resolver); - // if (bFirst) { - // bFirst = false; - // } else { - // str += ",";//$NON-NLS-1$ - // } - // str += resolverType.getTextContent(); - // } - // } - // } - // } - // try { - // if (!str.equals("")) {//$NON-NLS-1$ - // project.setPersistentProperty(PERSIST_PROPERTY_KEY_PROPERTY_RESOLVERS, - // str); - // } else { - // project.setPersistentProperty(PERSIST_PROPERTY_KEY_PROPERTY_RESOLVERS, - // null); - // } - // } catch (CoreException e) { - // e.printStackTrace(); - // } - // } - // - // /** - // * Called when a change in an application configuration model for which - // * this listener has been registered occurs. - // * - // * @param notification EMF {@link Notification} instance that describes - // the - // * model change. - // */ - // public void notifyChanged(Notification notification) { - // checkFacesConfigForPropertyResolver(); - // } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/symbols/ConfigBasedDTVariableResolver.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/symbols/ConfigBasedDTVariableResolver.java deleted file mode 100644 index e39fe1ccb..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/symbols/ConfigBasedDTVariableResolver.java +++ /dev/null @@ -1,203 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Xiaonan Jiang/IBM -- extracted from https://bugs.eclipse.org/bugs/show_bug.cgi?id=206514 - * Cameron Bateman/Oracle - integrated. - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.designtime.internal.symbols; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.jst.jsf.context.symbol.ISymbol; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.core.jsfappconfig.JSFAppConfigManager; -import org.eclipse.jst.jsf.designtime.context.DTFacesContext; -import org.eclipse.jst.jsf.designtime.el.AbstractDTVariableResolver; -import org.eclipse.jst.jsf.designtime.el.DefaultDTVariableResolver; -import org.eclipse.jst.jsf.designtime.el.IDecorativeResolver; - -/** - * A design time proxy for the runtime VariableResolver. - * - * @author xnjiang - * - */ -public class ConfigBasedDTVariableResolver extends DefaultDTVariableResolver -// implements IFacesConfigChangeListener -{ - /** - * Constructor - */ - public ConfigBasedDTVariableResolver() - { - super(); - - } - - @Override - public ISymbol[] getAllVariables(final DTFacesContext facesContext, - final IAdaptable externalContextKey) - { - //final long curTime = System.nanoTime(); - final Map<String, ISymbol> allSymbols = new HashMap<String, ISymbol>(); - final ISymbol[] superSymbols = super.getAllVariables(facesContext, - externalContextKey); - for (final ISymbol superSymbol : superSymbols) - { - allSymbols.put(superSymbol.getName(), superSymbol); - } - - if (JSFCorePlugin.hasDecorativeVariableResolvers()) - { - final IProject project = getProject(facesContext); - - final List<AbstractDTVariableResolver> resolvers = retrieveDecorativeVariableResolvers(project); - for (final AbstractDTVariableResolver resolver : resolvers) - { - final ISymbol[] otherSymbols = resolver.getAllVariables( - facesContext, externalContextKey); - for (final ISymbol otherSymbol : otherSymbols) - { - // allow subsequent resolvers to replace symbols by name - // added previously - allSymbols.put(otherSymbol.getName(), otherSymbol); - } - } - } - //System.out.printf("totalAllSymbols: %d\n", Long.valueOf(System.nanoTime()- curTime)); - return allSymbols.values().toArray(ISymbol.EMPTY_SYMBOL_ARRAY); - } - - @Override - public ISymbol resolveVariable(final DTFacesContext context, - final String name, final IAdaptable externalContextKey) - { - //long curTime = System.nanoTime(); - if (JSFCorePlugin.hasDecorativeVariableResolvers()) - { - final IProject project = getProject(context); - - final List<AbstractDTVariableResolver> resolvers = retrieveDecorativeVariableResolvers(project); - - // we need to iterate backwards through the resolvers, since - // the we take the first answer we receive. - for (int i = resolvers.size() - 1; i >= 0; i--) - { - final ISymbol symbol = resolvers.get(i).resolveVariable( - context, name, externalContextKey); - if (symbol != null) - { - return symbol; - } - } - } - ISymbol symbol = super.resolveVariable(context, name, externalContextKey); - //System.out.printf("totalSymbol: %d\n", Long.valueOf(System.nanoTime()- curTime)); - return symbol; - } - - private List<AbstractDTVariableResolver> retrieveDecorativeVariableResolvers( - final IProject project) - { - //final long curTime = System.nanoTime(); - final JSFAppConfigManager manager = JSFAppConfigManager - .getInstance(project); - final List<String> variableResolvers = manager.getVariableResolvers(); - final List<AbstractDTVariableResolver> resolvers = new ArrayList<AbstractDTVariableResolver>(); - for (final String variableResolver : variableResolvers) - { - final List<String> ids = JSFCorePlugin - .getVariableResolversForName(variableResolver); - - for (final String id : ids) - { - final AbstractDTVariableResolver resolver = JSFCorePlugin - .getVariableResolvers(id).getInstance(project); - if (resolver instanceof IDecorativeResolver) - { - resolvers.add(resolver); - } - else - { - JSFCorePlugin.log(new Exception(), String.format("resolver %s must implement the IDecorativeResolver interface to be used", id)); - } - } - } - //System.out.printf("retrieveDecorativeVariable: %d\n", Long.valueOf(System.nanoTime()- curTime)); - return resolvers; - } - - private IProject getProject(final DTFacesContext facesContext) - { - final IResource res = facesContext.adaptContextObject(); - - if (res != null) - { - return res.getProject(); - } - return null; - } - - // private void checkFacesConfigForVariableResolver(final IProject project) - // { - // resolvers = new ArrayList<AbstractDTVariableResolver>(); - // String str = "";//$NON-NLS-1$ - // boolean bFirst = true; - // final List facesConfigs = - // JSFAppConfigManager.getInstance(project).getFacesConfigModels(); - // final Iterator itFacesConfigs = facesConfigs.iterator(); - // while (itFacesConfigs.hasNext()) { - // final FacesConfigType facesConfig = - // (FacesConfigType)itFacesConfigs.next(); - // final EList applications = facesConfig.getApplication(); - // for (int i=0;i<applications.size();i++) { - // final EList resolvers2 = - // ((ApplicationType)applications.get(i)).getVariableResolver(); - // for (int j=0;j<resolvers2.size();j++) { - // final VariableResolverType resolverType = - // (VariableResolverType)resolvers2.get(i); - // final AbstractDTVariableResolver resolver = - // JSFCorePlugin.getVariableResolvers().get(resolverType.getTextContent()); - // if (resolver != null) { - // resolvers.add(resolver); - // if (bFirst) { - // bFirst = false; - // } else { - // str += ",";//$NON-NLS-1$ - // } - // str += resolverType.getTextContent(); - // } - // } - // } - // } - // try { - // if (!str.equals("")) {//$NON-NLS-1$ - // project.setPersistentProperty(PERSIST_PROPERTY_KEY_VARIABLE_RESOLVERS, - // str); - // } else { - // project.setPersistentProperty(PERSIST_PROPERTY_KEY_VARIABLE_RESOLVERS, - // null); - // } - // } catch (final CoreException e) { - // e.printStackTrace(); - // } - // } - // - // public void notifyChanged(final Notification notification) { - // checkFacesConfigForVariableResolver(); - // } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/symbols/DataModelVariableTestFacade.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/symbols/DataModelVariableTestFacade.java deleted file mode 100644 index 7dc1801df..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/symbols/DataModelVariableTestFacade.java +++ /dev/null @@ -1,84 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.symbols; - -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jst.jsf.common.internal.types.ValueType; -import org.eclipse.jst.jsf.context.symbol.ERuntimeSource; -import org.eclipse.jst.jsf.context.symbol.ISymbol; -import org.eclipse.jst.jsf.designtime.symbols.AbstractDataModelVariableFactory; - -/** - * Used to expose protected final members of AbstractDataModelVariableFactory - * for testing purposes. May change without notice, should *never* be used in - * production code. - * - * @author cbateman - * - */ -public final class DataModelVariableTestFacade extends AbstractDataModelVariableFactory -{ - /** - * Test facade for createArraySymbol - * - * @param symbolName - * @param signature - * @param javaProject - * @return super.createArraySymbol() - */ - public final ISymbol testCreateArraySymbol(final String symbolName, final String signature, final IJavaProject javaProject) - { - return getSymbolFactory().createArraySymbol(symbolName, signature, ERuntimeSource.TAG_INSTANTIATED_SYMBOL_LITERAL, javaProject); - } - - /** - * Test facade for createFromList - * - * @param symbolName - * @param valueType - * @param javaProject - * @return super.createFromList() - */ - public final ISymbol testCreateFromList(String symbolName, ValueType valueType, IJavaProject javaProject) - { - return getSymbolFactory().createFromList(symbolName, valueType, ERuntimeSource.TAG_INSTANTIATED_SYMBOL_LITERAL, null, javaProject); - } - - /** - * @param symbolName - * @param signature - * @param javaProject - * @return a symbol assuming a scalar type wrapping - */ - public ISymbol testCreateScalarSymbol(String symbolName, String signature, IJavaProject javaProject) - { - return getSymbolFactory().createScalarSymbol(symbolName, signature, ERuntimeSource.TAG_INSTANTIATED_SYMBOL_LITERAL, javaProject); - } - - - /** - * @param symbolName - * @param valueType - * @param javaProject - * @return a symbol from a proxied call to super.createFromType - */ - public ISymbol testCreateFromType(String symbolName, ValueType valueType, - IJavaProject javaProject) { - return super.createFromType(symbolName, valueType, javaProject); - } - - @Override - protected final String getVariableSourceName() - { - return "testFacade -- SHOULD NOT BE USED IN PRODUCTION CODE"; //$NON-NLS-1$ - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/symbols/JSPTagVariableSymbolSourceProvider.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/symbols/JSPTagVariableSymbolSourceProvider.java deleted file mode 100644 index ca109f718..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/symbols/JSPTagVariableSymbolSourceProvider.java +++ /dev/null @@ -1,107 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.designtime.internal.symbols; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jst.jsf.context.symbol.ISymbol; -import org.eclipse.jst.jsf.context.symbol.source.AbstractSymbolSourceProviderFactory; -import org.eclipse.jst.jsf.context.symbol.source.ISymbolConstants; -import org.eclipse.jst.jsf.context.symbol.source.ISymbolSourceProvider; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.designtime.internal.jsp.JSPModelProcessor; -import org.eclipse.jst.jsf.designtime.symbols.FileContextUtil; -import org.eclipse.jst.jsf.designtime.symbols.SymbolUtil; - - -/** - * Self-factory for a symbol provider that derives symbol information from - * meta-data annotations on tag attributes that declare runtime EL variables - * - * @author cbateman - * - */ -public class JSPTagVariableSymbolSourceProvider extends - AbstractSymbolSourceProviderFactory implements ISymbolSourceProvider -{ - protected ISymbolSourceProvider create(IProject project) - { - return this; - } - - public ISymbol[] getSymbols(IAdaptable context, int symbolScopeMask) - { - final IFile fileContext = FileContextUtil.deriveIFileFromContext(context); - - if (isProvider(fileContext)) - { - JSPModelProcessor modelProcessor = null; - - try - { - modelProcessor = JSPModelProcessor.get(fileContext); - - // ensure internal model is sync'ed with document - // but don't force refresh - modelProcessor.refresh(false); - final List<ISymbol> symbols = new ArrayList(); - - if ((symbolScopeMask & ISymbolConstants.SYMBOL_SCOPE_REQUEST) != 0) - { - symbols.addAll(modelProcessor.getMapForScope(ISymbolConstants.SYMBOL_SCOPE_REQUEST_STRING).values()); - } - if ((symbolScopeMask & ISymbolConstants.SYMBOL_SCOPE_SESSION) != 0) - { - symbols.addAll(modelProcessor.getMapForScope(ISymbolConstants.SYMBOL_SCOPE_SESSION_STRING).values()); - } - if ((symbolScopeMask & ISymbolConstants.SYMBOL_SCOPE_APPLICATION) != 0) - { - symbols.addAll(modelProcessor.getMapForScope(ISymbolConstants.SYMBOL_SCOPE_APPLICATION_STRING).values()); - } - if ((symbolScopeMask & ISymbolConstants.SYMBOL_SCOPE_NONE) != 0) - { - symbols.addAll(modelProcessor.getMapForScope(ISymbolConstants.SYMBOL_SCOPE_NONE_STRING).values()); - } - - return symbols.toArray(ISymbol.EMPTY_SYMBOL_ARRAY); - } - catch (Exception e) - { - JSFCorePlugin.getDefault().getLog().log(new Status(IStatus.ERROR, JSFCorePlugin.PLUGIN_ID, 0, "Error acquiring model processor",e)); //$NON-NLS-1$ - // fall-through to empty symbol array - } - } - - return ISymbol.EMPTY_SYMBOL_ARRAY; - } - - public ISymbol[] getSymbols(String prefix, IAdaptable context, - int symbolScopeMask) { - return SymbolUtil. - filterSymbolsByPrefix(getSymbols(context, symbolScopeMask), prefix); - } - - public boolean isProvider(IAdaptable context) - { - IFile file = FileContextUtil.deriveIFileFromContext(context); - - return (file != null - && file.getProject() == this.getProject()); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/symbols/Messages.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/symbols/Messages.java deleted file mode 100644 index f55547720..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/symbols/Messages.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2007 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.designtime.internal.symbols; - -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -/** - * Message resource class - * - * @author cbateman - * - */ -/*package*/ final class Messages { - private static final String BUNDLE_NAME = "org.eclipse.jst.jsf.designtime.messages"; //$NON-NLS-1$ - - private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle - .getBundle(BUNDLE_NAME); - - private Messages() { - // no external instatiation - } - - /** - * @param key - * @return the message string for key or !key! if not found - */ - public static String getString(String key) { - try { - return RESOURCE_BUNDLE.getString(key); - } catch (MissingResourceException e) { - return '!' + key + '!'; - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/symbols/ResourceBundleMapSource.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/symbols/ResourceBundleMapSource.java deleted file mode 100644 index 4e7d66c4b..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/symbols/ResourceBundleMapSource.java +++ /dev/null @@ -1,246 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.symbols; - -import java.io.IOException; -import java.io.InputStream; -import java.util.AbstractMap; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import java.util.Properties; -import java.util.Set; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IStorage; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.QualifiedName; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jst.jsf.common.internal.resource.IResourceLifecycleListener; -import org.eclipse.jst.jsf.common.internal.resource.LifecycleListener; -import org.eclipse.jst.jsf.common.internal.resource.ResourceLifecycleEvent; -import org.eclipse.jst.jsf.common.internal.resource.ResourceLifecycleEvent.EventType; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.core.internal.tld.LoadBundleUtil; - -class ResourceBundleMapSource extends AbstractMap -{ - private static final String PROPERTY_QUALIFIER = - "org.eclipse.jst.jsf.designtime.internal.jsp"; //$NON-NLS-1$ - private static final String SESSION_PROPERTY_NAME_PROJECT = - "ResourceBundleMapSource"; //$NON-NLS-1$ - private static final QualifiedName SESSION_PROPERTY_KEY_PROJECT = - new QualifiedName(PROPERTY_QUALIFIER, SESSION_PROPERTY_NAME_PROJECT); - - private static IFile getCachedBundleFile(final IProject project, final String baseName) - { - if (project != null) - { - Map bundleFileCache = getBundleFileCache(project); - - if (bundleFileCache != null) - { - return (IFile) bundleFileCache.get(baseName); - } - } - - return null; - } - - private static Map getBundleFileCache(final IProject project) - { - synchronized(project) - { - Map bundleFileCache = null; - - try - { - bundleFileCache = - (Map) project.getSessionProperty(SESSION_PROPERTY_KEY_PROJECT); - - if (bundleFileCache == null) - { - bundleFileCache = new HashMap(); - LifecycleListener listener = new LifecycleListener(project); - listener.addListener(new IResourceLifecycleListener() - { - public EventResult acceptEvent(ResourceLifecycleEvent event) - { - EventResult result = EventResult.getDefaultEventResult(); - - if (event.getEventType() == EventType.RESOURCE_INACCESSIBLE) - { - try - { - Map bundleCache = - (Map) project.getSessionProperty(SESSION_PROPERTY_KEY_PROJECT); - bundleCache.clear(); - project.setSessionProperty(SESSION_PROPERTY_KEY_PROJECT, null); - } - catch (CoreException ce) - { - JSFCorePlugin.log("Error clearing bundle file cache", ce); //$NON-NLS-1$ - } - result = EventResult.getDisposeAfterEventResult(); - } - - return result; - } - } - ); - - project.setSessionProperty(SESSION_PROPERTY_KEY_PROJECT, bundleFileCache); - } - } - catch (CoreException ce) - { - JSFCorePlugin.log("Error creating bundle file cache", ce); //$NON-NLS-1$ - } - - return bundleFileCache; - } - } - - private static IFile createCachedBundleFile(final IProject project, - final String resourcePathStr) - throws IOException, CoreException - { - IStorage storage = - LoadBundleUtil.getLoadBundleResource(project, resourcePathStr); - - IFile bundleRes = null; - - if (storage != null - && storage.getAdapter(IFile.class) != null) - { - bundleRes = (IFile) storage.getAdapter(IFile.class); - getBundleFileCache(project).put(resourcePathStr, bundleRes); - return bundleRes; - } - - throw new IOException("Bundle "+resourcePathStr+" not found in classpath for project: "+project.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - private Properties _resourceBundle; // = null; set on first access or changes - private final IFile _bundleFile; // the resource - private final String _resourcePathStr; // the key used in the file cache - // as returned by IResource.getModificationStamp() - // the last time _resourceBundle was loaded - private long _lastModificationStamp; - - ResourceBundleMapSource(final IProject context, - final String resourcePathStr) - throws IOException, JavaModelException, CoreException - { - IFile cachedBundleFile = getCachedBundleFile(context, resourcePathStr); - - if (cachedBundleFile == null) - { - cachedBundleFile = createCachedBundleFile(context, resourcePathStr); - } - - _bundleFile = cachedBundleFile; - _resourcePathStr = resourcePathStr; - } - - private void checkAndRefreshBundle() - { - if (_bundleFile.isAccessible()) - { - if (_resourceBundle == null // doesn't exist yet - // exists but ws is out of sync - || !_bundleFile.isSynchronized(IResource.DEPTH_ZERO) - // exists but user has changed in workspace - || _bundleFile.getModificationStamp() - != _lastModificationStamp) - { - InputStream bundleStream = null; - try - { - // force refresh if out of sync - bundleStream = _bundleFile.getContents(true); - _resourceBundle = new Properties(); - _resourceBundle.load(bundleStream); - _lastModificationStamp = _bundleFile.getModificationStamp(); - } - catch (CoreException ce) - { - JSFCorePlugin.log("Error refreshing bundle", ce); //$NON-NLS-1$ - } - catch (IOException ioe) - { - JSFCorePlugin.log("Error refreshing bundle", ioe); //$NON-NLS-1$ - } - finally - { - if (bundleStream != null) - { - try - { - bundleStream.close(); - } - catch (IOException ioe) - { - JSFCorePlugin.log("Error closing bundle", ioe); //$NON-NLS-1$ - } - } - } - } - } - else - { - // bundle no longer exists so remove it - Map bundleFileCache = getBundleFileCache(_bundleFile.getProject()); - - if (bundleFileCache != null && - bundleFileCache.containsKey(_resourcePathStr)) - { - bundleFileCache.remove(_resourcePathStr); - } - // in either case, clear the bundle entry - if (_resourceBundle != null) - { - _resourceBundle.clear(); - _resourceBundle = null; - } - } - } - - public Set entrySet() - { - checkAndRefreshBundle(); - - if (_resourceBundle == null) - { - return Collections.EMPTY_SET; - } - return _resourceBundle.entrySet(); - } - - /** - * @see java.util.AbstractMap#get(java.lang.Object) - * @overrride to optimize for the fact that we are doing a hash get - */ - // - public Object get(Object key) - { - checkAndRefreshBundle(); - - if (_resourceBundle == null) - { - return null; - } - return _resourceBundle.get(key); - } -}
\ No newline at end of file diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/symbols/ResourceBundleMapSourceFactory.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/symbols/ResourceBundleMapSourceFactory.java deleted file mode 100644 index dc2209c6d..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/symbols/ResourceBundleMapSourceFactory.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.designtime.internal.symbols; - -import java.io.IOException; -import java.util.Map; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jdt.core.JavaModelException; - -/** - * Factory class for acquiring a ResourceBundleMapSourceFactory outside the local - * package. This is intended only for internal testing and related use and - * should not be used for normal feature development - * - * @author cbateman - * - */ -public class ResourceBundleMapSourceFactory -{ - /** - * @param project - * @param resourcePathStr - * @return a ResourceBundleMapSource - * @throws CoreException - * @throws IOException - * @throws JavaModelException - */ - public static Map getResourceBundleMapSource(final IProject project, - final String resourcePathStr) - throws JavaModelException, IOException, CoreException - { - return new ResourceBundleMapSource(project, resourcePathStr); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/symbols/ResourceBundleSymbolSourceProvider.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/symbols/ResourceBundleSymbolSourceProvider.java deleted file mode 100644 index b96b8a89a..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/symbols/ResourceBundleSymbolSourceProvider.java +++ /dev/null @@ -1,159 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.symbols; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jst.jsf.context.symbol.IComponentSymbol; -import org.eclipse.jst.jsf.context.symbol.IMapTypeDescriptor; -import org.eclipse.jst.jsf.context.symbol.ISymbol; -import org.eclipse.jst.jsf.context.symbol.SymbolFactory; -import org.eclipse.jst.jsf.context.symbol.source.AbstractSymbolSourceProviderFactory; -import org.eclipse.jst.jsf.context.symbol.source.ISymbolSourceProvider; -import org.eclipse.jst.jsf.core.IJSFCoreConstants; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.core.jsfappconfig.JSFAppConfigManager; -import org.eclipse.jst.jsf.core.jsfappconfig.JSFAppConfigUtils; -import org.eclipse.jst.jsf.designtime.symbols.FileContextUtil; -import org.eclipse.jst.jsf.designtime.symbols.SymbolUtil; -import org.eclipse.jst.jsf.facesconfig.emf.BaseNameType; -import org.eclipse.jst.jsf.facesconfig.emf.ResourceBundleType; -import org.eclipse.jst.jsf.facesconfig.emf.VarType; - -/** - * WARNING: this is an interim solution to supporting Faces 1.2 resource - * bundle variables. This class will become obsolete by design once - * the dt framework for Unified EL symbol resolution is added - * - * DO NOT USE THIS CLASS EXTERNALLY, IT WILL BE REMOVED WITHOUT WARNING IN THE FUTURE - * WITH NO MIGRATION PATH - * - * Self-factory for symbol source providers that contribute symbols for - * the resource bundle variables declared in Faces 1.2 and greater - * app configuration files. - * - * @author cbateman - * - */ -public final class ResourceBundleSymbolSourceProvider extends - AbstractSymbolSourceProviderFactory implements ISymbolSourceProvider { - - protected final ISymbolSourceProvider create(IProject project) { - return this; - } - - public final ISymbol[] getSymbols(IAdaptable context, int symbolScopeMask) - { - if (isProvider(context)) - { - final List symbols = new ArrayList(); - final IFile fileContext = FileContextUtil.deriveIFileFromContext(context); - final IProject project = fileContext.getProject(); - - final JSFAppConfigManager appconfigMgr = JSFAppConfigManager.getInstance(project); - final List resourceBundles = appconfigMgr.getResourceBundles(); - - for (final Iterator it = resourceBundles.iterator(); it.hasNext();) - { - ResourceBundleType resBundle = (ResourceBundleType) it.next(); - final String basename = getBaseName(resBundle); - final String name = getVarName(resBundle); - - if (basename != null && name != null) - { - try - { - symbols.add(createSymbolForResourceBundle(project, name, basename)); - } catch (JavaModelException e) { - JSFCorePlugin.log(e, "Error creating base name for: "+basename); //$NON-NLS-1$ - } catch (IOException e) { - JSFCorePlugin.log(e, "Error creating base name for: "+basename); //$NON-NLS-1$ - } catch (CoreException e) { - JSFCorePlugin.log(e, "Error creating base name for: "+basename); //$NON-NLS-1$ - } - } - } - return (ISymbol[]) symbols.toArray(ISymbol.EMPTY_SYMBOL_ARRAY); - } - return ISymbol.EMPTY_SYMBOL_ARRAY; - } - - private ISymbol createSymbolForResourceBundle(IProject project, - final String name, - final String basename) throws JavaModelException, IOException, CoreException - { - // TODO: push down into ResourceBundleMapSourceFactory and share - // with loadBundle - final Map mapSource = ResourceBundleMapSourceFactory - .getResourceBundleMapSource(project, basename); - final IMapTypeDescriptor typeDesc = - SymbolFactory.eINSTANCE.createIMapTypeDescriptor(); - typeDesc.setMapSource(mapSource); - final IComponentSymbol symbol = - SymbolFactory.eINSTANCE.createIComponentSymbol(); - symbol.setName(name); - symbol.setTypeDescriptor(typeDesc); - symbol.setDetailedDescription(Messages.getString("ResourceBundleSymbolSourceProvider.DetailedDescription")+basename+"</i>"); //$NON-NLS-1$//$NON-NLS-2$ - return symbol; - } - - private String getBaseName(ResourceBundleType resBundle) - { - final BaseNameType baseNameType = resBundle.getBaseName(); - if (baseNameType != null) - { - return baseNameType.getTextContent(); - } - return null; - } - - private String getVarName(ResourceBundleType resBundle) - { - final VarType varName = resBundle.getVar(); - if (varName != null) - { - return varName.getTextContent(); - } - return null; - } - - public final ISymbol[] getSymbols(String prefix, IAdaptable context, - int symbolScopeMask) { - return SymbolUtil. - filterSymbolsByPrefix(getSymbols(context, symbolScopeMask), prefix); - } - - public final boolean isProvider(IAdaptable context) { - IFile file = FileContextUtil.deriveIFileFromContext(context); - - if (file != null) - { - final IProject project = file.getProject(); - - if (project != null && project.isAccessible()) - { - // to be valid, the jsf project must be at least version 1.2 - return JSFAppConfigUtils.isValidJSFProject(project, IJSFCoreConstants.FACET_VERSION_1_2); - } - } - - return false; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/symbols/StaticJavaTypeSymbolFactory.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/symbols/StaticJavaTypeSymbolFactory.java deleted file mode 100644 index 14d1c9369..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/symbols/StaticJavaTypeSymbolFactory.java +++ /dev/null @@ -1,93 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.designtime.internal.symbols; - -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext; -import org.eclipse.jst.jsf.context.symbol.IJavaTypeDescriptor2; -import org.eclipse.jst.jsf.context.symbol.ISymbol; -import org.eclipse.jst.jsf.context.symbol.source.AbstractContextSymbolFactory; -import org.eclipse.jst.jsf.context.symbol.source.IAdditionalContextSymbolInfo; -import org.eclipse.jst.jsf.designtime.symbols.FileContextUtil; -import org.eclipse.jst.jsf.designtime.symbols.JSFSymbolFactory; - -/** - * Creates symbols using a simple type. - * - * @author cbateman - * - */ -public class StaticJavaTypeSymbolFactory extends AbstractContextSymbolFactory -{ - private final JSFSymbolFactory _factory = new JSFSymbolFactory(); - - @Override - protected ISymbol internalCreate(String symbolName, int scope, - IAdaptable context, List problems, - IAdditionalContextSymbolInfo additionalInfo) - { - if (additionalInfo != null) - { - final String signature = additionalInfo.getSymbolTypeSignature(); - if (signature != null) - { - final IJavaTypeDescriptor2 descriptor = _factory - .createTypeDescriptorFromSignature(signature, - getJavaProject(context)); - return _factory.createJavaComponentSymbol(symbolName, descriptor, null); - } - } - - // can't create - return null; - } - - @Override - protected ISymbol internalCreate(String symbolName, int scope, - IAdaptable context, List problems) - { - // need additionInfo to create the symbol - return null; - } - - @Override - public boolean supports(IAdaptable context) - { - return getJavaProject(context) != null; - } - - private IJavaProject getJavaProject(final IAdaptable context) - { - if (context != null) - { - final IStructuredDocumentContext sContext = (IStructuredDocumentContext) context - .getAdapter(IStructuredDocumentContext.class); - if (sContext != null) - { - final IProject project = FileContextUtil - .getProject((IStructuredDocumentContext) context - .getAdapter(IStructuredDocumentContext.class)); - if (project != null) - { - return JavaCore.create(project); - } - } - } - return null; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/symbols/ValueExpressionSymbolFactory.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/symbols/ValueExpressionSymbolFactory.java deleted file mode 100644 index 724fd9484..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/symbols/ValueExpressionSymbolFactory.java +++ /dev/null @@ -1,169 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.designtime.internal.symbols; - -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jst.jsf.common.internal.types.ValueType; -import org.eclipse.jst.jsf.context.resolver.structureddocument.IDOMContextResolver; -import org.eclipse.jst.jsf.context.resolver.structureddocument.IStructuredDocumentContextResolverFactory; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContextFactory; -import org.eclipse.jst.jsf.context.symbol.ISymbol; -import org.eclipse.jst.jsf.context.symbol.source.AbstractContextSymbolFactory; -import org.eclipse.jst.jsf.context.symbol.source.IAdditionalContextSymbolInfo; -import org.eclipse.jst.jsf.designtime.symbols.FileContextUtil; -import org.eclipse.jst.jsf.designtime.symbols.JSFSymbolFactory; -import org.eclipse.jst.jsf.validation.internal.appconfig.AppConfigValidationUtil; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement; -import org.w3c.dom.Attr; -import org.w3c.dom.Element; -import org.w3c.dom.Node; - -/** - * - * @author cbateman - * - */ -public class ValueExpressionSymbolFactory extends AbstractContextSymbolFactory -{ - private final JSFSymbolFactory _factory = new JSFSymbolFactory(); - - @Override - protected ISymbol internalCreate(final String symbolName, final int scope, - final IAdaptable context, final List problems, - final IAdditionalContextSymbolInfo additionalInfo) - { - final Node node = getNode(context); - final IStructuredDocumentContext sContext = getContext(context); - - final String valueAttrName = additionalInfo - .getValueExpressionAttributeName(); - if (node != null && valueAttrName != null) - { - Element element = null; - - if (node instanceof Element) - { - element = (Element) node; - } - else - { - element = ((Attr) node).getOwnerElement(); - } - - return createSymbol(symbolName, sContext, valueAttrName, element); - } - - return null; - } - - - private ISymbol createSymbol(final String name, - final IStructuredDocumentContext sContext, - final String valueAttrName, Element element) - { - if (element instanceof IDOMElement) // implicit null check. - { - final Attr attr = element.getAttributeNode(valueAttrName); - - if (attr instanceof IDOMAttr && attr.getValue() != null) - { - // TODO: the extract expression method belongs in more - // generic code - final String elText = AppConfigValidationUtil - .extractELExpression(attr.getValue()).getElText(); - final IFile file = FileContextUtil - .deriveIFileFromContext(sContext); - final IStructuredDocumentContext elContext = IStructuredDocumentContextFactory.INSTANCE - .getContext(sContext.getStructuredDocument(), attr); - if (elText != null && file != null && elContext != null) - { - final ValueType valueExpr = _factory - .getValueTypeFromEL(elText, elContext, file); - if (valueExpr != null) - { - final IJavaProject javaProject = getJavaProject(sContext); - return _factory.createJavaComponentSymbol(name, valueExpr, null, javaProject); - } - } - } - } - return null; - } - - - @Override - protected ISymbol internalCreate(final String symbolName, final int scope, - final IAdaptable context, final List problems) - { - // need additionalInfo - return null; - } - - @Override - public boolean supports(final IAdaptable context) - { - final Node node = getNode(context); - final IJavaProject javaProject = getJavaProject(context); - return javaProject != null && (node instanceof Element) || (node instanceof Attr); - } - - private Node getNode(final IAdaptable context) - { - final IStructuredDocumentContext sContext = getContext(context); - if (sContext != null) - { - final IDOMContextResolver domResolver = IStructuredDocumentContextResolverFactory.INSTANCE - .getDOMContextResolver(sContext); - if (domResolver != null) - { - return domResolver.getNode(); - } - } - return null; - } - - private IJavaProject getJavaProject(final IAdaptable context) - { - final IStructuredDocumentContext sContext = getContext(context); - - if (sContext != null) - { - final IProject project = FileContextUtil - .getProject((IStructuredDocumentContext) sContext - .getAdapter(IStructuredDocumentContext.class)); - if (project != null) - { - return JavaCore.create(project); - } - } - return null; - } - - private IStructuredDocumentContext getContext(final IAdaptable context) - { - if (context != null) - { - return (IStructuredDocumentContext) context - .getAdapter(IStructuredDocumentContext.class); - } - return null; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/AbstractDTViewHandler.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/AbstractDTViewHandler.java deleted file mode 100644 index e40b3c403..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/AbstractDTViewHandler.java +++ /dev/null @@ -1,319 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view; - -import java.util.concurrent.atomic.AtomicBoolean; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IPath; -import org.eclipse.jst.jsf.common.internal.resource.ImmutableLifecycleListener; -import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentTypeInfo; -import org.eclipse.jst.jsf.designtime.context.DTFacesContext; -import org.eclipse.jst.jsf.designtime.internal.view.DTUIViewRoot.StalenessAdvisor; -import org.eclipse.jst.jsf.designtime.internal.view.DTUIViewRoot.StalenessListener; -import org.eclipse.jst.jsf.designtime.internal.view.DTUIViewRoot.VersionStamp; -import org.eclipse.jst.jsf.designtime.internal.view.IDTViewHandler.ViewHandlerException.Cause; -import org.eclipse.wst.common.componentcore.ComponentCore; - -/** - * All IDTViewHandler's must sub-class this abstract class. - * - * @author cbateman - * - */ -public abstract class AbstractDTViewHandler implements IDTViewHandler -{ - private final AtomicBoolean _isDisposed = new AtomicBoolean(false); - - /** - * the path separator - */ - public static final String PATH_SEPARATOR = "/"; - - public abstract String calculateLocale(DTFacesContext context) - throws ViewHandlerException; - - public final DTUIViewRoot createView(final DTFacesContext facesContext, - final String viewId) throws ViewHandlerException - { - if (_isDisposed.get()) - { - throw new IllegalStateException("View handler is disposed"); - } - - final DTUIViewRoot viewRoot = internalCreateView(facesContext, viewId); - - if (viewRoot == null) - { - throw new ViewHandlerException("Problem in createView", Cause.UNABLE_TO_CREATE_VIEW); - } - viewRoot.setViewId(viewId); - final VersionStamp versionStamp = createVersionStamp(facesContext, - viewId); - if (versionStamp == null) - { - throw new ViewHandlerException(new Throwable( - "Bad version stamp detected"), Cause.BAD_VERSION_STAMP); - } - viewRoot.setVersionStamp(versionStamp); - - final StalenessAdvisor advisor = createStalenessAdvisor(viewRoot, - facesContext, viewId); - - if (advisor == null) - { - throw new ViewHandlerException(new Throwable( - "Bad staleness advisor"), Cause.BAD_STALENESS_ADVISOR); - } - viewRoot.setStalenessAdvisor(advisor); - - // lock down the tree - viewRoot.setSubtreeProtected(); - - registerView(viewRoot, facesContext, viewId); - - return viewRoot; - } - - /** - * @param facesContext - * @param viewId - * @return internal construction of the view root. - */ - protected abstract DTUIViewRoot internalCreateView( - final DTFacesContext facesContext, final String viewId); - - public abstract IResource getActionDefinition(DTFacesContext context, - String viewId) throws ViewHandlerException; - - public abstract IPath getActionURL(DTFacesContext context, - IResource resource, IPath requestPath) throws ViewHandlerException; - - public abstract IPath getRelativeActionPath(DTFacesContext context, - String relativeToViewId, String uri) throws ViewHandlerException; - - public abstract IViewDefnAdapterFactory getViewMetadataAdapterFactory( - DTFacesContext context) throws ViewHandlerException; - - public abstract boolean supportsViewDefinition(IFile file); - - - public abstract void setLifecycleListener(ImmutableLifecycleListener listener); - - public final void dispose() - { - if (_isDisposed.compareAndSet(false, true)) - { - doDispose(); - } - } - - /** - * Sub-classes should override to add disposal tasks - */ - protected void doDispose() - { - // do nothing by default - } - - /** - * IMPORTANT: this method must not return null. All view creation will fail - * for this handler when createVersionStamp() returns null. create() will - * throw ViewHandlerException. - * - * @param facesContext - * @param viewId - * @return a new version stamp for the facesContext/viewId. The version - * stamp needs to be unique for all instances of viewId only, not - * all instances of component trees everywhere in the system. - */ - protected abstract VersionStamp createVersionStamp( - final DTFacesContext facesContext, final String viewId); - - /** - * IMPORTANT: this method must not return null. All view creation will fail - * for this handler when createStalenessAdvisor returns null. - * - * @param viewRoot - * @param facesContext - * @param viewId - * @return a new staleness advisor. - */ - protected abstract StalenessAdvisor createStalenessAdvisor( - final DTUIViewRoot viewRoot, DTFacesContext facesContext, - String viewId); - - /** - * Called by createView immediately before returning. Provides sub-class - * a chance to register a fully initialized view root with any stateful - * activities such as automatic change tracking and caching. - * - * @param viewRoot - * @param context - * @param viewId - */ - protected void registerView(DTUIViewRoot viewRoot, final DTFacesContext context, final String viewId) - { - // do nothing by default - } - - public String getViewId(final DTFacesContext context, final IResource res) - { - // TODO: sync with WebrootUtil? - String strWebrootPath = ""; - final IProject project = res.getProject(); - final IPath path = res.getFullPath(); - final IPath webContentPath = getWebContentPath(project); - if (webContentPath != null && webContentPath.isPrefixOf(path)) - { - final int start = path.matchingFirstSegments(webContentPath); - final String[] segments = path.segments(); - for (int i = start, n = path.segmentCount(); i < n; i++) - { - strWebrootPath = strWebrootPath + PATH_SEPARATOR + segments[i]; - } - } - return strWebrootPath; - } - - private IPath getWebContentPath(final IProject project) - { - if (project != null) - { - return ComponentCore.createComponent(project).getRootFolder() - .getUnderlyingFolder().getFullPath(); - } - return null; - } - - /** - * A default DTUIViewRoot that represents an uncreatable or uninitializable - * view root. - * - */ - protected static final class NullViewRoot extends DTUIViewRoot - { - /** - * - */ - private static final long serialVersionUID = 1187035338610719171L; - - /** - */ - protected NullViewRoot() - { - super(null, null, new ComponentTypeInfo("", "", "","")); - } - - @Override - public IAdaptable getServices() - { - return new IAdaptable() - { - public Object getAdapter(Class adapter) - { - // no services - return null; - } - }; - } - - } - - /** - * Provides a simple time-based stamp that makes almost impossible to create - * the same timestamp twice. To do so, two threads would need to get the - * same system simulataneously and get same number back from the same - * gaussian distribution. - * - * @author cbateman - * - */ - protected static class TimeBasedVersionStamp extends VersionStamp - { - /** - * - */ - private static final long serialVersionUID = 5557828245936568977L; - private final long timestamp; - private final long randomStamp; - - /** - * - */ - public TimeBasedVersionStamp() - { - super(); - // use the millisecond time, since it is offset from a known - // point on all platform, whereas no guarantee is made about - // the nano time value. - this.timestamp = System.currentTimeMillis(); - // this protects against two threads constructing two time - // stamp objects "simulataneously" and having the same time based - // stamp. Math.random is thread-safe. - this.randomStamp = (long) (Long.MAX_VALUE * Math.random()); - } - - @Override - public int hashCode() - { - return (int) (timestamp ^ randomStamp); - } - - @Override - protected boolean isEqual(final VersionStamp other) - { - return other instanceof TimeBasedVersionStamp - && (timestamp == ((TimeBasedVersionStamp) other).timestamp) - && (randomStamp == ((TimeBasedVersionStamp) other).randomStamp); - } - } - - /** - * Returns a default staleness advisor that always returns false. - * - * @author cbateman - * - */ - protected static final class NullStalenessAdvisor extends StalenessAdvisor - { - /** - * - */ - private static final long serialVersionUID = 5946420948320047613L; - - @Override - public boolean isStale() - { - return false; - } - - @Override - public void addListener(final StalenessListener listener) - { - // do nothing - } - - @Override - public void removeListener(final StalenessListener listener) - { - // do nothing - } - - public boolean isAccessible() - { - return true; - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/AbstractViewDefnAdapter.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/AbstractViewDefnAdapter.java deleted file mode 100644 index a7e620d15..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/AbstractViewDefnAdapter.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view; - -import java.util.List; - -import org.eclipse.jst.jsf.common.runtime.internal.model.ViewObject; -import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentInfo; -import org.eclipse.jst.jsf.common.runtime.internal.model.datatypes.ELExpression; -import org.eclipse.jst.jsf.context.IModelContext; -import org.eclipse.jst.jsf.designtime.context.DTFacesContext; -import org.eclipse.jst.jsf.designtime.internal.view.IDTViewHandler.ViewHandlerException; - -/** - * All view definition adapters must sub-class this abstract class. - * - * @author cbateman - * @param <VIEW_DEFN_BASE_TYPE> - * @param <VIEW_CONTAINER_TYPE> - * - */ -public abstract class AbstractViewDefnAdapter<VIEW_DEFN_BASE_TYPE, VIEW_CONTAINER_TYPE> - implements IViewDefnAdapter<VIEW_DEFN_BASE_TYPE, VIEW_CONTAINER_TYPE> -{ - public abstract ViewObject mapToViewObject( - VIEW_DEFN_BASE_TYPE viewDefnObject, - ViewObjectConstructionStrategy<? extends VIEW_DEFN_BASE_TYPE> constructionData, - VIEW_CONTAINER_TYPE viewContainer); - - public abstract String getId(VIEW_DEFN_BASE_TYPE viewDefnObject) - throws IllegalArgumentException; - - public abstract VIEW_CONTAINER_TYPE getContainer(DTFacesContext context, - String viewId); - - public abstract List<VIEW_DEFN_BASE_TYPE> getViewDefnRoots( - VIEW_CONTAINER_TYPE container); - - public abstract ELExpression getELExpression(final IModelContext context) - throws ViewHandlerException; - - public abstract ViewObject findViewObject(VIEW_DEFN_BASE_TYPE viewDefnObject, - ComponentInfo root); - - public abstract VIEW_DEFN_BASE_TYPE findViewDefn(ViewObject viewObject, - ComponentInfo root); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/AbstractViewDefnAdapterFactory.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/AbstractViewDefnAdapterFactory.java deleted file mode 100644 index 5c5fdf230..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/AbstractViewDefnAdapterFactory.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.content.IContentType; -import org.eclipse.core.runtime.content.IContentTypeManager; -import org.eclipse.jst.jsf.core.internal.CompositeTagRegistryFactory; -import org.eclipse.jst.jsf.core.internal.CompositeTagRegistryFactory.TagRegistryIdentifier; -import org.eclipse.jst.jsf.designtime.context.DTFacesContext; -import org.eclipse.jst.jsf.designtime.internal.view.model.ITagRegistry; - -/** - * Factories that create view definition adapters must extend this - * class. - * - * @author cbateman - * - */ -public abstract class AbstractViewDefnAdapterFactory implements IViewDefnAdapterFactory -{ - /** - * @param context - * @param viewId - * @return a view adapter for the viewid or null if this factory - * cannot produce an adapter for the underlying view definition. - */ - public abstract IViewDefnAdapter createAdapter(DTFacesContext context, String viewId); - - /** - * TODO: since this implicitly, XML-specific, perhaps this belongs - * in a util class - * Sub-classes may use to locate a tag registry for their view adapter - * @param file - * @return a tag registry for the file (based on class path and - * content type) or null if none. - */ - protected final ITagRegistry findTagRegistry(final IFile file) - { - final IContentTypeManager typeManager = Platform.getContentTypeManager(); - final IContentType contentType = - typeManager.findContentTypeFor(file.getName()); - ITagRegistry tagRegistry = null; - if (contentType != null) - { - final TagRegistryIdentifier id = - new TagRegistryIdentifier(file.getProject(), contentType); - tagRegistry = CompositeTagRegistryFactory.getInstance().getRegistry(id); - } - return tagRegistry; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/ComponentConstructionData.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/ComponentConstructionData.java deleted file mode 100644 index 914f7efbf..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/ComponentConstructionData.java +++ /dev/null @@ -1,102 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jface.text.IDocument; -import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentInfo; - -/** - * Encapsulates information required to construct a component - * - * @author cbateman - * - */ -public class ComponentConstructionData -{ - private ComponentInfo _parent; - private int _idCounter; - private final IProject _project; - private final IDocument _document; - /** - * @param idCounter - * @param parent - * @param project - * @param document - */ - public ComponentConstructionData(final int idCounter, - final ComponentInfo parent, final IProject project, final IDocument document) - { - _parent = parent; - _idCounter = idCounter; - _project = project; - _document = document; - } - - /** - * @return the parent id - */ - public final ComponentInfo getParent() - { - return _parent; - } - - /** - * @return the id counter - */ - public final int getIdCounter() - { - return _idCounter; - } - - /** - * Increment the counter by 1 and return the old value - * - * @return the old value - */ - public final int increment() - { - return _idCounter++; - } - - /** - * @param parent - */ - public final void setParent(final ComponentInfo parent) - { - _parent = parent; - } - - /** - * @param idCounter - */ - public final void setIdCounter(final int idCounter) - { - _idCounter = idCounter; - } - - /** - * @return the project that this component construction is associated with - */ - public final IProject getProject() - { - return _project; - } - - /** - * @return the document context for the construction - */ - public final IDocument getDocument() - { - return _document; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/ComponentTreeConstructionStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/ComponentTreeConstructionStrategy.java deleted file mode 100644 index 53763daa6..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/ComponentTreeConstructionStrategy.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view; - -import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentInfo; -import org.eclipse.jst.jsf.designtime.context.DTFacesContext; - -/** - * @author cbateman - * - * @param <VIEW_DEFN_BASE_TYPE> - * @param <VIEW_CONTAINER_TYPE> - */ -public abstract class ComponentTreeConstructionStrategy<VIEW_DEFN_BASE_TYPE, VIEW_CONTAINER_TYPE> -{ - /** - * @param context - * @param viewRoot - * @return a component tree rooted - * XXX: need to accommodate different cases of fragments, invalid multiple roots - * etc, perhaps with special surrogate root type - */ - public abstract ComponentInfo createComponentTree(DTFacesContext context, DTUIViewRoot viewRoot); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/DTComponentIntrospector.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/DTComponentIntrospector.java deleted file mode 100644 index 8819c6e3c..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/DTComponentIntrospector.java +++ /dev/null @@ -1,403 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jem.internal.proxy.core.IBeanTypeProxy; -import org.eclipse.jem.internal.proxy.core.IConfigurationContributor; -import org.eclipse.jem.internal.proxy.core.IStandardBeanTypeProxyFactory; -import org.eclipse.jem.internal.proxy.core.ProxyFactoryRegistry; -import org.eclipse.jem.internal.proxy.ide.IDERegistration; -import org.eclipse.jst.jsf.common.internal.types.TypeInfoCache; -import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentTypeInfo; -import org.eclipse.jst.jsf.common.runtime.internal.model.decorator.ConverterTypeInfo; -import org.eclipse.jst.jsf.common.runtime.internal.model.decorator.ValidatorTypeInfo; -import org.eclipse.jst.jsf.common.util.JDTBeanIntrospector; -import org.eclipse.jst.jsf.common.util.JDTBeanProperty; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.core.internal.JSFCoreTraceOptions; -import org.eclipse.jst.jsf.core.internal.jem.BeanProxyUtil.BeanProxyWrapper; -import org.eclipse.jst.jsf.core.internal.jem.BeanProxyUtil.ProxyException; -import org.eclipse.jst.jsf.core.jsfappconfig.JSFAppConfigManager; -import org.eclipse.jst.jsf.facesconfig.emf.ComponentType; -import org.eclipse.jst.jsf.facesconfig.emf.ConverterType; -import org.eclipse.jst.jsf.facesconfig.emf.ValidatorType; - -/** - * Utility class for finding and bean introspecting component and related - * classes. - * - * @author cbateman - * - */ -public final class DTComponentIntrospector -{ - /** - * A shared type cache for doing tag class introspection. The cache stores - * type hierarchies and updates them on detected changes to reduce the - * overhead of doing such lookups - */ - private static TypeInfoCache TYPE_CACHE; // lazily created, don't access - - // directly - - /** - * @return the type cache used by all DTComponentIntrospector internally. - */ - public static TypeInfoCache getSharedTypeCache() - { - if (TYPE_CACHE == null) - { - TYPE_CACHE = TypeInfoCache.createNewInstance(); - } - return TYPE_CACHE; - } - - /** - * @param classType - * @param className - * @param project - * @param contributors may be null - * @return the component type info for the class type or null if none. Adds - * contributors to the class path - */ - public static ComponentTypeInfo getComponent(final String classType, - final String className, final IProject project, - final IConfigurationContributor[] contributors) - { - ProxyFactoryRegistry registry = null; - try - { - registry = getProxyFactoryRegistry(project, - contributors); - - if (registry != null) - { - final IStandardBeanTypeProxyFactory factory = registry - .getBeanTypeProxyFactory(); - final IBeanTypeProxy classTypeProxy = factory - .getBeanTypeProxy(className); - final BeanProxyWrapper classTypeWrapper = new BeanProxyWrapper(project, - classTypeProxy); - - String family = null; - String renderer = null; - try - { - classTypeWrapper.init(); - family = classTypeWrapper.callStringMethod("getFamily"); - renderer = classTypeWrapper.callStringMethod("getRendererType"); - } - catch (ProxyException e1) - { - // fall through - if (JSFCoreTraceOptions.TRACE_JSPTAGINTROSPECTOR) - { - JSFCoreTraceOptions.log("DTComponentIntrospector.getComponent:", e1); - } - } - - IType type = null; - - try - { - type = JavaCore.create(project).findType(className); - } - catch (JavaModelException e) - { - // fall through; - } - - List<String> interfaces = new ArrayList<String>(); - List<String> superClasses = new ArrayList<String>(); - - if (type != null) - { - TypeInfoCache typeCache = getSharedTypeCache(); - - IType[] interfaceTypes = typeCache.cacheInterfaceTypesFor(type); - for (IType interfaze : interfaceTypes) - { - interfaces.add(interfaze.getFullyQualifiedName()); - } - - IType[] superClassTypes = typeCache.cacheSupertypesFor(type); - - for (IType superClass : superClassTypes) - { - superClasses.add(superClass.getFullyQualifiedName()); - } - } - - return new ComponentTypeInfo(classType, className, superClasses - .toArray(new String[0]), interfaces.toArray(new String[0]), - family, renderer); - } - } - finally - { - if (registry != null) - { - registry.terminateRegistry(true); - } - } - return null; - } - - /** - * @param classType - * @param className - * @param project - * @return the component type info with no additional classpath - * contributions. May return null; - */ - public static ComponentTypeInfo getComponent(final String classType, - final String className, final IProject project) - { - return getComponent(classType, className, project, null); - } - - /** - * @param converterId - * @param converterClass - * @return a new converter type info for the converter id. - */ - public static ConverterTypeInfo getConverter(final String converterId, - final String converterClass) - { - return new ConverterTypeInfo(converterClass, converterId); - } - - /** - * @param validatorId - * @param validatorClass - * @return a new validator type info for the validator id - */ - public static ValidatorTypeInfo getValidator(final String validatorId, - final String validatorClass) - { - return new ValidatorTypeInfo(validatorClass, validatorId); - } - - /** - * @param componentType - * @param project - * @return the configured class name for the JSF component type id or null - * if not found. - */ - public static String findComponentClass(final String componentType, - final IProject project) - { - final JSFAppConfigManager manager = JSFAppConfigManager - .getInstance(project); - final List components = manager.getComponents(); - - for (final Iterator it = components.iterator(); it.hasNext();) - { - final ComponentType component = (ComponentType) it.next(); - final String type = component.getComponentType().getTextContent() - .trim(); - - if (componentType.equals(type)) - { - return component.getComponentClass().getTextContent().trim(); - } - } - return null; - } - - /** - * @param converterId - * @param project - * @return a fully qualified class name corresponding to converterId or null - * if none. - */ - public static String findConverterClass(final String converterId, - final IProject project) - { - final JSFAppConfigManager manager = JSFAppConfigManager - .getInstance(project); - final List converters = manager.getConverters(); - - for (final Iterator it = converters.iterator(); it.hasNext();) - { - final ConverterType converter = (ConverterType) it.next(); - - if (converter != null && converter.getConverterId() != null - && converter.getConverterId().getTextContent() != null) - { - final String type = converter.getConverterId().getTextContent() - .trim(); - - if (converterId.equals(type)) - { - if (converter.getConverterClass() != null && converter.getConverterClass().getTextContent()!=null) - { - return converter.getConverterClass().getTextContent() - .trim(); - } - return null; - } - } - } - return null; - } - - /** - * @param validatorId - * @param project - * @return a fully qualified class name corresponding to the validatorId or - * null if none. - */ - public static String findValidatorClass(final String validatorId, - final IProject project) - { - final JSFAppConfigManager manager = JSFAppConfigManager - .getInstance(project); - final List converters = manager.getValidators(); - - for (final Iterator it = converters.iterator(); it.hasNext();) - { - final ValidatorType validatorType = (ValidatorType) it.next(); - - if (validatorType != null && validatorType.getValidatorId() != null && - validatorType.getValidatorId().getTextContent() != null) - { - final String type = validatorType.getValidatorId().getTextContent() - .trim(); - - if (validatorId.equals(type)) - { - return validatorType.getValidatorClass().getTextContent() - .trim(); - } - } - } - return null; - } - - /** - * @param type - * @param checkInstanceOf - * @return true if type resolves to a type that is an instance of one of the - * types in checkInstanceOf. - */ - public static boolean isTypeNameInstanceOfClass(final IType type, - final Set<String> checkInstanceOf) - { - if (type != null) - { - // first and foremost, are these exactly droids you're - // looking for and not just their predecessors? - if (checkInstanceOf.contains(type.getFullyQualifiedName())) - { - return true; - } - - for (final IType supertype : getSharedTypeCache() - .cacheSupertypesFor(type)) - { - if (checkInstanceOf.contains(supertype.getFullyQualifiedName())) - { - return true; - } - } - - for (final IType interfaces : getSharedTypeCache() - .cacheInterfaceTypesFor(type)) - { - if (checkInstanceOf - .contains(interfaces.getFullyQualifiedName())) - { - return true; - } - } - } - - return false; - } - - /** - * @param typeInfo - * @param project - * @return a list of all bean properties (using the POJO method) on - * typeInfo. List may be empty, never null. - */ - public static Map<String, JDTBeanProperty> getBeanProperties( - final ComponentTypeInfo typeInfo, final IProject project) - { - Map<String, JDTBeanProperty> properties = new HashMap<String, JDTBeanProperty>(); - - IJavaProject javaProject = JavaCore.create(project); - try - { - IType type = javaProject.findType(typeInfo.getClassName()); - - if (type != null) - { - // TODO: should be able to use type cache for this - final JDTBeanIntrospector introspector = new JDTBeanIntrospector( - type); - properties = introspector.getProperties(); - } - } - catch (JavaModelException e) - { - JSFCorePlugin.log("Error finding component type", e); - } - - return properties; - } - - /** - * @param project - * @return a new proxy factory registry or null; - * - * TODO: caching? - */ - private static ProxyFactoryRegistry getProxyFactoryRegistry( - final IProject project, final IConfigurationContributor[] contributors) - { - try - { - return IDERegistration.startAnImplementation(contributors, false, project, - project.getName(), JSFCorePlugin.PLUGIN_ID, - new NullProgressMonitor()); - } - catch (final CoreException e) - { - JSFCorePlugin.log("Error starting vm for project: " - + project.getName(), e); - } - - return null; - } - - private DTComponentIntrospector() - { - // no external instantiation - } - - // private static class -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/DTUIViewRoot.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/DTUIViewRoot.java deleted file mode 100644 index f14121ecb..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/DTUIViewRoot.java +++ /dev/null @@ -1,315 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view; - -import java.io.Serializable; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentInfo; -import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentTypeInfo; - -/** - * The interface for all design view root objects. - * - */ -public abstract class DTUIViewRoot extends ComponentInfo -{ - private StalenessAdvisor _stalenessAdvisor; - - private String _viewId; - private VersionStamp _versionStamp; - - /** - * - */ - private static final long serialVersionUID = -6375907116774572269L; - - /** - * @param id - * @param parent - * @param componentTypeInfo - */ - protected DTUIViewRoot(final String id, final ComponentInfo parent, - final ComponentTypeInfo componentTypeInfo) - { - super(id, parent, componentTypeInfo, true); - } - - /** - * @return the view id - */ - public final String getViewId() - { - return _viewId; - } - - /** - * @param viewId - * - */ - final void setViewId(final String viewId) - { - _viewId = viewId; - } - - /** - * <p> - * Clients may use the version stamp to determine if their instance of a - * view root is out of date. For example, if a client has cached an instance - * of a view root and wants to quickly checked if there is a newer version, - * it may request a new copy and compare version stamps - * </p> - * - * <p> - * The version stamp must be calculated so that given two instance of a view - * root for the same view id, v1 and v2: - * </p> - * - * <p> - * if v1.getVersionStamp().equals(v2.getVersionStamp()) then v1 and v2 are - * the same even if v1 != v2. Note that this uniqueness must hold true - * across multiple sessions of the IDE, since v1 or v2 may have been - * restored from permanent storage. For this reason, running counts should - * are discouraged unless they too can be reliably stored. Better is - * something that relies on large random numbers combined with a time stamp - * or workspace modification stamp - * </p> - * - * @return the unique version stamp of this view root. This may be used as - * quick check as to whether to view roots are not equal. - */ - public final VersionStamp getVersionStamp() - { - return delegateVersionStamp(); - } - - VersionStamp delegateVersionStamp() - { - return _versionStamp; - } - - final void setVersionStamp(VersionStamp versionStamp) - { - _versionStamp = versionStamp; - } - - /** - * @return true if the view root is out of sync with its view source. - */ - public final boolean isStale() - { - return _stalenessAdvisor.isStale(); - } - - final void setStalenessAdvisor(final StalenessAdvisor stalenessAdvisor) - { - _stalenessAdvisor = stalenessAdvisor; - } - - /** - * Implementations must ensure that listeners are only added if they are - * not already present. - * - * @param listener - */ - public final void addListener(final StalenessListener listener) - { - _stalenessAdvisor.addListener(listener); - } - - /** - * @param listener - */ - public final void removeListener(final StalenessListener listener) - { - _stalenessAdvisor.removeListener(listener); - } - - /** - * @return an adapter that can be used to request additional services from - * the view root instance. This can be used to get services that are - * not specific to all view roots such as mappings between view - * definition artifacts and their view objects. Value may be null if - * a view root chooses not to expose any services. - */ - public abstract IAdaptable getServices(); - - /** - * An abstract versioning stamp that can be used to uniquely identify a - * version of a DTUIViewRoot. - * - * @author cbateman - * - */ - public abstract static class VersionStamp implements Serializable - { - /** - * - */ - private static final long serialVersionUID = -7869336223178326584L; - - /** - * Called by equals to determine absolute equality. - * - * @param other - * @return true if and only if other represents the exact same version - * as this. Hashcode must be reimplemented in a way to guarantee - * that the equals() contract is respected. - */ - protected abstract boolean isEqual(final VersionStamp other); - - /** - * Must reimplement hashCode to match isEqual - */ - public abstract int hashCode(); - - @Override - public final boolean equals(Object obj) - { - if (this == obj) - { - return true; - } - - // NOTE: instanceof covers obj == null check. - if (obj instanceof VersionStamp) - { - return isEqual((VersionStamp) obj); - } - return false; - } - } - - /** - * An advisor which allows a view root to bridge to its source to see if its - * out-of-sync, while keeping it decoupled from what specifically its source - * is. - * - * @author cbateman - * - */ - public static abstract class StalenessAdvisor implements Serializable - { - /** - * - */ - private static final long serialVersionUID = 3449240686744169430L; - - /** - * Implementations must ensure that listeners are only added if they are - * not already present. - * @param listener - */ - public abstract void addListener(StalenessListener listener); - - /** - * @param listener - */ - public abstract void removeListener(StalenessListener listener); - - /** - * NOTE: it is very dangerous to have an advisor that always returns - * stale == true since many clients will rely on the staleness flag to - * determine if they should try to update the model. - * - * @return true if we are out of sync with the source that this tree was - * constructed from. - */ - public abstract boolean isStale(); - - /** - * @return a flag similar to IResource.isAccessible that indicates if - * the underlying view definition is no longer accessible either - * due it being deleted or it's source file being unaccessible - * due to project closure or other issues. - */ - public abstract boolean isAccessible(); - } - - /** - * A listener that is informed of model staleness events - * - */ - public static abstract class StalenessListener - { - /** - * @param event - */ - protected abstract void stalenessChanged(StalenessEvent event); - } - - /** - * An event that is fied when a model's staleness changes. - * - */ - public final static class StalenessEvent - { - private final ChangeType _type; - - /** - * @param type - */ - protected StalenessEvent(final ChangeType type) - { - _type = type; - } - - /** - * @return true if the event source is now stale. - */ - public final ChangeType getChangeType() - { - return _type; - } - - /** - * The type of staleness change - * - */ - /** - * @author cbateman - * - */ - public enum ChangeType - { - /** - * Indicates that the view definition has been changed in a way that - * will make existing DTUIViewRoot's stale. - */ - VIEW_DEFN_CHANGED, - - /** - * Inidicates that the view definition has been deleted. - */ - VIEW_DEFN_DELETED, - - /** - * Indicates that the view definition's enclosing project will be - * closed, causing the definition to be made unavailable for an - * indeterminate amount of time. - */ - VIEW_DEFN_PROJECT_CLOSED, - - /** - * Indicates that a view root has been invalid due to a project - * clean. View root should generally be forcibly updated on - * a project clean even if other staleness preconditions haven't - * been met. - */ - PROJECT_CLEANED - } - - /** - * - */ - private static final long serialVersionUID = 6765346004772568514L; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/DefaultDTUIViewRoot.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/DefaultDTUIViewRoot.java deleted file mode 100644 index 29a4219cf..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/DefaultDTUIViewRoot.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view; - -import java.io.Serializable; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentTypeInfo; - -/** - * The default view root implementation. Assumes an XML view definition. - * - * @author cbateman - * - */ -public class DefaultDTUIViewRoot extends DTUIViewRoot -{ - /** - * serializable - */ - private static final long serialVersionUID = -6948413077931237435L; - private final DefaultServices _defaultServices; - - /** - */ - public DefaultDTUIViewRoot() - { - // TODO: refactor constants - super(null, null, new ComponentTypeInfo("javax.faces.ViewRoot", - "javax.faces.component.UIViewRoot", "javax.faces.ViewRoot", - null)); - _defaultServices = new DefaultServices(); - } - - @Override - public IAdaptable getServices() - { - return _defaultServices; - } - - private class DefaultServices implements IAdaptable, Serializable - { - /** - * - */ - private static final long serialVersionUID = -5220371377352799212L; - private final XMLViewObjectMappingService _xmlViewObjectMappingService; - - private DefaultServices() - { - _xmlViewObjectMappingService = new XMLViewObjectMappingService(); - } - - public Object getAdapter(final Class adapter) - { - if (adapter.equals(XMLViewObjectMappingService.class)) - { - return _xmlViewObjectMappingService; - } - return null; - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/DefaultDTViewHandler.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/DefaultDTViewHandler.java deleted file mode 100644 index 537355ad5..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/DefaultDTViewHandler.java +++ /dev/null @@ -1,598 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.CopyOnWriteArrayList; -import java.util.concurrent.atomic.AtomicBoolean; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IResourceChangeEvent; -import org.eclipse.core.resources.IResourceChangeListener; -import org.eclipse.core.resources.IWorkspace; -import org.eclipse.core.resources.IncrementalProjectBuilder; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jface.text.IDocument; -import org.eclipse.jst.jsf.common.internal.JSPUtil; -import org.eclipse.jst.jsf.common.internal.resource.IResourceLifecycleListener; -import org.eclipse.jst.jsf.common.internal.resource.ImmutableLifecycleListener; -import org.eclipse.jst.jsf.common.internal.resource.ResourceLifecycleEvent; -import org.eclipse.jst.jsf.common.internal.resource.ResourceLifecycleEvent.ReasonType; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.designtime.context.DTFacesContext; -import org.eclipse.jst.jsf.designtime.internal.view.DTUIViewRoot.StalenessAdvisor; -import org.eclipse.jst.jsf.designtime.internal.view.DTUIViewRoot.StalenessEvent; -import org.eclipse.jst.jsf.designtime.internal.view.DTUIViewRoot.StalenessListener; -import org.eclipse.jst.jsf.designtime.internal.view.DTUIViewRoot.VersionStamp; -import org.eclipse.jst.jsf.designtime.internal.view.DTUIViewRoot.StalenessEvent.ChangeType; -import org.eclipse.jst.jsf.designtime.internal.view.model.ITagRegistry; -import org.w3c.dom.Node; - -/** - * A default implementation of the design time view handler meant to parallel - * the default runtime ViewHandler required by the JSF spec. - * - */ -public class DefaultDTViewHandler extends AbstractDTViewHandler -{ - private final MyLifecycleManager _lifecycleManager = new MyLifecycleManager(); - - @Override - public String calculateLocale(final DTFacesContext context) - throws ViewHandlerException - { - // TODO Auto-generated method stub - return null; - } - - @Override - public IResource getActionDefinition(final DTFacesContext context, - final String viewId) throws ViewHandlerException - { - // TODO: this seems like a bit of a cop out... - return context.adaptContextObject(); - } - - @Override - public IPath getActionURL(final DTFacesContext context, - final IResource resource, final IPath requestPath) - throws ViewHandlerException - { - // TODO Auto-generated method stub - return null; - } - - @Override - public IPath getRelativeActionPath(final DTFacesContext context, - final String relativeToViewId, final String uri) - throws ViewHandlerException - { - // TODO Auto-generated method stub - return null; - } - - @Override - public IViewDefnAdapterFactory getViewMetadataAdapterFactory( - final DTFacesContext context) throws ViewHandlerException - { - final IResource res = context.adaptContextObject(); - - if (res instanceof IFile) - { - return new DefaultViewDefnAdapterFactory(this); - } - - return null; - } - - @Override - protected VersionStamp createVersionStamp( - final DTFacesContext facesContext, final String viewId) - { - return new TimeBasedVersionStamp(); - } - - static class DefaultViewDefnAdapterFactory extends - AbstractViewDefnAdapterFactory - { - private final DefaultDTViewHandler _myViewHandler; - - DefaultViewDefnAdapterFactory(final DefaultDTViewHandler viewHandler) - { - _myViewHandler = viewHandler; - } - - @Override - public IViewDefnAdapter<Node, IDocument> createAdapter( - final DTFacesContext context, final String viewId) - { - try - { - final IResource res = _myViewHandler.getActionDefinition( - context, viewId); - - if (res instanceof IFile) - { - final IFile srcFile = (IFile) res; - final ITagRegistry registry = findTagRegistry(srcFile); - if (JSPUtil.isJSPContentType(srcFile) && registry != null) - { - // if we have a jsp file, then return the default - // adapter - return new JSPViewDefnAdapter(registry); - } - } - } - catch (final ViewHandlerException vhe) - { - JSFCorePlugin.log(vhe, "While acquiring view adapter"); - } - - // not found or failed - return null; - } - } - - @Override - protected DTUIViewRoot internalCreateView( - final DTFacesContext facesContext, final String viewId) - { - IViewDefnAdapterFactory factory; - try - { - factory = getViewMetadataAdapterFactory(facesContext); - if (factory != null) - { - final IViewDefnAdapter<?, ?> adapter = factory.createAdapter( - facesContext, viewId); - if (adapter instanceof XMLViewDefnAdapter) - { - final IResource res = facesContext.adaptContextObject(); - final DTUIViewRoot root = newView(facesContext, viewId); - final XMLComponentTreeConstructionStrategy constructionStrategy = createTreeConstructionStrategy( - (XMLViewDefnAdapter) adapter, res.getProject()); - - constructionStrategy - .createComponentTree(facesContext, root); - return root; - } - JSFCorePlugin - .log( - IStatus.WARNING, - String - .format( - "Could not get view adapter to construct design time view root for %s", - viewId)); - } - else - { - JSFCorePlugin - .log( - IStatus.WARNING, - String - .format( - "Could not get view adapter factory toconstruct design time view root for %s", - viewId)); - } - } - catch (final ViewHandlerException e) - { - JSFCorePlugin.log(e, "While acquiring view defn adapter factory"); - // fall-through - } - - return new NullViewRoot(); - } - - /** - * By default, returns DefaultDTUIViewRoot. - * - * @param facesContext - * @param viewId - * @return a new instance of a view. Override to change the implementation - * or configuration of DTUIViewRoot that is used by - * internalCreateView. - */ - protected DTUIViewRoot newView(final DTFacesContext facesContext, - final String viewId) - { - return new DefaultDTUIViewRoot(); - } - - @Override - protected void registerView(final DTUIViewRoot viewRoot, - final DTFacesContext facesContext, final String viewId) - { - final IResource res = facesContext.adaptContextObject(); - _lifecycleManager.addViewInfo(viewId, res); - } - - /** - * Sub-classes may override to provide a different strategy. - * - * @param adapter - * @param project - * @return the construction strategy used to create this view's component - * tree - */ - protected XMLComponentTreeConstructionStrategy createTreeConstructionStrategy( - final XMLViewDefnAdapter adapter, final IProject project) - { - return new XMLComponentTreeConstructionStrategy(adapter, project); - } - - @Override - public boolean supportsViewDefinition(final IFile file) - { - // currently only JSP content type is supported - return (JSPUtil.isJSPContentType(file)); - } - - @Override - protected StalenessAdvisor createStalenessAdvisor( - final DTUIViewRoot viewRoot, final DTFacesContext facesContext, - final String viewId) - { - final IResource res = facesContext.adaptContextObject(); - // if the view root is null or the res is null fall through - // and use the null staleness advisor - if (!(viewRoot instanceof NullViewRoot) && res != null) - { - return new ResourceModStampStalenessAdvisor(viewRoot, res, viewId); - } - return new NullStalenessAdvisor(); - } - - /** - * Measures the staleness of a view by comparing the modification stamp on - * the resource at construction with the current value when isStale is - * called. - * - * @author cbateman - * - */ - protected final class ResourceModStampStalenessAdvisor extends - StalenessAdvisor implements Serializable - { - /** - * version id - */ - private static final long serialVersionUID = -4982206388722638735L; - private final long _modificationStamp; - - private transient final IResource _res; - private transient final AtomicBoolean _forcedStale; - private transient final StalenessListener _myListener; - - /** - * @param viewRoot - * @param file - * @param viewId - */ - public ResourceModStampStalenessAdvisor(final DTUIViewRoot viewRoot, - final IResource file, final String viewId) - { - _res = file; - _modificationStamp = file.getModificationStamp(); - _forcedStale = new AtomicBoolean(false); - _myListener = new StalenessListener() - { - @Override - protected void stalenessChanged(final StalenessEvent event) - { - if (event.getChangeType() == ChangeType.PROJECT_CLEANED) - { - if (_forcedStale.compareAndSet(false, true)) - { - _lifecycleManager.removeListener(_res, _myListener); - } - } - } - }; - _lifecycleManager.addViewInfo(viewId, _res); - _lifecycleManager.addListener(_res, _myListener); - } - - @Override - public boolean isStale() - { - if (!_forcedStale.get()) - { - final long curStamp = _res.getModificationStamp(); - return curStamp != _modificationStamp; - } - // else forced stale - return true; - } - - @Override - public void addListener(final StalenessListener listener) - { - _lifecycleManager.addListener(_res, listener); - } - - @Override - public void removeListener(final StalenessListener listener) - { - _lifecycleManager.removeListener(_res, listener); - } - - @Override - public boolean isAccessible() - { - return _res.isAccessible(); - } - } - - @Override - public final void setLifecycleListener(final ImmutableLifecycleListener listener) - { - _lifecycleManager.update(listener); - } - - @Override - protected final void doDispose() - { - _lifecycleManager.dispose(); - } - - private class MyLifecycleManager implements IResourceLifecycleListener - { - private ImmutableLifecycleListener _listener; - private final Map<IResource, ViewInfo> _stalenessListeners; - private final IResourceChangeListener _buildListener; - - public MyLifecycleManager() - { - _stalenessListeners = new HashMap<IResource, ViewInfo>(); - _buildListener = new IResourceChangeListener() - { - // on a clean build request, fire staleness for all project-related - // resources. - public void resourceChanged(final IResourceChangeEvent event) - { - if (event.getType() == IResourceChangeEvent.PRE_BUILD) - { - if (event.getBuildKind() == IncrementalProjectBuilder.CLEAN_BUILD) - { - if (event.getSource() instanceof IProject) - { - cleanProject((IProject) event.getSource()); - } - else if (event.getSource() instanceof IWorkspace) - { - cleanAll(); - } - } - } - } - }; - ResourcesPlugin.getWorkspace().addResourceChangeListener(_buildListener, - IResourceChangeEvent.PRE_BUILD); - } - - public void addListener(final IResource res, final StalenessListener listener) - { - final ViewInfo viewInfo = getViewInfo(res); - viewInfo.getListeners().addIfAbsent(listener); - } - - public void removeListener(final IResource res, final StalenessListener listener) - { - final ViewInfo viewInfo = getViewInfo(res); - viewInfo.getListeners().remove(listener); - } - - public EventResult acceptEvent(final ResourceLifecycleEvent event) - { - switch (event.getEventType()) - { - case RESOURCE_CHANGED: - { - return handleContentChangeEvent(event); - } - - case RESOURCE_INACCESSIBLE: - { - return handleInaccessibleChangeEvent(event); - } - - default: - // do nothing with other types - } - - return EventResult.getDefaultEventResult(); - } - - private EventResult handleContentChangeEvent( - final ResourceLifecycleEvent event) - { - if (event.getReasonType() != ReasonType.RESOURCE_CHANGED_CONTENTS) - { - return EventResult.getDefaultEventResult(); - } - - final IResource res = event.getAffectedResource(); - final List<StalenessListener> stalenessListeners = getListeners(res); - - if (stalenessListeners != null) - { - for (final StalenessListener listener : stalenessListeners) - { - listener.stalenessChanged(new StalenessEvent( - ChangeType.VIEW_DEFN_CHANGED)); - } - } - return EventResult.getDefaultEventResult(); - } - - private EventResult handleInaccessibleChangeEvent( - final ResourceLifecycleEvent event) - { - final IResource res = event.getAffectedResource(); - final ReasonType reasonType = event.getReasonType(); - ChangeType changeType = null; - if (reasonType == ReasonType.RESOURCE_PROJECT_CLOSED) - { - changeType = ChangeType.VIEW_DEFN_PROJECT_CLOSED; - } - else if (reasonType == ReasonType.RESOURCE_DELETED) - { - changeType = ChangeType.VIEW_DEFN_DELETED; - } - else - { - return EventResult.getDefaultEventResult(); - } - - final List<StalenessListener> listeners = getListeners(res); - - if (listeners != null) - { - for (final StalenessListener listener : listeners) - { - listener.stalenessChanged(new StalenessEvent( - changeType)); - } - } - return EventResult.getDefaultEventResult(); - } - - private void cleanAll() - { - final StalenessEvent event = new StalenessEvent(ChangeType.PROJECT_CLEANED); - for (final Map.Entry<IResource, ViewInfo> entry : _stalenessListeners.entrySet()) - { - final ViewInfo info = entry.getValue(); - for (final StalenessListener listener : info.getListeners()) - { - listener.stalenessChanged(event); - } - } - } - - private void cleanProject(final IProject project) - { - final StalenessEvent event = new StalenessEvent(ChangeType.PROJECT_CLEANED); - for (final Map.Entry<IResource, ViewInfo> entry : _stalenessListeners.entrySet()) - { - final IResource res = entry.getKey(); - - if (res.getProject().equals(project)) - { - final ViewInfo info = entry.getValue(); - for (final StalenessListener listener : info.getListeners()) - { - listener.stalenessChanged(event); - } - } - } - } - - private List<StalenessListener> getListeners(final IResource res) - { - List<StalenessListener> stalenessListeners = null; - - synchronized (this) - { - final ViewInfo viewInfo = _stalenessListeners.get(res); - - if (viewInfo != null) - { - stalenessListeners = viewInfo.getListeners(); - } - } - return stalenessListeners; - } - - public synchronized void addViewInfo(final String viewId, - final IResource res) - { - ViewInfo viewInfo = _stalenessListeners.get(res); - - if (viewInfo == null) - { - viewInfo = new ViewInfo(viewId); - _stalenessListeners.put(res, viewInfo); - } - } - - public synchronized ViewInfo getViewInfo(final IResource res) - { - return _stalenessListeners.get(res); - } - - public synchronized void dispose() - { - // updating with null effectively deregisters any existing listener - // and doesn't register a new one. - ResourcesPlugin.getWorkspace().removeResourceChangeListener(_buildListener); - update(null); - } - - public synchronized void update( - final ImmutableLifecycleListener listener) - { - if (listener == _listener) - { - return; - } - - final ImmutableLifecycleListener oldListener = _listener; - - if (oldListener != null) - { - oldListener.removeListener(this); - } - - _listener = listener; - - if (_listener != null) - { - _listener.addListener(this); - } - } - } - - private static class ViewInfo - { - private final CopyOnWriteArrayList<StalenessListener> _listeners; - private final String _viewId; - - /** - * @param listeners - * @param res - */ - private ViewInfo(final String viewId) - { - super(); - _listeners = new CopyOnWriteArrayList<StalenessListener>(); - _viewId = viewId; - } - - protected final CopyOnWriteArrayList<StalenessListener> getListeners() - { - return _listeners; - } - - protected final String getViewId() - { - return _viewId; - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/IDTViewHandler.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/IDTViewHandler.java deleted file mode 100644 index 81e4be6a4..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/IDTViewHandler.java +++ /dev/null @@ -1,255 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.IPath; -import org.eclipse.jst.jsf.common.internal.resource.ImmutableLifecycleListener; -import org.eclipse.jst.jsf.designtime.context.DTFacesContext; - -/** - * <p> - * Defines the basic interface for all design time view handlers that parallel - * custom runtime view handlers (extenders of ViewHandler). - * </p> - * - * @author cbateman - * - */ -public interface IDTViewHandler -{ - /** - * <p> - * Creates and returns the view root. This method <i>may</i> optionally - * intialize the view root with any data that need only be done once per - * instance. Generally, this will include providing the root access to - * itself or its IViewDefnAdapterFactory so that it can refresh itself. - * </p> - * - * @param facesContext - * @param viewId - * @return a designtime view root instance of viewId under the given faces - * context - * @throws ViewHandlerException - */ - DTUIViewRoot createView(DTFacesContext facesContext, String viewId) - throws ViewHandlerException; - - /** - * Calculate the locale for the current view context. The return string must - * conform to the standard format proscribed by java.util.Locale. - * - * @param context - * @return the locale string for the view definition referred to by context - * @throws ViewHandlerException - */ - String calculateLocale(DTFacesContext context) throws ViewHandlerException; - - /** - * Given that resource is the view definition source and requestPath is the - * current servlet uri for a request relative to the web content root, map - * it to the actual request uri that would be required at runtime to invoke - * the view definition in resource. DTFacesContext will contain an external - * context that may be used to derive servlet mapping configuration. - * - * @param context - * @param resource - * @param requestPath - * @return the IPath representing the newly mapped request path - * @throws ViewHandlerException - */ - IPath getActionURL(DTFacesContext context, IResource resource, - IPath requestPath) throws ViewHandlerException; - - /** - * TODO: if we already have context, must we already know what the source - * is? - * - * The IResource need not exist. - * - * @param context - * @param viewId - * @return the resource containing the view definition for viewId. - * @throws ViewHandlerException - */ - IResource getActionDefinition(DTFacesContext context, String viewId) - throws ViewHandlerException; - - /** - * Given that a request is made for uri from within the view named by - * relativeToViewId at runtime, return the path to the resource containing - * that view definition. The path need not point to a resource that - * currently exists. - * - * @param context - * @param relativeToViewId - * @param uri - * @return the path to the resource named by uri relative to the view named - * by relativeToViewId - * @throws ViewHandlerException - */ - IPath getRelativeActionPath(DTFacesContext context, - String relativeToViewId, String uri) throws ViewHandlerException; - - /** - * Translate a workspace resource to the view id it will have at runtime. - * - * @param context - * @param res - * @return the view id for res or null if there is no meaningful value - */ - String getViewId(DTFacesContext context, IResource res); - - /** - * @param context - * @return a view definition adapter - * @throws ViewHandlerException - */ - IViewDefnAdapterFactory getViewMetadataAdapterFactory(DTFacesContext context) - throws ViewHandlerException; - - /** - * @param file - * @return true if the contents of the file is of a format that this view - * handler supports. Generally, this is decided by a combination of - * content type and, in the case of XML formats, schema. - */ - boolean supportsViewDefinition(final IFile file); - - /** - * Releases the handler's in-memory image. - */ - void dispose(); - - /** - * Called by design time app manager to set a global resource listener - * for the view handler to use. View handlers should generally use this - * listener to reduce the overhead of extra resouce change listeners. - * - * @param listener - */ - void setLifecycleListener(final ImmutableLifecycleListener listener); - - /** - * General exception class for problems that a custom view handler wants to - * propagate to the framework in a well-defined way. - * - */ - public static final class ViewHandlerException extends Exception - { - private final Cause _causeCode; - - /** - * Enumerates the known failure causes - * - */ - public enum Cause - { - /** - * thrown from getELExpression when the context passed does not - * refer to a parsable EL expression in the view definition - */ - EL_NOT_FOUND, - /** - * thrown from getELExpression when an exception occurs during EL - * parsing. The ViewHandlerException should wrap the causing - * exception in this cause - */ - EL_EXCEPTION_CAUGHT_WHILE_PARSING, - /** - * an undefined exception cause indicating something not foreseen by - * the framework. - */ - UNDEFINED, - - /** - * indicates that a bad or null version stamp was encountered. The - * wrapped exception may provide tracing information to the cause. - */ - BAD_VERSION_STAMP, - - /** - * indicates that a bad or null staleness advisor was encountered. - * The wrapped exception may provide tracing information to the - * cause. - */ - BAD_STALENESS_ADVISOR, - - /** - * a general failure by the view creation to create a new view root. - */ - UNABLE_TO_CREATE_VIEW - } - - /** - * - */ - private static final long serialVersionUID = 2109525340402345111L; - - /** - * Construct an exception with an undefined cause - */ - public ViewHandlerException() - { - this(Cause.UNDEFINED); - } - - /** - * @param cause - */ - public ViewHandlerException(final Cause cause) - { - super(); - _causeCode = cause; - } - - /** - * @param message - * @param caught - * @param cause - */ - public ViewHandlerException(final String message, - final Throwable caught, final Cause cause) - { - super(message, caught); - _causeCode = cause; - } - - /** - * @param message - * @param cause - */ - public ViewHandlerException(final String message, final Cause cause) - { - super(message); - _causeCode = cause; - } - - /** - * @param caught - * @param cause - */ - public ViewHandlerException(final Throwable caught, final Cause cause) - { - super(caught); - _causeCode = cause; - } - - /** - * @return the cause code - */ - public final Cause getCauseCode() - { - return _causeCode; - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/IViewDefnAdapter.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/IViewDefnAdapter.java deleted file mode 100644 index 676643a74..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/IViewDefnAdapter.java +++ /dev/null @@ -1,128 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view; - -import java.util.List; - -import org.eclipse.jst.jsf.common.runtime.internal.model.ViewObject; -import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentInfo; -import org.eclipse.jst.jsf.common.runtime.internal.model.datatypes.ELExpression; -import org.eclipse.jst.jsf.context.IModelContext; -import org.eclipse.jst.jsf.designtime.context.DTFacesContext; -import org.eclipse.jst.jsf.designtime.internal.view.IDTViewHandler.ViewHandlerException; - -/** - * <p> - * A generic adapter used to adapt arbitrary view definitions to framework - * objects. - * </p> - * - * @author cbateman - * @param <VIEW_DEFN_BASE_TYPE> - * the base type of all view definition objects - * @param <VIEW_CONTAINER_TYPE> - * the type of the container that is expeccted to hold the view defn - * - */ -public interface IViewDefnAdapter<VIEW_DEFN_BASE_TYPE, VIEW_CONTAINER_TYPE> -{ - /** - * @param viewDefnObject - * @param constructionData - * @param viewContainer - * @return a view object corresponding to the viewDefnBaseType object or - * null if none. - */ - ViewObject mapToViewObject( - VIEW_DEFN_BASE_TYPE viewDefnObject, - ViewObjectConstructionStrategy<? extends VIEW_DEFN_BASE_TYPE> constructionData, - VIEW_CONTAINER_TYPE viewContainer); - - /** - * This method may be expensive. - * - * @param viewDefnObject - * @param root - * @return the view object corresponding to viewDefnObject in the - * component sub-tree rooted at root. - * <b>May return null if isn't found or can't be found</b> - */ - ViewObject findViewObject(VIEW_DEFN_BASE_TYPE viewDefnObject, ComponentInfo root); - - /** - * @param viewObject - * @param root - * @return the view definition object that viewObject was derived from - * using root as the component sub-tree root to search in. - * <b>May return null if isn't found or can't be found</b> - */ - VIEW_DEFN_BASE_TYPE findViewDefn(ViewObject viewObject, ComponentInfo root); - - /** - * @param viewDefnObject - * @return the id for the viewDefnObject or null if none. Generally, null - * should indicate that no id is present but could be. This is - * distinct from the case where viewDefnObject can never define an - * id, in which case IllegalArgumentException should be thrown. - * - * @throws IllegalArgumentException - * may be thrown to indicate that viewDefnObject does not - * correspond to a ViewObject type that has an id. - * - */ - String getId(VIEW_DEFN_BASE_TYPE viewDefnObject) - throws IllegalArgumentException; - - /** - * Normally this is a workspace resource (IFile) or higher level document - * type like an IDocument. - * - * @param context - * @param viewId - * @return the container resource for the viewId in context. - */ - VIEW_CONTAINER_TYPE getContainer(DTFacesContext context, String viewId); - - /** - * @param container - * @return the view roots for the definition in container or empty if none. - * MUST NOT BE NULL. - */ - List<VIEW_DEFN_BASE_TYPE> getViewDefnRoots(VIEW_CONTAINER_TYPE container); - - /** - * <p> - * The view definition adapter must be able to extract all EL expressions - * from a view definition. Given a model context that points into the view - * definition it must return the EL expression in that context. - * </p> - * - * <p> - * If the model context provided does not refer to a valid view definition - * for this handler, then ViewHandlerException(EL_NOT_FOUND) should be - * thrown. If an exception occurs while trying to extract the EL expression - * at context, then ViewHandlerException(caughtException, - * EL_EXCEPTION_CAUGHT_WHILE_PARSING) should be thrown. - * </p> - * - * <p> - * Note that any reference to parsing here means extraction from the - * document and not building an AST for the expression itself.</p> - * - * @param context - * @return the text (stripped of any escaping such as #{} in JSP) of the EL - * expression referred to by context or null if there is no valid EL - * expression at context. - * @throws ViewHandlerException - */ - ELExpression getELExpression(IModelContext context) throws ViewHandlerException; - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/IViewDefnAdapterFactory.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/IViewDefnAdapterFactory.java deleted file mode 100644 index b0aa0f06e..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/IViewDefnAdapterFactory.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view; - -import org.eclipse.jst.jsf.designtime.context.DTFacesContext; - -/** - * <p>Interface for a factory that creates view definition adapters.</p> - * - * @author cbateman - * - */ -public interface IViewDefnAdapterFactory -{ - /** - * @param context - * @param viewId - * @return a view adapter for the viewid or null if this factory - * cannot produce an adapter for the underlying view definition. - */ - IViewDefnAdapter<?,?> createAdapter(DTFacesContext context, String viewId); -}
\ No newline at end of file diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/IViewRootHandle.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/IViewRootHandle.java deleted file mode 100644 index c8d37630c..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/IViewRootHandle.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view; - -import org.eclipse.jst.jsf.designtime.internal.view.DTUIViewRoot.StalenessListener; - -/** - * A handle to a view root. - * - * @author cbateman - * - */ -public interface IViewRootHandle -{ - /** - * <p> - * This returns the copy of the view root cached by the faces context. If - * updateViewRoot has never been called (or if it was called but never - * succeeded) it may return null. - * </p> - * - * <p> - * This method should be cheap and avoid blocking - * </p> - * - * return null if the value of the view root - * - * @return the cached view root. May be null. - */ - DTUIViewRoot getCachedViewRoot(); - - /** - * NOTE: this method may be long running. If you can tolerate a possibly - * stale value more quickly, use getCachedViewRoot(). NEVER run this method - * on the main UI thread. - * - * A good strategy for invoking is as follows: - * - * DTUIViewRoot viewRoot = handle.getCachedViewRoot(); - * - * <pre> - * if (viewRoot == null || viewRoot.isStale()) - * { - * spawnTread that calls updateViewRoot - * } - * - * </pre> - * - * @return the view root for the associated context object or null if there - * is no context object. - */ - DTUIViewRoot updateViewRoot(); - - /** - * Adds a staleness listener to the currently cached view root. If there - * currently is no cached view root, then the listener will be stored - * until a updateViewRoot is successfully called. - * @param listener - */ - void addListener(final StalenessListener listener); - - /** - * Removes a staleness listener from the currently cached view root. If - * there is no currently cached root, then the listener will be stored - * until one is found. The call will then attempt to remove it. - * @param listener - */ - void removeListener(final StalenessListener listener); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/JSPViewDefnAdapter.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/JSPViewDefnAdapter.java deleted file mode 100644 index 13d9e2911..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/JSPViewDefnAdapter.java +++ /dev/null @@ -1,229 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view; - -import java.io.IOException; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jface.text.IDocument; -import org.eclipse.jst.jsf.context.IModelContext; -import org.eclipse.jst.jsf.context.resolver.structureddocument.IStructuredDocumentContextResolverFactory; -import org.eclipse.jst.jsf.context.resolver.structureddocument.internal.ITextRegionContextResolver; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContextFactory; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.designtime.context.DTFacesContext; -import org.eclipse.jst.jsf.designtime.internal.view.IDTViewHandler.ViewHandlerException; -import org.eclipse.jst.jsf.designtime.internal.view.IDTViewHandler.ViewHandlerException.Cause; -import org.eclipse.jst.jsf.designtime.internal.view.model.ITagRegistry; -import org.eclipse.jst.jsp.core.internal.contentmodel.TaglibController; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.TLDCMDocumentManager; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.TaglibTracker; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDDocument; -import org.eclipse.jst.jsp.core.internal.domdocument.DOMModelForJSP; -import org.eclipse.jst.jsp.core.internal.regions.DOMJSPRegionContexts; -import org.eclipse.wst.sse.core.StructuredModelManager; -import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; -import org.eclipse.wst.xml.core.internal.contentmodel.CMDocument; -import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext; -import org.w3c.dom.Element; - -/** - * <p> - * A view definition adapter that adapts JSF view definitions based on the - * standard JSP view description language. - * </p> - * - * @author cbateman - * - */ -public class JSPViewDefnAdapter extends TaglibBasedViewDefnAdapter -{ - JSPViewDefnAdapter(final ITagRegistry tldTagRegistry) - { - super(tldTagRegistry); - } - - @Override - public IDocument getContainer(final DTFacesContext context, - final String viewId) - { - final IResource viewDefn = context.adaptContextObject(); - - if (viewDefn instanceof IFile) - { - final IFile viewDefnFile = (IFile) viewDefn; - IStructuredModel model = null; - try - { - model = - StructuredModelManager.getModelManager() - .getModelForRead(viewDefnFile); - - if (model instanceof DOMModelForJSP) - { - return model.getStructuredDocument(); - } - } - catch (final IOException e) - { - JSFCorePlugin.log(e, "Acquiring model for view root"); - } - catch (final CoreException e) - { - JSFCorePlugin.log(e, "Acquiring model for view root"); - } - finally - { - if (model != null) - { - model.releaseFromRead(); - } - } - } - return null; - } - - @Override - public final String getNamespace(final Element element, - final IDocument doc) - { - final String prefix = element.getPrefix(); - - // TODO: merge back with JSPUtil.findUri() - final TLDCMDocumentManager m = - TaglibController.getTLDCMDocumentManager(doc); - - if (prefix == null || m == null) - { - return null; - } - final List<?> trackers = m.getTaglibTrackers(); - for (final Object name : trackers) - { - final TaglibTracker tracker = (TaglibTracker) name; - if (prefix.equals(tracker.getPrefix())) - { - return tracker.getURI(); - } - } - return null; - } - - - @Override - public DTELExpression getELExpression(final IModelContext genericContext) - throws ViewHandlerException - { - final IStructuredDocumentContext context = - (IStructuredDocumentContext) genericContext - .getAdapter(IStructuredDocumentContext.class); - - if (context == null) - { - throw new ViewHandlerException(Cause.EL_NOT_FOUND); - } - - ITextRegionContextResolver resolver = - IStructuredDocumentContextResolverFactory.INSTANCE - .getTextRegionResolver(context); - - String elText = null; - - if (resolver != null) - { - final String regionType = resolver.getRegionType(); - - if (regionType != null && resolver.matchesRelative(new String[] - { DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE })) - { - // if we are in the EL content, then get the current region - // text - if (DOMJSPRegionContexts.JSP_VBL_CONTENT.equals(regionType)) - { - elText = resolver.getRegionText(); - } - // otherwise, we may be at the end of a content region but - // at - // the beginning of a closing brace so check to see if the - // previous - // region was a VBL_CONTENT - else if (regionType.equals(DOMJSPRegionContexts.JSP_VBL_CLOSE)) - { - final IStructuredDocumentContext previousContext = - resolver.getPreviousContext(); - - final ITextRegionContextResolver prevResolver = - IStructuredDocumentContextResolverFactory.INSTANCE - .getTextRegionResolver(previousContext); - - if (prevResolver != null) - { - if (DOMJSPRegionContexts.JSP_VBL_CONTENT - .equals(prevResolver.getRegionType())) - { - resolver = prevResolver; - elText = prevResolver.getRegionText(); - } - else if (DOMJSPRegionContexts.JSP_VBL_OPEN - .equals(prevResolver.getRegionType())) - { - elText = ""; //$NON-NLS-1$ - } - } - } - } - } - - if (elText != null) - { - final IStructuredDocumentContext elContext = - IStructuredDocumentContextFactory.INSTANCE.getContext( - context.getStructuredDocument(), resolver - .getStartOffset()); - return new DTELExpression(elContext, elText); - } - return null; - } - - @Override - public String getGeneratedIdPrefix() - { - return "_idJsp"; - } - - @Override - public String getPrefix(String namespace, IDocument doc) - { - TLDCMDocumentManager m = TaglibController.getTLDCMDocumentManager(doc); - if (m == null) - return null; - List trackers = m.getTaglibTrackers(); - for (Iterator iter = trackers.iterator(); iter.hasNext();) { - TaglibTracker tracker = (TaglibTracker) iter.next(); - if (namespace.equals(tracker.getURI())) { - return tracker.getPrefix(); - } - - CMDocument cmdoc = tracker.getDocument(); - if (cmdoc instanceof TLDDocument - && namespace.equals(((TLDDocument) cmdoc).getUri())) { - return tracker.getPrefix(); - } - } - return null; - - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/TaglibBasedViewDefnAdapter.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/TaglibBasedViewDefnAdapter.java deleted file mode 100644 index f24c405eb..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/TaglibBasedViewDefnAdapter.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view; - -import org.eclipse.jface.text.IDocument; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagElement; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.Namespace; -import org.eclipse.jst.jsf.designtime.internal.view.model.ITagRegistry; -import org.w3c.dom.Element; - -/** - * A view defintion adapter for XML-based view definition formats that use - * a well defined tag library system, with associated ITagRegistry, to define - * tag handlers. Most common view handlers (JSP, Facelets) should use this. - * - * @author cbateman - * - */ -public abstract class TaglibBasedViewDefnAdapter extends XMLViewDefnAdapter -{ - private final ITagRegistry _tagRegistry; - - /** - * @param tagRegistry - */ - protected TaglibBasedViewDefnAdapter(final ITagRegistry tagRegistry) - { - _tagRegistry = tagRegistry; - } - - /** - * @param node - * @param document - * @return the tag element for node or null if none. - */ - @Override - protected ITagElement findTagElement(final Element node, - final IDocument document) - { - final String uri = getNamespace(node, document); - final String tagName = node.getLocalName(); - - if (uri != null) - { - final Namespace lib = getTagRegistry().getTagLibrary(uri); - - if (lib != null) - { - return findTagElement(tagName, lib); - } - } - return null; - } - - /** - * @return the tag registry - */ - protected final ITagRegistry getTagRegistry() - { - return _tagRegistry; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/ViewObjectConstructionStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/ViewObjectConstructionStrategy.java deleted file mode 100644 index ad3a7a231..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/ViewObjectConstructionStrategy.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view; - -import org.eclipse.jst.jsf.common.runtime.internal.model.ViewObject; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagElement; - -/** - * A strategy for constructing a new view object from a tag element - * @author cbateman - * @param <VIEW_DEFN_BASE_TYPE> - * - */ -public abstract class ViewObjectConstructionStrategy<VIEW_DEFN_BASE_TYPE> -{ - /** - * For a tag element return the corresponding view object or null if - * there is no such object. XMLViewObjectMappingService must be updated - * if not null with any attribute->property mappings. - * - * @param viewBase the source object in the source - * @param tagElement - * @return a new view object or null if we can't do so - */ - public abstract ViewObject createViewObject(VIEW_DEFN_BASE_TYPE viewBase, - ITagElement tagElement); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/XMLComponentTreeConstructionStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/XMLComponentTreeConstructionStrategy.java deleted file mode 100644 index 9139646ef..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/XMLComponentTreeConstructionStrategy.java +++ /dev/null @@ -1,193 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view; - -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.jface.text.IDocument; -import org.eclipse.jst.jsf.common.runtime.internal.model.ViewObject; -import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentFactory; -import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentInfo; -import org.eclipse.jst.jsf.designtime.context.DTFacesContext; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - -/** - * A component tree construction strategy based on XML view definition - * - * @author cbateman - * - */ -public class XMLComponentTreeConstructionStrategy extends - ComponentTreeConstructionStrategy<Node, IDocument> -{ - private final XMLViewDefnAdapter _adapter; - // private final XMLViewObjectConstructionStrategy - // _objectConstructionStrategy; - private final IProject _project; - - /** - * @param adapter - * @param project - */ - public XMLComponentTreeConstructionStrategy( - final XMLViewDefnAdapter adapter, final IProject project) - { - _adapter = adapter; - _project = project; - } - - @Override - public ComponentInfo createComponentTree(final DTFacesContext context, - final DTUIViewRoot viewRoot) - { - final IDocument container = _adapter.getContainer(context, viewRoot - .getViewId()); - final List<Node> roots = _adapter.getViewDefnRoots(container); - - if (roots.size() > 0) - { - final IAdaptable adaptable = viewRoot.getServices(); - - XMLViewObjectMappingService tagMappingService = null; - if (adaptable != null) - { - tagMappingService = (XMLViewObjectMappingService) adaptable - .getAdapter(XMLViewObjectMappingService.class); - } - final XMLViewObjectConstructionStrategy objectConstructionStrategy = - new XMLViewObjectConstructionStrategy( - _adapter, new ComponentConstructionData(0, null, _project, - container), tagMappingService); - - objectConstructionStrategy.getConstructionData().setIdCounter(0); - // can only handle a single root for XML; should be the DOM root - return buildComponentTree(roots.get(0), viewRoot, container, - objectConstructionStrategy); - } - - return viewRoot; - } - - private ComponentInfo buildComponentTree(final Node root, - final DTUIViewRoot viewRoot, final IDocument document, - final XMLViewObjectConstructionStrategy objectConstructionStrategy) - { - final ComponentInfo dummyRoot = ComponentFactory.createComponentInfo( - null, null, null, true); - // populate the dummy root - recurseDOMModel(root, dummyRoot, document, objectConstructionStrategy); - - // try to extract the view defined root from the dummyRoot and update - // 'root' with its children. - populateViewRoot(viewRoot, dummyRoot.getChildren()); - return viewRoot; - } - - /** - * Tries to find the view defined view root in children and use it populate - * viewRoot. Children may sub-class to a different algorithm or, in some - * cases create an implicit (i.e. Facelets does this) view root if one is - * not explicitly created by the view definition. - * - * Regardless of the strategy, the following post-conditions must be true - * - * To the extend that children represent the top-level objects in the view - * under the presumed root, viewRoot must be populated with them either - * directly if the creation of a view root is implicit (i.e. Facelets) or - * through a valid view root declaration found in the view definition (i.e. - * f:view in JSP) found the children list. - * - * The default behaviour assumes the JSP case. - * - * TODO: add validation cases for missing view roots in JSP. - * - * @param viewRoot - * @param children - */ - protected void populateViewRoot(final DTUIViewRoot viewRoot, - final List children) - { - ComponentInfo foundRoot = null; - // TODO: additional cases: - // 1) Valid case: view is a fragment and has one or more non-view root - // children - // 2) Invalid case: not a fragment and has no view root - // 3) Invalid case: any definition and has more than one view root - // 4) Invalid case: any definition and has component siblings to the - // view root - FIND_VIEWROOT: for (final Iterator it = children.iterator(); it - .hasNext();) - { - final ComponentInfo topLevelChild = (ComponentInfo) it.next(); - - if ("javax.faces.ViewRoot".equals(topLevelChild - .getComponentTypeInfo().getComponentType())) - { - foundRoot = topLevelChild; - break FIND_VIEWROOT; - } - } - - if (foundRoot != null) - { - for (final Iterator it = foundRoot.getChildren().iterator(); it - .hasNext();) - { - final ComponentInfo child = (ComponentInfo) it.next(); - final String facetName = foundRoot.getFacetName(child); - - // if not a facet, add as a normal child - if (facetName == null) - { - viewRoot.addChild(child); - } - // if it is a facet, add as a facet - else - { - viewRoot.addFacet(facetName, child); - } - } - } - } - - private void recurseDOMModel(final Node node, final ComponentInfo parent, - final IDocument document, - XMLViewObjectConstructionStrategy objectConstructionStrategy) - { - ViewObject mappedObject = null; - - objectConstructionStrategy.getConstructionData().setParent(parent); - - mappedObject = _adapter.mapToViewObject(node, - objectConstructionStrategy, document); - - ComponentInfo newParent = parent; - - if (mappedObject instanceof ComponentInfo) - { - parent.addChild((ComponentInfo) mappedObject); - newParent = (ComponentInfo) mappedObject; - } - - final NodeList children = node.getChildNodes(); - final int numChildren = children.getLength(); - - for (int i = 0; i < numChildren; i++) - { - recurseDOMModel(children.item(i), newParent, document, - objectConstructionStrategy); - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/XMLViewDefnAdapter.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/XMLViewDefnAdapter.java deleted file mode 100644 index 842f92ccb..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/XMLViewDefnAdapter.java +++ /dev/null @@ -1,319 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.jface.text.IDocument; -import org.eclipse.jst.jsf.common.runtime.internal.model.ViewObject; -import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentInfo; -import org.eclipse.jst.jsf.common.runtime.internal.model.datatypes.ELExpression; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagElement; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.Namespace; -import org.eclipse.jst.jsf.context.IModelContext; -import org.eclipse.jst.jsf.context.resolver.structureddocument.IDOMContextResolver; -import org.eclipse.jst.jsf.context.resolver.structureddocument.IStructuredDocumentContextResolverFactory; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContextFactory; -import org.eclipse.jst.jsf.designtime.context.DTFacesContext; -import org.eclipse.jst.jsf.designtime.internal.view.IDTViewHandler.ViewHandlerException; -import org.eclipse.jst.jsf.designtime.internal.view.XMLViewObjectMappingService.ElementData; -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode; -import org.w3c.dom.Attr; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; - -/** - * A view definition adapter base class for view definition that use XML to - * define the view. - * - * @author cbateman - * - */ -public abstract class XMLViewDefnAdapter extends - AbstractViewDefnAdapter<Node, IDocument> -{ - private static final String GENERATED_ID = "_generatedId"; - - @Override - public abstract IDocument getContainer(DTFacesContext context, String viewId); - - @Override - public String getId(final Node viewDefnObject) - throws IllegalArgumentException - { - if (viewDefnObject instanceof Element) - { - return ((Element) viewDefnObject).getAttribute("id"); - } - throw new IllegalArgumentException( - "Only Elements can define view object ids"); - } - - @Override - public ViewObject mapToViewObject( - final Node viewDefnObject, - final ViewObjectConstructionStrategy<? extends Node> constructionData, - final IDocument document) - { - switch (viewDefnObject.getNodeType()) - { - case Node.ELEMENT_NODE: - return createFromElement( - (Element) viewDefnObject, - (ViewObjectConstructionStrategy<Element>) constructionData, - document); - } - - return null; - } - - /** - * @param viewDefnObject - * @param viewContainer - * @return the tag element corresponding to viewDefnObject in the context of - * viewContainer or null if not found. Node must be an Element in - * order for this work. - */ - public ITagElement mapToTagElement(final Node viewDefnObject, - final IDocument viewContainer) - { - if (viewDefnObject instanceof Element) - { - return findTagElement((Element) viewDefnObject, viewContainer); - } - return null; - } - - @Override - public List<Node> getViewDefnRoots(final IDocument container) - { - final List<Node> roots = new ArrayList<Node>(); - - final IStructuredDocumentContext context = IStructuredDocumentContextFactory.INSTANCE - .getContext(container, -1); - - if (context != null) - { - final IDOMContextResolver resolver = IStructuredDocumentContextResolverFactory.INSTANCE - .getDOMContextResolver(context); - - if (resolver != null) - { - final Document doc = resolver.getDOMDocument(); - - if (doc != null) - { - roots.add(doc); - } - } - } - - return roots; - } - - @Override - public ViewObject findViewObject(final Node viewDefnObject, - final ComponentInfo root) - { - if (root instanceof DTUIViewRoot && viewDefnObject instanceof Element) - { - final IAdaptable services = ((DTUIViewRoot) root).getServices(); - final Object serviceAdapter = services - .getAdapter(XMLViewObjectMappingService.class); - if (serviceAdapter instanceof XMLViewObjectMappingService) - { - final IStructuredDocumentContext context = getContext(viewDefnObject); - - if (context != null) - { - final String uri = getNamespace((Element) viewDefnObject, - context.getStructuredDocument()); - final ElementData elementData = XMLViewObjectMappingService - .createElementData(uri, viewDefnObject - .getLocalName(), context, - Collections.EMPTY_MAP); - return ((XMLViewObjectMappingService) serviceAdapter) - .findViewObject(elementData); - } - } - } - return null; - } - - private IStructuredDocumentContext getContext(final Node viewDefnObject) - { - if (viewDefnObject instanceof IDOMNode) - { - final IStructuredDocument sdoc = ((IDOMNode) viewDefnObject) - .getStructuredDocument(); - return IStructuredDocumentContextFactory.INSTANCE.getContext(sdoc, - viewDefnObject); - } - return null; - } - - @Override - public Node findViewDefn(final ViewObject viewObject, - final ComponentInfo root) - { - // TODO Auto-generated method stub - return null; - } - - @Override - public abstract DTELExpression getELExpression(IModelContext context) - throws ViewHandlerException; - - // TODO: need to extend to other objects - /** - * @param element - * @param constructionData - * @param document - * @return the component info for element - */ - protected ViewObject createFromElement(final Element element, - final ViewObjectConstructionStrategy<Element> constructionData, - final IDocument document) - { - final ITagElement tagElement = findTagElement(element, document); - return constructionData.createViewObject(element, tagElement); - } - - /** - * @param element - * @param doc - * @return the namespace uri for element in doc - */ - public abstract String getNamespace(Element element, IDocument doc); - - /** - * @param namespace - * @param doc - * @return the prefix in doc for namespace or null if none. - */ - public abstract String getPrefix(final String namespace, IDocument doc); - - /** - * @param node - * @param document - * @return the tag element for node in document or null if none - */ - protected abstract ITagElement findTagElement(final Element node, - final IDocument document); - - /** - * @param nodeName - * @param lib - * @return the tag element with local name nodeName in lib or null if none. - */ - protected static ITagElement findTagElement(final String nodeName, - final Namespace lib) - { - return lib.getViewElement(nodeName); - } - - /** - * @param namespaces - * @param uri - * @return the namespace object in namespaces with uri, 'uri', or null if - * none. - */ - protected static Namespace getTaglib( - final Collection<? extends Namespace> namespaces, final String uri) - { - for (final Namespace namespace : namespaces) - { - if (uri.equals(namespace.getNSUri())) - { - return namespace; - } - } - return null; - } - - /** - * @return the prefix string to which a running count will be added to - * produced the default generated id - */ - public String getGeneratedIdPrefix() - { - return GENERATED_ID; - } - - /** - * @param element - * @param componentAttrName - * @return the attribute on element matching the component attribute called - * componentAttrName or null if not found (this may indicate either - * no such attribute or that it simply not populated on element; no - * guarantee is made as to which it is) - */ - public Attr mapAttributeToComponent(final Element element, - final String componentAttrName) - { - // TODO: need to make meta-data type driven and validate bad conversion - - final boolean mapByBeanName = true; // TODO: getMetadata for mapping - // instead - - if (mapByBeanName) - { - return element.getAttributeNode(componentAttrName); - } - - return null; - } - - /** - * A design time EL expression - * - */ - public static class DTELExpression extends ELExpression - { - private final IStructuredDocumentContext _documentContext; - private final String _originalText; - - /** - * @param doc - * @param text - */ - public DTELExpression(final IStructuredDocumentContext doc, - final String text) - { - _documentContext = doc; - _originalText = text; - } - - @Override - public String getText() - { - return _originalText; - } - - /** - * @return the document context. The document relative position of the - * start of the EL expression is used - * - */ - public IStructuredDocumentContext getDocumentContext() - { - return _documentContext; - } - - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/XMLViewObjectConstructionStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/XMLViewObjectConstructionStrategy.java deleted file mode 100644 index a30295a21..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/XMLViewObjectConstructionStrategy.java +++ /dev/null @@ -1,519 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import org.eclipse.jdt.core.Signature; -import org.eclipse.jface.text.IDocument; -import org.eclipse.jst.jsf.common.internal.types.TypeConstants; -import org.eclipse.jst.jsf.common.runtime.internal.model.ViewObject; -import org.eclipse.jst.jsf.common.runtime.internal.model.behavioural.ActionSourceInfo; -import org.eclipse.jst.jsf.common.runtime.internal.model.behavioural.ActionSourceInfo2; -import org.eclipse.jst.jsf.common.runtime.internal.model.behavioural.EditableValueHolderInfo; -import org.eclipse.jst.jsf.common.runtime.internal.model.behavioural.INamingContainerInfo; -import org.eclipse.jst.jsf.common.runtime.internal.model.behavioural.ValueHolderInfo; -import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentFactory; -import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentInfo; -import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentTypeInfo; -import org.eclipse.jst.jsf.common.runtime.internal.model.decorator.ConverterDecorator; -import org.eclipse.jst.jsf.common.runtime.internal.model.decorator.ConverterTypeInfo; -import org.eclipse.jst.jsf.common.runtime.internal.model.decorator.ValidatorDecorator; -import org.eclipse.jst.jsf.common.runtime.internal.model.decorator.ValidatorTypeInfo; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.IComponentPropertyHandler; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.IComponentTagElement; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.IConverterTagElement; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagAttributeHandler; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagElement; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.IValidatorTagElement; -import org.eclipse.jst.jsf.common.util.JDTBeanProperty; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContextFactory; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.designtime.internal.view.XMLViewObjectMappingService.ElementData; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.ICustomViewMapper; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.ICustomViewMapper.PropertyMapping; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.CustomViewMapperExtensionLoader; -import org.w3c.dom.Attr; -import org.w3c.dom.Element; -import org.w3c.dom.NamedNodeMap; - -/** - * A strategy for constructing view objects. - * - * @author cbateman - * - */ -public class XMLViewObjectConstructionStrategy extends - ViewObjectConstructionStrategy<Element> -{ - private static final String GENERATED_ID = "_generatedId"; - private final ComponentConstructionData _constructionData; - private final XMLViewDefnAdapter _adapter; - private final XMLViewObjectMappingService _mappingService; - - /** - * @param adapter - * MUST NOT BE NULL - * @param constructionData - * MUST NOT BE NULL - * @param mappingService - * MAY BE NULL - */ - public XMLViewObjectConstructionStrategy(final XMLViewDefnAdapter adapter, - final ComponentConstructionData constructionData, - final XMLViewObjectMappingService mappingService) - { - super(); - if (adapter == null || constructionData == null) - { - throw new IllegalArgumentException( - "adapter and constructionData must not be null"); - } - _constructionData = constructionData; - _adapter = adapter; - _mappingService = mappingService; - } - - @Override - public ViewObject createViewObject(final Element element, - final ITagElement tagElement) - { - try - { - if (tagElement instanceof IComponentTagElement) - { - String id = null; - - // only generate ids for non-viewroot components. This will - // make the generated id's more faithful to runtime since the - // running count won't be incremented for view roots (as they - // won't at runtime). - final ComponentTypeInfo typeInfo = ((IComponentTagElement) tagElement) - .getComponent(); - - if (!"javax.faces.ViewRoot".equals(typeInfo.getComponentType())) - { - id = calculateId(element, _constructionData); - } - return findBestComponent(tagElement.getUri(), element, id, - (IComponentTagElement) tagElement); - } - else if (tagElement instanceof IConverterTagElement) - { - final ConverterTypeInfo typeInfo = ((IConverterTagElement) tagElement) - .getConverter(); - // TODO: validate when no parent - ComponentInfo parent = _constructionData.getParent(); - parent = findFirstParent( - ComponentFactory.INTERFACE_VALUEHOLDER, parent); - if (parent != null) - { - parent.addDecorator( - new ConverterDecorator(parent, typeInfo), - ComponentFactory.CONVERTER); - } - // TODO: else validate problem - } - else if (tagElement instanceof IValidatorTagElement) - { - final ValidatorTypeInfo typeInfo = ((IValidatorTagElement) tagElement) - .getValidator(); - ComponentInfo parent = _constructionData.getParent(); - parent = findFirstParent( - ComponentFactory.INTERFACE_EDITABLEVALUEHOLDER, parent); - if (parent != null) - { - parent.addDecorator( - new ValidatorDecorator(parent, typeInfo), - ComponentFactory.VALIDATOR); - } - // TODO :else validate problem - } - } - catch (final Exception e) - { - // log and ignore if an individual construction fails - JSFCorePlugin.log(e, "Error constructing view object"); - } - return null; - } - - private ComponentInfo findFirstParent(final String matchingType, - final ComponentInfo start) - { - ComponentInfo parent = start; - - while (parent != null && parent.getComponentTypeInfo() != null - && !parent.getComponentTypeInfo().isInstanceOf(matchingType)) - { - parent = parent.getParent(); - } - return parent; - } - - private ComponentInfo findBestComponent(final String uri, - final Element srcElement, final String id, - final IComponentTagElement tagElement) - { - ComponentInfo bestComponent = null; - - final ComponentInfo parent = _constructionData.getParent(); - - final Map<String, Object> initMap = new HashMap<String, Object>(); - final Map<String, String> attributeToPropertyMap = new HashMap<String, String>(); - populateInitMap(uri, initMap, srcElement, tagElement, - attributeToPropertyMap); - - if (initMap.get("id") == null) - { - // id must be set - initMap.put("id", id); - } - - final ComponentTypeInfo typeInfo = tagElement.getComponent(); - - // if we have a well-established base type, try that first - // sub-classes must occur before superclasses to ensure most accurate - // detection. - if (typeInfo.isInstanceOf(ComponentFactory.BASE_CLASS_UIINPUT)) - { - bestComponent = ComponentFactory.createUIInputInfo(parent, - typeInfo, initMap); - } - else if (typeInfo.isInstanceOf(ComponentFactory.BASE_CLASS_UIOUTPUT)) - { - bestComponent = ComponentFactory.createUIOutputInfo(parent, - typeInfo, initMap); - } - else if (typeInfo.isInstanceOf(ComponentFactory.BASE_CLASS_UICOMMAND)) - { - bestComponent = ComponentFactory.createUICommandInfo(parent, - typeInfo, initMap); - } - else if (typeInfo.isInstanceOf(ComponentFactory.BASE_CLASS_UIDATA)) - { - bestComponent = ComponentFactory.createUIDataInfo(parent, typeInfo, - initMap); - } - else if (typeInfo.isInstanceOf(ComponentFactory.BASE_CLASS_UIFORM)) - { - // TODO: how handle prepend ids? - bestComponent = ComponentFactory.createUIFormInfo(parent, typeInfo, - initMap); - } - else - { - // default - bestComponent = ComponentFactory.createComponentInfo( - _constructionData.getParent(), typeInfo, initMap); - } - - addTypeAdapters(bestComponent); - maybeMapXMLToViewObjects(bestComponent, srcElement, - attributeToPropertyMap, _constructionData.getDocument()); - maybeUpdateViewObject(bestComponent, srcElement, tagElement); - return bestComponent; - } - - // TODO: move to view definition adapter? - private void populateInitMap(final String uri, - final Map<String, Object> initMap, final Element srcElement, - final IComponentTagElement tagElement, - final Map<String, String> attributeToPropertyMap) - { - final ComponentTypeInfo typeInfo = tagElement.getComponent(); - final Map<String, JDTBeanProperty> properties = DTComponentIntrospector - .getBeanProperties(typeInfo, _constructionData.getProject()); - final Map<String, ITagAttributeHandler> attributeHandlers = tagElement - .getAttributeHandlers(); - - final NamedNodeMap nodeMap = srcElement.getAttributes(); - - if (nodeMap != null && attributeHandlers != null) - { - for (int i = 0; i < nodeMap.getLength(); i++) - { - final Attr attr = (Attr) nodeMap.item(i); - if (attr != null) - { - final String name = attr.getLocalName(); - - if (name != null) - { - final ITagAttributeHandler attrHandler = attributeHandlers - .get(name); - if (attrHandler instanceof IComponentPropertyHandler) - { - mapComponentProperty(uri, srcElement, properties, - (IComponentPropertyHandler) attrHandler, - attr, name, initMap, attributeHandlers, - attributeToPropertyMap); - } - } - } - } - } - } - - private void mapComponentProperty(final String uri, - final Element srcElement, - final Map<String, JDTBeanProperty> properties, - final IComponentPropertyHandler attrHandler, final Attr attr, - final String attributeName, final Map initMap, - final Map<String, ITagAttributeHandler> attributeHandlers, - final Map<String, String> attributeToPropertyMap) - { - final String propertyName = attrHandler.getPropertyName(); - if (properties.containsKey(propertyName)) - { - final String id = attrHandler.getCustomHandler(); - - ICustomViewMapper mapper = null; - - if (id != null) - { - mapper = CustomViewMapperExtensionLoader - .getCustomViewMapper(id); - if (mapper != null) - { - final PropertyMapping mapping = mapper - .mapToComponentProperty(uri, srcElement, attr); - if (mapping != null) - { - initMap.put(mapping.getName(), mapping.getProperty()); - attributeToPropertyMap.put(attributeName, mapping - .getName()); - return; - } - } - } - - final String value = attr.getValue(); - if (value != null) - { - final Object convertedValue = convertFromString(value, - properties.get(propertyName)); - initMap.put(propertyName, convertedValue); - } - attributeToPropertyMap.put(attributeName, propertyName); - } - } - - private void maybeMapXMLToViewObjects(final ViewObject mappedObject, - final Element node, - final Map<String, String> attributeToProperties, - final IDocument document) - { - if (mappedObject != null && _mappingService != null) - { - final String uri = _adapter.getNamespace(node, document); - final IStructuredDocumentContext context = IStructuredDocumentContextFactory.INSTANCE - .getContext(document, node); - final ElementData elementData = XMLViewObjectMappingService - .createElementData(uri, node.getLocalName(), context, - attributeToProperties); - - _mappingService.createMapping(elementData, mappedObject); - } - } - - private void maybeUpdateViewObject(final ComponentInfo bestComponent, - final Element srcElement, final ITagElement tagElement) - { - if (srcElement.getAttributes() == null) - return; - - for (int i = 0; i < srcElement.getAttributes().getLength(); i++) - { - final Attr attr = (Attr) srcElement.getAttributes().item(i); - final Map<String, ITagAttributeHandler> attributeHandlers = tagElement - .getAttributeHandlers(); - - if (attributeHandlers != null) - { - final ITagAttributeHandler handler = attributeHandlers.get(attr - .getLocalName()); - - if (handler != null) - { - final String id = handler.getCustomHandler(); - - ICustomViewMapper mapper = null; - - if (id != null) - { - mapper = CustomViewMapperExtensionLoader - .getCustomViewMapper(id); - if (mapper != null) - { - mapper.doAttributeActions(bestComponent, - srcElement, attr); - } - } - } - } - } - } - - private Object convertFromString(final String convertValue, - final JDTBeanProperty ofThisType) - { - final String signature = ofThisType.getTypeSignature(); - - Object result = null; - switch (Signature.getTypeSignatureKind(signature)) - { - case Signature.BASE_TYPE_SIGNATURE: - result = convertFromBaseType(convertValue, signature); - break; - - case Signature.CLASS_TYPE_SIGNATURE: - if (TypeConstants.TYPE_STRING.equals(signature)) - { - result = convertValue; - } - else if (TypeConstants.TYPE_JAVAOBJECT.equals(signature)) - { - result = convertValue; - } - break; - } - - return result; - } - - // TODO: does this belong somewhere else? - private Object convertFromBaseType(final String convertValue, - final String signature) - { - if (Signature.SIG_BOOLEAN.equals(signature)) - { - return Boolean.valueOf(convertValue); - } - else if (Signature.SIG_INT.equals(signature) - || Signature.SIG_BYTE.equals(signature) - || Signature.SIG_SHORT.equals(signature)) - { - try - { - return Integer.valueOf(convertValue); - } - catch (final NumberFormatException nfe) - { - return null; - } - } - else if (Signature.SIG_LONG.equals(convertValue)) - { - try - { - return Long.valueOf(convertValue); - } - catch (final NumberFormatException nfe) - { - return null; - } - } - - return null; - } - - private void addTypeAdapters(final ComponentInfo component) - { - final String[] interfaceNames = component.getComponentTypeInfo() - .getInterfaces(); - final Set interfaceNameSets = new HashSet(); - - for (final String interfaceName : interfaceNames) - { - interfaceNameSets.add(interfaceName); - } - - // don't replace intrinsic adapters - if (interfaceNameSets.contains(ComponentFactory.INTERFACE_ACTIONSOURCE)) - { - // an ActionSource2 is-a ActionSource - if (interfaceNameSets - .contains(ComponentFactory.INTERFACE_ACTIONSOURCE2) - && component.getAdapter(ComponentFactory.ACTION_SOURCE2) == null) - { - component.addAdapter(ComponentFactory.ACTION_SOURCE2, - new ActionSourceInfo2(null, null, false, null)); - } - - if (component.getAdapter(ComponentFactory.ACTION_SOURCE) == null) - { - component.addAdapter(ComponentFactory.ACTION_SOURCE, - new ActionSourceInfo(null, null, false)); - } - } - - if (interfaceNameSets.contains(ComponentFactory.INTERFACE_VALUEHOLDER)) - { - // a EditableValueHolder is-a ValueHolder - if (interfaceNameSets - .contains(ComponentFactory.INTERFACE_EDITABLEVALUEHOLDER) - && component - .getAdapter(ComponentFactory.EDITABLE_VALUE_HOLDER) == null) - { - component.addAdapter(ComponentFactory.EDITABLE_VALUE_HOLDER, - new EditableValueHolderInfo(null, null, null, false, - false, true, false, null, null, null)); - } - - if (component.getAdapter(ComponentFactory.VALUE_HOLDER) == null) - { - component.addAdapter(ComponentFactory.VALUE_HOLDER, - new ValueHolderInfo(null, null, null)); - } - } - - if (interfaceNameSets - .contains(ComponentFactory.INTERFACE_NAMINGCONTAINER) - && component.getAdapter(ComponentFactory.NAMING_CONTAINER) == null) - { - component.addAdapter(ComponentFactory.NAMING_CONTAINER, - INamingContainerInfo.ADAPTER); - } - } - - /** - * @param element - * @param constructionData - * @return the id for element either derived from the element using getId or - * if not present, using a generation algorithm - */ - protected String calculateId(final Element element, - final ComponentConstructionData constructionData) - { - final String id = _adapter.getId(element); - if (id != null) - { - return id; - } - // TODO: improve this - final String prefix = _adapter.getGeneratedIdPrefix(); - return (prefix != null ? prefix : GENERATED_ID) - + constructionData.increment(); - } - - /** - * @return the construction data for this strategy - */ - public final ComponentConstructionData getConstructionData() - { - return _constructionData; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/XMLViewObjectMappingService.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/XMLViewObjectMappingService.java deleted file mode 100644 index 362fc56b3..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/XMLViewObjectMappingService.java +++ /dev/null @@ -1,382 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view; - -import java.io.IOException; -import java.io.Serializable; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.Path; -import org.eclipse.jst.jsf.common.dom.TagIdentifier; -import org.eclipse.jst.jsf.common.runtime.internal.model.ViewObject; -import org.eclipse.jst.jsf.context.resolver.structureddocument.IStructuredDocumentContextResolverFactory; -import org.eclipse.jst.jsf.context.resolver.structureddocument.IWorkspaceContextResolver; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.core.internal.region.Region2ElementAdapter; -import org.eclipse.jst.jsf.core.internal.region.Region2ElementAdapter.NoElementException; -import org.eclipse.jst.jsf.core.internal.tld.TagIdentifierFactory; -import org.eclipse.wst.sse.core.StructuredModelManager; -import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument; -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion; -import org.w3c.dom.Element; - -/** - * @author cbateman - * - */ -public final class XMLViewObjectMappingService implements Serializable -{ - /** - * - */ - private static final long serialVersionUID = -5371998199186683997L; - private final Map<ElementData, ViewObject> _elementToViewObjMap; - private final Map<ViewObject, ElementData> _viewObjToElementMap; - - /** - * - */ - public XMLViewObjectMappingService() - { - _elementToViewObjMap = new HashMap<ElementData, ViewObject>(); - _viewObjToElementMap = new HashMap<ViewObject, ElementData>(); - } - - /** - * @param elementData - * @param viewObject - */ - public void createMapping(final ElementData elementData, - final ViewObject viewObject) - { - if (elementData == null) - { - throw new IllegalArgumentException("elementData cannot be null"); - } - else if (viewObject == null) - { - throw new IllegalArgumentException("viewObject cannot be null"); - } - - synchronized(this) - { - _elementToViewObjMap.put(elementData, viewObject); - _viewObjToElementMap.put(viewObject, elementData); - } - } - - /** - * Remove all mappings - */ - public void clearMappings() - { - synchronized (this) - { - _elementToViewObjMap.clear(); - _viewObjToElementMap.clear(); - } - } - - /** - * @param elementData - * @return the view object for which the mapping was removed - */ - public ViewObject removeMapping(final ElementData elementData) - { - if (elementData == null) - { - throw new IllegalArgumentException("elementData mustn't be null"); - } - - ViewObject viewObject = null; - synchronized(this) - { - viewObject = _elementToViewObjMap.remove(elementData); - if (viewObject != null) - { - _viewObjToElementMap.remove(viewObject); - } - } - return viewObject; - } - - /** - * @param viewObject - * @return the element data for which the mapping was removed - */ - public ElementData removeMapping(final ViewObject viewObject) - { - if (viewObject == null) - { - throw new IllegalArgumentException("elementData mustn't be null"); - } - - ElementData elementData = null; - synchronized(this) - { - elementData = _viewObjToElementMap.remove(viewObject); - if (elementData != null) - { - _elementToViewObjMap.remove(elementData); - } - } - return elementData; - } - - /** - * @param viewObject - * @return the element data for the view object - */ - public synchronized ElementData findElementData(final ViewObject viewObject) - { - return _viewObjToElementMap.get(viewObject); - } - - /** - * @param viewObject - * @return the element for the viewObject - */ - public Element findElement(final ViewObject viewObject) - { - final ElementData elementData = findElementData(viewObject); - - if (elementData != null) - { - final IFile file = ResourcesPlugin.getWorkspace().getRoot() - .getFile(new Path(elementData.getDocumentPath())); - - if (file != null && file.isAccessible()) - { - IStructuredModel model = null; - try - { - model = StructuredModelManager.getModelManager() - .getModelForRead(file); - final IStructuredDocument sDoc = model - .getStructuredDocument(); - final IStructuredDocumentRegion region = sDoc - .getRegionAtCharacterOffset(elementData - .getStartOffset()); - final Region2ElementAdapter adapter = new Region2ElementAdapter( - region); - final TagIdentifier tagId = adapter.getTagId(); - if (tagId.equals(elementData.getTagId())) - { - return adapter.getElement(); - } - } - catch (CoreException ce) - { - JSFCorePlugin.log(ce, - "While finding element for viewObject: " - + viewObject.toString() + " in " - + file.getFullPath()); - } - catch (IOException e) - { - JSFCorePlugin.log(e, - "While finding element for viewObject: " - + viewObject.toString() + " in " - + file.getFullPath()); - } - catch (NoElementException e) - { - JSFCorePlugin.log(e, - "While finding element for viewObject: " - + viewObject.toString() + " in " - + file.getFullPath()); - } - finally - { - if (model != null) - { - model.releaseFromRead(); - } - } - } - } - return null; - } - - /** - * @param elementData - * @return the mapped view object for elementData or null if not found. - */ - public synchronized ViewObject findViewObject(final ElementData elementData) - { - return _elementToViewObjMap.get(elementData); - } - - /** - * @param namespace - * @param tagName - * @param context - * @param attributeToPropertyMap - * @return a new Element data for the namespace/element name in 'context' - */ - public static ElementData createElementData(final String namespace, - final String tagName, final IStructuredDocumentContext context, - final Map<String, String> attributeToPropertyMap) - { - final IFile file = getFile(context); - final int offset = context.getDocumentPosition(); - - if (file != null && file.isAccessible() && offset > -1 - && tagName != null && namespace != null) - { - return new ElementData(offset, file.getFullPath().toString(), - TagIdentifierFactory - .createJSPTagWrapper(namespace, tagName), - attributeToPropertyMap); - } - return null; - } - - private static IFile getFile(final IStructuredDocumentContext context) - { - final IWorkspaceContextResolver resolver = IStructuredDocumentContextResolverFactory.INSTANCE - .getWorkspaceContextResolver(context); - IResource res = resolver.getResource(); - if (res instanceof IFile) - { - return (IFile) res; - } - // fall through. - return null; - } - - /** - * Describes enough information about an element instance to look it up - * again, without storing possibly transient references to it. - * - * @author cbateman - * - */ - public final static class ElementData implements Serializable - { - /** - * serializable id - */ - private static final long serialVersionUID = 7937312530318827977L; - - private transient TagIdentifier _tagId; - private Map<String, String> _attributeToPropertyMap; - private String _documentPath; - private int _startOffset; - - /** - * @param startOffset - * @param documentPath - * @param tagId - * @param attributeToPropertyMap constructor takes copy of map - */ - private ElementData(final int startOffset, final String documentPath, - final TagIdentifier tagId, Map<String, String> attributeToPropertyMap) - { - super(); - _startOffset = startOffset; - - _tagId = tagId; - _documentPath = documentPath; - _attributeToPropertyMap = Collections.unmodifiableMap( - new HashMap<String,String>(attributeToPropertyMap)); - } - - /** - * Default constructor - */ - protected ElementData() - { - // for serialization - } - - /** - * @return the tag identifier for this element - */ - public final TagIdentifier getTagId() - { - return _tagId; - } - - /** - * @param forTagAttribute - * @return the name of the view object property that forTagAttribute - * maps to on this element or null if none. - */ - public final String getPropertyName(final String forTagAttribute) - { - return _attributeToPropertyMap.get(forTagAttribute); - } - - final int getStartOffset() - { - return _startOffset; - } - - final String getDocumentPath() - { - return _documentPath; - } - - private void writeObject(final java.io.ObjectOutputStream out) - throws IOException - { - out.defaultWriteObject(); - out.writeObject(_tagId.getUri()); - out.writeObject(_tagId.getTagName()); - } - - private void readObject(final java.io.ObjectInputStream in) - throws IOException, ClassNotFoundException - { - in.defaultReadObject(); - final String uri = (String) in.readObject(); - final String tagName = (String) in.readObject(); - _tagId = TagIdentifierFactory.createJSPTagWrapper(uri, tagName); - } - - @Override - public boolean equals(final Object obj) - { - if (this == obj) - { - return true; - } - if (obj instanceof ElementData) - { - final ElementData other = (ElementData) obj; - return _startOffset == other._startOffset - && _documentPath.equals(other._documentPath) - && _tagId.equals(other._tagId); - } - return false; - } - - @Override - public int hashCode() - { - int hashCode = _tagId.hashCode(); - hashCode ^= _documentPath.hashCode(); - // startOffsets will generally fit in the first 10 bits, so mix - // it up a bit. - hashCode ^= ~(_startOffset * 104551); - return hashCode; - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/AbstractCustomViewMapper.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/AbstractCustomViewMapper.java deleted file mode 100644 index f50a460e8..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/AbstractCustomViewMapper.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.mapping; - -import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentInfo; -import org.w3c.dom.Attr; -import org.w3c.dom.Element; - -/** - * Must be sub-classed by all ICustomViewMapper's. - * - * @author cbateman - * - */ -public abstract class AbstractCustomViewMapper implements ICustomViewMapper -{ - public abstract PropertyMapping mapToComponentProperty(final String uri, - final Element srcElement, final Attr attr); - - public abstract void doAttributeActions(final ComponentInfo bestComponent, - final Element srcElement, final Attr attr); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/CustomViewMappingAdapter.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/CustomViewMappingAdapter.java deleted file mode 100644 index 4d3830bf3..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/CustomViewMappingAdapter.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.mapping; - -import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentInfo; -import org.w3c.dom.Attr; -import org.w3c.dom.Element; - -/** - * A no-op implementation that sub-classes can selectively override. - * - * @author cbateman - * - */ -public class CustomViewMappingAdapter extends AbstractCustomViewMapper -{ - - @Override - public void doAttributeActions(ComponentInfo bestComponent, - Element srcElement, Attr attr) - { - // do nothing - } - - @Override - public PropertyMapping mapToComponentProperty(String uri, - Element srcElement, Attr attr) - { - // no mappings - return null; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/ICustomViewMapper.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/ICustomViewMapper.java deleted file mode 100644 index 954167e59..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/ICustomViewMapper.java +++ /dev/null @@ -1,83 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.mapping; - -import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentInfo; -import org.w3c.dom.Attr; -import org.w3c.dom.Element; - -/** - * A custom view mapper to map from elements and attributes to view objects and - * properties. - * - * @author cbateman - * - */ -public interface ICustomViewMapper -{ - /** - * @param uri - * @param srcElement - * @param attr - * @return the name/value of the component property or null if no mapping. - */ - PropertyMapping mapToComponentProperty(final String uri, - final Element srcElement, final Attr attr); - - /** - * Allows a mapper to make updates to a component based on its attribute. - * May choose to do nothing. - * - * @param bestComponent - * @param srcElement - * @param attr - */ - void doAttributeActions(ComponentInfo bestComponent, Element srcElement, - Attr attr); - - /** - * The name/value pair of a component property mapping. - * - * @author cbateman - * - */ - public static class PropertyMapping - { - private final String _name; - private final Object _property; - - /** - * @param name - * @param property - */ - public PropertyMapping(final String name, final Object property) - { - _name = name; - _property = property; - } - - /** - * @return the property name - */ - public final String getName() - { - return _name; - } - - /** - * @return the property value - */ - public final Object getProperty() - { - return _property; - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/ViewMetadataGenerator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/ViewMetadataGenerator.java deleted file mode 100644 index 919d54f28..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/ViewMetadataGenerator.java +++ /dev/null @@ -1,202 +0,0 @@ -package org.eclipse.jst.jsf.designtime.internal.view.mapping; - -import java.io.IOException; -import java.io.OutputStream; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; -import org.eclipse.emf.ecore.util.BasicExtendedMetaData; -import org.eclipse.emf.ecore.util.ExtendedMetaData; -import org.eclipse.emf.ecore.xmi.XMLHelper; -import org.eclipse.emf.ecore.xmi.XMLResource; -import org.eclipse.emf.ecore.xmi.impl.XMLHelperImpl; -import org.eclipse.emf.ecore.xmi.impl.XMLResourceFactoryImpl; -import org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl; -import org.eclipse.jst.jsf.common.metadata.Entity; -import org.eclipse.jst.jsf.common.metadata.MetadataFactory; -import org.eclipse.jst.jsf.common.metadata.MetadataPackage; -import org.eclipse.jst.jsf.common.metadata.Model; -import org.eclipse.jst.jsf.common.metadata.Trait; -import org.eclipse.jst.jsf.common.runtime.internal.model.types.ClassTypeInfo; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ClassTypeInfo_; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingFactory; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagMapping; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagToViewObjectMapping; - -/** - * Generates View metadata from common.runtime objects. - * - * @author cbateman - * - */ -public class ViewMetadataGenerator -{ - private final ResourceSet _resourceSet; - private final ExtendedMetaData _extendedMetadata; - private final Model _root; - private final ViewMetadataMapper _mapper; - - /** - * @param uri - */ - public ViewMetadataGenerator(final String uri) - { - _root = MetadataFactory.eINSTANCE.createModel(); - _root.setId(uri); - _root.setType("tagFile"); - _resourceSet = new ResourceSetImpl(); - _mapper = new ViewMetadataMapper(); - _extendedMetadata = new BasicExtendedMetaData(_resourceSet - .getPackageRegistry()); - - // Register the appropriate resource factory to handle all file - // extensions. - // - _resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap() - .put(Resource.Factory.Registry.DEFAULT_EXTENSION, - new XMLResourceFactoryImpl()); - } - - /** - * The format of the strings should match OSGI version: - * - * MAJOR . MINOR . BUILD . QUALIFIER - * - * @param tagName - * @param typeInfo - * @param minJSFVersion - * the minimum JSF version, null for DEFAULT. - * @param minLibVersion - * the minimum library version, null for NONE. - */ - public void addTagToViewObjectMapping(final String tagName, - final ClassTypeInfo typeInfo, final String minJSFVersion, - final String minLibVersion) - { - final ClassTypeInfo_ metadata = _mapper.mapToMetadata(typeInfo); - - if (metadata != null) - { - final TagToViewObjectMapping viewMapping = - ComponentMappingFactory.eINSTANCE.createTagToViewObjectMapping(); - if (minJSFVersion != null) - { - viewMapping.setMinJSFVersion(minJSFVersion); - } - viewMapping.setMinLibraryVersion(minLibVersion); - viewMapping.setTypeInfo(metadata); - - final TagMapping tagMapping = findOrCreateTagMapping(tagName); - tagMapping.getVersionedTagToViewMappings().add(viewMapping); - - final Trait trait = MetadataFactory.eINSTANCE.createTrait(); - trait.setId(ViewMetadataMapper.DEFAULT_MAPPING_TRAIT_ID); - trait.setValue(tagMapping); - - final Entity entity = MetadataFactory.eINSTANCE.createEntity(); - entity.setId(tagName); - entity.setType("tag"); - entity.getTraits().add(trait); - - _root.getChildEntities().add(entity); - } - } - - private TagMapping findOrCreateTagMapping(final String tagName) - { - for (final Entity entity : (List<Entity>)_root.getChildEntities()) - { - if (entity.getId().equals(tagName)) - { - for (final Trait trait : (List<Trait>)entity.getTraits()) - { - if (trait.getId().equals(ViewMetadataMapper.DEFAULT_MAPPING_TRAIT_ID)) - { - return (TagMapping) trait.getValue(); - } - } - } - } - return ComponentMappingFactory.eINSTANCE.createTagMapping(); - } - - /** - * @param out - * @throws IOException - */ - public void save(final OutputStream out) throws IOException - { - final Resource res = new XMLResourceImpl() - { - @Override - protected XMLHelper createXMLHelper() - { - return new XMLHelperImpl() - { - public String getHREF(EObject obj) - { - return ComponentMappingPackage.eNS_URI; - } - - @Override - public EPackage getNoNamespacePackage() - { - return MetadataPackage.eINSTANCE; - } - }; - } - };// _resourceSet.createResource(URI.createURI("foo.xml")); - res.getContents().add(_root); - // res.setURI(uri); - // resourceSet.getResources().add(res); - // setLoadOptions(res); - Map options = new HashMap(); - options.put(XMLResource.OPTION_SCHEMA_LOCATION, Boolean.TRUE); - options.put(XMLResource.OPTION_EXTENDED_META_DATA, _extendedMetadata); - // options.put(XMLResource.OPTION_RESOURCE_HANDLER, res); - options.put(XMLResource.OPTION_LAX_FEATURE_PROCESSING, Boolean.TRUE); - options.put(XMLResource.OPTION_RECORD_UNKNOWN_FEATURE, Boolean.FALSE);// turning - // this - // off - // so - // that - // res.getErrors() - // has - // values - // to - // check! - // bizarre - // that - // I - // should - // need - // to - // do - // this. - res.save(out, options); - } - - // private void printHeader(final OutputStream out) throws IOException - // { - // final String header = "<md:metadatamodel \n" - // + "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" - // + "xmlns:ecore=\"http://www.eclipse.org/emf/2002/Ecore\"" - // + - // "xmlns:md=\"http://org.eclipse.jst.jsf.common.metadata/metadata.ecore\"" - // + - // "xmlns:mdt=\"http://org.eclipse.jst.jsf.common.metadata/metadataTraitTypes.ecore\" - // " - // + - // "xmlns:viewMap=\"http://org.eclipse.jst.jsf.core/componentMapping.ecore\"" - // + "id=\"http://java.sun.com/jsf/html\"" - // + "type\"tagFile\">"; - // out.write(header.getBytes()); - // } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/ViewMetadataLoader.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/ViewMetadataLoader.java deleted file mode 100644 index b422bb87c..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/ViewMetadataLoader.java +++ /dev/null @@ -1,96 +0,0 @@ -package org.eclipse.jst.jsf.designtime.internal.view.mapping; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.jsf.common.dom.TagIdentifier; -import org.eclipse.jst.jsf.common.metadata.Entity; -import org.eclipse.jst.jsf.common.metadata.Trait; -import org.eclipse.jst.jsf.common.metadata.query.ITaglibDomainMetaDataModelContext; -import org.eclipse.jst.jsf.common.metadata.query.TaglibDomainMetaDataQueryHelper; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.AttributeToPropertyMapping; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagMapping; - -/** - * Loader class for view metadata. - * - * @author cbateman - * - */ -public class ViewMetadataLoader -{ - private final IProject _project; - private final Map<String, ITaglibDomainMetaDataModelContext> _metadataContexts; - - /** - * @param project - */ - public ViewMetadataLoader(final IProject project) - { - _project = project; - _metadataContexts = new HashMap<String, ITaglibDomainMetaDataModelContext>(); - } - - /** - * @param tagId - * @return the tag to view object mapping metadata for a tag in a particular - * metadata context or null if not found. - */ - public TagMapping getTagToViewMapping(final TagIdentifier tagId) - { - final ITaglibDomainMetaDataModelContext modelContext = createMetadataContext(tagId - .getUri()); - final Entity entity = TaglibDomainMetaDataQueryHelper.getEntity( - modelContext, tagId.getTagName()); - if (entity != null) - { - final Trait trait = TaglibDomainMetaDataQueryHelper.getTrait( - entity, ViewMetadataMapper.DEFAULT_MAPPING_TRAIT_ID); - if (trait != null) - { - return (TagMapping) trait.getValue(); - } - } - return null; - } - - private ITaglibDomainMetaDataModelContext createMetadataContext( - final String uri) - { - ITaglibDomainMetaDataModelContext modelContext = _metadataContexts - .get(uri); - - if (modelContext == null) - { - modelContext = TaglibDomainMetaDataQueryHelper - .createMetaDataModelContext(_project, uri); - _metadataContexts.put(uri, modelContext); - } - return modelContext; - } - - /** - * @param tagId - * @param name - * @return the attribute mapping for name on tagId or null if known - */ - public AttributeToPropertyMapping getAttributeMapping( - final TagIdentifier tagId, final String name) - { - final ITaglibDomainMetaDataModelContext modelContext = createMetadataContext(tagId - .getUri()); - final Entity entity = TaglibDomainMetaDataQueryHelper.getEntity( - modelContext, tagId.getTagName()+"/"+name); - if (entity != null) - { - final Trait trait = TaglibDomainMetaDataQueryHelper.getTrait( - entity, ViewMetadataMapper.DEFAULT_ATTRIBUTE_TRAIT_ID); - if (trait != null) - { - return (AttributeToPropertyMapping) trait.getValue(); - } - } - return null; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/ViewMetadataMapper.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/ViewMetadataMapper.java deleted file mode 100644 index a4bb00f8b..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/ViewMetadataMapper.java +++ /dev/null @@ -1,170 +0,0 @@ -package org.eclipse.jst.jsf.designtime.internal.view.mapping; - -import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentTypeInfo; -import org.eclipse.jst.jsf.common.runtime.internal.model.decorator.ConverterTypeInfo; -import org.eclipse.jst.jsf.common.runtime.internal.model.decorator.ValidatorTypeInfo; -import org.eclipse.jst.jsf.common.runtime.internal.model.types.ClassTypeInfo; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ClassTypeInfo_; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingFactory; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentTypeInfo_; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ConverterTypeInfo_; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ValidatorTypeInfo_; - -/** - * Maps meta-data to and from common.runtime data. In future, we may eliminate - * this class by making the EMF meta-data structures into the common.runtime - * data. - * - * @author cbateman - * - */ -public final class ViewMetadataMapper -{ - - /** - * The default trait id where meta-data will annotated - */ - public final static String DEFAULT_MAPPING_TRAIT_ID = "viewElementMapping"; //$NON-NLS-1$ - /** - * The default trait id where meta-data will be annotated. - */ - public final static String DEFAULT_ATTRIBUTE_TRAIT_ID = "attributeMapping"; //$NON-NLS-1$ - - /** - * @param classTypeInfo - * @return a framework ClassTypeInfo equivalent to classTypeInfo or null if - * none. - */ - public ClassTypeInfo mapToFrameworkData(final ClassTypeInfo_ classTypeInfo) - { - if (classTypeInfo instanceof ComponentTypeInfo_) - { - return createComponentTypeInfo_((ComponentTypeInfo_) classTypeInfo); - } - else if (classTypeInfo instanceof ConverterTypeInfo_) - { - return createConverterTypeInfo_((ConverterTypeInfo_) classTypeInfo); - } - else if (classTypeInfo instanceof ValidatorTypeInfo_) - { - return createValidatorTypeInfo_((ValidatorTypeInfo_) classTypeInfo); - } - return null; - } - - private ClassTypeInfo createValidatorTypeInfo_( - ValidatorTypeInfo_ classTypeInfo) - { - final String[] superClasses = classTypeInfo.getSuperClasses().toArray( - new String[0]); - final String[] interfaces = classTypeInfo.getInterfaces().toArray( - new String[0]); - if (classTypeInfo.getClassName()==null && classTypeInfo.getValidatorId() == null) - { - return ValidatorTypeInfo.UNKNOWN; - } - - return new ValidatorTypeInfo(classTypeInfo.getClassName(), - superClasses, interfaces, classTypeInfo.getValidatorId()); - } - - private ClassTypeInfo createConverterTypeInfo_( - ConverterTypeInfo_ classTypeInfo) - { - final String[] superClasses = classTypeInfo.getSuperClasses().toArray( - new String[0]); - final String[] interfaces = classTypeInfo.getInterfaces().toArray( - new String[0]); - if (classTypeInfo.getClassName() == null - && classTypeInfo.getConverterId() == null) - { - return ConverterTypeInfo.UNKNOWN; - } - final String[] forClasses = classTypeInfo.getForClasses().toArray( - new String[0]); - return new ConverterTypeInfo(classTypeInfo.getClassName(), - superClasses, interfaces, classTypeInfo.getConverterId(), - forClasses); - } - - private ClassTypeInfo createComponentTypeInfo_( - ComponentTypeInfo_ classTypeInfo) - { - final String[] superClasses = classTypeInfo.getSuperClasses().toArray( - new String[0]); - final String[] interfaces = classTypeInfo.getInterfaces().toArray( - new String[0]); - return new ComponentTypeInfo(classTypeInfo.getComponentType(), - classTypeInfo.getClassName(), superClasses, interfaces, - classTypeInfo.getComponentFamily(), classTypeInfo - .getRenderType()); - } - - /** - * @param classTypeInfo - * @return a metadata type info matching classTypeInfo or null if - * classTypeInfo isn't of a supported concrete type. - */ - public ClassTypeInfo_ mapToMetadata(final ClassTypeInfo classTypeInfo) - { - if (classTypeInfo instanceof ComponentTypeInfo) - { - return createComponentTypeInfo((ComponentTypeInfo) classTypeInfo); - } - else if (classTypeInfo instanceof ConverterTypeInfo) - { - return createConverterTypeInfo((ConverterTypeInfo) classTypeInfo); - } - else if (classTypeInfo instanceof ValidatorTypeInfo) - { - return createValidatorTypeInfo((ValidatorTypeInfo) classTypeInfo); - } - return null; - } - - private ClassTypeInfo_ createComponentTypeInfo( - final ComponentTypeInfo typeInfo) - { - final ComponentTypeInfo_ metadata = ComponentMappingFactory.eINSTANCE - .createComponentTypeInfo_(); - metadata.setComponentFamily(typeInfo.getComponentFamily()); - metadata.setComponentType(typeInfo.getComponentType()); - metadata.setRenderType(typeInfo.getRenderFamily()); - copy(typeInfo, metadata); - return metadata; - } - - private ClassTypeInfo_ createConverterTypeInfo( - final ConverterTypeInfo typeInfo) - { - final ConverterTypeInfo_ metadata = ComponentMappingFactory.eINSTANCE - .createConverterTypeInfo_(); - copy(typeInfo, metadata); - metadata.setConverterId(typeInfo.getConverterId()); - return metadata; - } - - private ClassTypeInfo_ createValidatorTypeInfo( - final ValidatorTypeInfo typeInfo) - { - final ValidatorTypeInfo_ metadata = ComponentMappingFactory.eINSTANCE - .createValidatorTypeInfo_(); - copy(typeInfo, metadata); - metadata.setValidatorId(typeInfo.getValidatorId()); - return metadata; - } - - private void copy(ClassTypeInfo source, ClassTypeInfo_ dest) - { - dest.setClassName(source.getClassName()); - for (final String interfaze : source.getInterfaces()) - { - dest.getInterfaces().add(interfaze); - } - - for (final String superClass : source.getSuperClasses()) - { - dest.getSuperClasses().add(superClass); - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/mappers/ValueHolderAttributeMapper.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/mappers/ValueHolderAttributeMapper.java deleted file mode 100644 index 7a2753665..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/mappers/ValueHolderAttributeMapper.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.mapping.mappers; - -import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentFactory; -import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentInfo; -import org.eclipse.jst.jsf.common.runtime.internal.model.decorator.ConverterDecorator; -import org.eclipse.jst.jsf.common.runtime.internal.model.decorator.ConverterTypeInfo; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.CustomViewMappingAdapter; -import org.w3c.dom.Attr; -import org.w3c.dom.Element; - -/** - * Default mapper for value holders. - * - * @author cbateman - * - */ -public class ValueHolderAttributeMapper extends CustomViewMappingAdapter -{ - @Override - public void doAttributeActions(ComponentInfo bestComponent, - Element srcElement, Attr attr) - { - final String name = attr.getNodeName(); - - if ("converter".equals(name) - && bestComponent.getComponentTypeInfo().isInstanceOf( - ComponentFactory.INTERFACE_VALUEHOLDER)) - { - final String value = attr.getValue(); - - if (value != null) - { - ConverterTypeInfo typeInfo = null; - - if (!value.startsWith("#{")) - { - typeInfo = new ConverterTypeInfo(null, value); - - } - else - { - typeInfo = ConverterTypeInfo.UNKNOWN; - } - ConverterDecorator decorator = new ConverterDecorator( - bestComponent, typeInfo); - bestComponent.addDecorator(decorator, - ComponentFactory.CONVERTER); - } - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/AttributeToPropertyMapping.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/AttributeToPropertyMapping.java deleted file mode 100644 index a30491531..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/AttributeToPropertyMapping.java +++ /dev/null @@ -1,111 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: AttributeToPropertyMapping.java,v 1.1 2008/05/12 17:42:19 cbateman Exp $ - */ -package org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping; - -import org.eclipse.emf.ecore.EObject; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Attribute To Property Mapping</b></em>'. - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.AttributeToPropertyMapping#getPropertyName <em>Property Name</em>}</li> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.AttributeToPropertyMapping#isElAllowed <em>El Allowed</em>}</li> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.AttributeToPropertyMapping#getCustomConversionFactoryId <em>Custom Conversion Factory Id</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage#getAttributeToPropertyMapping() - * @model - * @generated - */ -public interface AttributeToPropertyMapping extends EObject -{ - /** - * Returns the value of the '<em><b>Property Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Property Name</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Property Name</em>' attribute. - * @see #setPropertyName(String) - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage#getAttributeToPropertyMapping_PropertyName() - * @model extendedMetaData="kind='element' name='propertyName'" - * @generated - */ - String getPropertyName(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.AttributeToPropertyMapping#getPropertyName <em>Property Name</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Property Name</em>' attribute. - * @see #getPropertyName() - * @generated - */ - void setPropertyName(String value); - - /** - * Returns the value of the '<em><b>El Allowed</b></em>' attribute. - * The default value is <code>"true"</code>. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>El Allowed</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>El Allowed</em>' attribute. - * @see #setElAllowed(boolean) - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage#getAttributeToPropertyMapping_ElAllowed() - * @model default="true" - * extendedMetaData="kind='element' name='elAllowed'" - * @generated - */ - boolean isElAllowed(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.AttributeToPropertyMapping#isElAllowed <em>El Allowed</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>El Allowed</em>' attribute. - * @see #isElAllowed() - * @generated - */ - void setElAllowed(boolean value); - - /** - * Returns the value of the '<em><b>Custom Conversion Factory Id</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Custom Conversion Factory Id</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Custom Conversion Factory Id</em>' attribute. - * @see #setCustomConversionFactoryId(String) - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage#getAttributeToPropertyMapping_CustomConversionFactoryId() - * @model extendedMetaData="kind='element' name='customConversionFactoryId'" - * @generated - */ - String getCustomConversionFactoryId(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.AttributeToPropertyMapping#getCustomConversionFactoryId <em>Custom Conversion Factory Id</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Custom Conversion Factory Id</em>' attribute. - * @see #getCustomConversionFactoryId() - * @generated - */ - void setCustomConversionFactoryId(String value); - -} // AttributeToPropertyMapping diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/ClassTypeInfo_.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/ClassTypeInfo_.java deleted file mode 100644 index bad26512d..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/ClassTypeInfo_.java +++ /dev/null @@ -1,91 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: ClassTypeInfo_.java,v 1.1 2008/05/12 17:42:19 cbateman Exp $ - */ -package org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping; - -import org.eclipse.emf.common.util.EList; - -import org.eclipse.emf.ecore.EObject; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Class Type Info </b></em>'. - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ClassTypeInfo_#getClassName <em>Class Name</em>}</li> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ClassTypeInfo_#getSuperClasses <em>Super Classes</em>}</li> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ClassTypeInfo_#getInterfaces <em>Interfaces</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage#getClassTypeInfo_() - * @model - * @generated - */ -public interface ClassTypeInfo_ extends EObject -{ - /** - * Returns the value of the '<em><b>Class Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Class Name</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Class Name</em>' attribute. - * @see #setClassName(String) - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage#getClassTypeInfo__ClassName() - * @model extendedMetaData="kind='element' name='className'" - * @generated - */ - String getClassName(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ClassTypeInfo_#getClassName <em>Class Name</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Class Name</em>' attribute. - * @see #getClassName() - * @generated - */ - void setClassName(String value); - - /** - * Returns the value of the '<em><b>Super Classes</b></em>' attribute list. - * The list contents are of type {@link java.lang.String}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Super Classes</em>' attribute list isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Super Classes</em>' attribute list. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage#getClassTypeInfo__SuperClasses() - * @model extendedMetaData="kind='element' name='superClasses'" - * @generated - */ - EList<String> getSuperClasses(); - - /** - * Returns the value of the '<em><b>Interfaces</b></em>' attribute list. - * The list contents are of type {@link java.lang.String}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Interfaces</em>' attribute list isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Interfaces</em>' attribute list. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage#getClassTypeInfo__Interfaces() - * @model extendedMetaData="kind='element' name='interfaces'" - * @generated - */ - EList<String> getInterfaces(); - -} // ClassTypeInfo_ diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/ComponentMappingFactory.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/ComponentMappingFactory.java deleted file mode 100644 index 9a45fa050..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/ComponentMappingFactory.java +++ /dev/null @@ -1,101 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: ComponentMappingFactory.java,v 1.1 2008/05/12 17:42:19 cbateman Exp $ - */ -package org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping; - -import org.eclipse.emf.ecore.EFactory; - -/** - * <!-- begin-user-doc --> - * The <b>Factory</b> for the model. - * It provides a create method for each non-abstract class of the model. - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage - * @generated - */ -public interface ComponentMappingFactory extends EFactory -{ - /** - * The singleton instance of the factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - ComponentMappingFactory eINSTANCE = org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ComponentMappingFactoryImpl.init(); - - /** - * Returns a new object of class '<em>Tag Mapping</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Tag Mapping</em>'. - * @generated - */ - TagMapping createTagMapping(); - - /** - * Returns a new object of class '<em>Tag To View Object Mapping</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Tag To View Object Mapping</em>'. - * @generated - */ - TagToViewObjectMapping createTagToViewObjectMapping(); - - /** - * Returns a new object of class '<em>Class Type Info </em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Class Type Info </em>'. - * @generated - */ - ClassTypeInfo_ createClassTypeInfo_(); - - /** - * Returns a new object of class '<em>Component Type Info </em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Component Type Info </em>'. - * @generated - */ - ComponentTypeInfo_ createComponentTypeInfo_(); - - /** - * Returns a new object of class '<em>Converter Type Info </em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Converter Type Info </em>'. - * @generated - */ - ConverterTypeInfo_ createConverterTypeInfo_(); - - /** - * Returns a new object of class '<em>Validator Type Info </em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Validator Type Info </em>'. - * @generated - */ - ValidatorTypeInfo_ createValidatorTypeInfo_(); - - /** - * Returns a new object of class '<em>Attribute To Property Mapping</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Attribute To Property Mapping</em>'. - * @generated - */ - AttributeToPropertyMapping createAttributeToPropertyMapping(); - - /** - * Returns the package supported by this factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the package supported by this factory. - * @generated - */ - ComponentMappingPackage getComponentMappingPackage(); - -} //ComponentMappingFactory diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/ComponentMappingPackage.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/ComponentMappingPackage.java deleted file mode 100644 index e340b4f30..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/ComponentMappingPackage.java +++ /dev/null @@ -1,949 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: ComponentMappingPackage.java,v 1.1 2008/05/12 17:42:19 cbateman Exp $ - */ -package org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; - -/** - * <!-- begin-user-doc --> - * The <b>Package</b> for the model. - * It contains accessors for the meta objects to represent - * <ul> - * <li>each class,</li> - * <li>each feature of each class,</li> - * <li>each enum,</li> - * <li>and each data type</li> - * </ul> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingFactory - * @model kind="package" - * @generated - */ -public interface ComponentMappingPackage extends EPackage -{ - /** - * The package name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNAME = "viewmapping"; - - /** - * The package namespace URI. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNS_URI = "http://org.eclipse.jst.jsf.core/componentMapping.ecore"; - - /** - * The package namespace name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNS_PREFIX = "viewMap"; - - /** - * The singleton instance of the package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - ComponentMappingPackage eINSTANCE = org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ComponentMappingPackageImpl.init(); - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.TagMappingImpl <em>Tag Mapping</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.TagMappingImpl - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ComponentMappingPackageImpl#getTagMapping() - * @generated - */ - int TAG_MAPPING = 0; - - /** - * The feature id for the '<em><b>Versioned Tag To View Mappings</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int TAG_MAPPING__VERSIONED_TAG_TO_VIEW_MAPPINGS = 0; - - /** - * The feature id for the '<em><b>Custom Conversion Factory Id</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int TAG_MAPPING__CUSTOM_CONVERSION_FACTORY_ID = 1; - - /** - * The feature id for the '<em><b>Bean Mapped Properties</b></em>' attribute list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int TAG_MAPPING__BEAN_MAPPED_PROPERTIES = 2; - - /** - * The number of structural features of the '<em>Tag Mapping</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int TAG_MAPPING_FEATURE_COUNT = 3; - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.TagToViewObjectMappingImpl <em>Tag To View Object Mapping</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.TagToViewObjectMappingImpl - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ComponentMappingPackageImpl#getTagToViewObjectMapping() - * @generated - */ - int TAG_TO_VIEW_OBJECT_MAPPING = 1; - - /** - * The feature id for the '<em><b>Type Info</b></em>' containment reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int TAG_TO_VIEW_OBJECT_MAPPING__TYPE_INFO = 0; - - /** - * The feature id for the '<em><b>Min JSF Version</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int TAG_TO_VIEW_OBJECT_MAPPING__MIN_JSF_VERSION = 1; - - /** - * The feature id for the '<em><b>Min Library Version</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int TAG_TO_VIEW_OBJECT_MAPPING__MIN_LIBRARY_VERSION = 2; - - /** - * The number of structural features of the '<em>Tag To View Object Mapping</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int TAG_TO_VIEW_OBJECT_MAPPING_FEATURE_COUNT = 3; - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ClassTypeInfo_Impl <em>Class Type Info </em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ClassTypeInfo_Impl - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ComponentMappingPackageImpl#getClassTypeInfo_() - * @generated - */ - int CLASS_TYPE_INFO_ = 2; - - /** - * The feature id for the '<em><b>Class Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int CLASS_TYPE_INFO___CLASS_NAME = 0; - - /** - * The feature id for the '<em><b>Super Classes</b></em>' attribute list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int CLASS_TYPE_INFO___SUPER_CLASSES = 1; - - /** - * The feature id for the '<em><b>Interfaces</b></em>' attribute list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int CLASS_TYPE_INFO___INTERFACES = 2; - - /** - * The number of structural features of the '<em>Class Type Info </em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int CLASS_TYPE_INFO__FEATURE_COUNT = 3; - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ComponentTypeInfo_Impl <em>Component Type Info </em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ComponentTypeInfo_Impl - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ComponentMappingPackageImpl#getComponentTypeInfo_() - * @generated - */ - int COMPONENT_TYPE_INFO_ = 3; - - /** - * The feature id for the '<em><b>Class Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int COMPONENT_TYPE_INFO___CLASS_NAME = CLASS_TYPE_INFO___CLASS_NAME; - - /** - * The feature id for the '<em><b>Super Classes</b></em>' attribute list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int COMPONENT_TYPE_INFO___SUPER_CLASSES = CLASS_TYPE_INFO___SUPER_CLASSES; - - /** - * The feature id for the '<em><b>Interfaces</b></em>' attribute list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int COMPONENT_TYPE_INFO___INTERFACES = CLASS_TYPE_INFO___INTERFACES; - - /** - * The feature id for the '<em><b>Component Type</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int COMPONENT_TYPE_INFO___COMPONENT_TYPE = CLASS_TYPE_INFO__FEATURE_COUNT + 0; - - /** - * The feature id for the '<em><b>Component Family</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int COMPONENT_TYPE_INFO___COMPONENT_FAMILY = CLASS_TYPE_INFO__FEATURE_COUNT + 1; - - /** - * The feature id for the '<em><b>Render Type</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int COMPONENT_TYPE_INFO___RENDER_TYPE = CLASS_TYPE_INFO__FEATURE_COUNT + 2; - - /** - * The number of structural features of the '<em>Component Type Info </em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int COMPONENT_TYPE_INFO__FEATURE_COUNT = CLASS_TYPE_INFO__FEATURE_COUNT + 3; - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ConverterTypeInfo_Impl <em>Converter Type Info </em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ConverterTypeInfo_Impl - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ComponentMappingPackageImpl#getConverterTypeInfo_() - * @generated - */ - int CONVERTER_TYPE_INFO_ = 4; - - /** - * The feature id for the '<em><b>Class Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int CONVERTER_TYPE_INFO___CLASS_NAME = CLASS_TYPE_INFO___CLASS_NAME; - - /** - * The feature id for the '<em><b>Super Classes</b></em>' attribute list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int CONVERTER_TYPE_INFO___SUPER_CLASSES = CLASS_TYPE_INFO___SUPER_CLASSES; - - /** - * The feature id for the '<em><b>Interfaces</b></em>' attribute list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int CONVERTER_TYPE_INFO___INTERFACES = CLASS_TYPE_INFO___INTERFACES; - - /** - * The feature id for the '<em><b>Converter Id</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int CONVERTER_TYPE_INFO___CONVERTER_ID = CLASS_TYPE_INFO__FEATURE_COUNT + 0; - - /** - * The feature id for the '<em><b>For Classes</b></em>' attribute list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int CONVERTER_TYPE_INFO___FOR_CLASSES = CLASS_TYPE_INFO__FEATURE_COUNT + 1; - - /** - * The number of structural features of the '<em>Converter Type Info </em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int CONVERTER_TYPE_INFO__FEATURE_COUNT = CLASS_TYPE_INFO__FEATURE_COUNT + 2; - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ValidatorTypeInfo_Impl <em>Validator Type Info </em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ValidatorTypeInfo_Impl - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ComponentMappingPackageImpl#getValidatorTypeInfo_() - * @generated - */ - int VALIDATOR_TYPE_INFO_ = 5; - - /** - * The feature id for the '<em><b>Class Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int VALIDATOR_TYPE_INFO___CLASS_NAME = CLASS_TYPE_INFO___CLASS_NAME; - - /** - * The feature id for the '<em><b>Super Classes</b></em>' attribute list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int VALIDATOR_TYPE_INFO___SUPER_CLASSES = CLASS_TYPE_INFO___SUPER_CLASSES; - - /** - * The feature id for the '<em><b>Interfaces</b></em>' attribute list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int VALIDATOR_TYPE_INFO___INTERFACES = CLASS_TYPE_INFO___INTERFACES; - - /** - * The feature id for the '<em><b>Validator Id</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int VALIDATOR_TYPE_INFO___VALIDATOR_ID = CLASS_TYPE_INFO__FEATURE_COUNT + 0; - - /** - * The number of structural features of the '<em>Validator Type Info </em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int VALIDATOR_TYPE_INFO__FEATURE_COUNT = CLASS_TYPE_INFO__FEATURE_COUNT + 1; - - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.AttributeToPropertyMappingImpl <em>Attribute To Property Mapping</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.AttributeToPropertyMappingImpl - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ComponentMappingPackageImpl#getAttributeToPropertyMapping() - * @generated - */ - int ATTRIBUTE_TO_PROPERTY_MAPPING = 6; - - /** - * The feature id for the '<em><b>Property Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ATTRIBUTE_TO_PROPERTY_MAPPING__PROPERTY_NAME = 0; - - /** - * The feature id for the '<em><b>El Allowed</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ATTRIBUTE_TO_PROPERTY_MAPPING__EL_ALLOWED = 1; - - /** - * The feature id for the '<em><b>Custom Conversion Factory Id</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ATTRIBUTE_TO_PROPERTY_MAPPING__CUSTOM_CONVERSION_FACTORY_ID = 2; - - /** - * The number of structural features of the '<em>Attribute To Property Mapping</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ATTRIBUTE_TO_PROPERTY_MAPPING_FEATURE_COUNT = 3; - - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagMapping <em>Tag Mapping</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Tag Mapping</em>'. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagMapping - * @generated - */ - EClass getTagMapping(); - - /** - * Returns the meta object for the containment reference list '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagMapping#getVersionedTagToViewMappings <em>Versioned Tag To View Mappings</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the containment reference list '<em>Versioned Tag To View Mappings</em>'. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagMapping#getVersionedTagToViewMappings() - * @see #getTagMapping() - * @generated - */ - EReference getTagMapping_VersionedTagToViewMappings(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagMapping#getCustomConversionFactoryId <em>Custom Conversion Factory Id</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Custom Conversion Factory Id</em>'. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagMapping#getCustomConversionFactoryId() - * @see #getTagMapping() - * @generated - */ - EAttribute getTagMapping_CustomConversionFactoryId(); - - /** - * Returns the meta object for the attribute list '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagMapping#getBeanMappedProperties <em>Bean Mapped Properties</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute list '<em>Bean Mapped Properties</em>'. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagMapping#getBeanMappedProperties() - * @see #getTagMapping() - * @generated - */ - EAttribute getTagMapping_BeanMappedProperties(); - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagToViewObjectMapping <em>Tag To View Object Mapping</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Tag To View Object Mapping</em>'. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagToViewObjectMapping - * @generated - */ - EClass getTagToViewObjectMapping(); - - /** - * Returns the meta object for the containment reference '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagToViewObjectMapping#getTypeInfo <em>Type Info</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the containment reference '<em>Type Info</em>'. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagToViewObjectMapping#getTypeInfo() - * @see #getTagToViewObjectMapping() - * @generated - */ - EReference getTagToViewObjectMapping_TypeInfo(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagToViewObjectMapping#getMinJSFVersion <em>Min JSF Version</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Min JSF Version</em>'. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagToViewObjectMapping#getMinJSFVersion() - * @see #getTagToViewObjectMapping() - * @generated - */ - EAttribute getTagToViewObjectMapping_MinJSFVersion(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagToViewObjectMapping#getMinLibraryVersion <em>Min Library Version</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Min Library Version</em>'. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagToViewObjectMapping#getMinLibraryVersion() - * @see #getTagToViewObjectMapping() - * @generated - */ - EAttribute getTagToViewObjectMapping_MinLibraryVersion(); - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ClassTypeInfo_ <em>Class Type Info </em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Class Type Info </em>'. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ClassTypeInfo_ - * @generated - */ - EClass getClassTypeInfo_(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ClassTypeInfo_#getClassName <em>Class Name</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Class Name</em>'. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ClassTypeInfo_#getClassName() - * @see #getClassTypeInfo_() - * @generated - */ - EAttribute getClassTypeInfo__ClassName(); - - /** - * Returns the meta object for the attribute list '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ClassTypeInfo_#getSuperClasses <em>Super Classes</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute list '<em>Super Classes</em>'. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ClassTypeInfo_#getSuperClasses() - * @see #getClassTypeInfo_() - * @generated - */ - EAttribute getClassTypeInfo__SuperClasses(); - - /** - * Returns the meta object for the attribute list '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ClassTypeInfo_#getInterfaces <em>Interfaces</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute list '<em>Interfaces</em>'. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ClassTypeInfo_#getInterfaces() - * @see #getClassTypeInfo_() - * @generated - */ - EAttribute getClassTypeInfo__Interfaces(); - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentTypeInfo_ <em>Component Type Info </em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Component Type Info </em>'. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentTypeInfo_ - * @generated - */ - EClass getComponentTypeInfo_(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentTypeInfo_#getComponentType <em>Component Type</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Component Type</em>'. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentTypeInfo_#getComponentType() - * @see #getComponentTypeInfo_() - * @generated - */ - EAttribute getComponentTypeInfo__ComponentType(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentTypeInfo_#getComponentFamily <em>Component Family</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Component Family</em>'. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentTypeInfo_#getComponentFamily() - * @see #getComponentTypeInfo_() - * @generated - */ - EAttribute getComponentTypeInfo__ComponentFamily(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentTypeInfo_#getRenderType <em>Render Type</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Render Type</em>'. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentTypeInfo_#getRenderType() - * @see #getComponentTypeInfo_() - * @generated - */ - EAttribute getComponentTypeInfo__RenderType(); - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ConverterTypeInfo_ <em>Converter Type Info </em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Converter Type Info </em>'. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ConverterTypeInfo_ - * @generated - */ - EClass getConverterTypeInfo_(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ConverterTypeInfo_#getConverterId <em>Converter Id</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Converter Id</em>'. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ConverterTypeInfo_#getConverterId() - * @see #getConverterTypeInfo_() - * @generated - */ - EAttribute getConverterTypeInfo__ConverterId(); - - /** - * Returns the meta object for the attribute list '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ConverterTypeInfo_#getForClasses <em>For Classes</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute list '<em>For Classes</em>'. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ConverterTypeInfo_#getForClasses() - * @see #getConverterTypeInfo_() - * @generated - */ - EAttribute getConverterTypeInfo__ForClasses(); - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ValidatorTypeInfo_ <em>Validator Type Info </em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Validator Type Info </em>'. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ValidatorTypeInfo_ - * @generated - */ - EClass getValidatorTypeInfo_(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ValidatorTypeInfo_#getValidatorId <em>Validator Id</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Validator Id</em>'. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ValidatorTypeInfo_#getValidatorId() - * @see #getValidatorTypeInfo_() - * @generated - */ - EAttribute getValidatorTypeInfo__ValidatorId(); - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.AttributeToPropertyMapping <em>Attribute To Property Mapping</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Attribute To Property Mapping</em>'. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.AttributeToPropertyMapping - * @generated - */ - EClass getAttributeToPropertyMapping(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.AttributeToPropertyMapping#getPropertyName <em>Property Name</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Property Name</em>'. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.AttributeToPropertyMapping#getPropertyName() - * @see #getAttributeToPropertyMapping() - * @generated - */ - EAttribute getAttributeToPropertyMapping_PropertyName(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.AttributeToPropertyMapping#isElAllowed <em>El Allowed</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>El Allowed</em>'. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.AttributeToPropertyMapping#isElAllowed() - * @see #getAttributeToPropertyMapping() - * @generated - */ - EAttribute getAttributeToPropertyMapping_ElAllowed(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.AttributeToPropertyMapping#getCustomConversionFactoryId <em>Custom Conversion Factory Id</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Custom Conversion Factory Id</em>'. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.AttributeToPropertyMapping#getCustomConversionFactoryId() - * @see #getAttributeToPropertyMapping() - * @generated - */ - EAttribute getAttributeToPropertyMapping_CustomConversionFactoryId(); - - /** - * Returns the factory that creates the instances of the model. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the factory that creates the instances of the model. - * @generated - */ - ComponentMappingFactory getComponentMappingFactory(); - - /** - * <!-- begin-user-doc --> - * Defines literals for the meta objects that represent - * <ul> - * <li>each class,</li> - * <li>each feature of each class,</li> - * <li>each enum,</li> - * <li>and each data type</li> - * </ul> - * <!-- end-user-doc --> - * @generated - */ - @SuppressWarnings("hiding") - interface Literals - { - /** - * The meta object literal for the '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.TagMappingImpl <em>Tag Mapping</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.TagMappingImpl - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ComponentMappingPackageImpl#getTagMapping() - * @generated - */ - EClass TAG_MAPPING = eINSTANCE.getTagMapping(); - - /** - * The meta object literal for the '<em><b>Versioned Tag To View Mappings</b></em>' containment reference list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference TAG_MAPPING__VERSIONED_TAG_TO_VIEW_MAPPINGS = eINSTANCE.getTagMapping_VersionedTagToViewMappings(); - - /** - * The meta object literal for the '<em><b>Custom Conversion Factory Id</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute TAG_MAPPING__CUSTOM_CONVERSION_FACTORY_ID = eINSTANCE.getTagMapping_CustomConversionFactoryId(); - - /** - * The meta object literal for the '<em><b>Bean Mapped Properties</b></em>' attribute list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute TAG_MAPPING__BEAN_MAPPED_PROPERTIES = eINSTANCE.getTagMapping_BeanMappedProperties(); - - /** - * The meta object literal for the '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.TagToViewObjectMappingImpl <em>Tag To View Object Mapping</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.TagToViewObjectMappingImpl - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ComponentMappingPackageImpl#getTagToViewObjectMapping() - * @generated - */ - EClass TAG_TO_VIEW_OBJECT_MAPPING = eINSTANCE.getTagToViewObjectMapping(); - - /** - * The meta object literal for the '<em><b>Type Info</b></em>' containment reference feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference TAG_TO_VIEW_OBJECT_MAPPING__TYPE_INFO = eINSTANCE.getTagToViewObjectMapping_TypeInfo(); - - /** - * The meta object literal for the '<em><b>Min JSF Version</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute TAG_TO_VIEW_OBJECT_MAPPING__MIN_JSF_VERSION = eINSTANCE.getTagToViewObjectMapping_MinJSFVersion(); - - /** - * The meta object literal for the '<em><b>Min Library Version</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute TAG_TO_VIEW_OBJECT_MAPPING__MIN_LIBRARY_VERSION = eINSTANCE.getTagToViewObjectMapping_MinLibraryVersion(); - - /** - * The meta object literal for the '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ClassTypeInfo_Impl <em>Class Type Info </em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ClassTypeInfo_Impl - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ComponentMappingPackageImpl#getClassTypeInfo_() - * @generated - */ - EClass CLASS_TYPE_INFO_ = eINSTANCE.getClassTypeInfo_(); - - /** - * The meta object literal for the '<em><b>Class Name</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute CLASS_TYPE_INFO___CLASS_NAME = eINSTANCE.getClassTypeInfo__ClassName(); - - /** - * The meta object literal for the '<em><b>Super Classes</b></em>' attribute list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute CLASS_TYPE_INFO___SUPER_CLASSES = eINSTANCE.getClassTypeInfo__SuperClasses(); - - /** - * The meta object literal for the '<em><b>Interfaces</b></em>' attribute list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute CLASS_TYPE_INFO___INTERFACES = eINSTANCE.getClassTypeInfo__Interfaces(); - - /** - * The meta object literal for the '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ComponentTypeInfo_Impl <em>Component Type Info </em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ComponentTypeInfo_Impl - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ComponentMappingPackageImpl#getComponentTypeInfo_() - * @generated - */ - EClass COMPONENT_TYPE_INFO_ = eINSTANCE.getComponentTypeInfo_(); - - /** - * The meta object literal for the '<em><b>Component Type</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute COMPONENT_TYPE_INFO___COMPONENT_TYPE = eINSTANCE.getComponentTypeInfo__ComponentType(); - - /** - * The meta object literal for the '<em><b>Component Family</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute COMPONENT_TYPE_INFO___COMPONENT_FAMILY = eINSTANCE.getComponentTypeInfo__ComponentFamily(); - - /** - * The meta object literal for the '<em><b>Render Type</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute COMPONENT_TYPE_INFO___RENDER_TYPE = eINSTANCE.getComponentTypeInfo__RenderType(); - - /** - * The meta object literal for the '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ConverterTypeInfo_Impl <em>Converter Type Info </em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ConverterTypeInfo_Impl - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ComponentMappingPackageImpl#getConverterTypeInfo_() - * @generated - */ - EClass CONVERTER_TYPE_INFO_ = eINSTANCE.getConverterTypeInfo_(); - - /** - * The meta object literal for the '<em><b>Converter Id</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute CONVERTER_TYPE_INFO___CONVERTER_ID = eINSTANCE.getConverterTypeInfo__ConverterId(); - - /** - * The meta object literal for the '<em><b>For Classes</b></em>' attribute list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute CONVERTER_TYPE_INFO___FOR_CLASSES = eINSTANCE.getConverterTypeInfo__ForClasses(); - - /** - * The meta object literal for the '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ValidatorTypeInfo_Impl <em>Validator Type Info </em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ValidatorTypeInfo_Impl - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ComponentMappingPackageImpl#getValidatorTypeInfo_() - * @generated - */ - EClass VALIDATOR_TYPE_INFO_ = eINSTANCE.getValidatorTypeInfo_(); - - /** - * The meta object literal for the '<em><b>Validator Id</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute VALIDATOR_TYPE_INFO___VALIDATOR_ID = eINSTANCE.getValidatorTypeInfo__ValidatorId(); - - /** - * The meta object literal for the '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.AttributeToPropertyMappingImpl <em>Attribute To Property Mapping</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.AttributeToPropertyMappingImpl - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ComponentMappingPackageImpl#getAttributeToPropertyMapping() - * @generated - */ - EClass ATTRIBUTE_TO_PROPERTY_MAPPING = eINSTANCE.getAttributeToPropertyMapping(); - - /** - * The meta object literal for the '<em><b>Property Name</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute ATTRIBUTE_TO_PROPERTY_MAPPING__PROPERTY_NAME = eINSTANCE.getAttributeToPropertyMapping_PropertyName(); - - /** - * The meta object literal for the '<em><b>El Allowed</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute ATTRIBUTE_TO_PROPERTY_MAPPING__EL_ALLOWED = eINSTANCE.getAttributeToPropertyMapping_ElAllowed(); - - /** - * The meta object literal for the '<em><b>Custom Conversion Factory Id</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute ATTRIBUTE_TO_PROPERTY_MAPPING__CUSTOM_CONVERSION_FACTORY_ID = eINSTANCE.getAttributeToPropertyMapping_CustomConversionFactoryId(); - - } - -} //ComponentMappingPackage diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/ComponentTypeInfo_.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/ComponentTypeInfo_.java deleted file mode 100644 index e537498e1..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/ComponentTypeInfo_.java +++ /dev/null @@ -1,108 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: ComponentTypeInfo_.java,v 1.1 2008/05/12 17:42:19 cbateman Exp $ - */ -package org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping; - - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Component Type Info </b></em>'. - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentTypeInfo_#getComponentType <em>Component Type</em>}</li> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentTypeInfo_#getComponentFamily <em>Component Family</em>}</li> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentTypeInfo_#getRenderType <em>Render Type</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage#getComponentTypeInfo_() - * @model - * @generated - */ -public interface ComponentTypeInfo_ extends ClassTypeInfo_ -{ - /** - * Returns the value of the '<em><b>Component Type</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Component Type</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Component Type</em>' attribute. - * @see #setComponentType(String) - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage#getComponentTypeInfo__ComponentType() - * @model extendedMetaData="kind='element' name='componentType'" - * @generated - */ - String getComponentType(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentTypeInfo_#getComponentType <em>Component Type</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Component Type</em>' attribute. - * @see #getComponentType() - * @generated - */ - void setComponentType(String value); - - /** - * Returns the value of the '<em><b>Component Family</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Component Family</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Component Family</em>' attribute. - * @see #setComponentFamily(String) - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage#getComponentTypeInfo__ComponentFamily() - * @model extendedMetaData="kind='element' name='componentFamily'" - * @generated - */ - String getComponentFamily(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentTypeInfo_#getComponentFamily <em>Component Family</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Component Family</em>' attribute. - * @see #getComponentFamily() - * @generated - */ - void setComponentFamily(String value); - - /** - * Returns the value of the '<em><b>Render Type</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Render Type</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Render Type</em>' attribute. - * @see #setRenderType(String) - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage#getComponentTypeInfo__RenderType() - * @model extendedMetaData="kind='element' name='renderType'" - * @generated - */ - String getRenderType(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentTypeInfo_#getRenderType <em>Render Type</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Render Type</em>' attribute. - * @see #getRenderType() - * @generated - */ - void setRenderType(String value); - -} // ComponentTypeInfo_ diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/ConverterTypeInfo_.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/ConverterTypeInfo_.java deleted file mode 100644 index d7dbc5484..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/ConverterTypeInfo_.java +++ /dev/null @@ -1,73 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: ConverterTypeInfo_.java,v 1.1 2008/05/12 17:42:19 cbateman Exp $ - */ -package org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping; - -import org.eclipse.emf.common.util.EList; - - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Converter Type Info </b></em>'. - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ConverterTypeInfo_#getConverterId <em>Converter Id</em>}</li> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ConverterTypeInfo_#getForClasses <em>For Classes</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage#getConverterTypeInfo_() - * @model - * @generated - */ -public interface ConverterTypeInfo_ extends ClassTypeInfo_ -{ - /** - * Returns the value of the '<em><b>Converter Id</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Converter Id</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Converter Id</em>' attribute. - * @see #setConverterId(String) - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage#getConverterTypeInfo__ConverterId() - * @model extendedMetaData="kind='element' name='converterId'" - * @generated - */ - String getConverterId(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ConverterTypeInfo_#getConverterId <em>Converter Id</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Converter Id</em>' attribute. - * @see #getConverterId() - * @generated - */ - void setConverterId(String value); - - /** - * Returns the value of the '<em><b>For Classes</b></em>' attribute list. - * The list contents are of type {@link java.lang.String}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>For Classes</em>' attribute list isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>For Classes</em>' attribute list. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage#getConverterTypeInfo__ForClasses() - * @model extendedMetaData="kind='element' name='forClass'" - * @generated - */ - EList<String> getForClasses(); - -} // ConverterTypeInfo_ diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/CustomViewMapperExtensionLoader.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/CustomViewMapperExtensionLoader.java deleted file mode 100644 index 540a76158..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/CustomViewMapperExtensionLoader.java +++ /dev/null @@ -1,100 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping; - -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtension; -import org.eclipse.core.runtime.IExtensionPoint; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.ICustomViewMapper; - -/** - * @author cbateman - * - */ -public class CustomViewMapperExtensionLoader -{ - private final static String EXTENSION_ID = "customViewMapper"; - private final static String ELEMENT_NAME = "customViewMapper"; - - private static Map<String, ICustomViewMapper> _extensions; - - /** - * @param id - * @return the list of handlers. The list is not modifiable and will throw - * exceptions if it is attempted. - */ - public static synchronized ICustomViewMapper getCustomViewMapper( - final String id) - { - if (_extensions == null) - { - _extensions = Collections.unmodifiableMap(readAllHandlers()); - } - return _extensions.get(id); - } - - private static Map<String, ICustomViewMapper> readAllHandlers() - { - final Map<String, ICustomViewMapper> handlers = new HashMap<String, ICustomViewMapper>(); - final IExtensionPoint extensionPoint = JSFCorePlugin.getDefault() - .getExtension(EXTENSION_ID); - final IExtension[] extensions = extensionPoint.getExtensions(); - - for (final IExtension ext : extensions) - { - final IConfigurationElement[] configElements = ext - .getConfigurationElements(); - - for (final IConfigurationElement element : configElements) - { - if (ELEMENT_NAME.equals(element.getName())) - { - try - { - final String pluginId = element.getContributor() - .getName(); - final String name = element.getAttribute("id"); - final Object customHandler = element - .createExecutableExtension("class"); - if (customHandler instanceof ICustomViewMapper - && name != null) - { - handlers.put(pluginId + "." + name, - (ICustomViewMapper) customHandler); - } - else - { - JSFCorePlugin.log( - "Error loading tag registry extension: " - + element.getContributor().getName() - + "." + element.getAttribute("id") - , new Throwable("No exception: stack trace only")); - } - } - catch (final CoreException e) - { - JSFCorePlugin.log(e, - "Error loading tag registry extension: " - + element.getContributor().getName() - + "." + element.getAttribute("id")); - } - } - } - } - return handlers; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/TagMapping.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/TagMapping.java deleted file mode 100644 index 4f824a1ea..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/TagMapping.java +++ /dev/null @@ -1,103 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: TagMapping.java,v 1.1 2008/05/12 17:42:19 cbateman Exp $ - */ -package org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping; - -import org.eclipse.emf.common.util.EList; - -import org.eclipse.emf.ecore.EObject; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Tag Mapping</b></em>'. - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagMapping#getVersionedTagToViewMappings <em>Versioned Tag To View Mappings</em>}</li> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagMapping#getCustomConversionFactoryId <em>Custom Conversion Factory Id</em>}</li> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagMapping#getBeanMappedProperties <em>Bean Mapped Properties</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage#getTagMapping() - * @model - * @generated - */ -public interface TagMapping extends EObject -{ - /** - * Returns the value of the '<em><b>Versioned Tag To View Mappings</b></em>' containment reference list. - * The list contents are of type {@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagToViewObjectMapping}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Versioned Tag To View Mappings</em>' containment reference list isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Versioned Tag To View Mappings</em>' containment reference list. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage#getTagMapping_VersionedTagToViewMappings() - * @model containment="true" - * extendedMetaData="kind='element' name='versionedTagToViewMappings'" - * @generated - */ - EList<TagToViewObjectMapping> getVersionedTagToViewMappings(); - - /** - * Returns the value of the '<em><b>Custom Conversion Factory Id</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Custom Conversion Factory Id</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Custom Conversion Factory Id</em>' attribute. - * @see #setCustomConversionFactoryId(String) - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage#getTagMapping_CustomConversionFactoryId() - * @model extendedMetaData="kind='element' name='customConversionFactoryId'" - * @generated - */ - String getCustomConversionFactoryId(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagMapping#getCustomConversionFactoryId <em>Custom Conversion Factory Id</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Custom Conversion Factory Id</em>' attribute. - * @see #getCustomConversionFactoryId() - * @generated - */ - void setCustomConversionFactoryId(String value); - - /** - * Returns the value of the '<em><b>Bean Mapped Properties</b></em>' attribute list. - * The list contents are of type {@link java.lang.String}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Bean Mapped Properties</em>' attribute list isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Bean Mapped Properties</em>' attribute list. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage#getTagMapping_BeanMappedProperties() - * @model default="" - * extendedMetaData="kind='element' name='beanMappedProperties'" - * @generated - */ - EList<String> getBeanMappedProperties(); - - /** - * <!-- begin-user-doc --> - * @param jsfVersion - * @param libVersion - * <!-- end-user-doc --> - * @model - * @generated - */ - void findBestMapping(String jsfVersion, String libVersion); - -} // TagMapping diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/TagToViewObjectMapping.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/TagToViewObjectMapping.java deleted file mode 100644 index 608ba0f16..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/TagToViewObjectMapping.java +++ /dev/null @@ -1,114 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: TagToViewObjectMapping.java,v 1.1 2008/05/12 17:42:19 cbateman Exp $ - */ -package org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping; - -import org.eclipse.emf.ecore.EObject; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Tag To View Object Mapping</b></em>'. - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagToViewObjectMapping#getTypeInfo <em>Type Info</em>}</li> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagToViewObjectMapping#getMinJSFVersion <em>Min JSF Version</em>}</li> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagToViewObjectMapping#getMinLibraryVersion <em>Min Library Version</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage#getTagToViewObjectMapping() - * @model - * @generated - */ -public interface TagToViewObjectMapping extends EObject -{ - /** - * Returns the value of the '<em><b>Type Info</b></em>' containment reference. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Type Info</em>' reference isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Type Info</em>' containment reference. - * @see #setTypeInfo(ClassTypeInfo_) - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage#getTagToViewObjectMapping_TypeInfo() - * @model containment="true" - * extendedMetaData="kind='element' name='typeInfo'" - * @generated - */ - ClassTypeInfo_ getTypeInfo(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagToViewObjectMapping#getTypeInfo <em>Type Info</em>}' containment reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Type Info</em>' containment reference. - * @see #getTypeInfo() - * @generated - */ - void setTypeInfo(ClassTypeInfo_ value); - - /** - * Returns the value of the '<em><b>Min JSF Version</b></em>' attribute. - * The default value is <code>"1.1"</code>. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Min JSF Version</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Min JSF Version</em>' attribute. - * @see #setMinJSFVersion(String) - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage#getTagToViewObjectMapping_MinJSFVersion() - * @model default="1.1" - * extendedMetaData="kind='element' name='minVersion'" - * @generated - */ - String getMinJSFVersion(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagToViewObjectMapping#getMinJSFVersion <em>Min JSF Version</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Min JSF Version</em>' attribute. - * @see #getMinJSFVersion() - * @generated - */ - void setMinJSFVersion(String value); - - /** - * Returns the value of the '<em><b>Min Library Version</b></em>' attribute. - * The default value is <code>""</code>. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Min Library Version</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Min Library Version</em>' attribute. - * @see #setMinLibraryVersion(String) - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage#getTagToViewObjectMapping_MinLibraryVersion() - * @model default="" - * extendedMetaData="kind='element' name='minLibraryVersion'" - * @generated - */ - String getMinLibraryVersion(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagToViewObjectMapping#getMinLibraryVersion <em>Min Library Version</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Min Library Version</em>' attribute. - * @see #getMinLibraryVersion() - * @generated - */ - void setMinLibraryVersion(String value); - -} // TagToViewObjectMapping diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/ValidatorTypeInfo_.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/ValidatorTypeInfo_.java deleted file mode 100644 index 608568431..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/ValidatorTypeInfo_.java +++ /dev/null @@ -1,54 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: ValidatorTypeInfo_.java,v 1.1 2008/05/12 17:42:19 cbateman Exp $ - */ -package org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping; - - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Validator Type Info </b></em>'. - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ValidatorTypeInfo_#getValidatorId <em>Validator Id</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage#getValidatorTypeInfo_() - * @model - * @generated - */ -public interface ValidatorTypeInfo_ extends ClassTypeInfo_ -{ - /** - * Returns the value of the '<em><b>Validator Id</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Validator Id</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Validator Id</em>' attribute. - * @see #setValidatorId(String) - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage#getValidatorTypeInfo__ValidatorId() - * @model extendedMetaData="kind='element' name='validatorId'" - * @generated - */ - String getValidatorId(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ValidatorTypeInfo_#getValidatorId <em>Validator Id</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Validator Id</em>' attribute. - * @see #getValidatorId() - * @generated - */ - void setValidatorId(String value); - -} // ValidatorTypeInfo_ diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/impl/AttributeToPropertyMappingImpl.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/impl/AttributeToPropertyMappingImpl.java deleted file mode 100644 index b39915897..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/impl/AttributeToPropertyMappingImpl.java +++ /dev/null @@ -1,293 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: AttributeToPropertyMappingImpl.java,v 1.1 2008/05/12 17:42:20 cbateman Exp $ - */ -package org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl; - -import org.eclipse.emf.common.notify.Notification; - -import org.eclipse.emf.ecore.EClass; - -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.impl.EObjectImpl; - -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.AttributeToPropertyMapping; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Attribute To Property Mapping</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.AttributeToPropertyMappingImpl#getPropertyName <em>Property Name</em>}</li> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.AttributeToPropertyMappingImpl#isElAllowed <em>El Allowed</em>}</li> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.AttributeToPropertyMappingImpl#getCustomConversionFactoryId <em>Custom Conversion Factory Id</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class AttributeToPropertyMappingImpl extends EObjectImpl implements AttributeToPropertyMapping -{ - /** - * The default value of the '{@link #getPropertyName() <em>Property Name</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getPropertyName() - * @generated - * @ordered - */ - protected static final String PROPERTY_NAME_EDEFAULT = null; - - /** - * The cached value of the '{@link #getPropertyName() <em>Property Name</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getPropertyName() - * @generated - * @ordered - */ - protected String propertyName = PROPERTY_NAME_EDEFAULT; - - /** - * The default value of the '{@link #isElAllowed() <em>El Allowed</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isElAllowed() - * @generated - * @ordered - */ - protected static final boolean EL_ALLOWED_EDEFAULT = true; - - /** - * The cached value of the '{@link #isElAllowed() <em>El Allowed</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isElAllowed() - * @generated - * @ordered - */ - protected boolean elAllowed = EL_ALLOWED_EDEFAULT; - - /** - * The default value of the '{@link #getCustomConversionFactoryId() <em>Custom Conversion Factory Id</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getCustomConversionFactoryId() - * @generated - * @ordered - */ - protected static final String CUSTOM_CONVERSION_FACTORY_ID_EDEFAULT = null; - - /** - * The cached value of the '{@link #getCustomConversionFactoryId() <em>Custom Conversion Factory Id</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getCustomConversionFactoryId() - * @generated - * @ordered - */ - protected String customConversionFactoryId = CUSTOM_CONVERSION_FACTORY_ID_EDEFAULT; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected AttributeToPropertyMappingImpl() - { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() - { - return ComponentMappingPackage.Literals.ATTRIBUTE_TO_PROPERTY_MAPPING; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getPropertyName() - { - return propertyName; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setPropertyName(String newPropertyName) - { - String oldPropertyName = propertyName; - propertyName = newPropertyName; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, ComponentMappingPackage.ATTRIBUTE_TO_PROPERTY_MAPPING__PROPERTY_NAME, oldPropertyName, propertyName)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean isElAllowed() - { - return elAllowed; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setElAllowed(boolean newElAllowed) - { - boolean oldElAllowed = elAllowed; - elAllowed = newElAllowed; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, ComponentMappingPackage.ATTRIBUTE_TO_PROPERTY_MAPPING__EL_ALLOWED, oldElAllowed, elAllowed)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getCustomConversionFactoryId() - { - return customConversionFactoryId; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setCustomConversionFactoryId(String newCustomConversionFactoryId) - { - String oldCustomConversionFactoryId = customConversionFactoryId; - customConversionFactoryId = newCustomConversionFactoryId; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, ComponentMappingPackage.ATTRIBUTE_TO_PROPERTY_MAPPING__CUSTOM_CONVERSION_FACTORY_ID, oldCustomConversionFactoryId, customConversionFactoryId)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) - { - switch (featureID) - { - case ComponentMappingPackage.ATTRIBUTE_TO_PROPERTY_MAPPING__PROPERTY_NAME: - return getPropertyName(); - case ComponentMappingPackage.ATTRIBUTE_TO_PROPERTY_MAPPING__EL_ALLOWED: - return isElAllowed() ? Boolean.TRUE : Boolean.FALSE; - case ComponentMappingPackage.ATTRIBUTE_TO_PROPERTY_MAPPING__CUSTOM_CONVERSION_FACTORY_ID: - return getCustomConversionFactoryId(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eSet(int featureID, Object newValue) - { - switch (featureID) - { - case ComponentMappingPackage.ATTRIBUTE_TO_PROPERTY_MAPPING__PROPERTY_NAME: - setPropertyName((String)newValue); - return; - case ComponentMappingPackage.ATTRIBUTE_TO_PROPERTY_MAPPING__EL_ALLOWED: - setElAllowed(((Boolean)newValue).booleanValue()); - return; - case ComponentMappingPackage.ATTRIBUTE_TO_PROPERTY_MAPPING__CUSTOM_CONVERSION_FACTORY_ID: - setCustomConversionFactoryId((String)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) - { - switch (featureID) - { - case ComponentMappingPackage.ATTRIBUTE_TO_PROPERTY_MAPPING__PROPERTY_NAME: - setPropertyName(PROPERTY_NAME_EDEFAULT); - return; - case ComponentMappingPackage.ATTRIBUTE_TO_PROPERTY_MAPPING__EL_ALLOWED: - setElAllowed(EL_ALLOWED_EDEFAULT); - return; - case ComponentMappingPackage.ATTRIBUTE_TO_PROPERTY_MAPPING__CUSTOM_CONVERSION_FACTORY_ID: - setCustomConversionFactoryId(CUSTOM_CONVERSION_FACTORY_ID_EDEFAULT); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) - { - switch (featureID) - { - case ComponentMappingPackage.ATTRIBUTE_TO_PROPERTY_MAPPING__PROPERTY_NAME: - return PROPERTY_NAME_EDEFAULT == null ? propertyName != null : !PROPERTY_NAME_EDEFAULT.equals(propertyName); - case ComponentMappingPackage.ATTRIBUTE_TO_PROPERTY_MAPPING__EL_ALLOWED: - return elAllowed != EL_ALLOWED_EDEFAULT; - case ComponentMappingPackage.ATTRIBUTE_TO_PROPERTY_MAPPING__CUSTOM_CONVERSION_FACTORY_ID: - return CUSTOM_CONVERSION_FACTORY_ID_EDEFAULT == null ? customConversionFactoryId != null : !CUSTOM_CONVERSION_FACTORY_ID_EDEFAULT.equals(customConversionFactoryId); - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public String toString() - { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (propertyName: "); - result.append(propertyName); - result.append(", elAllowed: "); - result.append(elAllowed); - result.append(", customConversionFactoryId: "); - result.append(customConversionFactoryId); - result.append(')'); - return result.toString(); - } - -} //AttributeToPropertyMappingImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/impl/ClassTypeInfo_Impl.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/impl/ClassTypeInfo_Impl.java deleted file mode 100644 index b5607fb19..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/impl/ClassTypeInfo_Impl.java +++ /dev/null @@ -1,264 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: ClassTypeInfo_Impl.java,v 1.1 2008/05/12 17:42:20 cbateman Exp $ - */ -package org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl; - -import java.util.Collection; - -import org.eclipse.emf.common.notify.Notification; - -import org.eclipse.emf.common.util.EList; - -import org.eclipse.emf.ecore.EClass; - -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.impl.EObjectImpl; - -import org.eclipse.emf.ecore.util.EDataTypeUniqueEList; - -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ClassTypeInfo_; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Class Type Info </b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ClassTypeInfo_Impl#getClassName <em>Class Name</em>}</li> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ClassTypeInfo_Impl#getSuperClasses <em>Super Classes</em>}</li> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ClassTypeInfo_Impl#getInterfaces <em>Interfaces</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class ClassTypeInfo_Impl extends EObjectImpl implements ClassTypeInfo_ -{ - /** - * The default value of the '{@link #getClassName() <em>Class Name</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getClassName() - * @generated - * @ordered - */ - protected static final String CLASS_NAME_EDEFAULT = null; - - /** - * The cached value of the '{@link #getClassName() <em>Class Name</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getClassName() - * @generated - * @ordered - */ - protected String className = CLASS_NAME_EDEFAULT; - - /** - * The cached value of the '{@link #getSuperClasses() <em>Super Classes</em>}' attribute list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getSuperClasses() - * @generated - * @ordered - */ - protected EList<String> superClasses; - - /** - * The cached value of the '{@link #getInterfaces() <em>Interfaces</em>}' attribute list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getInterfaces() - * @generated - * @ordered - */ - protected EList<String> interfaces; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ClassTypeInfo_Impl() - { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() - { - return ComponentMappingPackage.Literals.CLASS_TYPE_INFO_; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getClassName() - { - return className; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setClassName(String newClassName) - { - String oldClassName = className; - className = newClassName; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, ComponentMappingPackage.CLASS_TYPE_INFO___CLASS_NAME, oldClassName, className)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EList<String> getSuperClasses() - { - if (superClasses == null) - { - superClasses = new EDataTypeUniqueEList<String>(String.class, this, ComponentMappingPackage.CLASS_TYPE_INFO___SUPER_CLASSES); - } - return superClasses; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EList<String> getInterfaces() - { - if (interfaces == null) - { - interfaces = new EDataTypeUniqueEList<String>(String.class, this, ComponentMappingPackage.CLASS_TYPE_INFO___INTERFACES); - } - return interfaces; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) - { - switch (featureID) - { - case ComponentMappingPackage.CLASS_TYPE_INFO___CLASS_NAME: - return getClassName(); - case ComponentMappingPackage.CLASS_TYPE_INFO___SUPER_CLASSES: - return getSuperClasses(); - case ComponentMappingPackage.CLASS_TYPE_INFO___INTERFACES: - return getInterfaces(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @SuppressWarnings("unchecked") - @Override - public void eSet(int featureID, Object newValue) - { - switch (featureID) - { - case ComponentMappingPackage.CLASS_TYPE_INFO___CLASS_NAME: - setClassName((String)newValue); - return; - case ComponentMappingPackage.CLASS_TYPE_INFO___SUPER_CLASSES: - getSuperClasses().clear(); - getSuperClasses().addAll((Collection<? extends String>)newValue); - return; - case ComponentMappingPackage.CLASS_TYPE_INFO___INTERFACES: - getInterfaces().clear(); - getInterfaces().addAll((Collection<? extends String>)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) - { - switch (featureID) - { - case ComponentMappingPackage.CLASS_TYPE_INFO___CLASS_NAME: - setClassName(CLASS_NAME_EDEFAULT); - return; - case ComponentMappingPackage.CLASS_TYPE_INFO___SUPER_CLASSES: - getSuperClasses().clear(); - return; - case ComponentMappingPackage.CLASS_TYPE_INFO___INTERFACES: - getInterfaces().clear(); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) - { - switch (featureID) - { - case ComponentMappingPackage.CLASS_TYPE_INFO___CLASS_NAME: - return CLASS_NAME_EDEFAULT == null ? className != null : !CLASS_NAME_EDEFAULT.equals(className); - case ComponentMappingPackage.CLASS_TYPE_INFO___SUPER_CLASSES: - return superClasses != null && !superClasses.isEmpty(); - case ComponentMappingPackage.CLASS_TYPE_INFO___INTERFACES: - return interfaces != null && !interfaces.isEmpty(); - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public String toString() - { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (className: "); - result.append(className); - result.append(", superClasses: "); - result.append(superClasses); - result.append(", interfaces: "); - result.append(interfaces); - result.append(')'); - return result.toString(); - } - -} //ClassTypeInfo_Impl diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/impl/ComponentMappingFactoryImpl.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/impl/ComponentMappingFactoryImpl.java deleted file mode 100644 index 5cb08177b..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/impl/ComponentMappingFactoryImpl.java +++ /dev/null @@ -1,184 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: ComponentMappingFactoryImpl.java,v 1.1 2008/05/12 17:42:20 cbateman Exp $ - */ -package org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; - -import org.eclipse.emf.ecore.impl.EFactoryImpl; - -import org.eclipse.emf.ecore.plugin.EcorePlugin; - -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.*; - -/** - * <!-- begin-user-doc --> - * An implementation of the model <b>Factory</b>. - * <!-- end-user-doc --> - * @generated - */ -public class ComponentMappingFactoryImpl extends EFactoryImpl implements ComponentMappingFactory -{ - /** - * Creates the default factory implementation. - * <!-- begin-user-doc --> - * @return the factory - * <!-- end-user-doc --> - * @generated - */ - public static ComponentMappingFactory init() - { - try - { - ComponentMappingFactory theComponentMappingFactory = (ComponentMappingFactory)EPackage.Registry.INSTANCE.getEFactory("http://org.eclipse.jst.jsf.core/componentMapping.ecore"); - if (theComponentMappingFactory != null) - { - return theComponentMappingFactory; - } - } - catch (Exception exception) - { - EcorePlugin.INSTANCE.log(exception); - } - return new ComponentMappingFactoryImpl(); - } - - /** - * Creates an instance of the factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ComponentMappingFactoryImpl() - { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public EObject create(EClass eClass) - { - switch (eClass.getClassifierID()) - { - case ComponentMappingPackage.TAG_MAPPING: return createTagMapping(); - case ComponentMappingPackage.TAG_TO_VIEW_OBJECT_MAPPING: return createTagToViewObjectMapping(); - case ComponentMappingPackage.CLASS_TYPE_INFO_: return createClassTypeInfo_(); - case ComponentMappingPackage.COMPONENT_TYPE_INFO_: return createComponentTypeInfo_(); - case ComponentMappingPackage.CONVERTER_TYPE_INFO_: return createConverterTypeInfo_(); - case ComponentMappingPackage.VALIDATOR_TYPE_INFO_: return createValidatorTypeInfo_(); - case ComponentMappingPackage.ATTRIBUTE_TO_PROPERTY_MAPPING: return createAttributeToPropertyMapping(); - default: - throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public TagMapping createTagMapping() - { - TagMappingImpl tagMapping = new TagMappingImpl(); - return tagMapping; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public TagToViewObjectMapping createTagToViewObjectMapping() - { - TagToViewObjectMappingImpl tagToViewObjectMapping = new TagToViewObjectMappingImpl(); - return tagToViewObjectMapping; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ClassTypeInfo_ createClassTypeInfo_() - { - ClassTypeInfo_Impl classTypeInfo_ = new ClassTypeInfo_Impl(); - return classTypeInfo_; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ComponentTypeInfo_ createComponentTypeInfo_() - { - ComponentTypeInfo_Impl componentTypeInfo_ = new ComponentTypeInfo_Impl(); - return componentTypeInfo_; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ConverterTypeInfo_ createConverterTypeInfo_() - { - ConverterTypeInfo_Impl converterTypeInfo_ = new ConverterTypeInfo_Impl(); - return converterTypeInfo_; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ValidatorTypeInfo_ createValidatorTypeInfo_() - { - ValidatorTypeInfo_Impl validatorTypeInfo_ = new ValidatorTypeInfo_Impl(); - return validatorTypeInfo_; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public AttributeToPropertyMapping createAttributeToPropertyMapping() - { - AttributeToPropertyMappingImpl attributeToPropertyMapping = new AttributeToPropertyMappingImpl(); - return attributeToPropertyMapping; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ComponentMappingPackage getComponentMappingPackage() - { - return (ComponentMappingPackage)getEPackage(); - } - - /** - * <!-- begin-user-doc --> - * @return the package - * <!-- end-user-doc --> - * @deprecated - * @generated - */ - @Deprecated - public static ComponentMappingPackage getPackage() - { - return ComponentMappingPackage.eINSTANCE; - } - -} //ComponentMappingFactoryImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/impl/ComponentMappingPackageImpl.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/impl/ComponentMappingPackageImpl.java deleted file mode 100644 index 5d73875f9..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/impl/ComponentMappingPackageImpl.java +++ /dev/null @@ -1,699 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: ComponentMappingPackageImpl.java,v 1.1 2008/05/12 17:42:20 cbateman Exp $ - */ -package org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EOperation; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.ecore.impl.EPackageImpl; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.AttributeToPropertyMapping; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ClassTypeInfo_; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingFactory; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentTypeInfo_; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ConverterTypeInfo_; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagMapping; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagToViewObjectMapping; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ValidatorTypeInfo_; - -/** - * <!-- begin-user-doc --> - * An implementation of the model <b>Package</b>. - * <!-- end-user-doc --> - * @generated - */ -public class ComponentMappingPackageImpl extends EPackageImpl implements ComponentMappingPackage -{ - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass tagMappingEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass tagToViewObjectMappingEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass classTypeInfo_EClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass componentTypeInfo_EClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass converterTypeInfo_EClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass validatorTypeInfo_EClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass attributeToPropertyMappingEClass = null; - - /** - * Creates an instance of the model <b>Package</b>, registered with - * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package - * package URI value. - * <p>Note: the correct way to create the package is via the static - * factory method {@link #init init()}, which also performs - * initialization of the package, or returns the registered package, - * if one already exists. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.ecore.EPackage.Registry - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage#eNS_URI - * @see #init() - * @generated - */ - private ComponentMappingPackageImpl() - { - super(eNS_URI, ComponentMappingFactory.eINSTANCE); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private static boolean isInited = false; - - /** - * Creates, registers, and initializes the <b>Package</b> for this - * model, and for any others upon which it depends. Simple - * dependencies are satisfied by calling this method on all - * dependent packages before doing anything else. This method drives - * initialization for interdependent packages directly, in parallel - * with this package, itself. - * <p>Of this package and its interdependencies, all packages which - * have not yet been registered by their URI values are first created - * and registered. The packages are then initialized in two steps: - * meta-model objects for all of the packages are created before any - * are initialized, since one package's meta-model objects may refer to - * those of another. - * <p>Invocation of this method will not affect any packages that have - * already been initialized. - * <!-- begin-user-doc --> - * @return the initialized package - * <!-- end-user-doc --> - * @see #eNS_URI - * @see #createPackageContents() - * @see #initializePackageContents() - * @generated - */ - public static ComponentMappingPackage init() - { - if (isInited) return (ComponentMappingPackage)EPackage.Registry.INSTANCE.getEPackage(ComponentMappingPackage.eNS_URI); - - // Obtain or create and register package - ComponentMappingPackageImpl theComponentMappingPackage = (ComponentMappingPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(eNS_URI) instanceof ComponentMappingPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(eNS_URI) : new ComponentMappingPackageImpl()); - - isInited = true; - - // Create package meta-data objects - theComponentMappingPackage.createPackageContents(); - - // Initialize created meta-data - theComponentMappingPackage.initializePackageContents(); - - // Mark meta-data to indicate it can't be changed - theComponentMappingPackage.freeze(); - - return theComponentMappingPackage; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getTagMapping() - { - return tagMappingEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getTagMapping_VersionedTagToViewMappings() - { - return (EReference)tagMappingEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getTagMapping_CustomConversionFactoryId() - { - return (EAttribute)tagMappingEClass.getEStructuralFeatures().get(1); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getTagMapping_BeanMappedProperties() - { - return (EAttribute)tagMappingEClass.getEStructuralFeatures().get(2); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getTagToViewObjectMapping() - { - return tagToViewObjectMappingEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getTagToViewObjectMapping_TypeInfo() - { - return (EReference)tagToViewObjectMappingEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getTagToViewObjectMapping_MinJSFVersion() - { - return (EAttribute)tagToViewObjectMappingEClass.getEStructuralFeatures().get(1); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getTagToViewObjectMapping_MinLibraryVersion() - { - return (EAttribute)tagToViewObjectMappingEClass.getEStructuralFeatures().get(2); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getClassTypeInfo_() - { - return classTypeInfo_EClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getClassTypeInfo__ClassName() - { - return (EAttribute)classTypeInfo_EClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getClassTypeInfo__SuperClasses() - { - return (EAttribute)classTypeInfo_EClass.getEStructuralFeatures().get(1); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getClassTypeInfo__Interfaces() - { - return (EAttribute)classTypeInfo_EClass.getEStructuralFeatures().get(2); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getComponentTypeInfo_() - { - return componentTypeInfo_EClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getComponentTypeInfo__ComponentType() - { - return (EAttribute)componentTypeInfo_EClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getComponentTypeInfo__ComponentFamily() - { - return (EAttribute)componentTypeInfo_EClass.getEStructuralFeatures().get(1); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getComponentTypeInfo__RenderType() - { - return (EAttribute)componentTypeInfo_EClass.getEStructuralFeatures().get(2); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getConverterTypeInfo_() - { - return converterTypeInfo_EClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getConverterTypeInfo__ConverterId() - { - return (EAttribute)converterTypeInfo_EClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getConverterTypeInfo__ForClasses() - { - return (EAttribute)converterTypeInfo_EClass.getEStructuralFeatures().get(1); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getValidatorTypeInfo_() - { - return validatorTypeInfo_EClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getValidatorTypeInfo__ValidatorId() - { - return (EAttribute)validatorTypeInfo_EClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getAttributeToPropertyMapping() - { - return attributeToPropertyMappingEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getAttributeToPropertyMapping_PropertyName() - { - return (EAttribute)attributeToPropertyMappingEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getAttributeToPropertyMapping_ElAllowed() - { - return (EAttribute)attributeToPropertyMappingEClass.getEStructuralFeatures().get(1); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getAttributeToPropertyMapping_CustomConversionFactoryId() - { - return (EAttribute)attributeToPropertyMappingEClass.getEStructuralFeatures().get(2); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ComponentMappingFactory getComponentMappingFactory() - { - return (ComponentMappingFactory)getEFactoryInstance(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private boolean isCreated = false; - - /** - * Creates the meta-model objects for the package. This method is - * guarded to have no affect on any invocation but its first. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void createPackageContents() - { - if (isCreated) return; - isCreated = true; - - // Create classes and their features - tagMappingEClass = createEClass(TAG_MAPPING); - createEReference(tagMappingEClass, TAG_MAPPING__VERSIONED_TAG_TO_VIEW_MAPPINGS); - createEAttribute(tagMappingEClass, TAG_MAPPING__CUSTOM_CONVERSION_FACTORY_ID); - createEAttribute(tagMappingEClass, TAG_MAPPING__BEAN_MAPPED_PROPERTIES); - - tagToViewObjectMappingEClass = createEClass(TAG_TO_VIEW_OBJECT_MAPPING); - createEReference(tagToViewObjectMappingEClass, TAG_TO_VIEW_OBJECT_MAPPING__TYPE_INFO); - createEAttribute(tagToViewObjectMappingEClass, TAG_TO_VIEW_OBJECT_MAPPING__MIN_JSF_VERSION); - createEAttribute(tagToViewObjectMappingEClass, TAG_TO_VIEW_OBJECT_MAPPING__MIN_LIBRARY_VERSION); - - classTypeInfo_EClass = createEClass(CLASS_TYPE_INFO_); - createEAttribute(classTypeInfo_EClass, CLASS_TYPE_INFO___CLASS_NAME); - createEAttribute(classTypeInfo_EClass, CLASS_TYPE_INFO___SUPER_CLASSES); - createEAttribute(classTypeInfo_EClass, CLASS_TYPE_INFO___INTERFACES); - - componentTypeInfo_EClass = createEClass(COMPONENT_TYPE_INFO_); - createEAttribute(componentTypeInfo_EClass, COMPONENT_TYPE_INFO___COMPONENT_TYPE); - createEAttribute(componentTypeInfo_EClass, COMPONENT_TYPE_INFO___COMPONENT_FAMILY); - createEAttribute(componentTypeInfo_EClass, COMPONENT_TYPE_INFO___RENDER_TYPE); - - converterTypeInfo_EClass = createEClass(CONVERTER_TYPE_INFO_); - createEAttribute(converterTypeInfo_EClass, CONVERTER_TYPE_INFO___CONVERTER_ID); - createEAttribute(converterTypeInfo_EClass, CONVERTER_TYPE_INFO___FOR_CLASSES); - - validatorTypeInfo_EClass = createEClass(VALIDATOR_TYPE_INFO_); - createEAttribute(validatorTypeInfo_EClass, VALIDATOR_TYPE_INFO___VALIDATOR_ID); - - attributeToPropertyMappingEClass = createEClass(ATTRIBUTE_TO_PROPERTY_MAPPING); - createEAttribute(attributeToPropertyMappingEClass, ATTRIBUTE_TO_PROPERTY_MAPPING__PROPERTY_NAME); - createEAttribute(attributeToPropertyMappingEClass, ATTRIBUTE_TO_PROPERTY_MAPPING__EL_ALLOWED); - createEAttribute(attributeToPropertyMappingEClass, ATTRIBUTE_TO_PROPERTY_MAPPING__CUSTOM_CONVERSION_FACTORY_ID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private boolean isInitialized = false; - - /** - * Complete the initialization of the package and its meta-model. This - * method is guarded to have no affect on any invocation but its first. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void initializePackageContents() - { - if (isInitialized) return; - isInitialized = true; - - // Initialize package - setName(eNAME); - setNsPrefix(eNS_PREFIX); - setNsURI(eNS_URI); - - // Create type parameters - - // Set bounds for type parameters - - // Add supertypes to classes - componentTypeInfo_EClass.getESuperTypes().add(this.getClassTypeInfo_()); - converterTypeInfo_EClass.getESuperTypes().add(this.getClassTypeInfo_()); - validatorTypeInfo_EClass.getESuperTypes().add(this.getClassTypeInfo_()); - - // Initialize classes and features; add operations and parameters - initEClass(tagMappingEClass, TagMapping.class, "TagMapping", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEReference(getTagMapping_VersionedTagToViewMappings(), this.getTagToViewObjectMapping(), null, "versionedTagToViewMappings", null, 0, -1, TagMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getTagMapping_CustomConversionFactoryId(), ecorePackage.getEString(), "customConversionFactoryId", null, 0, 1, TagMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getTagMapping_BeanMappedProperties(), ecorePackage.getEString(), "beanMappedProperties", "", 0, -1, TagMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - - EOperation op = addEOperation(tagMappingEClass, null, "findBestMapping", 0, 1, IS_UNIQUE, IS_ORDERED); - addEParameter(op, ecorePackage.getEString(), "jsfVersion", 0, 1, IS_UNIQUE, IS_ORDERED); - addEParameter(op, ecorePackage.getEString(), "libVersion", 0, 1, IS_UNIQUE, IS_ORDERED); - - initEClass(tagToViewObjectMappingEClass, TagToViewObjectMapping.class, "TagToViewObjectMapping", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEReference(getTagToViewObjectMapping_TypeInfo(), this.getClassTypeInfo_(), null, "typeInfo", null, 0, 1, TagToViewObjectMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getTagToViewObjectMapping_MinJSFVersion(), ecorePackage.getEString(), "minJSFVersion", "1.1", 0, 1, TagToViewObjectMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getTagToViewObjectMapping_MinLibraryVersion(), ecorePackage.getEString(), "minLibraryVersion", "", 0, 1, TagToViewObjectMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - - initEClass(classTypeInfo_EClass, ClassTypeInfo_.class, "ClassTypeInfo_", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEAttribute(getClassTypeInfo__ClassName(), ecorePackage.getEString(), "className", null, 0, 1, ClassTypeInfo_.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getClassTypeInfo__SuperClasses(), ecorePackage.getEString(), "superClasses", null, 0, -1, ClassTypeInfo_.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getClassTypeInfo__Interfaces(), ecorePackage.getEString(), "interfaces", null, 0, -1, ClassTypeInfo_.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - - initEClass(componentTypeInfo_EClass, ComponentTypeInfo_.class, "ComponentTypeInfo_", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEAttribute(getComponentTypeInfo__ComponentType(), ecorePackage.getEString(), "componentType", null, 0, 1, ComponentTypeInfo_.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getComponentTypeInfo__ComponentFamily(), ecorePackage.getEString(), "componentFamily", null, 0, 1, ComponentTypeInfo_.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getComponentTypeInfo__RenderType(), ecorePackage.getEString(), "renderType", null, 0, 1, ComponentTypeInfo_.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - - initEClass(converterTypeInfo_EClass, ConverterTypeInfo_.class, "ConverterTypeInfo_", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEAttribute(getConverterTypeInfo__ConverterId(), ecorePackage.getEString(), "converterId", null, 0, 1, ConverterTypeInfo_.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getConverterTypeInfo__ForClasses(), ecorePackage.getEString(), "forClasses", null, 0, -1, ConverterTypeInfo_.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - - initEClass(validatorTypeInfo_EClass, ValidatorTypeInfo_.class, "ValidatorTypeInfo_", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEAttribute(getValidatorTypeInfo__ValidatorId(), ecorePackage.getEString(), "validatorId", null, 0, 1, ValidatorTypeInfo_.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - - initEClass(attributeToPropertyMappingEClass, AttributeToPropertyMapping.class, "AttributeToPropertyMapping", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEAttribute(getAttributeToPropertyMapping_PropertyName(), ecorePackage.getEString(), "propertyName", null, 0, 1, AttributeToPropertyMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getAttributeToPropertyMapping_ElAllowed(), ecorePackage.getEBoolean(), "elAllowed", "true", 0, 1, AttributeToPropertyMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getAttributeToPropertyMapping_CustomConversionFactoryId(), ecorePackage.getEString(), "customConversionFactoryId", null, 0, 1, AttributeToPropertyMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - - // Create resource - createResource(eNS_URI); - - // Create annotations - // http:///org/eclipse/emf/ecore/util/ExtendedMetaData - createExtendedMetaDataAnnotations(); - } - - /** - * Initializes the annotations for <b>http:///org/eclipse/emf/ecore/util/ExtendedMetaData</b>. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void createExtendedMetaDataAnnotations() - { - String source = "http:///org/eclipse/emf/ecore/util/ExtendedMetaData"; - addAnnotation - (getTagMapping_VersionedTagToViewMappings(), - source, - new String[] - { - "kind", "element", - "name", "versionedTagToViewMappings" - }); - addAnnotation - (getTagMapping_CustomConversionFactoryId(), - source, - new String[] - { - "kind", "element", - "name", "customConversionFactoryId" - }); - addAnnotation - (getTagMapping_BeanMappedProperties(), - source, - new String[] - { - "kind", "element", - "name", "beanMappedProperties" - }); - addAnnotation - (getTagToViewObjectMapping_TypeInfo(), - source, - new String[] - { - "kind", "element", - "name", "typeInfo" - }); - addAnnotation - (getTagToViewObjectMapping_MinJSFVersion(), - source, - new String[] - { - "kind", "element", - "name", "minVersion" - }); - addAnnotation - (getTagToViewObjectMapping_MinLibraryVersion(), - source, - new String[] - { - "kind", "element", - "name", "minLibraryVersion" - }); - addAnnotation - (getClassTypeInfo__ClassName(), - source, - new String[] - { - "kind", "element", - "name", "className" - }); - addAnnotation - (getClassTypeInfo__SuperClasses(), - source, - new String[] - { - "kind", "element", - "name", "superClasses" - }); - addAnnotation - (getClassTypeInfo__Interfaces(), - source, - new String[] - { - "kind", "element", - "name", "interfaces" - }); - addAnnotation - (getComponentTypeInfo__ComponentType(), - source, - new String[] - { - "kind", "element", - "name", "componentType" - }); - addAnnotation - (getComponentTypeInfo__ComponentFamily(), - source, - new String[] - { - "kind", "element", - "name", "componentFamily" - }); - addAnnotation - (getComponentTypeInfo__RenderType(), - source, - new String[] - { - "kind", "element", - "name", "renderType" - }); - addAnnotation - (getConverterTypeInfo__ConverterId(), - source, - new String[] - { - "kind", "element", - "name", "converterId" - }); - addAnnotation - (getConverterTypeInfo__ForClasses(), - source, - new String[] - { - "kind", "element", - "name", "forClass" - }); - addAnnotation - (getValidatorTypeInfo__ValidatorId(), - source, - new String[] - { - "kind", "element", - "name", "validatorId" - }); - addAnnotation - (getAttributeToPropertyMapping_PropertyName(), - source, - new String[] - { - "kind", "element", - "name", "propertyName" - }); - addAnnotation - (getAttributeToPropertyMapping_ElAllowed(), - source, - new String[] - { - "kind", "element", - "name", "elAllowed" - }); - addAnnotation - (getAttributeToPropertyMapping_CustomConversionFactoryId(), - source, - new String[] - { - "kind", "element", - "name", "customConversionFactoryId" - }); - } - -} //ComponentMappingPackageImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/impl/ComponentTypeInfo_Impl.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/impl/ComponentTypeInfo_Impl.java deleted file mode 100644 index ceae1a899..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/impl/ComponentTypeInfo_Impl.java +++ /dev/null @@ -1,292 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: ComponentTypeInfo_Impl.java,v 1.1 2008/05/12 17:42:20 cbateman Exp $ - */ -package org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl; - -import org.eclipse.emf.common.notify.Notification; - -import org.eclipse.emf.ecore.EClass; - -import org.eclipse.emf.ecore.impl.ENotificationImpl; - -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentTypeInfo_; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Component Type Info </b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ComponentTypeInfo_Impl#getComponentType <em>Component Type</em>}</li> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ComponentTypeInfo_Impl#getComponentFamily <em>Component Family</em>}</li> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ComponentTypeInfo_Impl#getRenderType <em>Render Type</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class ComponentTypeInfo_Impl extends ClassTypeInfo_Impl implements ComponentTypeInfo_ -{ - /** - * The default value of the '{@link #getComponentType() <em>Component Type</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getComponentType() - * @generated - * @ordered - */ - protected static final String COMPONENT_TYPE_EDEFAULT = null; - - /** - * The cached value of the '{@link #getComponentType() <em>Component Type</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getComponentType() - * @generated - * @ordered - */ - protected String componentType = COMPONENT_TYPE_EDEFAULT; - - /** - * The default value of the '{@link #getComponentFamily() <em>Component Family</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getComponentFamily() - * @generated - * @ordered - */ - protected static final String COMPONENT_FAMILY_EDEFAULT = null; - - /** - * The cached value of the '{@link #getComponentFamily() <em>Component Family</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getComponentFamily() - * @generated - * @ordered - */ - protected String componentFamily = COMPONENT_FAMILY_EDEFAULT; - - /** - * The default value of the '{@link #getRenderType() <em>Render Type</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getRenderType() - * @generated - * @ordered - */ - protected static final String RENDER_TYPE_EDEFAULT = null; - - /** - * The cached value of the '{@link #getRenderType() <em>Render Type</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getRenderType() - * @generated - * @ordered - */ - protected String renderType = RENDER_TYPE_EDEFAULT; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ComponentTypeInfo_Impl() - { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() - { - return ComponentMappingPackage.Literals.COMPONENT_TYPE_INFO_; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getComponentType() - { - return componentType; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setComponentType(String newComponentType) - { - String oldComponentType = componentType; - componentType = newComponentType; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, ComponentMappingPackage.COMPONENT_TYPE_INFO___COMPONENT_TYPE, oldComponentType, componentType)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getComponentFamily() - { - return componentFamily; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setComponentFamily(String newComponentFamily) - { - String oldComponentFamily = componentFamily; - componentFamily = newComponentFamily; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, ComponentMappingPackage.COMPONENT_TYPE_INFO___COMPONENT_FAMILY, oldComponentFamily, componentFamily)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getRenderType() - { - return renderType; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setRenderType(String newRenderType) - { - String oldRenderType = renderType; - renderType = newRenderType; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, ComponentMappingPackage.COMPONENT_TYPE_INFO___RENDER_TYPE, oldRenderType, renderType)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) - { - switch (featureID) - { - case ComponentMappingPackage.COMPONENT_TYPE_INFO___COMPONENT_TYPE: - return getComponentType(); - case ComponentMappingPackage.COMPONENT_TYPE_INFO___COMPONENT_FAMILY: - return getComponentFamily(); - case ComponentMappingPackage.COMPONENT_TYPE_INFO___RENDER_TYPE: - return getRenderType(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eSet(int featureID, Object newValue) - { - switch (featureID) - { - case ComponentMappingPackage.COMPONENT_TYPE_INFO___COMPONENT_TYPE: - setComponentType((String)newValue); - return; - case ComponentMappingPackage.COMPONENT_TYPE_INFO___COMPONENT_FAMILY: - setComponentFamily((String)newValue); - return; - case ComponentMappingPackage.COMPONENT_TYPE_INFO___RENDER_TYPE: - setRenderType((String)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) - { - switch (featureID) - { - case ComponentMappingPackage.COMPONENT_TYPE_INFO___COMPONENT_TYPE: - setComponentType(COMPONENT_TYPE_EDEFAULT); - return; - case ComponentMappingPackage.COMPONENT_TYPE_INFO___COMPONENT_FAMILY: - setComponentFamily(COMPONENT_FAMILY_EDEFAULT); - return; - case ComponentMappingPackage.COMPONENT_TYPE_INFO___RENDER_TYPE: - setRenderType(RENDER_TYPE_EDEFAULT); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) - { - switch (featureID) - { - case ComponentMappingPackage.COMPONENT_TYPE_INFO___COMPONENT_TYPE: - return COMPONENT_TYPE_EDEFAULT == null ? componentType != null : !COMPONENT_TYPE_EDEFAULT.equals(componentType); - case ComponentMappingPackage.COMPONENT_TYPE_INFO___COMPONENT_FAMILY: - return COMPONENT_FAMILY_EDEFAULT == null ? componentFamily != null : !COMPONENT_FAMILY_EDEFAULT.equals(componentFamily); - case ComponentMappingPackage.COMPONENT_TYPE_INFO___RENDER_TYPE: - return RENDER_TYPE_EDEFAULT == null ? renderType != null : !RENDER_TYPE_EDEFAULT.equals(renderType); - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public String toString() - { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (componentType: "); - result.append(componentType); - result.append(", componentFamily: "); - result.append(componentFamily); - result.append(", renderType: "); - result.append(renderType); - result.append(')'); - return result.toString(); - } - -} //ComponentTypeInfo_Impl diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/impl/ConverterTypeInfo_Impl.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/impl/ConverterTypeInfo_Impl.java deleted file mode 100644 index 988532025..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/impl/ConverterTypeInfo_Impl.java +++ /dev/null @@ -1,222 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: ConverterTypeInfo_Impl.java,v 1.1 2008/05/12 17:42:20 cbateman Exp $ - */ -package org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl; - -import java.util.Collection; -import org.eclipse.emf.common.notify.Notification; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EClass; - -import org.eclipse.emf.ecore.impl.ENotificationImpl; - -import org.eclipse.emf.ecore.util.EDataTypeUniqueEList; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ConverterTypeInfo_; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Converter Type Info </b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ConverterTypeInfo_Impl#getConverterId <em>Converter Id</em>}</li> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ConverterTypeInfo_Impl#getForClasses <em>For Classes</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class ConverterTypeInfo_Impl extends ClassTypeInfo_Impl implements ConverterTypeInfo_ -{ - /** - * The default value of the '{@link #getConverterId() <em>Converter Id</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getConverterId() - * @generated - * @ordered - */ - protected static final String CONVERTER_ID_EDEFAULT = null; - - /** - * The cached value of the '{@link #getConverterId() <em>Converter Id</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getConverterId() - * @generated - * @ordered - */ - protected String converterId = CONVERTER_ID_EDEFAULT; - - /** - * The cached value of the '{@link #getForClasses() <em>For Classes</em>}' attribute list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getForClasses() - * @generated - * @ordered - */ - protected EList<String> forClasses; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ConverterTypeInfo_Impl() - { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() - { - return ComponentMappingPackage.Literals.CONVERTER_TYPE_INFO_; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getConverterId() - { - return converterId; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setConverterId(String newConverterId) - { - String oldConverterId = converterId; - converterId = newConverterId; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, ComponentMappingPackage.CONVERTER_TYPE_INFO___CONVERTER_ID, oldConverterId, converterId)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EList<String> getForClasses() - { - if (forClasses == null) - { - forClasses = new EDataTypeUniqueEList<String>(String.class, this, ComponentMappingPackage.CONVERTER_TYPE_INFO___FOR_CLASSES); - } - return forClasses; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) - { - switch (featureID) - { - case ComponentMappingPackage.CONVERTER_TYPE_INFO___CONVERTER_ID: - return getConverterId(); - case ComponentMappingPackage.CONVERTER_TYPE_INFO___FOR_CLASSES: - return getForClasses(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @SuppressWarnings("unchecked") - @Override - public void eSet(int featureID, Object newValue) - { - switch (featureID) - { - case ComponentMappingPackage.CONVERTER_TYPE_INFO___CONVERTER_ID: - setConverterId((String)newValue); - return; - case ComponentMappingPackage.CONVERTER_TYPE_INFO___FOR_CLASSES: - getForClasses().clear(); - getForClasses().addAll((Collection<? extends String>)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) - { - switch (featureID) - { - case ComponentMappingPackage.CONVERTER_TYPE_INFO___CONVERTER_ID: - setConverterId(CONVERTER_ID_EDEFAULT); - return; - case ComponentMappingPackage.CONVERTER_TYPE_INFO___FOR_CLASSES: - getForClasses().clear(); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) - { - switch (featureID) - { - case ComponentMappingPackage.CONVERTER_TYPE_INFO___CONVERTER_ID: - return CONVERTER_ID_EDEFAULT == null ? converterId != null : !CONVERTER_ID_EDEFAULT.equals(converterId); - case ComponentMappingPackage.CONVERTER_TYPE_INFO___FOR_CLASSES: - return forClasses != null && !forClasses.isEmpty(); - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public String toString() - { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (converterId: "); - result.append(converterId); - result.append(", forClasses: "); - result.append(forClasses); - result.append(')'); - return result.toString(); - } - -} //ConverterTypeInfo_Impl diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/impl/TagMappingImpl.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/impl/TagMappingImpl.java deleted file mode 100644 index fedaf6726..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/impl/TagMappingImpl.java +++ /dev/null @@ -1,294 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: TagMappingImpl.java,v 1.1 2008/05/12 17:42:20 cbateman Exp $ - */ -package org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl; - -import java.util.Collection; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.NotificationChain; - -import org.eclipse.emf.common.util.EList; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.InternalEObject; - -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.impl.EObjectImpl; - -import org.eclipse.emf.ecore.util.EDataTypeUniqueEList; -import org.eclipse.emf.ecore.util.EObjectContainmentEList; -import org.eclipse.emf.ecore.util.InternalEList; - -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagMapping; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagToViewObjectMapping; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Tag Mapping</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.TagMappingImpl#getVersionedTagToViewMappings <em>Versioned Tag To View Mappings</em>}</li> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.TagMappingImpl#getCustomConversionFactoryId <em>Custom Conversion Factory Id</em>}</li> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.TagMappingImpl#getBeanMappedProperties <em>Bean Mapped Properties</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class TagMappingImpl extends EObjectImpl implements TagMapping -{ - /** - * The cached value of the '{@link #getVersionedTagToViewMappings() <em>Versioned Tag To View Mappings</em>}' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getVersionedTagToViewMappings() - * @generated - * @ordered - */ - protected EList<TagToViewObjectMapping> versionedTagToViewMappings; - - /** - * The default value of the '{@link #getCustomConversionFactoryId() <em>Custom Conversion Factory Id</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getCustomConversionFactoryId() - * @generated - * @ordered - */ - protected static final String CUSTOM_CONVERSION_FACTORY_ID_EDEFAULT = null; - /** - * The cached value of the '{@link #getCustomConversionFactoryId() <em>Custom Conversion Factory Id</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getCustomConversionFactoryId() - * @generated - * @ordered - */ - protected String customConversionFactoryId = CUSTOM_CONVERSION_FACTORY_ID_EDEFAULT; - - /** - * The cached value of the '{@link #getBeanMappedProperties() <em>Bean Mapped Properties</em>}' attribute list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getBeanMappedProperties() - * @generated - * @ordered - */ - protected EList<String> beanMappedProperties; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TagMappingImpl() - { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() - { - return ComponentMappingPackage.Literals.TAG_MAPPING; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EList<TagToViewObjectMapping> getVersionedTagToViewMappings() - { - if (versionedTagToViewMappings == null) - { - versionedTagToViewMappings = new EObjectContainmentEList<TagToViewObjectMapping>(TagToViewObjectMapping.class, this, ComponentMappingPackage.TAG_MAPPING__VERSIONED_TAG_TO_VIEW_MAPPINGS); - } - return versionedTagToViewMappings; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getCustomConversionFactoryId() - { - return customConversionFactoryId; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setCustomConversionFactoryId(String newCustomConversionFactoryId) - { - String oldCustomConversionFactoryId = customConversionFactoryId; - customConversionFactoryId = newCustomConversionFactoryId; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, ComponentMappingPackage.TAG_MAPPING__CUSTOM_CONVERSION_FACTORY_ID, oldCustomConversionFactoryId, customConversionFactoryId)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EList<String> getBeanMappedProperties() - { - if (beanMappedProperties == null) - { - beanMappedProperties = new EDataTypeUniqueEList<String>(String.class, this, ComponentMappingPackage.TAG_MAPPING__BEAN_MAPPED_PROPERTIES); - } - return beanMappedProperties; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void findBestMapping(String jsfVersion, String libVersion) - { - // TODO: implement this method - // Ensure that you remove @generated or mark it @generated NOT - throw new UnsupportedOperationException(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) - { - switch (featureID) - { - case ComponentMappingPackage.TAG_MAPPING__VERSIONED_TAG_TO_VIEW_MAPPINGS: - return ((InternalEList<?>)getVersionedTagToViewMappings()).basicRemove(otherEnd, msgs); - } - return super.eInverseRemove(otherEnd, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) - { - switch (featureID) - { - case ComponentMappingPackage.TAG_MAPPING__VERSIONED_TAG_TO_VIEW_MAPPINGS: - return getVersionedTagToViewMappings(); - case ComponentMappingPackage.TAG_MAPPING__CUSTOM_CONVERSION_FACTORY_ID: - return getCustomConversionFactoryId(); - case ComponentMappingPackage.TAG_MAPPING__BEAN_MAPPED_PROPERTIES: - return getBeanMappedProperties(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @SuppressWarnings("unchecked") - @Override - public void eSet(int featureID, Object newValue) - { - switch (featureID) - { - case ComponentMappingPackage.TAG_MAPPING__VERSIONED_TAG_TO_VIEW_MAPPINGS: - getVersionedTagToViewMappings().clear(); - getVersionedTagToViewMappings().addAll((Collection<? extends TagToViewObjectMapping>)newValue); - return; - case ComponentMappingPackage.TAG_MAPPING__CUSTOM_CONVERSION_FACTORY_ID: - setCustomConversionFactoryId((String)newValue); - return; - case ComponentMappingPackage.TAG_MAPPING__BEAN_MAPPED_PROPERTIES: - getBeanMappedProperties().clear(); - getBeanMappedProperties().addAll((Collection<? extends String>)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) - { - switch (featureID) - { - case ComponentMappingPackage.TAG_MAPPING__VERSIONED_TAG_TO_VIEW_MAPPINGS: - getVersionedTagToViewMappings().clear(); - return; - case ComponentMappingPackage.TAG_MAPPING__CUSTOM_CONVERSION_FACTORY_ID: - setCustomConversionFactoryId(CUSTOM_CONVERSION_FACTORY_ID_EDEFAULT); - return; - case ComponentMappingPackage.TAG_MAPPING__BEAN_MAPPED_PROPERTIES: - getBeanMappedProperties().clear(); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) - { - switch (featureID) - { - case ComponentMappingPackage.TAG_MAPPING__VERSIONED_TAG_TO_VIEW_MAPPINGS: - return versionedTagToViewMappings != null && !versionedTagToViewMappings.isEmpty(); - case ComponentMappingPackage.TAG_MAPPING__CUSTOM_CONVERSION_FACTORY_ID: - return CUSTOM_CONVERSION_FACTORY_ID_EDEFAULT == null ? customConversionFactoryId != null : !CUSTOM_CONVERSION_FACTORY_ID_EDEFAULT.equals(customConversionFactoryId); - case ComponentMappingPackage.TAG_MAPPING__BEAN_MAPPED_PROPERTIES: - return beanMappedProperties != null && !beanMappedProperties.isEmpty(); - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public String toString() - { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (customConversionFactoryId: "); - result.append(customConversionFactoryId); - result.append(", beanMappedProperties: "); - result.append(beanMappedProperties); - result.append(')'); - return result.toString(); - } - -} //TagMappingImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/impl/TagToViewObjectMappingImpl.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/impl/TagToViewObjectMappingImpl.java deleted file mode 100644 index dbaaa73c2..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/impl/TagToViewObjectMappingImpl.java +++ /dev/null @@ -1,314 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: TagToViewObjectMappingImpl.java,v 1.1 2008/05/12 17:42:20 cbateman Exp $ - */ -package org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl; - -import org.eclipse.emf.common.notify.Notification; - -import org.eclipse.emf.common.notify.NotificationChain; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.InternalEObject; - -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.impl.EObjectImpl; - -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ClassTypeInfo_; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagToViewObjectMapping; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Tag To View Object Mapping</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.TagToViewObjectMappingImpl#getTypeInfo <em>Type Info</em>}</li> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.TagToViewObjectMappingImpl#getMinJSFVersion <em>Min JSF Version</em>}</li> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.TagToViewObjectMappingImpl#getMinLibraryVersion <em>Min Library Version</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class TagToViewObjectMappingImpl extends EObjectImpl implements TagToViewObjectMapping -{ - /** - * The cached value of the '{@link #getTypeInfo() <em>Type Info</em>}' containment reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getTypeInfo() - * @generated - * @ordered - */ - protected ClassTypeInfo_ typeInfo; - - /** - * The default value of the '{@link #getMinJSFVersion() <em>Min JSF Version</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getMinJSFVersion() - * @generated - * @ordered - */ - protected static final String MIN_JSF_VERSION_EDEFAULT = "1.1"; - - /** - * The cached value of the '{@link #getMinJSFVersion() <em>Min JSF Version</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getMinJSFVersion() - * @generated - * @ordered - */ - protected String minJSFVersion = MIN_JSF_VERSION_EDEFAULT; - - /** - * The default value of the '{@link #getMinLibraryVersion() <em>Min Library Version</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getMinLibraryVersion() - * @generated - * @ordered - */ - protected static final String MIN_LIBRARY_VERSION_EDEFAULT = ""; - - /** - * The cached value of the '{@link #getMinLibraryVersion() <em>Min Library Version</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getMinLibraryVersion() - * @generated - * @ordered - */ - protected String minLibraryVersion = MIN_LIBRARY_VERSION_EDEFAULT; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TagToViewObjectMappingImpl() - { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() - { - return ComponentMappingPackage.Literals.TAG_TO_VIEW_OBJECT_MAPPING; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ClassTypeInfo_ getTypeInfo() - { - return typeInfo; - } - - /** - * <!-- begin-user-doc --> - * @param newTypeInfo - * @param msgs - * @return the notification chain - * <!-- end-user-doc --> - * @generated - */ - public NotificationChain basicSetTypeInfo(ClassTypeInfo_ newTypeInfo, NotificationChain msgs) - { - ClassTypeInfo_ oldTypeInfo = typeInfo; - typeInfo = newTypeInfo; - if (eNotificationRequired()) - { - ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ComponentMappingPackage.TAG_TO_VIEW_OBJECT_MAPPING__TYPE_INFO, oldTypeInfo, newTypeInfo); - if (msgs == null) msgs = notification; else msgs.add(notification); - } - return msgs; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setTypeInfo(ClassTypeInfo_ newTypeInfo) - { - if (newTypeInfo != typeInfo) - { - NotificationChain msgs = null; - if (typeInfo != null) - msgs = ((InternalEObject)typeInfo).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ComponentMappingPackage.TAG_TO_VIEW_OBJECT_MAPPING__TYPE_INFO, null, msgs); - if (newTypeInfo != null) - msgs = ((InternalEObject)newTypeInfo).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ComponentMappingPackage.TAG_TO_VIEW_OBJECT_MAPPING__TYPE_INFO, null, msgs); - msgs = basicSetTypeInfo(newTypeInfo, msgs); - if (msgs != null) msgs.dispatch(); - } - else if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, ComponentMappingPackage.TAG_TO_VIEW_OBJECT_MAPPING__TYPE_INFO, newTypeInfo, newTypeInfo)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getMinJSFVersion() - { - return minJSFVersion; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setMinJSFVersion(String newMinJSFVersion) - { - String oldMinJSFVersion = minJSFVersion; - minJSFVersion = newMinJSFVersion; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, ComponentMappingPackage.TAG_TO_VIEW_OBJECT_MAPPING__MIN_JSF_VERSION, oldMinJSFVersion, minJSFVersion)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getMinLibraryVersion() - { - return minLibraryVersion; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setMinLibraryVersion(String newMinLibraryVersion) - { - String oldMinLibraryVersion = minLibraryVersion; - minLibraryVersion = newMinLibraryVersion; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, ComponentMappingPackage.TAG_TO_VIEW_OBJECT_MAPPING__MIN_LIBRARY_VERSION, oldMinLibraryVersion, minLibraryVersion)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) - { - switch (featureID) - { - case ComponentMappingPackage.TAG_TO_VIEW_OBJECT_MAPPING__TYPE_INFO: - return basicSetTypeInfo(null, msgs); - } - return super.eInverseRemove(otherEnd, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) - { - switch (featureID) - { - case ComponentMappingPackage.TAG_TO_VIEW_OBJECT_MAPPING__TYPE_INFO: - return getTypeInfo(); - case ComponentMappingPackage.TAG_TO_VIEW_OBJECT_MAPPING__MIN_JSF_VERSION: - return getMinJSFVersion(); - case ComponentMappingPackage.TAG_TO_VIEW_OBJECT_MAPPING__MIN_LIBRARY_VERSION: - return getMinLibraryVersion(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eSet(int featureID, Object newValue) - { - switch (featureID) - { - case ComponentMappingPackage.TAG_TO_VIEW_OBJECT_MAPPING__TYPE_INFO: - setTypeInfo((ClassTypeInfo_)newValue); - return; - case ComponentMappingPackage.TAG_TO_VIEW_OBJECT_MAPPING__MIN_JSF_VERSION: - setMinJSFVersion((String)newValue); - return; - case ComponentMappingPackage.TAG_TO_VIEW_OBJECT_MAPPING__MIN_LIBRARY_VERSION: - setMinLibraryVersion((String)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) - { - switch (featureID) - { - case ComponentMappingPackage.TAG_TO_VIEW_OBJECT_MAPPING__TYPE_INFO: - setTypeInfo((ClassTypeInfo_)null); - return; - case ComponentMappingPackage.TAG_TO_VIEW_OBJECT_MAPPING__MIN_JSF_VERSION: - setMinJSFVersion(MIN_JSF_VERSION_EDEFAULT); - return; - case ComponentMappingPackage.TAG_TO_VIEW_OBJECT_MAPPING__MIN_LIBRARY_VERSION: - setMinLibraryVersion(MIN_LIBRARY_VERSION_EDEFAULT); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) - { - switch (featureID) - { - case ComponentMappingPackage.TAG_TO_VIEW_OBJECT_MAPPING__TYPE_INFO: - return typeInfo != null; - case ComponentMappingPackage.TAG_TO_VIEW_OBJECT_MAPPING__MIN_JSF_VERSION: - return MIN_JSF_VERSION_EDEFAULT == null ? minJSFVersion != null : !MIN_JSF_VERSION_EDEFAULT.equals(minJSFVersion); - case ComponentMappingPackage.TAG_TO_VIEW_OBJECT_MAPPING__MIN_LIBRARY_VERSION: - return MIN_LIBRARY_VERSION_EDEFAULT == null ? minLibraryVersion != null : !MIN_LIBRARY_VERSION_EDEFAULT.equals(minLibraryVersion); - } - return super.eIsSet(featureID); - } - - @Override - public String toString() - { - return "TagToViewObjectMapping: typeInfo="+getTypeInfo(); - } -} //TagToViewObjectMappingImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/impl/ValidatorTypeInfo_Impl.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/impl/ValidatorTypeInfo_Impl.java deleted file mode 100644 index bcfcfdbf2..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/impl/ValidatorTypeInfo_Impl.java +++ /dev/null @@ -1,180 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: ValidatorTypeInfo_Impl.java,v 1.1 2008/05/12 17:42:20 cbateman Exp $ - */ -package org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl; - -import org.eclipse.emf.common.notify.Notification; - -import org.eclipse.emf.ecore.EClass; - -import org.eclipse.emf.ecore.impl.ENotificationImpl; - -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ValidatorTypeInfo_; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Validator Type Info </b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ValidatorTypeInfo_Impl#getValidatorId <em>Validator Id</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class ValidatorTypeInfo_Impl extends ClassTypeInfo_Impl implements ValidatorTypeInfo_ -{ - /** - * The default value of the '{@link #getValidatorId() <em>Validator Id</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getValidatorId() - * @generated - * @ordered - */ - protected static final String VALIDATOR_ID_EDEFAULT = null; - - /** - * The cached value of the '{@link #getValidatorId() <em>Validator Id</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getValidatorId() - * @generated - * @ordered - */ - protected String validatorId = VALIDATOR_ID_EDEFAULT; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ValidatorTypeInfo_Impl() - { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() - { - return ComponentMappingPackage.Literals.VALIDATOR_TYPE_INFO_; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getValidatorId() - { - return validatorId; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setValidatorId(String newValidatorId) - { - String oldValidatorId = validatorId; - validatorId = newValidatorId; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, ComponentMappingPackage.VALIDATOR_TYPE_INFO___VALIDATOR_ID, oldValidatorId, validatorId)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) - { - switch (featureID) - { - case ComponentMappingPackage.VALIDATOR_TYPE_INFO___VALIDATOR_ID: - return getValidatorId(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eSet(int featureID, Object newValue) - { - switch (featureID) - { - case ComponentMappingPackage.VALIDATOR_TYPE_INFO___VALIDATOR_ID: - setValidatorId((String)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) - { - switch (featureID) - { - case ComponentMappingPackage.VALIDATOR_TYPE_INFO___VALIDATOR_ID: - setValidatorId(VALIDATOR_ID_EDEFAULT); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) - { - switch (featureID) - { - case ComponentMappingPackage.VALIDATOR_TYPE_INFO___VALIDATOR_ID: - return VALIDATOR_ID_EDEFAULT == null ? validatorId != null : !VALIDATOR_ID_EDEFAULT.equals(validatorId); - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public String toString() - { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (validatorId: "); - result.append(validatorId); - result.append(')'); - return result.toString(); - } - -} //ValidatorTypeInfo_Impl diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/util/ComponentMappingAdapterFactory.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/util/ComponentMappingAdapterFactory.java deleted file mode 100644 index 767687908..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/util/ComponentMappingAdapterFactory.java +++ /dev/null @@ -1,256 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: ComponentMappingAdapterFactory.java,v 1.1 2008/05/12 17:42:21 cbateman Exp $ - */ -package org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.util; - -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.common.notify.Notifier; - -import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; - -import org.eclipse.emf.ecore.EObject; - -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.*; - -/** - * <!-- begin-user-doc --> - * The <b>Adapter Factory</b> for the model. - * It provides an adapter <code>createXXX</code> method for each class of the model. - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage - * @generated - */ -public class ComponentMappingAdapterFactory extends AdapterFactoryImpl -{ - /** - * The cached model package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected static ComponentMappingPackage modelPackage; - - /** - * Creates an instance of the adapter factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ComponentMappingAdapterFactory() - { - if (modelPackage == null) - { - modelPackage = ComponentMappingPackage.eINSTANCE; - } - } - - /** - * Returns whether this factory is applicable for the type of the object. - * <!-- begin-user-doc --> - * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model. - * <!-- end-user-doc --> - * @return whether this factory is applicable for the type of the object. - * @generated - */ - @Override - public boolean isFactoryForType(Object object) - { - if (object == modelPackage) - { - return true; - } - if (object instanceof EObject) - { - return ((EObject)object).eClass().getEPackage() == modelPackage; - } - return false; - } - - /** - * The switch that delegates to the <code>createXXX</code> methods. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ComponentMappingSwitch<Adapter> modelSwitch = - new ComponentMappingSwitch<Adapter>() - { - @Override - public Adapter caseTagMapping(TagMapping object) - { - return createTagMappingAdapter(); - } - @Override - public Adapter caseTagToViewObjectMapping(TagToViewObjectMapping object) - { - return createTagToViewObjectMappingAdapter(); - } - @Override - public Adapter caseClassTypeInfo_(ClassTypeInfo_ object) - { - return createClassTypeInfo_Adapter(); - } - @Override - public Adapter caseComponentTypeInfo_(ComponentTypeInfo_ object) - { - return createComponentTypeInfo_Adapter(); - } - @Override - public Adapter caseConverterTypeInfo_(ConverterTypeInfo_ object) - { - return createConverterTypeInfo_Adapter(); - } - @Override - public Adapter caseValidatorTypeInfo_(ValidatorTypeInfo_ object) - { - return createValidatorTypeInfo_Adapter(); - } - @Override - public Adapter caseAttributeToPropertyMapping(AttributeToPropertyMapping object) - { - return createAttributeToPropertyMappingAdapter(); - } - @Override - public Adapter defaultCase(EObject object) - { - return createEObjectAdapter(); - } - }; - - /** - * Creates an adapter for the <code>target</code>. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param target the object to adapt. - * @return the adapter for the <code>target</code>. - * @generated - */ - @Override - public Adapter createAdapter(Notifier target) - { - return modelSwitch.doSwitch((EObject)target); - } - - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagMapping <em>Tag Mapping</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagMapping - * @generated - */ - public Adapter createTagMappingAdapter() - { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagToViewObjectMapping <em>Tag To View Object Mapping</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagToViewObjectMapping - * @generated - */ - public Adapter createTagToViewObjectMappingAdapter() - { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ClassTypeInfo_ <em>Class Type Info </em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ClassTypeInfo_ - * @generated - */ - public Adapter createClassTypeInfo_Adapter() - { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentTypeInfo_ <em>Component Type Info </em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentTypeInfo_ - * @generated - */ - public Adapter createComponentTypeInfo_Adapter() - { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ConverterTypeInfo_ <em>Converter Type Info </em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ConverterTypeInfo_ - * @generated - */ - public Adapter createConverterTypeInfo_Adapter() - { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ValidatorTypeInfo_ <em>Validator Type Info </em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ValidatorTypeInfo_ - * @generated - */ - public Adapter createValidatorTypeInfo_Adapter() - { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.AttributeToPropertyMapping <em>Attribute To Property Mapping</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.AttributeToPropertyMapping - * @generated - */ - public Adapter createAttributeToPropertyMappingAdapter() - { - return null; - } - - /** - * Creates a new adapter for the default case. - * <!-- begin-user-doc --> - * This default implementation returns null. - * <!-- end-user-doc --> - * @return the new adapter. - * @generated - */ - public Adapter createEObjectAdapter() - { - return null; - } - -} //ComponentMappingAdapterFactory diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/util/ComponentMappingResourceFactoryImpl.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/util/ComponentMappingResourceFactoryImpl.java deleted file mode 100644 index 08f2fbf27..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/util/ComponentMappingResourceFactoryImpl.java +++ /dev/null @@ -1,59 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: ComponentMappingResourceFactoryImpl.java,v 1.1 2008/05/12 17:42:21 cbateman Exp $ - */ -package org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.util; - -import org.eclipse.emf.common.util.URI; - -import org.eclipse.emf.ecore.resource.Resource; - -import org.eclipse.emf.ecore.resource.impl.ResourceFactoryImpl; - -import org.eclipse.emf.ecore.xmi.XMLResource; - -/** - * <!-- begin-user-doc --> - * The <b>Resource Factory</b> associated with the package. - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.util.ComponentMappingResourceImpl - * @generated - */ -public class ComponentMappingResourceFactoryImpl extends ResourceFactoryImpl -{ - /** - * Creates an instance of the resource factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ComponentMappingResourceFactoryImpl() - { - super(); - } - - /** - * Creates an instance of the resource. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Resource createResource(URI uri) - { - XMLResource result = new ComponentMappingResourceImpl(uri); - result.getDefaultSaveOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE); - result.getDefaultLoadOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE); - - result.getDefaultSaveOptions().put(XMLResource.OPTION_SCHEMA_LOCATION, Boolean.TRUE); - - result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, Boolean.TRUE); - result.getDefaultSaveOptions().put(XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, Boolean.TRUE); - - result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_LEXICAL_HANDLER, Boolean.TRUE); - return result; - } - -} //ComponentMappingResourceFactoryImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/util/ComponentMappingResourceImpl.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/util/ComponentMappingResourceImpl.java deleted file mode 100644 index 8d3c819df..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/util/ComponentMappingResourceImpl.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: ComponentMappingResourceImpl.java,v 1.1 2008/05/12 17:42:21 cbateman Exp $ - */ -package org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.util; - -import org.eclipse.emf.common.util.URI; - -import org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl; - -/** - * <!-- begin-user-doc --> - * The <b>Resource </b> associated with the package. - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.util.ComponentMappingResourceFactoryImpl - * @generated - */ -public class ComponentMappingResourceImpl extends XMLResourceImpl -{ - /** - * Creates an instance of the resource. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param uri the URI of the new resource. - * @generated - */ - public ComponentMappingResourceImpl(URI uri) - { - super(uri); - } - -} //ComponentMappingResourceImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/util/ComponentMappingSwitch.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/util/ComponentMappingSwitch.java deleted file mode 100644 index 3de410697..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/util/ComponentMappingSwitch.java +++ /dev/null @@ -1,286 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: ComponentMappingSwitch.java,v 1.1 2008/05/12 17:42:21 cbateman Exp $ - */ -package org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.util; - -import java.util.List; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; - -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.*; - -/** - * <!-- begin-user-doc --> - * The <b>Switch</b> for the model's inheritance hierarchy. - * It supports the call {@link #doSwitch(EObject) doSwitch(object)} - * to invoke the <code>caseXXX</code> method for each class of the model, - * starting with the actual class of the object - * and proceeding up the inheritance hierarchy - * until a non-null result is returned, - * which is the result of the switch. - * @param <T> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage - * @generated - */ -public class ComponentMappingSwitch<T> -{ - /** - * The cached model package - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected static ComponentMappingPackage modelPackage; - - /** - * Creates an instance of the switch. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ComponentMappingSwitch() - { - if (modelPackage == null) - { - modelPackage = ComponentMappingPackage.eINSTANCE; - } - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * @param theEObject - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - public T doSwitch(EObject theEObject) - { - return doSwitch(theEObject.eClass(), theEObject); - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * @param theEClass - * @param theEObject - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - protected T doSwitch(EClass theEClass, EObject theEObject) - { - if (theEClass.eContainer() == modelPackage) - { - return doSwitch(theEClass.getClassifierID(), theEObject); - } - List<EClass> eSuperTypes = theEClass.getESuperTypes(); - return - eSuperTypes.isEmpty() ? - defaultCase(theEObject) : - doSwitch(eSuperTypes.get(0), theEObject); - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * @param classifierID - * @param theEObject - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - protected T doSwitch(int classifierID, EObject theEObject) - { - switch (classifierID) - { - case ComponentMappingPackage.TAG_MAPPING: - { - TagMapping tagMapping = (TagMapping)theEObject; - T result = caseTagMapping(tagMapping); - if (result == null) result = defaultCase(theEObject); - return result; - } - case ComponentMappingPackage.TAG_TO_VIEW_OBJECT_MAPPING: - { - TagToViewObjectMapping tagToViewObjectMapping = (TagToViewObjectMapping)theEObject; - T result = caseTagToViewObjectMapping(tagToViewObjectMapping); - if (result == null) result = defaultCase(theEObject); - return result; - } - case ComponentMappingPackage.CLASS_TYPE_INFO_: - { - ClassTypeInfo_ classTypeInfo_ = (ClassTypeInfo_)theEObject; - T result = caseClassTypeInfo_(classTypeInfo_); - if (result == null) result = defaultCase(theEObject); - return result; - } - case ComponentMappingPackage.COMPONENT_TYPE_INFO_: - { - ComponentTypeInfo_ componentTypeInfo_ = (ComponentTypeInfo_)theEObject; - T result = caseComponentTypeInfo_(componentTypeInfo_); - if (result == null) result = caseClassTypeInfo_(componentTypeInfo_); - if (result == null) result = defaultCase(theEObject); - return result; - } - case ComponentMappingPackage.CONVERTER_TYPE_INFO_: - { - ConverterTypeInfo_ converterTypeInfo_ = (ConverterTypeInfo_)theEObject; - T result = caseConverterTypeInfo_(converterTypeInfo_); - if (result == null) result = caseClassTypeInfo_(converterTypeInfo_); - if (result == null) result = defaultCase(theEObject); - return result; - } - case ComponentMappingPackage.VALIDATOR_TYPE_INFO_: - { - ValidatorTypeInfo_ validatorTypeInfo_ = (ValidatorTypeInfo_)theEObject; - T result = caseValidatorTypeInfo_(validatorTypeInfo_); - if (result == null) result = caseClassTypeInfo_(validatorTypeInfo_); - if (result == null) result = defaultCase(theEObject); - return result; - } - case ComponentMappingPackage.ATTRIBUTE_TO_PROPERTY_MAPPING: - { - AttributeToPropertyMapping attributeToPropertyMapping = (AttributeToPropertyMapping)theEObject; - T result = caseAttributeToPropertyMapping(attributeToPropertyMapping); - if (result == null) result = defaultCase(theEObject); - return result; - } - default: return defaultCase(theEObject); - } - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Tag Mapping</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Tag Mapping</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseTagMapping(TagMapping object) - { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Tag To View Object Mapping</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Tag To View Object Mapping</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseTagToViewObjectMapping(TagToViewObjectMapping object) - { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Class Type Info </em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Class Type Info </em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseClassTypeInfo_(ClassTypeInfo_ object) - { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Component Type Info </em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Component Type Info </em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseComponentTypeInfo_(ComponentTypeInfo_ object) - { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Converter Type Info </em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Converter Type Info </em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseConverterTypeInfo_(ConverterTypeInfo_ object) - { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Validator Type Info </em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Validator Type Info </em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseValidatorTypeInfo_(ValidatorTypeInfo_ object) - { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Attribute To Property Mapping</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Attribute To Property Mapping</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseAttributeToPropertyMapping(AttributeToPropertyMapping object) - { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch, but this is the last case anyway. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>EObject</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) - * @generated - */ - public T defaultCase(EObject object) - { - return null; - } - -} //ComponentMappingSwitch diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/util/ComponentMappingXMLProcessor.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/util/ComponentMappingXMLProcessor.java deleted file mode 100644 index 0280c4e09..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/util/ComponentMappingXMLProcessor.java +++ /dev/null @@ -1,58 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: ComponentMappingXMLProcessor.java,v 1.1 2008/05/12 17:42:21 cbateman Exp $ - */ -package org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.util; - -import java.util.Map; - -import org.eclipse.emf.ecore.EPackage; - -import org.eclipse.emf.ecore.resource.Resource; - -import org.eclipse.emf.ecore.xmi.util.XMLProcessor; - -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage; - -/** - * This class contains helper methods to serialize and deserialize XML documents - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -public class ComponentMappingXMLProcessor extends XMLProcessor -{ - - /** - * Public constructor to instantiate the helper. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ComponentMappingXMLProcessor() - { - super((EPackage.Registry.INSTANCE)); - ComponentMappingPackage.eINSTANCE.eClass(); - } - - /** - * Register for "*" and "xml" file extensions the ComponentMappingResourceFactoryImpl factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected Map<String, Resource.Factory> getRegistrations() - { - if (registrations == null) - { - super.getRegistrations(); - registrations.put(XML_EXTENSION, new ComponentMappingResourceFactoryImpl()); - registrations.put(STAR_EXTENSION, new ComponentMappingResourceFactoryImpl()); - } - return registrations; - } - -} //ComponentMappingXMLProcessor diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/AbstractTagRegistry.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/AbstractTagRegistry.java deleted file mode 100644 index edc4118ec..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/AbstractTagRegistry.java +++ /dev/null @@ -1,149 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.model; - -import java.util.Collection; -import java.util.List; -import java.util.concurrent.CopyOnWriteArrayList; -import java.util.concurrent.atomic.AtomicBoolean; - -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.jst.jsf.common.internal.RunOnCompletionPattern; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.Namespace; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; - -/** - * The abstract registry that all implementations of ITagRegistry should - * sub-class. - * - * @author cbateman - * - */ -public abstract class AbstractTagRegistry implements ITagRegistry -{ - private final List<ITagRegistryListener> _listeners; - private final AtomicBoolean _isDisposed = new AtomicBoolean( - false); - - /** - * - */ - protected AbstractTagRegistry() - { - super(); - _listeners = new CopyOnWriteArrayList<ITagRegistryListener>(); - } - - public final void addListener(final ITagRegistryListener listener) - { - if (!_listeners.contains(listener)) - { - _listeners.add(listener); - } - } - - public final void removeListener(final ITagRegistryListener listener) - { - _listeners.remove(listener); - } - - /** - * @param event - */ - protected final void fireEvent(final TagRegistryChangeEvent event) - { - for (final ITagRegistryListener listener : _listeners) - { - try - { - listener.registryChanged(event); - } - catch (final Exception e) - { - JSFCorePlugin.log(new Exception(e), - "During change event notification"); - } - } - } - - public abstract Collection<? extends Namespace> getAllTagLibraries(); - - public abstract Namespace getTagLibrary(String uri); - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.jsf.designtime.internal.view.model.jsp.registry.ITagRegistry#isDisposed() - */ - public final boolean isDisposed() - { - return _isDisposed.get(); - } - - /** - * - */ - public final void destroy() - { - cleanupPersistentState(); - dispose(); - } - - /** - * Called by destroy before it calls dispose. Sub-class should - * invalidate, and ideally delete, any persistent state. - * - * NOTE: DO NOT call dispose functionality from this call. The framework - * will call dispose() immediately after cleanupPersistentState. - */ - protected abstract void cleanupPersistentState(); - - /** - * Must be factories or caches when disposing the registry. Instances - * must implement doDispose to provide their specific disposal operations. - */ - public final void dispose() - { - // latch on the isDisposed flag so this block can only ever - // execute once - if (_isDisposed.compareAndSet(false, true)) - { - fireEvent(new TagRegistryChangeEvent(this, - TagRegistryChangeEvent.EventType.REGISTRY_DISPOSED)); - doDispose(); - } - } - - /** - * Implement with instance specific disposal operations. Do do not fire - * the REGISTRY_DISPOSED event from this method (it is done in dispose. - * - * Implementer must assume that this method be called at most once and that - * it is error to access the registry instance after it is called - */ - protected abstract void doDispose(); - - public final void refresh(final Runnable runAfter, final boolean flushCaches) - { - final Job refreshJob = getRefreshJob(flushCaches); - - final RunOnCompletionPattern runPattern = new RunOnCompletionPattern( - refreshJob, runAfter); - runPattern.run(); - } - - /** - * @param flushCaches - * @return a job that, when run, will perform the registry refresh. Job - * must do any necessary synchronizing of internal state. - */ - protected abstract Job getRefreshJob(final boolean flushCaches); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/ITagRegistry.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/ITagRegistry.java deleted file mode 100644 index 7bb3dde8d..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/ITagRegistry.java +++ /dev/null @@ -1,150 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.model; - -import java.util.Collection; -import java.util.Collections; -import java.util.EventListener; -import java.util.EventObject; -import java.util.List; - -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.Namespace; - -/** - * A registry for tags for a given context TODO: generally tied to project, but - * may also need a tie to specific tag-in-use type. For example, if JSPs and - * Facelets are used at the same time? - * - * @author cbateman - * - */ -public interface ITagRegistry -{ - - /** - * @return true if this registry is disposed. It is an error to use a - * disposed registry and behaviour of such a registry is not - * guaranteed. - */ - public abstract boolean isDisposed(); - - /** - * This method may cause long-running operations to be executed. If runAfter - * is non-null, any long running operations will schedule asynchronously on - * a separate thread and on successful completion, runAfter will be executed - * (no assumption should be made about what thread it is run on). - * - * @param runAfter - * @param flushCaches true indicates that any cached data should be flushed. - * - */ - public abstract void refresh(final Runnable runAfter, final boolean flushCaches); - - /** - * Callers should assume the collection is not modifiable. Implementers - * may return a collection whose mutator operations throw exceptions. - * - * @return all tag libraries for a project tag registry - */ - public abstract Collection<? extends Namespace> getAllTagLibraries(); - - /** - * @param uri - * @return the tag library corresponding to uri or null if none. - */ - public abstract Namespace getTagLibrary(final String uri); - - /** - * Adds the listener to the list of objects that receive change events - * from this tag registry instance. If listener is already in the list, - * it will not be added again. - * - * @param listener - */ - public abstract void addListener(ITagRegistryListener listener); - - /** - * Remove listener from the list of objects that receive change events - * from this tag registry instance. - * - * @param listener - */ - public abstract void removeListener(ITagRegistryListener listener); - - - /** - * Marks a listener that receives tag registry change events - * - */ - interface ITagRegistryListener extends EventListener - { - /** - * @param changeEvent - */ - void registryChanged(final TagRegistryChangeEvent changeEvent); - } - - /** - * A change event object that communicates a single type of change to - * a single tag registry - * - */ - static class TagRegistryChangeEvent extends EventObject - { - public enum EventType - { - // if the type is any of these three, then getAffectedObjects() - // will return one or more Namespace objects that have changed. - ADDED_NAMESPACE, - REMOVED_NAMESPACE, - CHANGED_NAMESPACE, - - // if the type is is this one, then the event is being called - // before dispose operation on getSource(). - REGISTRY_DISPOSED - } - /** - * - */ - private static final long serialVersionUID = 6559096306615373552L; - private final List<? extends Namespace> _affectedObjects; - private final EventType _type; - - public TagRegistryChangeEvent(ITagRegistry source, EventType type) - { - this(source, type, Collections.EMPTY_LIST); - } - - public TagRegistryChangeEvent(ITagRegistry source, EventType type, - List<? extends Namespace> affectedObjects) - { - super(source); - _affectedObjects = affectedObjects; - _type = type; - } - - @Override - public ITagRegistry getSource() - { - return (ITagRegistry) super.getSource(); - } - - public List<? extends Namespace> getAffectedObjects() - { - return _affectedObjects; - } - - public EventType getType() - { - return _type; - } - } -}
\ No newline at end of file diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/TagRegistryFactory.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/TagRegistryFactory.java deleted file mode 100644 index 867125798..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/TagRegistryFactory.java +++ /dev/null @@ -1,83 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.model; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.jsf.common.internal.strategy.IIdentifiableStrategy; - -/** - * Creates a tag registry for the given project. The factory may use - * whatever mechanism it chooses and the tag registry may or may not be a - * single instance for project. - * - * @author cbateman - * - */ -public abstract class TagRegistryFactory implements IIdentifiableStrategy<IProject, ITagRegistry, String> -{ - private static final ITagRegistry NO_RESULT = null; - - private static final String ID = "org.eclipse.jst.jsf.designtime.view.model.TagRegistryFactory"; - - /** - * @param project - * @return a tag registry for project. This instance may be a common - * shared per-project singleton. The factory must ensure that the registry - * is cleaned up if the associated project becomes inaccessible (see IProject.isAccessible). - * Return null if none. - * - * @throws TagRegistryFactoryException - */ - public abstract ITagRegistry createTagRegistry(final IProject project) throws TagRegistryFactoryException; - - /** - * Allow - * - * @param project - * @return true if an instance of ITagRegistry already exists for project - */ - public abstract boolean isInstance(final IProject project); - - public final ITagRegistry getNoResult() - { - return NO_RESULT; - } - - public final ITagRegistry perform(IProject project) throws Exception - { - return createTagRegistry(project); - } - - public String getId() - { - return ID; - } - - /** - * Wraps exceptions generated by trying to create a tag registry - */ - public static class TagRegistryFactoryException extends Exception - { - /** - * serializable id - */ - private static final long serialVersionUID = 1361229535611361339L; - - /** - * @param cause - */ - public TagRegistryFactoryException(Throwable cause) - { - super("Problem during tag registry construction", cause); - } - - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/AbstractTagResolvingStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/AbstractTagResolvingStrategy.java deleted file mode 100644 index 637ec963c..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/AbstractTagResolvingStrategy.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.model.jsp; - -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagElement; - -/** - * Implements the tag resolving strategy. - * - * @author cbateman - * - * @param <TLDELEMENT> - * @param <IDTYPE> - */ -public abstract class AbstractTagResolvingStrategy<TLDELEMENT, IDTYPE> - implements ITagResolvingStrategy<TLDELEMENT, IDTYPE> -{ - private final static ITagElement NOT_FOUND_INDICATOR = null; - - public ITagElement getNotFoundIndicator() - { - return NOT_FOUND_INDICATOR; - } - - public abstract ITagElement resolve(TLDELEMENT element); - - public abstract IDTYPE getId(); - - /** - * Must always be the same as resolve. - */ - public final ITagElement perform(TLDELEMENT element) - { - return resolve(element); - } - - /** - * Must always be the same as getNotFoundIndicator. - */ - public final ITagElement getNoResult() - { - return getNotFoundIndicator(); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/CMNodeNamedMapAdapter.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/CMNodeNamedMapAdapter.java deleted file mode 100644 index 4a2ab0fe2..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/CMNodeNamedMapAdapter.java +++ /dev/null @@ -1,179 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.model.jsp; - -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.io.Serializable; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.atomic.AtomicBoolean; - -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagAttributeHandler; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.IAttributeAdvisor.UnknownAttributeException; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDElementDeclaration; -import org.eclipse.wst.xml.core.internal.contentmodel.CMAttributeDeclaration; - -/** - * Adapts TLDDocument attributes to a simple map of ITagAttributeHandler. Map is - * unmodifiable. - * - * @author cbateman - * - */ -public class CMNodeNamedMapAdapter implements - Map<String, ITagAttributeHandler>, Serializable -{ - /** - * serializable id - */ - private static final long serialVersionUID = -4188412823197830484L; - private transient final TLDElementDeclaration _tldElement; - private transient final IAttributeAdvisor _advisor; - private transient AtomicBoolean _isInitialized = new AtomicBoolean(false); - private final Map<String, ITagAttributeHandler> _cache; - - /** - * @param tldDoc - * @param advisor - */ - public CMNodeNamedMapAdapter(final TLDElementDeclaration tldDoc, - final IAttributeAdvisor advisor) - { - _tldElement = tldDoc; - _advisor = advisor; - _cache = new HashMap<String, ITagAttributeHandler>(); - } - - public boolean containsKey(Object key) - { - ensureAllAttributes(); - return _cache.containsKey(key); - } - - public boolean containsValue(Object value) - { - ensureAllAttributes(); - return _cache.containsValue(value); - } - - public Set<java.util.Map.Entry<String, ITagAttributeHandler>> entrySet() - { - ensureAllAttributes(); - return _cache.entrySet(); - } - - - public ITagAttributeHandler get(Object key) - { - if (key instanceof String) - { - return getOrCreateAttribute((String) key); - } - return null; - } - - public boolean isEmpty() - { - return size() == 0; - } - - public Set<String> keySet() - { - ensureAllAttributes(); - return Collections.unmodifiableSet(_cache.keySet()); - } - - public int size() - { - if (_tldElement != null) - { - return _tldElement.getAttributes().getLength(); - } - return _cache.size(); - } - - public Collection<ITagAttributeHandler> values() - { - ensureAllAttributes(); - return Collections.unmodifiableCollection(_cache.values()); - } - - private synchronized ITagAttributeHandler getOrCreateAttribute(final String name) - { - ITagAttributeHandler tagAttr = _cache.get(name); - - if (tagAttr == null) - { - try - { - tagAttr = _advisor.createAttributeHandler(name); - _cache.put(name, tagAttr); - } - catch (UnknownAttributeException e) - { - JSFCorePlugin.log(e, "Trying to get attribute for "+name); - } - } - - return tagAttr; - } - - private void ensureAllAttributes() - { - if (_isInitialized.compareAndSet(false, true)) - { - for (final Iterator it = _tldElement.getAttributes().iterator(); it.hasNext();) - { - final CMAttributeDeclaration attrDecl = (CMAttributeDeclaration) it.next(); - getOrCreateAttribute(attrDecl.getAttrName()); - } - } - } - - public void clear() - { - throw new UnsupportedOperationException("Cannot modify map"); - } - - public ITagAttributeHandler put(String key, ITagAttributeHandler value) - { - throw new UnsupportedOperationException("Cannot modify map"); - } - - public void putAll(Map<? extends String, ? extends ITagAttributeHandler> t) - { - throw new UnsupportedOperationException("Cannot modify map"); - } - - public ITagAttributeHandler remove(Object key) - { - throw new UnsupportedOperationException("Cannot modify map"); - } - - private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException - { - in.defaultReadObject(); - _isInitialized = new AtomicBoolean(true); - } - - private void writeObject(final ObjectOutputStream out) throws IOException - { - ensureAllAttributes(); - out.defaultWriteObject(); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/CompositeTagResolvingStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/CompositeTagResolvingStrategy.java deleted file mode 100644 index bfcf32def..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/CompositeTagResolvingStrategy.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.model.jsp; - -import org.eclipse.jst.jsf.common.internal.policy.IIdentifiable; -import org.eclipse.jst.jsf.common.internal.policy.IIteratorPolicy; -import org.eclipse.jst.jsf.common.internal.strategy.IteratorPolicyBasedStrategyComposite; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagElement; - -/** - * @author cbateman - * - * @param <TLDELEMENT> - */ -public class CompositeTagResolvingStrategy<TLDELEMENT> - extends - IteratorPolicyBasedStrategyComposite<TLDELEMENT, ITagElement, String, ITagResolvingStrategy<TLDELEMENT, String>> - implements IIdentifiable<String>, - ITagResolvingStrategy<TLDELEMENT, String> -{ - private static final String ID = "org.eclipse.jst.jsf.designtime.CompositeTagResolvingStrategy"; - - /** - * @param policy - * - */ - public CompositeTagResolvingStrategy(final IIteratorPolicy<String> policy) - { - super(policy); - } - - public final String getId() - { - return ID; - } - - public final String getDisplayName() - { - return "Composite Tag Resolving Strategies"; - } - - @Override - public ITagElement getNoResult() - { - return null; - } - - public final ITagElement getNotFoundIndicator() - { - return getNoResult(); - } - - public final ITagElement resolve(TLDELEMENT element) - { - return perform(element); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/DefaultJSPTagResolver.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/DefaultJSPTagResolver.java deleted file mode 100644 index b0226e3e5..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/DefaultJSPTagResolver.java +++ /dev/null @@ -1,188 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.model.jsp; - -import java.util.Iterator; - -import org.eclipse.core.resources.IProject; -import org.eclipse.emf.common.util.EList; -import org.eclipse.jst.jsf.common.dom.TagIdentifier; -import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentTypeInfo; -import org.eclipse.jst.jsf.common.runtime.internal.model.decorator.ConverterTypeInfo; -import org.eclipse.jst.jsf.common.runtime.internal.model.decorator.ValidatorTypeInfo; -import org.eclipse.jst.jsf.common.runtime.internal.model.types.TypeInfo; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagElement; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.IHandlerTagElement.TagHandlerType; -import org.eclipse.jst.jsf.core.internal.tld.TagIdentifierFactory; -import org.eclipse.jst.jsf.designtime.internal.Messages; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.ViewMetadataLoader; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.ViewMetadataMapper; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagMapping; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagToViewObjectMapping; -import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.IAttributeAdvisor.NullAttributeAdvisor; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDElementDeclaration; -import org.osgi.framework.Version; - -/** - * ** TEMPORARY CLASS UNTIL META-DATA STRATEGY IS AVAILABLE ** - * - * @author cbateman - * - */ -public class DefaultJSPTagResolver extends JSPTagResolvingStrategy -{ - /** - * strategy id - */ - public final static String ID = "org.eclipse.jst.jsf.metadata.DefaultJSPTagResolver"; //$NON-NLS-1$ - /** - * displayable nameb - */ - public final static String DISPLAY_NAME = Messages.DefaultJSPTagResolver_DisplayName; - - private final ViewMetadataLoader _loader; - private final ViewMetadataMapper _mapper; - - /** - * @return the descriptor for this resolver strategy - */ - public static StrategyDescriptor createDescriptor() - { - return new StrategyDescriptor(ID, DISPLAY_NAME); - } - - /** - * @param project - */ - public DefaultJSPTagResolver(final IProject project) - { - _loader = new ViewMetadataLoader(project); - _mapper = new ViewMetadataMapper(); - } - - @Override - public ITagElement resolve(final TLDElementDeclaration elementDecl) - { - // final IProjectFacetVersion version = JSFAppConfigUtils - // .getProjectFacet(_project); - // final String versionAsString = version.getVersionString(); - // final JSFVersion jsfVersion = JSFVersion.valueOfString(versionAsString); - - final TagIdentifier tagId = TagIdentifierFactory - .createTLDTagWrapper(elementDecl); - // final DefaultTagTypeInfo defaultTagTypeInfo = new DefaultTagTypeInfo(); - final TagMapping mapping = _loader.getTagToViewMapping(tagId); - - TypeInfo elementType = null; - if (mapping != null) - { - elementType = findTypeInfo(mapping, "1.1", null); //$NON-NLS-1$ - } - - if (elementType instanceof ComponentTypeInfo) - { - return new TLDComponentTagElement(elementDecl, - (ComponentTypeInfo) elementType, new MetadataAttributeAdvisor(tagId, _loader)); - } - else if (elementType instanceof ConverterTypeInfo) - { - return new TLDConverterTagElement(elementDecl, - (ConverterTypeInfo) elementType, new MetadataAttributeAdvisor(tagId, _loader)); - } - else if (elementType instanceof ValidatorTypeInfo) - { - return new TLDValidatorTagElement(elementDecl, - (ValidatorTypeInfo) elementType, new MetadataAttributeAdvisor(tagId, _loader)); - } - else if (elementType instanceof TagHandlerType) - { - return new TLDTagHandlerElement(elementDecl, - (TagHandlerType) elementType, new MetadataAttributeAdvisor(tagId, _loader)); - } - else if (DefaultTagTypeInfo.isDefaultLib(tagId.getUri())) - { - return new TLDTagElement(elementDecl, new NullAttributeAdvisor()); - } - - // not found - return null; - } - - private TypeInfo findTypeInfo(final TagMapping mapping, final String jsfVersion, - final String libVersion) - { - final EList list = mapping.getVersionedTagToViewMappings(); - - FIND_BY_VERSION : for (final Iterator<?> it = list.iterator(); it.hasNext();) - { - Object obj = it.next(); - - if (obj instanceof TagToViewObjectMapping) - { - final TagToViewObjectMapping viewMapping = (TagToViewObjectMapping) obj; - - final String minJsfVersionString = viewMapping.getMinJSFVersion(); - if (minJsfVersionString != null) - { - try - { - final Version version = new Version(jsfVersion); - final Version minVersion = Version.parseVersion(minJsfVersionString); - - if (version.compareTo(minVersion) < 0) - { - // my version is less than the minimum specified - // by this meta-data - continue FIND_BY_VERSION; - } - } - catch (final IllegalArgumentException iae) - { - continue FIND_BY_VERSION; - } - } - final String minLibVersionString = viewMapping.getMinLibraryVersion(); - if (libVersion != null && minLibVersionString != null) - { - try - { - final Version version = new Version(libVersion); - final Version minLibVersion = Version.parseVersion(minLibVersionString); - - if (version.compareTo(minLibVersion) < 0) - { - // my lib version is less than the minimum specified - // by the meta-data - continue FIND_BY_VERSION; - } - } - catch (IllegalArgumentException iae) - { - continue FIND_BY_VERSION; - } - } - return _mapper.mapToFrameworkData(viewMapping.getTypeInfo()); - } - } - return null; - } - - @Override - public String getId() - { - return ID; - } - - public String getDisplayName() - { - return DISPLAY_NAME; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/DefaultTagTypeInfo.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/DefaultTagTypeInfo.java deleted file mode 100644 index 989e03b35..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/DefaultTagTypeInfo.java +++ /dev/null @@ -1,655 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.model.jsp; - -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import org.eclipse.jst.jsf.common.dom.TagIdentifier; -import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentTypeInfo; -import org.eclipse.jst.jsf.common.runtime.internal.model.decorator.ConverterTypeInfo; -import org.eclipse.jst.jsf.common.runtime.internal.model.decorator.ValidatorTypeInfo; -import org.eclipse.jst.jsf.common.runtime.internal.model.types.TypeInfo; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.IHandlerTagElement.TagHandlerType; -import org.eclipse.jst.jsf.core.JSFVersion; -import org.eclipse.jst.jsf.core.internal.tld.IJSFConstants; -import org.eclipse.jst.jsf.core.internal.tld.ITLDConstants; - -/** - * Hard-coded TypeInfo for default core and html JSF tags. - * - * @author cbateman - * - */ -public final class DefaultTagTypeInfo -{ - private final static Set<String> URI_IS_A_JSF_LIB; - - static - { - final Set<String> libs = new HashSet<String>(); - libs.add(ITLDConstants.URI_JSF_CORE); - libs.add(ITLDConstants.URI_JSF_HTML); - URI_IS_A_JSF_LIB = Collections.unmodifiableSet(libs); - } - - /** - * @param tagId - * @param jsfVersion - * @return a type info for the tag id in jsf version or null if none. - */ - public TypeInfo getTypeInfo(final TagIdentifier tagId, - final JSFVersion jsfVersion) - { - - switch (jsfVersion) - { - case V1_0: - case V1_1: - return JSF11_ELEMENTS.get(tagId); - - case V1_2: - return JSF12_ELEMENTS.get(tagId); - - default: - return null; - } - } - - /** - * @param uri - * @return true if uri is covered by this class - */ - public static boolean isDefaultLib(final String uri) - { - return URI_IS_A_JSF_LIB.contains(uri); - } - - private static final ComponentTypeInfo COMPINFO_PARAM = new ComponentTypeInfo( - "javax.faces.Parameter", - "javax.faces.component.UIParameter", - new String[] - { - "javax.faces.component.UIComponentBase", - "javax.faces.component.UIComponent", "java.lang.Object", }, - new String[] - { "javax.faces.component.StateHolder", }, - "javax.faces.Parameter", - null); - - private static final ComponentTypeInfo COMPINFO_SELECTITEM = new ComponentTypeInfo( - "javax.faces.SelectItem", - "javax.faces.component.UISelectItem", - new String[] - { - "javax.faces.component.UIComponentBase", - "javax.faces.component.UIComponent", "java.lang.Object", }, - new String[] - { "javax.faces.component.StateHolder", }, - "javax.faces.SelectItem", - null); - - private static final ComponentTypeInfo COMPINFO_SELECTITEMS = new ComponentTypeInfo( - "javax.faces.SelectItems", - "javax.faces.component.UISelectItems", - new String[] - { - "javax.faces.component.UIComponentBase", - "javax.faces.component.UIComponent", "java.lang.Object", }, - new String[] - { "javax.faces.component.StateHolder", }, - "javax.faces.SelectItems", - null); - - private static final ComponentTypeInfo COMPINFO_SUBVIEW = new ComponentTypeInfo( - "javax.faces.NamingContainer", - "javax.faces.component.UINamingContainer", - new String[] - { - "javax.faces.component.UIComponentBase", - "javax.faces.component.UIComponent", "java.lang.Object", }, - new String[] - { - "javax.faces.component.NamingContainer", - "javax.faces.component.StateHolder", }, - "javax.faces.NamingContainer", - null); - - private static final ComponentTypeInfo COMPINFO_VERBATIM = new ComponentTypeInfo( - "javax.faces.Output", - "javax.faces.component.UIOutput", - new String[] - { - "javax.faces.component.UIComponentBase", - "javax.faces.component.UIComponent", "java.lang.Object", }, - new String[] - { - "javax.faces.component.ValueHolder", - "javax.faces.component.StateHolder", }, - "javax.faces.Output", - "javax.faces.Text"); - - private static final ComponentTypeInfo COMPINFO_VIEW = new ComponentTypeInfo( - "javax.faces.ViewRoot", - "javax.faces.component.UIViewRoot", - new String[] - { - "javax.faces.component.UIComponentBase", - "javax.faces.component.UIComponent", "java.lang.Object", }, - new String[] - { "javax.faces.component.StateHolder", }, - "javax.faces.ViewRoot", - null); - - // expected type info for jsf/html components - private static final ComponentTypeInfo COMPINFO_COLUMN = new ComponentTypeInfo( - "javax.faces.Column", - "javax.faces.component.UIColumn", - new String[] - { - "javax.faces.component.UIComponentBase", - "javax.faces.component.UIComponent", "java.lang.Object" }, - new String[] - { "javax.faces.component.StateHolder" }, - "javax.faces.Column", - null); - private static final ComponentTypeInfo COMPINFO_COMMAND = new ComponentTypeInfo( - "javax.faces.HtmlCommandButton", - "javax.faces.component.html.HtmlCommandButton", - new String[] - { - "javax.faces.component.UICommand", - "javax.faces.component.UIComponentBase", - "javax.faces.component.UIComponent", "java.lang.Object" }, - new String[] - { - "javax.faces.component.ActionSource", - "javax.faces.component.StateHolder" }, - "javax.faces.Command", - "javax.faces.Button"); - private static final ComponentTypeInfo COMPINFO_COMMANDLINK = new ComponentTypeInfo( - "javax.faces.HtmlCommandLink", - "javax.faces.component.html.HtmlCommandLink", - new String[] - { - "javax.faces.component.UICommand", - "javax.faces.component.UIComponentBase", - "javax.faces.component.UIComponent", "java.lang.Object" }, - new String[] - { - "javax.faces.component.ActionSource", - "javax.faces.component.StateHolder" }, - "javax.faces.Command", - "javax.faces.Link"); - private static final ComponentTypeInfo COMPINFO_DATATABLE = new ComponentTypeInfo( - "javax.faces.HtmlDataTable", - "javax.faces.component.html.HtmlDataTable", - new String[] - { - "javax.faces.component.UIData", - "javax.faces.component.UIComponentBase", - "javax.faces.component.UIComponent", "java.lang.Object" }, - new String[] - { - "javax.faces.component.NamingContainer", - "javax.faces.component.StateHolder" }, - "javax.faces.Data", - "javax.faces.Table"); - private static final ComponentTypeInfo COMPINFO_FORM = new ComponentTypeInfo( - "javax.faces.HtmlForm", - "javax.faces.component.html.HtmlForm", - new String[] - { - "javax.faces.component.UIForm", - "javax.faces.component.UIComponentBase", - "javax.faces.component.UIComponent", "java.lang.Object" }, - new String[] - { - "javax.faces.component.NamingContainer", - "javax.faces.component.StateHolder" }, - "javax.faces.Form", - "javax.faces.Form"); - private static final ComponentTypeInfo COMPINFO_GRAPHIC = new ComponentTypeInfo( - "javax.faces.HtmlGraphicImage", - "javax.faces.component.html.HtmlGraphicImage", - new String[] - { - "javax.faces.component.UIGraphic", - "javax.faces.component.UIComponentBase", - "javax.faces.component.UIComponent", "java.lang.Object", }, - new String[] - { "javax.faces.component.StateHolder", }, - "javax.faces.Graphic", - "javax.faces.Image"); - private static final ComponentTypeInfo COMPINFO_HIDDEN = new ComponentTypeInfo( - "javax.faces.HtmlInputHidden", - "javax.faces.component.html.HtmlInputHidden", - new String[] - { - "javax.faces.component.UIInput", "javax.faces.component.UIOutput", - "javax.faces.component.UIComponentBase", - "javax.faces.component.UIComponent", "java.lang.Object", }, - new String[] - { - "javax.faces.component.EditableValueHolder", - "javax.faces.component.ValueHolder", - "javax.faces.component.StateHolder", }, - "javax.faces.Input", - "javax.faces.Hidden"); - private static final ComponentTypeInfo COMPINFO_SECRET = new ComponentTypeInfo( - "javax.faces.HtmlInputSecret", - "javax.faces.component.html.HtmlInputSecret", - new String[] - { - "javax.faces.component.UIInput", "javax.faces.component.UIOutput", - "javax.faces.component.UIComponentBase", - "javax.faces.component.UIComponent", "java.lang.Object", }, - new String[] - { - "javax.faces.component.EditableValueHolder", - "javax.faces.component.ValueHolder", - "javax.faces.component.StateHolder" }, - "javax.faces.Input", - "javax.faces.Secret"); - private static final ComponentTypeInfo COMPINFO_INPUTTEXT = new ComponentTypeInfo( - "javax.faces.HtmlInputText", - "javax.faces.component.html.HtmlInputText", - new String[] - { - "javax.faces.component.UIInput", "javax.faces.component.UIOutput", - "javax.faces.component.UIComponentBase", - "javax.faces.component.UIComponent", "java.lang.Object" }, - new String[] - { - "javax.faces.component.EditableValueHolder", - "javax.faces.component.ValueHolder", - "javax.faces.component.StateHolder" }, - "javax.faces.Input", - "javax.faces.Text"); - private static final ComponentTypeInfo COMPINFO_INPUTTEXTAREA = new ComponentTypeInfo( - "javax.faces.HtmlInputTextarea", - "javax.faces.component.html.HtmlInputTextarea", - new String[] - { - "javax.faces.component.UIInput", "javax.faces.component.UIOutput", - "javax.faces.component.UIComponentBase", - "javax.faces.component.UIComponent", "java.lang.Object", }, - new String[] - { - "javax.faces.component.EditableValueHolder", - "javax.faces.component.ValueHolder", - "javax.faces.component.StateHolder", }, - "javax.faces.Input", - "javax.faces.Textarea"); - private static final ComponentTypeInfo COMPINFO_MESSAGE = new ComponentTypeInfo( - "javax.faces.HtmlMessage", - "javax.faces.component.html.HtmlMessage", - new String[] - { - "javax.faces.component.UIMessage", - "javax.faces.component.UIComponentBase", - "javax.faces.component.UIComponent", "java.lang.Object", }, - new String[] - { "javax.faces.component.StateHolder", }, - "javax.faces.Message", - "javax.faces.Message"); - private static final ComponentTypeInfo COMPINFO_MESSAGES = new ComponentTypeInfo( - "javax.faces.HtmlMessages", - "javax.faces.component.html.HtmlMessages", - new String[] - { - "javax.faces.component.UIMessages", - "javax.faces.component.UIComponentBase", - "javax.faces.component.UIComponent", "java.lang.Object", }, - new String[] - { "javax.faces.component.StateHolder", }, - "javax.faces.Messages", - "javax.faces.Messages"); - private static final ComponentTypeInfo COMPINFO_OUTPUTFORMAT = new ComponentTypeInfo( - "javax.faces.HtmlOutputFormat", - "javax.faces.component.html.HtmlOutputFormat", - new String[] - { - "javax.faces.component.UIOutput", - "javax.faces.component.UIComponentBase", - "javax.faces.component.UIComponent", "java.lang.Object", }, - new String[] - { - "javax.faces.component.ValueHolder", - "javax.faces.component.StateHolder", }, - "javax.faces.Output", - "javax.faces.Format"); - private static final ComponentTypeInfo COMPINFO_OUTPUTLABEL = new ComponentTypeInfo( - "javax.faces.HtmlOutputLabel", - "javax.faces.component.html.HtmlOutputLabel", - new String[] - { - "javax.faces.component.UIOutput", - "javax.faces.component.UIComponentBase", - "javax.faces.component.UIComponent", "java.lang.Object", }, - new String[] - { - "javax.faces.component.ValueHolder", - "javax.faces.component.StateHolder", }, - "javax.faces.Output", - "javax.faces.Label"); - private static final ComponentTypeInfo COMPINFO_OUTPUTLINK = new ComponentTypeInfo( - "javax.faces.HtmlOutputLink", - "javax.faces.component.html.HtmlOutputLink", - new String[] - { - "javax.faces.component.UIOutput", - "javax.faces.component.UIComponentBase", - "javax.faces.component.UIComponent", "java.lang.Object", }, - new String[] - { - "javax.faces.component.ValueHolder", - "javax.faces.component.StateHolder", }, - "javax.faces.Output", - "javax.faces.Link"); - private static final ComponentTypeInfo COMPINFO_OUTPUTTEXT = new ComponentTypeInfo( - "javax.faces.HtmlOutputText", - "javax.faces.component.html.HtmlOutputText", - new String[] - { - "javax.faces.component.UIOutput", - "javax.faces.component.UIComponentBase", - "javax.faces.component.UIComponent", "java.lang.Object", }, - new String[] - { - "javax.faces.component.ValueHolder", - "javax.faces.component.StateHolder", }, - "javax.faces.Output", - "javax.faces.Text"); - private static final ComponentTypeInfo COMPINFO_PANELGRID = new ComponentTypeInfo( - "javax.faces.HtmlPanelGrid", - "javax.faces.component.html.HtmlPanelGrid", - new String[] - { - "javax.faces.component.UIPanel", - "javax.faces.component.UIComponentBase", - "javax.faces.component.UIComponent", "java.lang.Object", }, - new String[] - { "javax.faces.component.StateHolder", }, - "javax.faces.Panel", - "javax.faces.Grid"); - private static final ComponentTypeInfo COMPINFO_PANELGROUP = new ComponentTypeInfo( - "javax.faces.HtmlPanelGroup", - "javax.faces.component.html.HtmlPanelGroup", - new String[] - { - "javax.faces.component.UIPanel", - "javax.faces.component.UIComponentBase", - "javax.faces.component.UIComponent", "java.lang.Object", }, - new String[] - { "javax.faces.component.StateHolder", }, - "javax.faces.Panel", - "javax.faces.Group"); - private static final ComponentTypeInfo COMPINFO_SELECTBOOLEANCHECKBOX = new ComponentTypeInfo( - "javax.faces.HtmlSelectBooleanCheckbox", - "javax.faces.component.html.HtmlSelectBooleanCheckbox", - new String[] - { - "javax.faces.component.UISelectBoolean", - "javax.faces.component.UIInput", "javax.faces.component.UIOutput", - "javax.faces.component.UIComponentBase", - "javax.faces.component.UIComponent", "java.lang.Object", }, - new String[] - { - "javax.faces.component.EditableValueHolder", - "javax.faces.component.ValueHolder", - "javax.faces.component.StateHolder", }, - "javax.faces.SelectBoolean", - "javax.faces.Checkbox"); - private static final ComponentTypeInfo COMPINFO_SELECTMANYCHECKBOX = new ComponentTypeInfo( - "javax.faces.HtmlSelectManyCheckbox", - "javax.faces.component.html.HtmlSelectManyCheckbox", - new String[] - { - "javax.faces.component.UISelectMany", - "javax.faces.component.UIInput", "javax.faces.component.UIOutput", - "javax.faces.component.UIComponentBase", - "javax.faces.component.UIComponent", "java.lang.Object", }, - new String[] - { - "javax.faces.component.EditableValueHolder", - "javax.faces.component.ValueHolder", - "javax.faces.component.StateHolder", }, - "javax.faces.SelectMany", - "javax.faces.Checkbox"); - private static final ComponentTypeInfo COMPINFO_SELECTMANYLISTBOX = new ComponentTypeInfo( - "javax.faces.HtmlSelectManyListbox", - "javax.faces.component.html.HtmlSelectManyListbox", - new String[] - { - "javax.faces.component.UISelectMany", - "javax.faces.component.UIInput", "javax.faces.component.UIOutput", - "javax.faces.component.UIComponentBase", - "javax.faces.component.UIComponent", "java.lang.Object", }, - new String[] - { - "javax.faces.component.EditableValueHolder", - "javax.faces.component.ValueHolder", - "javax.faces.component.StateHolder", }, - "javax.faces.SelectMany", - "javax.faces.Listbox"); - private static final ComponentTypeInfo COMPINFO_SELECTMANYMENU = new ComponentTypeInfo( - "javax.faces.HtmlSelectManyMenu", - "javax.faces.component.html.HtmlSelectManyMenu", - new String[] - { - "javax.faces.component.UISelectMany", - "javax.faces.component.UIInput", "javax.faces.component.UIOutput", - "javax.faces.component.UIComponentBase", - "javax.faces.component.UIComponent", "java.lang.Object", }, - new String[] - { - "javax.faces.component.EditableValueHolder", - "javax.faces.component.ValueHolder", - "javax.faces.component.StateHolder", }, - "javax.faces.SelectMany", - "javax.faces.Menu"); - private static final ComponentTypeInfo COMPINFO_SELECTONELISTBOX = new ComponentTypeInfo( - "javax.faces.HtmlSelectOneListbox", - "javax.faces.component.html.HtmlSelectOneListbox", - new String[] - { - "javax.faces.component.UISelectOne", - "javax.faces.component.UIInput", "javax.faces.component.UIOutput", - "javax.faces.component.UIComponentBase", - "javax.faces.component.UIComponent", "java.lang.Object", }, - new String[] - { - "javax.faces.component.EditableValueHolder", - "javax.faces.component.ValueHolder", - "javax.faces.component.StateHolder", }, - "javax.faces.SelectOne", - "javax.faces.Listbox"); - private static final ComponentTypeInfo COMPINFO_SELECTONEMENU = new ComponentTypeInfo( - "javax.faces.HtmlSelectOneMenu", - "javax.faces.component.html.HtmlSelectOneMenu", - new String[] - { - "javax.faces.component.UISelectOne", - "javax.faces.component.UIInput", "javax.faces.component.UIOutput", - "javax.faces.component.UIComponentBase", - "javax.faces.component.UIComponent", "java.lang.Object", }, - new String[] - { - "javax.faces.component.EditableValueHolder", - "javax.faces.component.ValueHolder", - "javax.faces.component.StateHolder", }, - "javax.faces.SelectOne", - "javax.faces.Menu"); - private static final ComponentTypeInfo COMPINFO_SELECTONERADIO = new ComponentTypeInfo( - "javax.faces.HtmlSelectOneRadio", - "javax.faces.component.html.HtmlSelectOneRadio", - new String[] - { - "javax.faces.component.UISelectOne", - "javax.faces.component.UIInput", "javax.faces.component.UIOutput", - "javax.faces.component.UIComponentBase", - "javax.faces.component.UIComponent", "java.lang.Object", }, - new String[] - { - "javax.faces.component.EditableValueHolder", - "javax.faces.component.ValueHolder", - "javax.faces.component.StateHolder", }, - "javax.faces.SelectOne", - "javax.faces.Radio"); - - // default converters - private static final ConverterTypeInfo CONVERTERINFO_DATETIME = new ConverterTypeInfo( - "javax.faces.convert.DateTimeConverter", - "javax.faces.DateTime"); - - private static final ConverterTypeInfo CONVERTERINFO_NUMBER = new ConverterTypeInfo( - "javax.faces.convert.NumberConverter", - "javax.faces.Number"); - - // default validators - private static final ValidatorTypeInfo VALIDATORINFO_DOUBLERANGE = new ValidatorTypeInfo( - "javax.faces.validator.DoubleRangeValidator", - "javax.faces.DoubleRange"); - - private static final ValidatorTypeInfo VALIDATORINFO_LENGTH = new ValidatorTypeInfo( - "javax.faces.validator.LengthValidator", - "javax.faces.Length"); - - private static final ValidatorTypeInfo VALIDATORINFO_LONGRANGE = new ValidatorTypeInfo( - "javax.faces.validator.LongRangeValidator", - "javax.faces.LongRange"); - - private static Map<TagIdentifier, TypeInfo> JSF11_ELEMENTS; - private static Map<TagIdentifier, TypeInfo> JSF12_ELEMENTS; - - static - { - final Map<TagIdentifier, TypeInfo> commonElements = new HashMap<TagIdentifier, TypeInfo>(); - // IJSFConstants.TAG_IDENTIFIER_PHASELISTENER); - // IJSFConstants.TAG_IDENTIFIER_SETPROPERTYACTIONLISTENER); - - commonElements.put(IJSFConstants.TAG_IDENTIFIER_ACTIONLISTENER, - TagHandlerType.ACTIONLISTENER); - commonElements.put(IJSFConstants.TAG_IDENTIFIER_ATTRIBUTE, - TagHandlerType.ATTRIBUTE); - commonElements.put(IJSFConstants.TAG_IDENTIFIER_CONVERTDATETIME, - CONVERTERINFO_DATETIME); - commonElements.put(IJSFConstants.TAG_IDENTIFIER_CONVERTER, - ConverterTypeInfo.UNKNOWN); - commonElements.put(IJSFConstants.TAG_IDENTIFIER_CONVERTNUMBER, - CONVERTERINFO_NUMBER); - commonElements.put(IJSFConstants.TAG_IDENTIFIER_FACET, TagHandlerType.FACET); - // elements.put(IJSFConstants.TAG_IDENTIFIER_LOADBUNDLE, - // TagHandlerType.); - commonElements.put(IJSFConstants.TAG_IDENTIFIER_PARAM, COMPINFO_PARAM); - commonElements.put(IJSFConstants.TAG_IDENTIFIER_SELECTITEM, - COMPINFO_SELECTITEM); - commonElements.put(IJSFConstants.TAG_IDENTIFIER_SELECTITEMS, - COMPINFO_SELECTITEMS); - commonElements.put(IJSFConstants.TAG_IDENTIFIER_SUBVIEW, COMPINFO_SUBVIEW); - commonElements.put(IJSFConstants.TAG_IDENTIFIER_VALIDATEDOUBLERANGE, - VALIDATORINFO_DOUBLERANGE); - commonElements.put(IJSFConstants.TAG_IDENTIFIER_VALIDATELENGTH, - VALIDATORINFO_LENGTH); - commonElements.put(IJSFConstants.TAG_IDENTIFIER_VALIDATELONGRANGE, - VALIDATORINFO_LONGRANGE); - commonElements.put(IJSFConstants.TAG_IDENTIFIER_VALIDATOR, - ValidatorTypeInfo.UNKNOWN); - commonElements.put(IJSFConstants.TAG_IDENTIFIER_VALUECHANGELISTENER, - TagHandlerType.VALUECHANGELISTENER); - commonElements.put(IJSFConstants.TAG_IDENTIFIER_VERBATIM, COMPINFO_VERBATIM); - commonElements.put(IJSFConstants.TAG_IDENTIFIER_VIEW, COMPINFO_VIEW); - - // JSF 1.2 core elements - // none currently... - - // JSF 1.1/1.2 HTML tags - // html verifier - commonElements.put(IJSFConstants.TAG_IDENTIFIER_COLUMN, COMPINFO_COLUMN); - - commonElements.put(IJSFConstants.TAG_IDENTIFIER_COMMANDBUTTON, - COMPINFO_COMMAND); - - commonElements.put(IJSFConstants.TAG_IDENTIFIER_COMMANDLINK, - COMPINFO_COMMANDLINK); - - commonElements.put(IJSFConstants.TAG_IDENTIFIER_DATA_TABLE, - COMPINFO_DATATABLE); - - commonElements.put(IJSFConstants.TAG_IDENTIFIER_FORM, COMPINFO_FORM); - - commonElements.put(IJSFConstants.TAG_IDENTIFIER_GRAPHICIMAGE, - COMPINFO_GRAPHIC); - - commonElements.put(IJSFConstants.TAG_IDENTIFIER_INPUTHIDDEN, COMPINFO_HIDDEN); - - commonElements.put(IJSFConstants.TAG_IDENTIFIER_INPUTSECRET, COMPINFO_SECRET); - - commonElements - .put(IJSFConstants.TAG_IDENTIFIER_INPUTTEXT, COMPINFO_INPUTTEXT); - - commonElements.put(IJSFConstants.TAG_IDENTIFIER_INPUTTEXTAREA, - COMPINFO_INPUTTEXTAREA); - - commonElements.put(IJSFConstants.TAG_IDENTIFIER_MESSAGE, COMPINFO_MESSAGE); - - commonElements.put(IJSFConstants.TAG_IDENTIFIER_MESSAGES, COMPINFO_MESSAGES); - - commonElements.put(IJSFConstants.TAG_IDENTIFIER_OUTPUTFORMAT, - COMPINFO_OUTPUTFORMAT); - - commonElements.put(IJSFConstants.TAG_IDENTIFIER_OUTPUTLABEL, - COMPINFO_OUTPUTLABEL); - - commonElements.put(IJSFConstants.TAG_IDENTIFIER_OUTPUTLINK, - COMPINFO_OUTPUTLINK); - - commonElements.put(IJSFConstants.TAG_IDENTIFIER_OUTPUTTEXT, - COMPINFO_OUTPUTTEXT); - - commonElements.put(IJSFConstants.TAG_IDENTIFIER_PANEL_GRID, - COMPINFO_PANELGRID); - - commonElements.put(IJSFConstants.TAG_IDENTIFIER_PANEL_GROUP, - COMPINFO_PANELGROUP); - - commonElements.put(IJSFConstants.TAG_IDENTIFIER_SELECTBOOLEANCHECKBOX, - COMPINFO_SELECTBOOLEANCHECKBOX); - - commonElements.put(IJSFConstants.TAG_IDENTIFIER_SELECTMANYCHECKBOX, - COMPINFO_SELECTMANYCHECKBOX); - - commonElements.put(IJSFConstants.TAG_IDENTIFIER_SELECTMANYLISTBOX, - COMPINFO_SELECTMANYLISTBOX); - - commonElements.put(IJSFConstants.TAG_IDENTIFIER_SELECTMANYMENU, - COMPINFO_SELECTMANYMENU); - - commonElements.put(IJSFConstants.TAG_IDENTIFIER_SELECTONELISTBOX, - COMPINFO_SELECTONELISTBOX); - - commonElements.put(IJSFConstants.TAG_IDENTIFIER_SELECTONEMENU, - COMPINFO_SELECTONEMENU); - - commonElements.put(IJSFConstants.TAG_IDENTIFIER_SELECTONERADIO, - COMPINFO_SELECTONERADIO); - - JSF11_ELEMENTS = Collections.unmodifiableMap(commonElements); - - JSF12_ELEMENTS = Collections - .unmodifiableMap(new HashMap<TagIdentifier, TypeInfo>(commonElements)); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/IAttributeAdvisor.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/IAttributeAdvisor.java deleted file mode 100644 index f473ab312..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/IAttributeAdvisor.java +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.model.jsp; - -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagAttributeHandler; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.TagAttributeHandler; - -/** - * @author cbateman - * - */ -public interface IAttributeAdvisor -{ - - /** - * @param name - * @return a tag attribute handler for the name. - * @throws UnknownAttributeException if name does not match a known attribute. - */ - ITagAttributeHandler createAttributeHandler(String name) throws UnknownAttributeException; - - /** - * @author cbateman - * - */ - public static class NullAttributeAdvisor implements IAttributeAdvisor - { - public ITagAttributeHandler createAttributeHandler(String name) - throws UnknownAttributeException - { - return new TagAttributeHandler(null, name, false); - } - } - - /** - * Indicates an unknown attribute was requested or encountered - * @author cbateman - * - */ - public static class UnknownAttributeException extends Exception - { - /** - * - */ - private static final long serialVersionUID = -988838913707929315L; - - /** - * - */ - public UnknownAttributeException() - { - super(); - } - - /** - * @param message - * @param cause - */ - public UnknownAttributeException(String message, Throwable cause) - { - super(message, cause); - } - - /** - * @param message - */ - public UnknownAttributeException(String message) - { - super(message); - } - - /** - * @param cause - */ - public UnknownAttributeException(Throwable cause) - { - super(cause); - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/ITagResolvingStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/ITagResolvingStrategy.java deleted file mode 100644 index 4befb221e..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/ITagResolvingStrategy.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.model.jsp; - -import org.eclipse.jst.jsf.common.internal.strategy.IIdentifiableStrategy; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagElement; - -/** - * Describes an algorithm that can produce ITagElements from <TLD> objects. - * - * @author cbateman - * @param <TLDELEMENT> the object type that describes a tag library. - * @param <IDTYPE> - * - */ -public interface ITagResolvingStrategy<TLDELEMENT, IDTYPE> extends - IIdentifiableStrategy<TLDELEMENT, ITagElement, IDTYPE> -{ - /** - * @param element - * @return a new tag element or {@link #getNotFoundIndicator()} if not found - */ - ITagElement resolve(TLDELEMENT element); - - /** - * @return the ITagElement (may be null) that indicates that - * resolve(TLDELEMENT) could not resolve a tag. The return - * must be testable with standard "==" operator and not equals(). - */ - ITagElement getNotFoundIndicator(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/JSPTagResolvingStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/JSPTagResolvingStrategy.java deleted file mode 100644 index 8f2235db6..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/JSPTagResolvingStrategy.java +++ /dev/null @@ -1,68 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.model.jsp; - -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagElement; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDElementDeclaration; - -/** - * A strategy for resolving JSP TLDs. - * - * @author cbateman - * - */ -public abstract class JSPTagResolvingStrategy extends - AbstractTagResolvingStrategy<TLDElementDeclaration, String> -{ - @Override - public abstract ITagElement resolve(TLDElementDeclaration element); - - public abstract String getId(); - - public abstract String getDisplayName(); - - /** - * A descriptor for JSP tag resolving strategies - * - * @author cbateman - * - */ - public final static class StrategyDescriptor - { - private final String _id; - private final String _displayName; - - /** - * @param id - * @param displayName - */ - public StrategyDescriptor(final String id, final String displayName) - { - _id = id; - _displayName = displayName; - } - - /** - * @return the id of the strategy - */ - public String getId() - { - return _id; - } - /** - * @return the human-readable displayable name of the strategy - */ - public String getDisplayName() - { - return _displayName; - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/Messages.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/Messages.java deleted file mode 100644 index 9d3dcee38..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/Messages.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.eclipse.jst.jsf.designtime.internal.view.model.jsp; - -import org.eclipse.osgi.util.NLS; - -/** - * NLS message getter. - * - * @author cbateman - * - */ -public class Messages extends NLS -{ - private static final String BUNDLE_NAME = "org.eclipse.jst.jsf.designtime.internal.view.model.jsp.messages"; //$NON-NLS-1$ - /** - * see messages.properties - */ - public static String UnresolvedJSPTagResolvingStrategy_1; - static - { - // initialize resource bundle - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } - - private Messages() - { - // no external instantiation - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/MetadataAttributeAdvisor.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/MetadataAttributeAdvisor.java deleted file mode 100644 index c85ec8a28..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/MetadataAttributeAdvisor.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.model.jsp; - -import org.eclipse.jst.jsf.common.dom.TagIdentifier; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ComponentPropertyHandler; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagAttributeHandler; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.TagAttributeHandler; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.ViewMetadataLoader; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.AttributeToPropertyMapping; - -/* package */class MetadataAttributeAdvisor implements IAttributeAdvisor -{ - private final TagIdentifier _tagId; - private final ViewMetadataLoader _loader; - - public MetadataAttributeAdvisor(final TagIdentifier tagId, - final ViewMetadataLoader loader) - { - _tagId = tagId; - _loader = loader; - } - - public ITagAttributeHandler createAttributeHandler(final String name) - throws UnknownAttributeException - { - final AttributeToPropertyMapping mapping = _loader.getAttributeMapping( - _tagId, name); - if (mapping != null) - { - final String customHandler = mapping.getCustomConversionFactoryId(); - final boolean isELAllowed = mapping.isElAllowed(); - final String propertyName = mapping.getPropertyName(); - if (propertyName != null) - { - return new ComponentPropertyHandler(customHandler, name, - isELAllowed, propertyName); - } - return new TagAttributeHandler(customHandler, name, isELAllowed); - } - return new TagAttributeHandler(null, name, false); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDComponentTagElement.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDComponentTagElement.java deleted file mode 100644 index 4e081bd36..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDComponentTagElement.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.model.jsp; - -import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentTypeInfo; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.IComponentTagElement; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDElementDeclaration; - - - -/** - * A TLD-defined tag (i.e. JSP) that maps one-to-one with a JSF UIComponent - * @author cbateman - * - */ -public class TLDComponentTagElement extends TLDJSFTagElement implements -IComponentTagElement -{ - /** - * - */ - private static final long serialVersionUID = -6479445622102799425L; - private final ComponentTypeInfo _componentTypeInfo; - - /** - * @param elementDecl - * @param componentTypeInfo - * @param advisor - */ - public TLDComponentTagElement(final TLDElementDeclaration elementDecl - , final ComponentTypeInfo componentTypeInfo, final IAttributeAdvisor advisor) - { - super(elementDecl, advisor); - _componentTypeInfo = componentTypeInfo; - } - - public ComponentTypeInfo getComponent() - { - return _componentTypeInfo; - } - - @Override - public TagType getType() - { - return TagType.COMPONENT; - } - - @Override - public String toString() - { - final String attributes = constructAttributesString(); - return _componentTypeInfo.toString() + - (!"".equals(attributes) ? "\n" + attributes : ""); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDConverterTagElement.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDConverterTagElement.java deleted file mode 100644 index 257a6f479..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDConverterTagElement.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.model.jsp; - -import org.eclipse.jst.jsf.common.runtime.internal.model.decorator.ConverterTypeInfo; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.IConverterTagElement; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDElementDeclaration; - -/** - * A TLD-defined tag (i.e. JSP) that maps one-to-one with a JSF Converter - * - * @author cbateman - * - */ -public class TLDConverterTagElement extends TLDJSFTagElement implements IConverterTagElement -{ - /** - * - */ - private static final long serialVersionUID = 2854457220470229847L; - private final ConverterTypeInfo _converterTypeInfo; - - /** - * @param elementDecl - * @param converterTypeInfo - * @param advisor - */ - public TLDConverterTagElement(final TLDElementDeclaration elementDecl, final ConverterTypeInfo converterTypeInfo, final IAttributeAdvisor advisor) - { - super(elementDecl, advisor); - _converterTypeInfo = converterTypeInfo; - } - - @Override - public TagType getType() - { - return TagType.CONVERTER; - } - - /** - * @return the type info for this converter - */ - public final ConverterTypeInfo getConverter() - { - return _converterTypeInfo; - } - - @Override - public String toString() - { - return _converterTypeInfo.toString(); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDJSFTagElement.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDJSFTagElement.java deleted file mode 100644 index 58f88a865..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDJSFTagElement.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.model.jsp; - -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.IJSFTagElement; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDElementDeclaration; - -/** - * A JSF tag element. - * - * @author cbateman - * - */ -public abstract class TLDJSFTagElement extends TLDTagElement implements - IJSFTagElement -{ - /** - * - */ - private static final long serialVersionUID = -7629153104201317346L; - - /** - * @param elementDecl - * @param advisor - */ - public TLDJSFTagElement(final TLDElementDeclaration elementDecl - , final IAttributeAdvisor advisor) - { - super(elementDecl, advisor); - } - - public abstract TagType getType(); - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDNamespace.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDNamespace.java deleted file mode 100644 index b2721dbe9..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDNamespace.java +++ /dev/null @@ -1,314 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.model.jsp; - -import java.io.Serializable; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.core.runtime.jobs.ILock; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagElement; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.Namespace; -import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.persistence.SerializableTLDNamespace; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDDocument; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDElementDeclaration; -import org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap; -import org.eclipse.wst.xml.core.internal.contentmodel.CMNode; - -/** - * Represents a JSP tag library namespace - * - * @author cbateman - * - */ -public class TLDNamespace extends Namespace -{ - /** - * - */ - private static final long serialVersionUID = 9206460825737988441L; - private TLDNamespaceData _tldData; - - /** - * @param tldDoc - * @param tagResolver - */ - public TLDNamespace( - final TLDDocument tldDoc, - final ITagResolvingStrategy<TLDElementDeclaration, String> tagResolver) - { - _tldData = new DocumentTLDNamespaceData(tldDoc, tagResolver); - } - - @Override - public final String getDisplayName() - { - return _tldData.getDisplayName(); - } - - @Override - public final String getNSUri() - { - return _tldData.getUri(); - } - - @Override - public boolean isInitialized() - { - return _tldData.isInitialized(); - } - - public final ITagElement getViewElement(final String name) - { - // // bias the table small if this creates it - // final Map<String, ITagElement> tags = getOrCreateMap(3); - // - // return _tldData.getOrCreateTagElement(name, tags); - return _tldData.getViewElement(name); - } - - @Override - public final Collection<? extends ITagElement> getViewElements() - { - return Collections.unmodifiableCollection(_tldData.getAllViewElements().values()); - } - - /** - * Differs from getViewElements because it won't include those elements - * that haven't been lazily loaded. - * - * @return an unmodifiable map of all elements currently calculated for - * this namespaces - */ - public final Map<String, ITagElement> getCurrentElements() - { - return Collections.unmodifiableMap(_tldData.getCurrentElements()); - } - - @Override - public final boolean hasViewElements() - { - return _tldData.getNumTags() > 0; - } - - - private Object writeReplace() - { - return new SerializableTLDNamespace(this); - } - - private static class DocumentTLDNamespaceData extends TLDNamespaceData - { - /** - * - */ - private static final long serialVersionUID = -1098872687238068584L; - private final transient TLDDocument _tldDoc; - private final transient ITagResolvingStrategy<TLDElementDeclaration, String> _tagResolver; - private final transient ILock _tagMapReadWriteLock; - // should only be accessed directly in getOrCreateMap; - private Map<String, ITagElement> _tags; // lazy init in initializeTags - - public DocumentTLDNamespaceData( - final TLDDocument tldDoc, - final ITagResolvingStrategy<TLDElementDeclaration, String> tagResolver) - { - _tldDoc = tldDoc; - _tagResolver = tagResolver; - _tagMapReadWriteLock = Job.getJobManager().newLock(); - } - - @Override - public String getDisplayName() - { - String displayName = _tldDoc.getDisplayName(); - if (displayName == null || "".equals(displayName.trim())) - { - displayName = getUri(); - } - return displayName; - } - - @Override - public String getUri() - { - return _tldDoc.getUri(); - } - - @Override - public int getNumTags() - { - return _tldDoc.getElements().getLength(); - } - - private ITagElement createTagElement(final String name) - { - CMNode cmNode = _tldDoc.getElements().getNamedItem(name); - ITagElement tagElement = null; - if (cmNode instanceof TLDElementDeclaration) - { - tagElement = _tagResolver - .resolve((TLDElementDeclaration) cmNode); - - if (tagElement == _tagResolver.getNotFoundIndicator()) - { - // the not-found indicator may not be null. - tagElement = null; - } - } - return tagElement; - } - - public final Map<String, ITagElement> getAllViewElements() - { - final CMNamedNodeMap elementMap = _tldDoc.getElements(); - final Map<String, ITagElement> tags = getOrCreateMap(elementMap - .getLength()); - if (!isInitialized()) - { - // if we create the table with this call, bias the table size - // to be 1 bigger than the number of tags, since we know if it's - // smaller, it'll cause at least one buffer resize - - - for (int i = 0; i < elementMap.getLength(); i++) - { - final CMNode cmNode = elementMap.item(i); - getViewElement(cmNode.getNodeName()); - } - } - return tags; - } - - public ITagElement getViewElement(final String name) - { - ITagElement tagElement = null; - - _tagMapReadWriteLock.acquire(); - final Map<String, ITagElement> tags = getOrCreateMap(_tldDoc.getElements().getLength()); - try - { - tagElement = tags.get(name); - - if (tagElement == null) - { - tagElement = createTagElement(name); - - if (tagElement != null) - { - tags.put(tagElement.getName(), tagElement); - } - } - } - finally - { - _tagMapReadWriteLock.release(); - } - - return tagElement; - } - - /** - * mapSizeHint will be used - * - * @param mapSizeHint - * @return the map - */ - private synchronized Map<String, ITagElement> getOrCreateMap( - final int mapSizeHint) - { - if (_tags == null) - { - final float loadFactor = 0.75f; - final int initSize = ((int) (mapSizeHint / loadFactor)) + 1; - _tags = Collections - .synchronizedMap(new HashMap<String, ITagElement>( - initSize)); - } - return _tags; - } - - @Override - public boolean isInitialized() - { - int numTags = getNumTags(); - int tagMapSize = getOrCreateMap(3).size(); - - // we are only initialized if the tag map is the equal in size - // to the number of tags in the tld. - return numTags == tagMapSize; - } - - @Override - public Map<String, ITagElement> getCurrentElements() - { - return getOrCreateMap(3); - } - } - - /** - * Encapsulates all the data for a TLDNamespace. Allows the model - * to be separated from the Namespace interface for ease of serialization and - * controlled subclassing. - * - */ - public abstract static class TLDNamespaceData implements Serializable - { - /** - * - */ - private static final long serialVersionUID = -1284294636936289804L; - - /** - * @return the displayb - */ - public abstract String getDisplayName(); - -// public abstract ITagElement getOrCreateTagElement(String name, -// Map<String, ITagElement> tags); - - /** - * @return the number of tags - */ - public abstract int getNumTags(); - - /** - * @return the namespace uri - */ - public abstract String getUri(); - - /** - * @param name - * @return the view element for name or null if not found. - */ - public abstract ITagElement getViewElement(final String name); - - /** - * May be long running since it will lazily calculate all unloaded - * tags. - * @return all view elements for this namespace - */ - public abstract Map<String, ITagElement> getAllViewElements(); - - /** - * @return true if all elements have been lazily loaded - */ - public abstract boolean isInitialized(); - - /** - * @return just the currently loaded elements for this namespace. - */ - public abstract Map<String, ITagElement> getCurrentElements(); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDTagElement.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDTagElement.java deleted file mode 100644 index f7ad76617..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDTagElement.java +++ /dev/null @@ -1,221 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.model.jsp; - -import java.io.Serializable; -import java.util.Iterator; -import java.util.Map; -import java.util.Map.Entry; - -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagAttributeHandler; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.TagElement; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDDocument; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDElementDeclaration; -import org.eclipse.wst.xml.core.internal.contentmodel.CMDocument; - - -/** - * A tag element for a JSP tag (TLD-defined) - * - * @author cbateman - * - */ -public class TLDTagElement extends TagElement -{ - /** - * - */ - private static final long serialVersionUID = -874272538404837105L; - private final TLDElementData _tldData; - - /** - * @param elementDecl - * @param advisor - */ - public TLDTagElement(final TLDElementDeclaration elementDecl - , final IAttributeAdvisor advisor) - { - _tldData = new DocumentElementData(elementDecl, advisor); - } - - @Override - public String getName() - { - return _tldData.getName(); - } - - @Override - public String getUri() - { - return _tldData.getUri(); - } - - @Override - public String getTagHandlerClassName() { - return _tldData.getTagHandlerClassName(); - } - - @Override - public String toString() - { - return String.format("Tag: Tag Handler: name=%s, uri=%s, tagHandlerClassName=%s\n" - , getName(), getUri(), getTagHandlerClassName()) - + constructAttributesString(); - } - - /** - * @return a string representation of the attributes. - */ - protected String constructAttributesString() - { - String attributes = ""; - - for (final Iterator it = getAttributeHandlers().entrySet().iterator(); it.hasNext();) - { - final Map.Entry entry = (Entry) it.next(); - final String name = (String) entry.getKey(); - final ITagAttributeHandler handler = (ITagAttributeHandler) entry.getValue(); - - attributes += String.format("\t\t\tAttribute: name=%s, customHandler=%s, propertyName=%s, isELAllowed=%b\n", - name, handler.getCustomHandler(), handler.getName(), - Boolean.valueOf(handler.isELAllowed())); - } - return attributes; - } - - @Override - public Map getAttributeHandlers() - { - return _tldData.getAttributes(); - } - - private static class DocumentElementData extends TLDElementData - { - /** - * serialization id - */ - private static final long serialVersionUID = -6160324802818766058L; - private final TLDElementDeclaration _tldDoc; - private final CMNodeNamedMapAdapter _adapter; - - public DocumentElementData(final TLDElementDeclaration tldDoc, - final IAttributeAdvisor advisor) - { - _tldDoc = tldDoc; - _adapter = new CMNodeNamedMapAdapter(tldDoc, advisor); - } - - @Override - public String getName() - { - return _tldDoc.getElementName(); - } - - @Override - public String getTagHandlerClassName() - { - return _tldDoc.getTagclass(); - } - - @Override - public String getUri() - { - final CMDocument owner = _tldDoc.getOwnerDocument(); - - if (owner instanceof TLDDocument) - { - return ((TLDDocument)owner).getUri(); - } - return null; - } - - private Object writeReplace() - { - return new SerializedTLDElementData(getName(), getTagHandlerClassName(), getUri() - , _adapter); - } - - @Override - public Map<String, ? extends ITagAttributeHandler> getAttributes() - { - return _adapter; - } - } - - /** - * @author cbateman - * - */ - private static class SerializedTLDElementData extends TLDElementData - { - /** - * - */ - private static final long serialVersionUID = 4008084060638384114L; - private final String _name; - private final String _uri; - private final String _tagHandlerClassName; - private final Map<String, ? extends ITagAttributeHandler> _tagAttributes; - - /** - * @param name - * @param tagHandlerClassName - * @param uri - * @param tagAttributes - */ - private SerializedTLDElementData(final String name, - final String tagHandlerClassName, final String uri, - final Map<String, ? extends ITagAttributeHandler> tagAttributes) - { - super(); - _name = name; - _tagHandlerClassName = tagHandlerClassName; - _uri = uri; - _tagAttributes = tagAttributes; - } - - @Override - public String getName() - { - return _name; - } - - @Override - public String getTagHandlerClassName() - { - return _tagHandlerClassName; - } - - @Override - public String getUri() - { - return _uri; - } - - @Override - public Map<String, ? extends ITagAttributeHandler> getAttributes() - { - return _tagAttributes; - } - } - - private static abstract class TLDElementData implements Serializable - { - /** - * - */ - private static final long serialVersionUID = -2494388738109839064L; - public abstract String getTagHandlerClassName(); - public abstract String getName(); - public abstract String getUri(); - public abstract Map<String, ? extends ITagAttributeHandler> getAttributes(); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDTagHandlerElement.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDTagHandlerElement.java deleted file mode 100644 index d637f49e2..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDTagHandlerElement.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.model.jsp; - -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.IHandlerTagElement; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDElementDeclaration; - -/** - * A TLD-defined tag (i.e. JSP) that maps to a known tag handler. - * - * @author cbateman - * - */ -public class TLDTagHandlerElement extends TLDJSFTagElement implements -IHandlerTagElement -{ - /** - * - */ - private static final long serialVersionUID = 8984277085824995102L; - private final TagHandlerType _tagHandlerType; - - /** - * @param elementDecl - * @param tagHandlerType - * @param advisor - */ - public TLDTagHandlerElement(final TLDElementDeclaration elementDecl, final TagHandlerType tagHandlerType, final IAttributeAdvisor advisor) - { - super(elementDecl, advisor); - _tagHandlerType = tagHandlerType; - } - - public TagHandlerType getTagHandlerType() - { - return _tagHandlerType; - } - - @Override - public TagType getType() - { - return TagType.HANDLER; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDValidatorTagElement.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDValidatorTagElement.java deleted file mode 100644 index e99d97b07..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDValidatorTagElement.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.model.jsp; - -import org.eclipse.jst.jsf.common.runtime.internal.model.decorator.ValidatorTypeInfo; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.IValidatorTagElement; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDElementDeclaration; - -/** - * A TLD-defined tag (i.e. JSP) that maps one-to-one with a JSF Converter - * - * @author cbateman - * - */ -public class TLDValidatorTagElement extends TLDJSFTagElement implements IValidatorTagElement -{ - /** - * - */ - private static final long serialVersionUID = 4251223772554969477L; - private final ValidatorTypeInfo _validator; - - /** - * @param elementDecl - * @param validatorTypeInfo - * @param advisor - */ - public TLDValidatorTagElement(final TLDElementDeclaration elementDecl, final ValidatorTypeInfo validatorTypeInfo, final IAttributeAdvisor advisor) - { - super(elementDecl, advisor); - _validator = validatorTypeInfo; - } - - public final ValidatorTypeInfo getValidator() - { - return _validator; - } - - @Override - public final TagType getType() - { - return TagType.VALIDATOR; - } - - @Override - public String toString() - { - return _validator.toString(); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TagIntrospectingStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TagIntrospectingStrategy.java deleted file mode 100644 index 6a5d97d35..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TagIntrospectingStrategy.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.model.jsp; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagElement; -import org.eclipse.jst.jsf.designtime.internal.Messages; -import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.analyzer.TagAnalyzer; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDElementDeclaration; - -/** - * A resolving strategy that uses tag introspection. - * - * @author cbateman - * - */ -public final class TagIntrospectingStrategy extends JSPTagResolvingStrategy -{ - /** - * the identifier of this strategy - */ - public final static String ID = "org.eclipse.jst.jsf.designtime.TagIntrospectingStrategy"; //$NON-NLS-1$ - /** - * the display name - */ - public final static String DISPLAY_NAME = Messages.TagIntrospectingStrategy_DisplayName; - - private final IProject _project; - - /** - * @return the descriptor for this resolver strategy - */ - public static StrategyDescriptor createDescriptor() - { - return new StrategyDescriptor(ID, DISPLAY_NAME); - } - - /** - * @param project - */ - public TagIntrospectingStrategy(final IProject project) - { - // TODO: would it be better to have a model context on the resolve? - _project = project; - } - - @Override - public String getId() - { - return ID; - } - - public String getDisplayName() - { - return DISPLAY_NAME; - } - - @Override - public ITagElement resolve(TLDElementDeclaration element) - { - return TagAnalyzer.createTLDTagElement(element, _project); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/UnresolvedJSPTagResolvingStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/UnresolvedJSPTagResolvingStrategy.java deleted file mode 100644 index 0a94f66b5..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/UnresolvedJSPTagResolvingStrategy.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.model.jsp; - -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagElement; -import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.IAttributeAdvisor.NullAttributeAdvisor; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDElementDeclaration; - -/** - * This a fallback strategy that always creates an element for a tld decl. This - * can be tacked to the end of a composite strategy (or used alone) to ensure - * that a basic ITagElement is always created for a TLDElementDeclaration. - * - * @author cbateman - * - */ -public class UnresolvedJSPTagResolvingStrategy extends JSPTagResolvingStrategy -{ - /** - * the identifier of this strategy - */ - public final static String ID = "org.eclipse.jst.jsf.designtime.UnresolvedJSPTagResolvingStrategy"; //$NON-NLS-1$ - /** - * the displayable name - */ - public final static String DISPLAY_NAME = Messages.UnresolvedJSPTagResolvingStrategy_1; - - /** - * @return the descriptor for this resolver strategy - */ - public static StrategyDescriptor createDescriptor() - { - return new StrategyDescriptor(ID, DISPLAY_NAME); - } - - @Override - public String getId() - { - return ID; - } - - public String getDisplayName() - { - return DISPLAY_NAME; - } - - @Override - public ITagElement resolve(TLDElementDeclaration element) - { - // just create a tag element - return new TLDTagElement(element, new NullAttributeAdvisor()); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/analyzer/ServletBeanProxyContributor.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/analyzer/ServletBeanProxyContributor.java deleted file mode 100644 index 7baa4a0fd..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/analyzer/ServletBeanProxyContributor.java +++ /dev/null @@ -1,131 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -/** - * - */ -package org.eclipse.jst.jsf.designtime.internal.view.model.jsp.analyzer; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jem.internal.proxy.core.ConfigurationContributorAdapter; -import org.eclipse.jem.internal.proxy.core.IConfigurationContributionController; -import org.eclipse.jst.jsf.core.JSFVersion; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.wst.common.project.facet.core.FacetedProjectFramework; -import org.osgi.framework.Bundle; - -class ServletBeanProxyContributor extends ConfigurationContributorAdapter -{ - private final IProject _project; - private final JSFVersion _jsfVersion; - - public ServletBeanProxyContributor(final IProject project) - { - _project = project; - _jsfVersion = getProjectVersion(project); - if (_jsfVersion == null) - { - throw new IllegalArgumentException("jsfVersion must not be null"); - } - - } - - @Override - public void contributeClasspaths( - final IConfigurationContributionController controller) - throws CoreException - { - if (_jsfVersion != JSFVersion.V1_2) - { - final Bundle servletBundle = Platform.getBundle("javax.servlet"); - controller.contributeClasspath(servletBundle, (IPath) null, - IConfigurationContributionController.APPEND_USER_CLASSPATH, - true); - - final Bundle jspBundle = Platform.getBundle("javax.servlet.jsp"); - controller.contributeClasspath(jspBundle, (IPath) null, - IConfigurationContributionController.APPEND_USER_CLASSPATH, - true); - } - else - { - final Bundle coreBundle = JSFCorePlugin.getDefault().getBundle(); - final IJavaProject javaProject = JavaCore.create(_project); - maybeAddJar(controller, "javax.servlet.jsp.tagext.JspIdConsumer", - javaProject, coreBundle, "/jars/fake_jsp_21.jar"); - maybeAddJar(controller, "javax.el.ELException", javaProject, - coreBundle, "/jars/fake_el.jar"); - } - } - - private void maybeAddJar( - final IConfigurationContributionController controller, - final String addIfTypeNameNotFound, final IJavaProject javaProject, - final Bundle bundle, final String path) - { - try - { - final IType type = javaProject.findType(addIfTypeNameNotFound); - // if we can't find the type name on the classpath,then inject - // our fake jar to aid linkage while introspecting facelet libs - if (type == null) - { - - controller - .contributeClasspath( - bundle, - path, - IConfigurationContributionController.APPEND_USER_CLASSPATH, - false); - } - } - catch (final JavaModelException jme) - { - // suppress - } - } - - static JSFVersion getProjectVersion(final IProject project) - { - try - { - if (FacetedProjectFramework.hasProjectFacet(project, "jst.jsf", - "1.0")) - { - return JSFVersion.V1_0; - } - else if (FacetedProjectFramework.hasProjectFacet(project, - "jst.jsf", "1.1")) - { - return JSFVersion.V1_1; - } - else if (FacetedProjectFramework.hasProjectFacet(project, - "jst.jsf", "1.2")) - { - return JSFVersion.V1_2; - } - } - catch (final CoreException e) - { - JSFCorePlugin.log("checking project version", e); - // fall-through - } - - return null; - } - -}
\ No newline at end of file diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/analyzer/TagAnalyzer.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/analyzer/TagAnalyzer.java deleted file mode 100644 index d7f03f9f5..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/analyzer/TagAnalyzer.java +++ /dev/null @@ -1,861 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.model.jsp.analyzer; - -import java.util.Collections; -import java.util.HashSet; -import java.util.Set; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.JavaConventions; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jem.internal.proxy.core.IBeanProxy; -import org.eclipse.jem.internal.proxy.core.IBeanTypeProxy; -import org.eclipse.jem.internal.proxy.core.IConfigurationContributor; -import org.eclipse.jem.internal.proxy.core.IStandardBeanTypeProxyFactory; -import org.eclipse.jem.internal.proxy.core.ProxyFactoryRegistry; -import org.eclipse.jem.internal.proxy.ide.IDERegistration; -import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentTypeInfo; -import org.eclipse.jst.jsf.common.runtime.internal.model.decorator.ConverterTypeInfo; -import org.eclipse.jst.jsf.common.runtime.internal.model.decorator.ValidatorTypeInfo; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.IJSFTagElement; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.IHandlerTagElement.TagHandlerType; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.IJSFTagElement.TagType; -import org.eclipse.jst.jsf.core.JSFVersion; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.core.internal.JSFCoreTraceOptions; -import org.eclipse.jst.jsf.core.internal.jem.BeanProxyUtil.BeanProxyWrapper; -import org.eclipse.jst.jsf.core.internal.jem.BeanProxyUtil.ProxyException; -import org.eclipse.jst.jsf.designtime.internal.view.DTComponentIntrospector; -import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.TLDComponentTagElement; -import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.TLDConverterTagElement; -import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.TLDTagElement; -import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.TLDTagHandlerElement; -import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.TLDValidatorTagElement; -import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.IAttributeAdvisor.NullAttributeAdvisor; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDElementDeclaration; - -/** - * Utility class supporting methods to derive information from JSP tag - * definitions (TLD) - * - * @author cbateman - * - */ -public final class TagAnalyzer -{ - private static final String JAVAX_FACES_WEBAPP_CONVERTER_TAG = "javax.faces.webapp.ConverterTag"; - private static final String JAVAX_FACES_WEBAPP_CONVERTER_ELTAG = "javax.faces.webapp.ConverterELTag"; - private static final String JAVAX_FACES_WEBAPP_VALIDATOR_TAG = "javax.faces.webapp.ValidatorTag"; - private static final String JAVAX_FACES_WEBAPP_VALIDATOR_ELTAG = "javax.faces.webapp.ValidatorELTag"; - private static final String JAVAX_FACES_WEBAPP_FACET_TAG = "javax.faces.webapp.FacetTag"; - - // private static final String JAVAX_FACES_WEBAPP_ACTIONLISTENER_TAG = - // "javax.faces.webapp.ActionListenerTag"; - // private static final String JAVAX_FACES_WEBAPP_VALUECHANGELISTENER_TAG = - // "javax.faces.webapp.ValueChangeListenerTag"; - private static final String JAVAX_FACES_WEBAPP_ATTRIBUTE_TAG = "javax.faces.webapp.AttributeTag"; - - private final static Set<String> COMPONENT_TAG_HANDLER_TYPES_JSF11; - private final static Set<String> COMPONENT_TAG_HANDLER_TYPES_JSF12; - - private final static Set<String> CONVERTER_TAG_HANDLER_TYPES_JSF11 = Collections - .singleton(JAVAX_FACES_WEBAPP_CONVERTER_TAG); - private final static Set<String> CONVERTER_TAG_HANDLER_TYPES_JSF12; - - private final static Set<String> VALIDATOR_TAG_HANDLER_TYPES_JSF11 = Collections - .singleton(JAVAX_FACES_WEBAPP_VALIDATOR_TAG); - private final static Set<String> VALIDATOR_TAG_HANDLER_TYPES_JSF12; - - private final static Set<String> FACET_TAG_HANDLER = Collections - .singleton(JAVAX_FACES_WEBAPP_FACET_TAG); - private final static Set<String> ATTRIBUTE_TAG_HANDLER = Collections - .singleton(JAVAX_FACES_WEBAPP_ATTRIBUTE_TAG); - // private final static Set<String> ACTIONLISTENER_TAG_HANDLER = Collections - // .singleton(JAVAX_FACES_WEBAPP_ACTIONLISTENER_TAG); - // private final static Set<String> VALUECHANGELISTENER_TAG_HANDLER = - // Collections - // .singleton(JAVAX_FACES_WEBAPP_VALUECHANGELISTENER_TAG); - - private final static Set<String> ALL_HANDLER_TAGS; - - static - { - // components - // JSF 1.1 - Set<String> set = new HashSet<String>(8); - set.add("javax.faces.webapp.UIComponentTag"); - set.add("javax.faces.webapp.UIComponentBodyTag"); - COMPONENT_TAG_HANDLER_TYPES_JSF11 = Collections.unmodifiableSet(set); - - // JSF 1.2 - set = new HashSet<String>(8); - set.add("javax.faces.webapp.UIComponentTag"); - set.add("javax.faces.webapp.UIComponentBodyTag"); - set.add("javax.faces.webapp.UIComponentELTag"); - COMPONENT_TAG_HANDLER_TYPES_JSF12 = Collections.unmodifiableSet(set); - - // converters - set = new HashSet<String>(8); - set.add(JAVAX_FACES_WEBAPP_CONVERTER_TAG); - set.add(JAVAX_FACES_WEBAPP_CONVERTER_ELTAG); - CONVERTER_TAG_HANDLER_TYPES_JSF12 = Collections.unmodifiableSet(set); - - // validators - set = new HashSet<String>(8); - set.add(JAVAX_FACES_WEBAPP_VALIDATOR_TAG); - set.add(JAVAX_FACES_WEBAPP_VALIDATOR_ELTAG); - VALIDATOR_TAG_HANDLER_TYPES_JSF12 = Collections.unmodifiableSet(set); - - // tag handlers - ALL_HANDLER_TAGS = new HashSet<String>(); - ALL_HANDLER_TAGS.addAll(FACET_TAG_HANDLER); - ALL_HANDLER_TAGS.addAll(ATTRIBUTE_TAG_HANDLER); - // ALL_HANDLER_TAGS.addAll(VALUECHANGELISTENER_TAG_HANDLER); - // ALL_HANDLER_TAGS.addAll(ACTIONLISTENER_TAG_HANDLER); - } - - /** - * Tries to determine the component type of the component that corresponds - * to the JSP tag defined by tldDecl. - * - * @param tldDecl - * @param project - * @return get the component type from the tag definition or null if none. - */ - public static String findComponentType(final TLDElementDeclaration tldDecl, - final IProject project) - { - final String className = tldDecl.getTagclass(); - - final IConfigurationContributor[] contributor = new IConfigurationContributor[] - { new ServletBeanProxyContributor(project) }; - - ProxyFactoryRegistry registry = null; - try - { - registry = getProxyFactoryRegistry(contributor, project); - - if (registry != null) - { - final IStandardBeanTypeProxyFactory factory = registry - .getBeanTypeProxyFactory(); - final IBeanTypeProxy classTypeProxy = factory - .getBeanTypeProxy(className); - final BeanProxyWrapper classTypeWrapper = new BeanProxyWrapper(project, - classTypeProxy); - - try - { - classTypeWrapper.init(); - return classTypeWrapper.callStringMethod("getComponentType"); - } - catch (final ProxyException tp) - { - if (JSFCoreTraceOptions.TRACE_JSPTAGINTROSPECTOR) - { - JSFCoreTraceOptions.log("TagAnalyzer.findComponentType", tp); - } - } - } - } - finally - { - if (registry != null) - { - registry.terminateRegistry(true); - } - } - return null; - } - - /** - * Tries to introspect tldDecl's tag class to determine what the identifier - * of the underlying Converter that is used to register it in the app config - * - * @param tldDecl - * @param project - * @return the converter type identifier for the tldDecl or null if not - * found - */ - public static String findConverterType(final TLDElementDeclaration tldDecl, - final IProject project) - { - // TODO: allow for pluggable resolver? - - // This one is more hacky and less prone to success than the component - // type finder because the ConverterTag doesn't initialize its type - // field on construction. Instead, both MyFaces and RI seem to do it - // based on the doStartTag method. They also don't provide a standard - // interface for acquiring the id so instead we make some guess on - // the internal field name. - ProxyFactoryRegistry registry = null; - try - { - final String className = tldDecl.getTagclass(); - - final IConfigurationContributor[] contributor = new IConfigurationContributor[] - { new ServletBeanProxyContributor(project) }; - registry = getProxyFactoryRegistry( - contributor, project); - - if (registry != null) - { - final IStandardBeanTypeProxyFactory factory = registry - .getBeanTypeProxyFactory(); - final IBeanTypeProxy classTypeProxy = factory - .getBeanTypeProxy(className); - - try - { - final IType type = JavaCore.create(project).findType(className); - - if (type != null - && DTComponentIntrospector - .isTypeNameInstanceOfClass( - type, - Collections - .singleton(JAVAX_FACES_WEBAPP_CONVERTER_ELTAG))) - { - return findConverterType_InELTag(factory, classTypeProxy,project); - } - // the assumption is that this is a component tag, so we assume - // it is one. - else if (type != null - && DTComponentIntrospector - .isTypeNameInstanceOfClass( - type, - Collections - .singleton(JAVAX_FACES_WEBAPP_CONVERTER_TAG))) - { - return findConverterType_InTag(factory, classTypeProxy, project); - } - } - catch (final JavaModelException jme) - { - // suppress for now - } - } - } - finally - { - if (registry != null) - { - registry.terminateRegistry(true); - } - } - return null; - } - - private static String findConverterType_InTag( - final IStandardBeanTypeProxyFactory factory, - final IBeanTypeProxy classTypeProxy, final IProject project) - { - final IBeanTypeProxy nullPageContextType = factory - .getBeanTypeProxy("javax.servlet.jsp.PageContext"); - final BeanProxyWrapper classTypeWrapper = new BeanProxyWrapper(project, - classTypeProxy); - - try - { - classTypeWrapper.init(); - - callSuppressExceptions(classTypeWrapper, "setPageContext", - new IBeanProxy[] - { null }, new IBeanTypeProxy[] - { nullPageContextType }); - callSuppressExceptions(classTypeWrapper, "doStartTag"); - - final IBeanTypeProxy converterProxy = factory - .getBeanTypeProxy(JAVAX_FACES_WEBAPP_CONVERTER_TAG); - - // hopefully doStartTag set the converter field before it - // failed. - // now try to guess what it's called - String converterId = getStringField(classTypeWrapper, - converterProxy, "converterId"); - - if (converterId != null) - { - return converterId; - } - - converterId = getStringField(classTypeWrapper, converterProxy, - "_converterId"); - - if (converterId != null) - { - return converterId; - } - - // no? look for a CONVERTER_ID - converterId = getStringField(classTypeWrapper, classTypeProxy, - "CONVERTER_ID"); - } - catch (final ProxyException tp) - { - // fall through - } - return null; - } - - private static String findConverterType_InELTag( - final IStandardBeanTypeProxyFactory factory, - final IBeanTypeProxy classTypeProxy, final IProject project) - { - final BeanProxyWrapper classTypeWrapper = new BeanProxyWrapper(project, - classTypeProxy); - final IBeanTypeProxy elExpressionType = factory - .getBeanTypeProxy("javax.el.ValueExpression"); - - if (elExpressionType == null) - { - return null; - } - - try - { - classTypeWrapper.init(); - - callSuppressExceptions(classTypeWrapper, "doStartTag"); - - // no? look for a CONVERTER_ID - final IBeanProxy converterId = getFieldInParents(classTypeWrapper, - classTypeProxy, "CONVERTER_ID_EXPR"); - - if (converterId != null) - { - converterId.getTypeProxy().isKindOf(elExpressionType); - final BeanProxyWrapper elExprValue = new BeanProxyWrapper(project, - converterId.getTypeProxy()); - final String value = elExprValue - .callStringMethod("getExpressionString"); - System.out.println("Expression string:" + value); - } - - // - // - // final IBeanTypeProxy converterProxy = factory - // .getBeanTypeProxy(JAVAX_FACES_WEBAPP_CONVERTER_TAG); - - } - catch (final ProxyException tp) - { - // fall through - } - return null; - } - - /** - * @param tldDecl - * @param project - * @return the validator type identifier for the tldDecl or null if not - * found - */ - public static String findValidatorType(final TLDElementDeclaration tldDecl, - final IProject project) - { - // TODO: allow for pluggable resolver? - - // This one is more hacky and less prone to success than the component - // type finder because the Validator doesn't initialize its type - // field on construction. Instead, both MyFaces and RI seem to do it - // based on the doStartTag method. They also don't provide a standard - // interface for acquiring the id so instead we make some guess on - // the internal field name. - final String className = tldDecl.getTagclass(); - - final IConfigurationContributor[] contributor = new IConfigurationContributor[] - { new ServletBeanProxyContributor(project) }; - - ProxyFactoryRegistry registry = null; - - try - { - registry = getProxyFactoryRegistry(contributor, project); - - if (registry != null) - { - final IStandardBeanTypeProxyFactory factory = registry - .getBeanTypeProxyFactory(); - final IBeanTypeProxy classTypeProxy = factory - .getBeanTypeProxy(className); - final BeanProxyWrapper classTypeWrapper = new BeanProxyWrapper(project, - classTypeProxy); - final IBeanTypeProxy converterProxy = factory - .getBeanTypeProxy(JAVAX_FACES_WEBAPP_VALIDATOR_TAG); - try - { - classTypeWrapper.init(); - - callSuppressExceptions(classTypeWrapper, "doStartTag"); - callSuppressExceptions(classTypeWrapper, "createValidator"); - - // hopefully doStartTag set the converter field before it - // failed. - // now try to guess what it's called - String validatorId = getStringField(classTypeWrapper, - converterProxy, "validatorId"); - - if (validatorId != null) - { - return validatorId; - } - - validatorId = getStringField(classTypeWrapper, converterProxy, - "_validatorId"); - - if (validatorId != null) - { - return validatorId; - } - - // no? then see if there's a VALIDATOR_ID field *on the tag* - validatorId = getStringField(classTypeWrapper, classTypeProxy, - "VALIDATOR_ID"); - - if (validatorId != null) - { - return validatorId; - } - } - catch (final ProxyException tp) - { - // fall through - } - } - } - finally - { - if (registry != null) - { - registry.terminateRegistry(true); - } - } - return null; - - } - - private static IBeanProxy getFieldInParents( - final BeanProxyWrapper classTypeWrapper, - final IBeanTypeProxy typeProxy, final String fieldName) - { - try - { - return classTypeWrapper.getFieldValueIncludeParents(fieldName, - typeProxy); - } - catch (final ProxyException e) - { - // suppress - } - - return null; - } - - private static String getStringField( - final BeanProxyWrapper classTypeWrapper, - final IBeanTypeProxy typeProxy, final String fieldName) - { - try - { - return classTypeWrapper.getStringFieldValue(fieldName, typeProxy); - } - catch (final ProxyException e) - { - // suppress - } - - return null; - } - - private static void callSuppressExceptions( - final BeanProxyWrapper classTypeWrapper, final String methodName) - { - try - { - classTypeWrapper.call(methodName); - } - catch (final ProxyException tp) - { - // suppress this since it may well throw an exception - // depending on what assumptions the tag class is making - // that won't be true because we're not in a servlet - } - } - - private static void callSuppressExceptions( - final BeanProxyWrapper classTypeWrapper, final String methodName, - final IBeanProxy[] args, final IBeanTypeProxy[] argTypes) - { - try - { - classTypeWrapper.call(methodName, args, argTypes); - } - catch (final ProxyException tp) - { - // suppress this since it may well throw an exception - // depending on what assumptions the tag class is making - // that won't be true because we're not in a servlet - } - - } - - /** - * @param project - * @return a new proxy factory registry or null; - * - * TODO: caching? - */ - private static ProxyFactoryRegistry getProxyFactoryRegistry( - final IConfigurationContributor[] configuration, - final IProject project) - { - try - { - return IDERegistration.startAnImplementation(configuration, false, - project, project.getName(), JSFCorePlugin.PLUGIN_ID, - new NullProgressMonitor()); - } - catch (final CoreException e) - { - JSFCorePlugin.log("Error starting vm for project: " - + project.getName(), e); - } - - return null; - } - - /** - * @param tldDecl - * @param project - * @return the tag element for the tldDecl - */ - public static TLDTagElement createTLDTagElement( - final TLDElementDeclaration tldDecl, final IProject project) - { - if (JSFCoreTraceOptions.TRACE_JSPTAGINTROSPECTOR) - { - JSFCoreTraceOptions - .log(String - .format( - "TagAnalyzer.createTLDTagElement: Start tld=%s, project=%s", - tldDecl.getNodeName(), project.getName())); - } - long startTime = 0; - if (JSFCoreTraceOptions.TRACE_JSPTAGINTROSPECTOR_PERF) - { - startTime = System.nanoTime(); - } - - try - { - final IJavaProject javaProject = JavaCore.create(project); - final String typeName = tldDecl.getTagclass(); - - if (typeName == null - || JavaConventions.validateJavaTypeName(typeName, - JavaCore.VERSION_1_3, - JavaCore.VERSION_1_3).getSeverity() == IStatus.ERROR) - { - JSFCorePlugin.log( - "Bad tag class name in " + tldDecl.toString(), - new Throwable()); - return null; - } - - final IType type = javaProject.findType(typeName); - - if (type == null) - { - if (JSFCoreTraceOptions.TRACE_JSPTAGINTROSPECTOR) - { - JSFCoreTraceOptions.log("Type not found for: "+typeName); - } - return null; - } - final TagType tagType = getJSFComponentTagType(type, project); - - if (JSFCoreTraceOptions.TRACE_JSPTAGINTROSPECTOR) - { - JSFCoreTraceOptions.log(String.format( - "Tag class type=%s\nTag type=%s", type, tagType)); - } - - if (tagType == TagType.COMPONENT) - { - final TLDTagElement element = createComponentTagElement(tldDecl, project); - - if (JSFCoreTraceOptions.TRACE_JSPTAGINTROSPECTOR_PERF) - { - String name = element != null ? element.toString() - : "<none>"; - System.out.printf( - "Time to create component tag element %s was %d\n", - name, Long.valueOf(System.nanoTime() - startTime)); - } - return element; - } - else if (tagType == TagType.CONVERTER) - { - final TLDTagElement element = createConverterTagElement(tldDecl, project); - if (JSFCoreTraceOptions.TRACE_JSPTAGINTROSPECTOR_PERF) - { - String name = element != null ? element.toString() - : "<none>"; - System.out.printf( - "Time to create converter tag element %s was %d\n", - name, Long.valueOf(System.nanoTime() - startTime)); - } - return element; - } - else if (tagType == TagType.VALIDATOR) - { - final TLDTagElement element = createValidatorTagElement(tldDecl, project); - if (JSFCoreTraceOptions.TRACE_JSPTAGINTROSPECTOR_PERF) - { - String name = element != null ? element.toString() - : "<none>"; - System.out.printf( - "Time to create validator tag element %s was %d\n", - name, Long.valueOf(System.nanoTime() - startTime)); - } - return element; - } - else if (tagType == TagType.HANDLER) - { - final TLDTagElement element = createHandlerTagElement(tldDecl, type); - if (JSFCoreTraceOptions.TRACE_JSPTAGINTROSPECTOR_PERF) - { - String name = element != null ? element.toString() - : "<none>"; - System.out.printf( - "Time to create handler tag element %s was %d\n", - name, Long.valueOf(System.nanoTime() - startTime)); - } - return element; - } - } - catch (final JavaModelException jme) - { - JSFCorePlugin.log(jme, "Trying to get type for TLD"); - } - - return null; - } - - /** - * @param tldDecl - * @param project - * @return a component tag element for tldDecl - */ - public static TLDTagElement createComponentTagElement( - final TLDElementDeclaration tldDecl, final IProject project) - { - final String componentType = findComponentType(tldDecl, project); - - if (componentType != null) - { - final String componentClass = DTComponentIntrospector - .findComponentClass(componentType, project); - - if (componentClass != null && !"".equals(componentClass.trim())) - { - final ComponentTypeInfo typeInfo = DTComponentIntrospector - .getComponent(componentType, componentClass, project, - new IConfigurationContributor[] - {new ServletBeanProxyContributor(project)}); - - if (typeInfo != null) - { - final TLDComponentTagElement tagElement = new TLDComponentTagElement( - tldDecl, typeInfo, new NullAttributeAdvisor()); - return tagElement; - } - } - } - - // TODO: really return null? - return null; - } - - /** - * @param tldDecl - * @param project - * @return a converter tag element for tldDecl - */ - public static TLDTagElement createConverterTagElement( - final TLDElementDeclaration tldDecl, final IProject project) - { - final String converterId = findConverterType(tldDecl, project); - - if (converterId != null) - { - final String converterClass = DTComponentIntrospector - .findConverterClass(converterId, project); - - if (converterClass != null && !"".equals(converterClass.trim())) - { - final ConverterTypeInfo typeInfo = DTComponentIntrospector - .getConverter(converterId, converterClass); - final TLDConverterTagElement tagElement = new TLDConverterTagElement( - tldDecl, typeInfo, new NullAttributeAdvisor()); - return tagElement; - } - } - - // we know (actually we assume by contract) that this a converter - // so create an unknown converter tag for it - return new TLDConverterTagElement(tldDecl, ConverterTypeInfo.UNKNOWN, new NullAttributeAdvisor()); - } - - /** - * @param tldDecl - * @param project - * @return a validator tag element for the tldDec - */ - public static TLDTagElement createValidatorTagElement( - final TLDElementDeclaration tldDecl, final IProject project) - { - final String validatorId = findValidatorType(tldDecl, project); - - if (validatorId != null) - { - final String validatorClass = DTComponentIntrospector - .findValidatorClass(validatorId, project); - - if (validatorClass != null && !"".equals(validatorClass.trim())) - { - final ValidatorTypeInfo typeInfo = DTComponentIntrospector - .getValidator(validatorId, validatorClass); - final TLDValidatorTagElement tagElement = new TLDValidatorTagElement( - tldDecl, typeInfo, new NullAttributeAdvisor()); - return tagElement; - } - } - // we know (actually we assume by contract) that this a validator - // so create an unknown converter tag for it - return new TLDValidatorTagElement(tldDecl, ValidatorTypeInfo.UNKNOWN, new NullAttributeAdvisor()); - } - - /** - * @param tldDecl - * @param type - * @return the tag element for a JSF handler - */ - public static TLDTagElement createHandlerTagElement( - final TLDElementDeclaration tldDecl, final IType type) - { - if (DTComponentIntrospector.isTypeNameInstanceOfClass(type, - FACET_TAG_HANDLER)) - { - return new TLDTagHandlerElement(tldDecl, TagHandlerType.FACET, new NullAttributeAdvisor()); - } - else if (DTComponentIntrospector.isTypeNameInstanceOfClass(type, - ATTRIBUTE_TAG_HANDLER)) - { - return new TLDTagHandlerElement(tldDecl, TagHandlerType.ATTRIBUTE, new NullAttributeAdvisor()); - } - // else if (isTypeNameInstanceOfClass(type, ACTIONLISTENER_TAG_HANDLER)) - // { - // return new TLDTagHandlerElement(tldDecl, - // TagHandlerType.ACTIONLISTENER); - // } - // else if (isTypeNameInstanceOfClass(type, - // VALUECHANGELISTENER_TAG_HANDLER)) - // { - // return new TLDTagHandlerElement(tldDecl, - // TagHandlerType.VALUECHANGELISTENER); - // } - return null; - } - - /** - * @param type - * @param project - * @return true if type represents a JSF component action class (spec 9.2.2) - */ - public static IJSFTagElement.TagType getJSFComponentTagType( - final IType type, final IProject project) - { - if (JSFCoreTraceOptions.TRACE_JSPTAGINTROSPECTOR) - { - JSFCoreTraceOptions - .log(String - .format( - "TagAnalyzer.getJSFComponentTagType: Determining Tag Type for type %s on project %s", - type.getFullyQualifiedName(), project - .toString())); - } - - Set<String> componentTags = null; - Set<String> converterTags = null; - Set<String> validatorTags = null; - - final JSFVersion jsfVersion = ServletBeanProxyContributor.getProjectVersion(project); - - // v1.1(9.2.2): JSF component tags must sub-class one of these - if (jsfVersion == JSFVersion.V1_0 || jsfVersion == JSFVersion.V1_1) - { - componentTags = COMPONENT_TAG_HANDLER_TYPES_JSF11; - converterTags = CONVERTER_TAG_HANDLER_TYPES_JSF11; - validatorTags = VALIDATOR_TAG_HANDLER_TYPES_JSF11; - } - // v1.2(9.2.2): JSF component tags must sub-class UIComponentELTag - // the original two are included because we must be backward - // compatible - else if (jsfVersion == JSFVersion.V1_2) - { - componentTags = COMPONENT_TAG_HANDLER_TYPES_JSF12; - converterTags = CONVERTER_TAG_HANDLER_TYPES_JSF12; - validatorTags = VALIDATOR_TAG_HANDLER_TYPES_JSF12; - } - - TagType tagType = null; - - if (DTComponentIntrospector.isTypeNameInstanceOfClass(type, - componentTags)) - { - tagType = TagType.COMPONENT; - } - else if (DTComponentIntrospector.isTypeNameInstanceOfClass(type, - converterTags)) - { - tagType = TagType.CONVERTER; - } - else if (DTComponentIntrospector.isTypeNameInstanceOfClass(type, - validatorTags)) - { - tagType = TagType.VALIDATOR; - } - else if (DTComponentIntrospector.isTypeNameInstanceOfClass(type, - ALL_HANDLER_TAGS)) - { - tagType = TagType.HANDLER; - } - - if (JSFCoreTraceOptions.TRACE_JSPTAGINTROSPECTOR) - { - JSFCoreTraceOptions.log(String.format( - "TagAnalyzer.getJSFComponentTagType: tag type is %s", - tagType != null ? tagType.toString() : "null")); - } - return tagType; - } - - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/messages.properties b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/messages.properties deleted file mode 100644 index 15bf8c5b3..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/messages.properties +++ /dev/null @@ -1 +0,0 @@ -UnresolvedJSPTagResolvingStrategy_1=Unresolved Tag Resolver diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/persistence/MasterIndex.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/persistence/MasterIndex.java deleted file mode 100644 index d9856995c..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/persistence/MasterIndex.java +++ /dev/null @@ -1,442 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.model.jsp.persistence; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.Path; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.core.internal.JSFCoreTraceOptions; -import org.osgi.framework.Version; - -/** - * The definitive index of what projects are indexed for JSP tag registry - * persistence. - * - * @author cbateman - * - */ -class MasterIndex implements Serializable -{ - public final static SerializableVersion CURRENT_VERSION = new SerializableVersion( - 1, 0, 0); - - /** - * - */ - private static final long serialVersionUID = -2725662604972649316L; - - private final transient String _repositoryPath; - private final transient File _storageFile; - - private IndexHeader _header; - private List<ProjectIndex> _projectIndices; - - public MasterIndex(final File storageFile, final String repositoryPath) - { - _storageFile = storageFile; - _repositoryPath = repositoryPath; - } - - public synchronized void create(final SerializableVersion version) - throws IOException - { - if (JSFCoreTraceOptions.TRACE_JSPTAGPERSISTENCE) - { - JSFCoreTraceOptions.log("MasterIndex.create, version=:" - + version.toString()); - } - - _header = new IndexHeader(version); - _projectIndices = new ArrayList<ProjectIndex>(); - - save(_storageFile); - } - - public synchronized void save(final File file) throws IOException - { - FileOutputStream out = null; - - try - { - if (JSFCoreTraceOptions.TRACE_JSPTAGPERSISTENCE) - { - JSFCoreTraceOptions.log("Trying to save master index file: " - + file.getAbsolutePath()); - } - - out = new FileOutputStream(file); - final ObjectOutputStream objStream = new ObjectOutputStream(out); - objStream.writeObject(this); - - if (JSFCoreTraceOptions.TRACE_JSPTAGPERSISTENCE) - { - JSFCoreTraceOptions - .log("Master index file written successfully: " - + file.getAbsolutePath()); - } - } - finally - { - if (out != null) - { - out.close(); - } - } - } - - public synchronized void load(final SerializableVersion expectedVersion) - throws IOException, ClassNotFoundException - { - FileInputStream in = null; - - try - { - if (JSFCoreTraceOptions.TRACE_JSPTAGPERSISTENCE) - { - JSFCoreTraceOptions.log("Trying to load master index file: " - + _storageFile.getAbsolutePath()); - } - - in = new FileInputStream(_storageFile); - final ObjectInputStream objStream = new ObjectInputStream(in); - MasterIndex index = (MasterIndex) objStream.readObject(); - _header = index._header; - _projectIndices = index._projectIndices; - - if (JSFCoreTraceOptions.TRACE_JSPTAGPERSISTENCE) - { - JSFCoreTraceOptions - .log("Loaded master index file successfully:" - + _storageFile.getAbsolutePath()); - JSFCoreTraceOptions.log("Initial contents: "); - System.out.println(index.toString()); - } - } - finally - { - if (in != null) - { - in.close(); - } - } - } - - public synchronized String toString() - { - StringBuffer buffer = new StringBuffer(); - - buffer.append(String.format("Header: %s\n\n", _header.toString())); - - for (final ProjectIndex projIndex : _projectIndices) - { - buffer.append(String.format("\t%s\n", projIndex.toString())); - } - - return buffer.toString(); - } - - public synchronized ProjectIndex getProjectIndex(final IProject project) - { - ProjectIndex index = findIndex(project); - - if (index != null) - { - return index; - } - - // otherwise, create. - index = new ProjectIndex(0, project.getName(), _repositoryPath); - index.create(); - _projectIndices.add(index); - try - { - save(_storageFile); - } - catch (IOException ioe) - { - JSFCorePlugin.log(ioe, - "Failed to save master index. Project Index for " - + project.toString() + " may not be saved"); - } - return index; - } - - public synchronized void removeProjectIndex(final IProject project) throws IOException - { - final ProjectIndex index = findIndex(project); - if (index != null) - { - _projectIndices.remove(index); - if (!index.remove()) - { - throw new IOException("Failed to remove index file"); - } - } - } - - private ProjectIndex findIndex(final IProject project) - { - // check if the project already exists - for (final ProjectIndex index : _projectIndices) - { - if (index.getProjectName().equals(project.getName())) - { - return index; - } - } - return null; - } - - private void writeObject(final java.io.ObjectOutputStream out) - throws IOException - { - out.writeObject(_header); - out.writeObject(_projectIndices); - } - - private void readObject(final java.io.ObjectInputStream in) - throws IOException, ClassNotFoundException - { - _header = (IndexHeader) in.readObject(); - _projectIndices = (List<ProjectIndex>) in.readObject(); - } - - private class IndexHeader implements Serializable - { - /** - * serializable - */ - private static final long serialVersionUID = 40851054201507727L; - - private final SerializableVersion _version; - private long _lastModifiedStamp; - - public IndexHeader(final SerializableVersion version) - { - _version = version; - _lastModifiedStamp = 0; - } - - protected final Version getVersion() - { - return _version.getVersion(); - } - - protected final synchronized long modified() - { - return _lastModifiedStamp++; - } - - protected final synchronized long getLastModifiedStamp() - { - return _lastModifiedStamp; - } - - public String toString() - { - return "Version: " + _version.toString(); - } - } - - static class SerializableVersion implements Serializable - { - private Version _version; - /** - * - */ - private static final long serialVersionUID = 5973410328814890568L; - - public SerializableVersion(final int major, final int minor, - final int micro) - { - _version = new Version(major, minor, micro); - } - - public SerializableVersion(final String versionString) - { - _version = new Version(versionString); - } - - public Version getVersion() - { - return _version; - } - - public String toString() - { - return _version.toString(); - } - - private void writeObject(ObjectOutputStream out) throws IOException - { - out.writeObject(_version.toString()); - } - - private void readObject(ObjectInputStream in) throws IOException, - ClassNotFoundException - { - final String versionString = (String) in.readObject(); - _version = new Version(versionString); - } - } - - static class ProjectIndex implements Serializable - { - /** - * - */ - private static final long serialVersionUID = 2864798175910805380L; - - private final String _projectName; - private final String _relativePath; - private final long _lastModStampOnProject; - private File _file; - - /** - * @param lastModStampOnProject - * @param projectName - * @param relativePath - */ - public ProjectIndex(final long lastModStampOnProject, - final String projectName, final String relativePath) - { - super(); - _lastModStampOnProject = lastModStampOnProject; - _projectName = projectName; - _relativePath = relativePath; - } - - public boolean remove() - { - return _file.delete(); - } - - public synchronized void create() - { - final long uniqueCode = Math - .round((Math.random() * Integer.MAX_VALUE)); - final String fileName = String.format("Project_%s_%x.idx", - _projectName, Long.valueOf(uniqueCode)); - _file = new File(new Path(_relativePath).append(fileName) - .toOSString()); - } - - public synchronized Map<String, SerializableTLDNamespace> getNamespaces() - throws IOException, ClassNotFoundException - { - FileInputStream in = null; - - try - { - in = new FileInputStream(_file); - final ObjectInputStream objStream = new ObjectInputStream(in); - final Map<String, SerializableTLDNamespace> namespaces = (Map<String, SerializableTLDNamespace>) objStream - .readObject(); - return namespaces; - } - catch (FileNotFoundException nfe) - { - return new HashMap<String, SerializableTLDNamespace>(); - } - finally - { - if (in != null) - { - in.close(); - } - } - } - - public synchronized void save( - final Map<String, SerializableTLDNamespace> namespaces) - throws IOException - { - FileOutputStream out = null; - - try - { - out = new FileOutputStream(_file); - final ObjectOutputStream objStream = new ObjectOutputStream(out); - objStream.writeObject(namespaces); - } - finally - { - if (out != null) - { - out.close(); - } - } - } - - public String toString() - { - return "project= " + _projectName + ", relativePath=" - + _relativePath + ", lastModified=" - + _lastModStampOnProject + ", saveFile=" + _file; - } - - // public synchronized void save() - // { - // if (_file != null) - // { - // doSave(); - // } - // throw new NullPointerException("_file is null"); - // } - // - // private void doSave() throws IOException - // { - // FileOutputStream out = null; - // - // try - // { - // out = new FileOutputStream(_file); - // final ObjectOutputStream objStream = new ObjectOutputStream(out); - // objStream.writeObject(this); - // } - // finally - // { - // if (out != null) - // { - // out.close(); - // } - // } - // } - - protected final String getProjectName() - { - return _projectName; - } - - protected final String getRelativePath() - { - return _relativePath; - } - - protected final long getLastModStampOnProject() - { - return _lastModStampOnProject; - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/persistence/PersistedDataTagStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/persistence/PersistedDataTagStrategy.java deleted file mode 100644 index 6c95f0274..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/persistence/PersistedDataTagStrategy.java +++ /dev/null @@ -1,257 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.model.jsp.persistence; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.atomic.AtomicBoolean; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagElement; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.core.internal.JSFCoreTraceOptions; -import org.eclipse.jst.jsf.designtime.internal.Messages; -import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.JSPTagResolvingStrategy; -import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.TLDNamespace; -import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.TLDTagElement; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDDocument; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDElementDeclaration; -import org.eclipse.wst.xml.core.internal.contentmodel.CMDocument; - -/** - * @author cbateman - * - */ -public class PersistedDataTagStrategy extends JSPTagResolvingStrategy -{ - /** - * the identifier of this strategy - */ - public final static String ID = "org.eclipse.jst.jsf.designtime.PersistedDataTagStrategy"; //$NON-NLS-1$ - /** - * the display name - */ - public final static String DISPLAY_NAME = Messages.PersistedDataTagStrategy_DisplayName; - - private final IProject _project; - private final TagRepository _repository; - private Map<String, SerializableTLDNamespace> _namespaces; - private final transient AtomicBoolean _reentrancyFlag = new AtomicBoolean( - false); - - /** - * @return the descriptor for this resolver strategy - */ - public static StrategyDescriptor createDescriptor() - { - return new StrategyDescriptor(ID, DISPLAY_NAME); - } - - /** - * @param project - */ - public PersistedDataTagStrategy(final IProject project) - { - _project = project; - _repository = new TagRepository(_project); - } - - /** - * - */ - public void init() - { - if (JSFCoreTraceOptions.TRACE_JSPTAGPERSISTENCE) - { - JSFCoreTraceOptions - .log("Initializing PersistedDataTagStrategy for project: " //$NON-NLS-1$ - + _project.toString()); - } - try - { - _namespaces = _repository.load(); - return; - } - catch (final IOException e) - { - JSFCorePlugin - .log(e, - "JSP tag registry cached failed to load. Strategy will not be used"); //$NON-NLS-1$ - } - catch (final ClassNotFoundException e) - { - JSFCorePlugin - .log(e, - "JSP tag registry cached failed to load. Strategy will not be used"); //$NON-NLS-1$ - } - _namespaces = new HashMap<String, SerializableTLDNamespace>(); - } - - /** - * @param namespace - * @throws ClassNotFoundException - * @throws IOException - */ - public void save(final Map<String, TLDNamespace> namespace) - throws IOException, ClassNotFoundException - { - if (JSFCoreTraceOptions.TRACE_JSPTAGPERSISTENCE) - { - JSFCoreTraceOptions - .log("Saving PersistedDataTagStrategy for project: " //$NON-NLS-1$ - + _project.toString()); - } - - // namespace is considered authoritative for every key it contains - // so copy them all in. However, preserve anything in our own namespace - // map not found in namespace - for (final Map.Entry<String, TLDNamespace> namespaceEntry : namespace - .entrySet()) - { - final TLDNamespace ns = namespaceEntry.getValue(); - final String nsName = namespaceEntry.getKey(); - final SerializableTLDNamespace myNs = _namespaces.get(nsName); - - if (myNs == null) - { - if (JSFCoreTraceOptions.TRACE_JSPTAGPERSISTENCE) - { - JSFCoreTraceOptions.log(String.format( - "Adding namespace %s for project", ns.getNSUri(), //$NON-NLS-1$ - _project.toString())); - } - - _namespaces.put(nsName, new SerializableTLDNamespace(ns)); - } - else - { - if (JSFCoreTraceOptions.TRACE_JSPTAGPERSISTENCE) - { - JSFCoreTraceOptions.log(String.format( - "Updating namespace %s for project", ns.getNSUri(), //$NON-NLS-1$ - _project.toString())); - } - - for (final Map.Entry<String, ITagElement> elementEntry : ns - .getCurrentElements().entrySet()) - { - if (JSFCoreTraceOptions.TRACE_JSPTAGPERSISTENCE) - { - JSFCoreTraceOptions.log(String.format( - "Putting element %s", elementEntry.getKey())); //$NON-NLS-1$ - } - myNs.put(elementEntry.getKey(), elementEntry.getValue()); - } - } - } - - _repository.save(_namespaces); - } - - @Override - public ITagElement resolve(final TLDElementDeclaration element) - { - if (JSFCoreTraceOptions.TRACE_JSPTAGPERSISTENCE) - { - JSFCoreTraceOptions.log(String.format( - "Attempting to resolve element %s for project %s", element //$NON-NLS-1$ - .getElementName(), _project)); - } - - try - { - if (!_reentrancyFlag.compareAndSet(false, true)) - { - throw new IllegalStateException("Reentrant call to resolve"); //$NON-NLS-1$ - } - - final String uri = getUri(element); - final String tagName = element.getElementName(); - - if (uri != null && tagName != null) - { - final SerializableTLDNamespace ns = _namespaces.get(uri); - - if (ns != null) - { - final ITagElement tagElement = ns.getViewElement(tagName); - - if (tagElement instanceof TLDTagElement) - { - if (JSFCoreTraceOptions.TRACE_JSPTAGPERSISTENCE) - { - JSFCoreTraceOptions.log(String.format( - "Resolved element %s for project %s", //$NON-NLS-1$ - element.getElementName(), _project)); - } - return tagElement; - } - } - } - return getNotFoundIndicator(); - } - finally - { - _reentrancyFlag.set(false); - } - } - - /** - * Clears all cached data and removes it permanently from disk. - */ - public void clear() - { - if (JSFCoreTraceOptions.TRACE_JSPTAGPERSISTENCE) - { - JSFCoreTraceOptions.log(String.format( - "Flushing all data for project %s", _project)); //$NON-NLS-1$ - } - - try - { - _repository.clearAll(); - } - catch (IOException e) - { - JSFCorePlugin.log(e, "Failure during cache flushing on project: " //$NON-NLS-1$ - + _project); - } - catch (ClassNotFoundException e) - { - JSFCorePlugin.log(e, "Failure during cache flushing on project: " //$NON-NLS-1$ - + _project); - } - _namespaces.clear(); - } - - public String getDisplayName() - { - return DISPLAY_NAME; - } - - private static String getUri(final TLDElementDeclaration element) - { - final CMDocument owner = element.getOwnerDocument(); - - if (owner instanceof TLDDocument) - { - return ((TLDDocument) owner).getUri(); - } - return null; - } - - @Override - public String getId() - { - return ID; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/persistence/SerializableTLDNamespace.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/persistence/SerializableTLDNamespace.java deleted file mode 100644 index b40878a8f..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/persistence/SerializableTLDNamespace.java +++ /dev/null @@ -1,159 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.model.jsp.persistence; - -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagElement; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.Namespace; -import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.TLDNamespace; -import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.TLDNamespace.TLDNamespaceData; - -/** - * A serializable tld namespace. This is distinct from TLDNamespace in that it - * takes a snapshot of a TLDNamespace at a point in time. Any elements not - * lazily resolved by the TLDNamespace will not be resolved by this namespace. - * - */ -public class SerializableTLDNamespace extends Namespace -{ - private final SerializedNamespaceData _data; - - /** - * @param namespace - */ - public SerializableTLDNamespace(final TLDNamespace namespace) - { - _data = new SerializedNamespaceData(namespace.getDisplayName(), - namespace.getCurrentElements(), namespace.getNSUri()); - } - - /** - * - */ - private static final long serialVersionUID = 5364814479459691353L; - - @Override - public String getDisplayName() - { - return _data.getDisplayName(); - } - - @Override - public String getNSUri() - { - return _data.getUri(); - } - - @Override - public ITagElement getViewElement(String name) - { - return _data.getViewElement(name); - } - - @Override - public Collection<? extends ITagElement> getViewElements() - { - return Collections.unmodifiableCollection(_data.getAllViewElements() - .values()); - } - - @Override - public boolean hasViewElements() - { - return _data.getNumTags() > 0; - } - - @Override - public boolean isInitialized() - { - return _data.isInitialized(); - } - - /* package */void put(final String name, final ITagElement tagElement) - { - _data._tags.put(name, tagElement); - } - - private static class SerializedNamespaceData extends TLDNamespaceData - { - /** - * serializable id - */ - private static final long serialVersionUID = -6723194339788215607L; - private final String _displayName; - private final String _uri; - private final Map<String, ITagElement> _tags; - - /** - * @param displayName - * @param tags - * @param uri - */ - private SerializedNamespaceData(String displayName, - Map<String, ITagElement> tags, String uri) - { - super(); - _displayName = displayName; - _tags = new HashMap<String, ITagElement>(); - for (final Map.Entry<String, ITagElement> tagEntry : tags.entrySet()) - { - _tags.put(tagEntry.getKey(), tagEntry.getValue()); - } - _uri = uri; - } - - @Override - public String getDisplayName() - { - return _displayName; - } - - @Override - public int getNumTags() - { - return _tags.size(); - } - - @Override - public ITagElement getViewElement(String name) - { - return _tags.get(name); - } - - @Override - public String getUri() - { - return _uri; - } - - @Override - public Map<String, ITagElement> getAllViewElements() - { - return _tags; - } - - @Override - public boolean isInitialized() - { - return true; - } - - @Override - public Map<String, ITagElement> getCurrentElements() - { - return _tags; - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/persistence/TagRepository.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/persistence/TagRepository.java deleted file mode 100644 index df457f820..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/persistence/TagRepository.java +++ /dev/null @@ -1,166 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -/** - * - */ -package org.eclipse.jst.jsf.designtime.internal.view.model.jsp.persistence; - -import java.io.File; -import java.io.IOException; -import java.util.Map; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagElement; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.core.internal.JSFCoreTraceOptions; -import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.persistence.MasterIndex.ProjectIndex; -import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.persistence.MasterIndex.SerializableVersion; - -class TagRepository -{ - private final static Object GLOBAL_MASTER_INDEX_LOCK = new Object(); - private static MasterIndex GLOBAL_MASTER_INDEX; - private final static String PATH_TO_REPOSITORY = "/.jsptagregistry"; - private final static String MASTER_INDEX_FILE_NAME = "tagRegistryMasterIndex.idx"; - - private final IProject _project; - //private Map<String, SerializableTLDNamespace> _namespaces; - - public TagRepository(final IProject project) - { - _project = project; - } - - public Map<String, SerializableTLDNamespace> load() throws IOException, - ClassNotFoundException - { - if (JSFCoreTraceOptions.TRACE_JSPTAGPERSISTENCE) - { - JSFCoreTraceOptions.log("Loading tag repository for: " - + _project.toString()); - } - - final MasterIndex index = getOrCreateMasterIndex(); - - final ProjectIndex projIndex = index.getProjectIndex(_project); - final Map<String, SerializableTLDNamespace> namespaces = projIndex.getNamespaces(); - - if (JSFCoreTraceOptions.TRACE_JSPTAGPERSISTENCE) - { - JSFCoreTraceOptions.log("Contents of repo for: " - + _project.toString()); - - for (final Map.Entry<String, SerializableTLDNamespace> nsEntry : namespaces.entrySet()) - { - JSFCoreTraceOptions.log("\tNamespace: "+nsEntry.getKey()); - - SerializableTLDNamespace ns = nsEntry.getValue(); - for (final ITagElement element : ns.getViewElements()) - { - JSFCoreTraceOptions.log("\t\tTag: "+element.toString()); - } - } - } - - return namespaces; - } - - public void save(Map<String, SerializableTLDNamespace> namespaces) throws IOException, - ClassNotFoundException - { - final MasterIndex index = getOrCreateMasterIndex(); - final ProjectIndex projectIndex = index.getProjectIndex(_project); - projectIndex.save(namespaces); - } - - public void clearAll() throws IOException, ClassNotFoundException - { - final MasterIndex index = getOrCreateMasterIndex(); - index.removeProjectIndex(_project); - } - - private MasterIndex getOrCreateMasterIndex() throws IOException, - ClassNotFoundException - { - final IPath wkspacePath = JSFCorePlugin.getDefault().getStateLocation(); - final IPath repoPath = wkspacePath.append(PATH_TO_REPOSITORY); - final File repoDir = new File(repoPath.toOSString()); - - synchronized (GLOBAL_MASTER_INDEX_LOCK) - { - if (GLOBAL_MASTER_INDEX != null) - { - if (JSFCoreTraceOptions.TRACE_JSPTAGPERSISTENCE) - { - JSFCoreTraceOptions - .log("GLOBAL_MASTER_INDEX already exists for: " - + _project.toString()); - } - return GLOBAL_MASTER_INDEX; - } - - if (!repoDir.exists()) - { - createNewRepo(repoDir); - } - - final File masterIndexFile = new File(new Path(repoDir - .getAbsolutePath()).append(MASTER_INDEX_FILE_NAME) - .toOSString()); - final MasterIndex index = new MasterIndex(masterIndexFile, repoDir.getAbsolutePath()); - - if (!masterIndexFile.exists()) - { - if (!masterIndexFile.createNewFile()) - { - throw new IOException( - "Could not create new master index file: " - + masterIndexFile.toString()); - } - if (JSFCoreTraceOptions.TRACE_JSPTAGPERSISTENCE) - { - JSFCoreTraceOptions.log("Creating master index file for " - + _project.toString()); - } - index.create(new SerializableVersion(1, 0, 0)); - } - else - { - if (JSFCoreTraceOptions.TRACE_JSPTAGPERSISTENCE) - { - JSFCoreTraceOptions.log("Loading master index file for " - + _project.toString()); - } - index.load(new SerializableVersion(1, 0, 0)); - } - - GLOBAL_MASTER_INDEX = index; - return index; - } - } - - private static void createNewRepo(final File repoDir) throws IOException - { - if (JSFCoreTraceOptions.TRACE_JSPTAGPERSISTENCE) - { - JSFCoreTraceOptions.log("Creating repo directory: " - + repoDir.getAbsolutePath()); - } - - if (!repoDir.mkdir()) - { - throw new IOException("Failed to create repo directory: " - + repoDir.getAbsolutePath()); - } - } -}
\ No newline at end of file diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/registry/LibraryOperation.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/registry/LibraryOperation.java deleted file mode 100644 index 31cfeb078..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/registry/LibraryOperation.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -/** - * - */ -package org.eclipse.jst.jsf.designtime.internal.view.model.jsp.registry; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsp.core.taglib.ITaglibRecord; - -abstract class LibraryOperation implements Runnable -{ - protected final ITaglibRecord _changeRecord; - private IStatus _result; - - protected LibraryOperation(final ITaglibRecord changeRecord) - { - _changeRecord = changeRecord; - } - - public final void run() - { - try - { - _result = doRun(); - } - catch (final Exception e) - { - _result = new Status(IStatus.ERROR, JSFCorePlugin.PLUGIN_ID, - "Problem during run", e); - } - } - - public IStatus getResult() - { - return _result; - } - - protected abstract IStatus doRun(); -}
\ No newline at end of file diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/registry/LibraryOperationFactory.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/registry/LibraryOperationFactory.java deleted file mode 100644 index 70f5d3f51..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/registry/LibraryOperationFactory.java +++ /dev/null @@ -1,122 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.model.jsp.registry; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jst.jsp.core.taglib.ITaglibRecord; - -class LibraryOperationFactory -{ - private final TLDTagRegistry _tagRegistry; - - public LibraryOperationFactory(final TLDTagRegistry tagRegistry) - { - _tagRegistry = tagRegistry; - } - - LibraryOperation createAddOperation(final ITaglibRecord changeRecord) - { - return new AddTagLibrary(_tagRegistry, changeRecord); - } - - LibraryOperation createRemoveOperation(final ITaglibRecord changeRecord) - { - return new RemoveTagLibrary(_tagRegistry, changeRecord); - } - - LibraryOperation createChangeOperation(final ITaglibRecord changeRecord) - { - if (changeRecord == null) - { - throw new IllegalArgumentException(); - } - return new ChangeTagLibrary(_tagRegistry, changeRecord); - } - - private static class AddTagLibrary extends LibraryOperation - { - private final TLDTagRegistry _tagRegistry; - - public AddTagLibrary(final TLDTagRegistry tagRegistry, - final ITaglibRecord newRecord) - { - super(newRecord); - _tagRegistry = tagRegistry; - } - - @Override - protected IStatus doRun() - { - synchronized (_tagRegistry) - { - // fire change event if applicable - _tagRegistry.initialize(_changeRecord, true); - return Status.OK_STATUS; - } - } - } - - private static class RemoveTagLibrary extends LibraryOperation - { - private final TLDTagRegistry _tagRegistry; - - protected RemoveTagLibrary(final TLDTagRegistry tagRegistry, - final ITaglibRecord changeRecord) - { - super(changeRecord); - _tagRegistry = tagRegistry; - } - - @Override - protected IStatus doRun() - { - _tagRegistry.remove(_changeRecord); - return Status.OK_STATUS; - - } - - } - - private static class ChangeTagLibrary extends LibraryOperation - { - private final TLDTagRegistry _tagRegistry; - - protected ChangeTagLibrary(final TLDTagRegistry tagRegistry, - final ITaglibRecord changeRecord) - { - super(changeRecord); - _tagRegistry = tagRegistry; - } - - @Override - protected IStatus doRun() - { - IStatus result = null; - - synchronized (_tagRegistry) - { - result = new RemoveTagLibrary(_tagRegistry, _changeRecord).doRun(); - - if (result.getSeverity() != IStatus.ERROR - && result.getSeverity() != IStatus.CANCEL) - { - result = new AddTagLibrary(_tagRegistry, _changeRecord) - .doRun(); - } - } - - return result; - } - - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/registry/TLDRegistryManager.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/registry/TLDRegistryManager.java deleted file mode 100644 index 9b1374543..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/registry/TLDRegistryManager.java +++ /dev/null @@ -1,216 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.model.jsp.registry; - -import java.util.Collection; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.ISaveContext; -import org.eclipse.core.resources.ISaveParticipant; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jst.jsf.common.internal.resource.ResourceSingletonObjectManager; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.core.internal.JSFCoreTraceOptions; -import org.eclipse.jst.jsf.designtime.internal.view.model.ITagRegistry; -import org.eclipse.jst.jsf.designtime.internal.view.model.TagRegistryFactory; - -/** - * A per-resource singleton manager for TLDTagRegistry's. - * - * @author cbateman - * - */ -public final class TLDRegistryManager extends - ResourceSingletonObjectManager<TLDTagRegistry, IProject> -{ - // STATIC - private static TLDRegistryManager INSTANCE; - - /** - * @return the singleton instance - */ - private static TLDRegistryManager getGlobalManager() - { - synchronized (TLDRegistryManager.class) - { - if (INSTANCE == null) - { - if (JSFCoreTraceOptions.TRACE_TLDREGISTRYMANAGER) - { - JSFCoreTraceOptions - .log("TLDRegistryManager: Initializing TLDRegistryManager singleton"); - } - INSTANCE = new TLDRegistryManager(); - } - - return INSTANCE; - } - } - - private TLDRegistryManager() - { - final ISaveParticipant participant = new MyWorkspaceSaveParticipant(); - - try - { - ResourcesPlugin.getWorkspace().addSaveParticipant(JSFCorePlugin.getDefault() - , participant); - } - catch (CoreException e) - { - JSFCorePlugin.log(e, "TLDRegistryManager failed to install save participant"); - } - } - - @Override - protected TLDTagRegistry createNewInstance(final IProject project) - { - if (JSFCoreTraceOptions.TRACE_TLDREGISTRYMANAGER) - { - JSFCoreTraceOptions - .log("TLDRegistryManager: creating new instance for " - + project.toString()); - } - - return new TLDTagRegistry(project); - } - - @Override - protected void runAfterGetInstance(final IProject resource) - { - if (JSFCoreTraceOptions.TRACE_TLDREGISTRYMANAGER) - { - JSFCoreTraceOptions - .log("TLDRegistryManager: Acquired instance for " - + resource.toString()); - } - } - - @Override - protected void runBeforeGetInstance(final IProject resource) - { - if (JSFCoreTraceOptions.TRACE_TLDREGISTRYMANAGER) - { - JSFCoreTraceOptions.log("TLDRegistryManager: Getting registry for " - + resource.toString()); - } - } - - /** - * Adapter used to allow creation by extension point. - * - * @author cbateman - * - */ - public static class MyRegistryFactory extends TagRegistryFactory - { - @Override - public ITagRegistry createTagRegistry(IProject project) - throws TagRegistryFactoryException - { - try - { - return getGlobalManager().getInstance(project); - } - catch (ManagedObjectException e) - { - throw new TagRegistryFactoryException(e); - } - } - - @Override - public boolean isInstance(IProject project) - { - return getGlobalManager().isInstance(project); - } - - public String getDisplayName() - { - return "JSP Registry Factory"; - } - } - - private class MyWorkspaceSaveParticipant implements ISaveParticipant - { - public void saving(ISaveContext context) throws CoreException - { - if (JSFCoreTraceOptions.TRACE_TLDREGISTRYMANAGER) - { - JSFCoreTraceOptions.log("MyWorkspaceSaveParticipant.saving: Kind="+context.getKind()); - } - try - { - if (context.getKind() == ISaveContext.FULL_SAVE) - { - final Collection<IProject> projects = TLDRegistryManager.this - .getManagedResources(); - - for (final IProject project : projects) - { - saveProject(project); - } - } - else if (context.getKind() == ISaveContext.PROJECT_SAVE) - { - saveProject(context.getProject()); - } - - } - catch (ManagedObjectException moe) - { - throw new CoreException(new Status(IStatus.ERROR, - JSFCorePlugin.PLUGIN_ID, "Couldn't commit workspace", - moe)); - } - } - - private void saveProject(final IProject project) - throws ManagedObjectException - { - if (JSFCoreTraceOptions.TRACE_TLDREGISTRYMANAGER) - { - JSFCoreTraceOptions.log("MyWorkspaceSaveParticipant.saveProject: Project="+project.toString()); - } - - // check that there is already instance -- don't do anything if there - // isn't already an instance for project. - if (TLDRegistryManager.this.isInstance(project)) - { - final TLDTagRegistry registry = TLDRegistryManager.this - .getInstance(project); - if (JSFCoreTraceOptions.TRACE_TLDREGISTRYMANAGER) - { - JSFCoreTraceOptions.log("MyWorkspaceSaveParticipant.saveProject: calling checkpoint on registry: "+registry.toString()); - } - - registry.checkpoint(); - } - } - - public void doneSaving(ISaveContext context) - { - // nothing to do - } - - public void prepareToSave(ISaveContext context) throws CoreException - { - // nothing to do - } - - public void rollback(ISaveContext context) - { - // nothing to do - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/registry/TLDRegistryPreferences.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/registry/TLDRegistryPreferences.java deleted file mode 100644 index 30d004f63..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/registry/TLDRegistryPreferences.java +++ /dev/null @@ -1,391 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.model.jsp.registry; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.CopyOnWriteArrayList; -import java.util.concurrent.atomic.AtomicBoolean; - -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jface.util.IPropertyChangeListener; -import org.eclipse.jface.util.PropertyChangeEvent; -import org.eclipse.jst.jsf.common.internal.policy.OrderedListProvider; -import org.eclipse.jst.jsf.common.internal.policy.OrderedListProvider.OrderableObject; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.DefaultJSPTagResolver; -import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.TagIntrospectingStrategy; -import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.JSPTagResolvingStrategy.StrategyDescriptor; -import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.persistence.PersistedDataTagStrategy; - -/** - * Preferences model for the TLD registry. This class is not thread-safe and - * a single instance should only be used by one owner. - * - * @author cbateman - * - */ -public class TLDRegistryPreferences -{ - private final static Map<String, StrategyDescriptor> ALL_KNOWN_STRATEGIES; - - private final IPreferenceStore _prefStore; - private final CopyOnWriteArrayList<PropertyListener> _listeners; - private final AtomicBoolean _isDisposed = new AtomicBoolean(false); - - private final static String KEY_STRATEGY_ID_ORDER = "org.eclipse.jst.jsf.designtime.jsp.registry.StrategyIDOrder"; - - private final static List<OrderableObject> DEFAULT_STRATEGY_ORDER; - - static - { - final List<OrderableObject> list = new ArrayList<OrderableObject>(); - - // NOTE !!! this ordering is important and effects the default order - // in which strategies will be consulted !!! - list.add(new OrderableObject(new StrategyIdentifier(PersistedDataTagStrategy.createDescriptor()), true)); - list.add(new OrderableObject(new StrategyIdentifier(DefaultJSPTagResolver.createDescriptor()), true)); - list.add(new OrderableObject(new StrategyIdentifier(TagIntrospectingStrategy.createDescriptor()), true)); - DEFAULT_STRATEGY_ORDER = Collections.unmodifiableList(list); - - - final Map<String, StrategyDescriptor> knownDescriptors = new HashMap<String, StrategyDescriptor>(); - for (final OrderableObject object : DEFAULT_STRATEGY_ORDER) - { - StrategyIdentifier strategyId = (StrategyIdentifier) object.getObject(); - knownDescriptors.put(strategyId.getId(), strategyId._descriptor); - } - ALL_KNOWN_STRATEGIES = Collections.unmodifiableMap(knownDescriptors); - } - - private List<OrderableObject> _ids; - private List<OrderableObject> _originalIds; - private IPropertyChangeListener _propertyListener; - - /** - * Constructor - * - * @param prefStore - */ - public TLDRegistryPreferences(final IPreferenceStore prefStore) - { - _prefStore = prefStore; - _ids = new ArrayList<OrderableObject>(); - _listeners = new CopyOnWriteArrayList<PropertyListener>(); - } - - /** - * Dispose of this preferences object - */ - public void dispose() - { - if (_isDisposed.compareAndSet(false, true)) - { - if (_propertyListener != null) - { - _prefStore.removePropertyChangeListener(_propertyListener); - } - } - } - - void addListener(final PropertyListener propListener) - { - if (!assertNotDisposed()) - { - return; - } - - if (_propertyListener == null) - { - _propertyListener = new IPropertyChangeListener() - { - public void propertyChange(PropertyChangeEvent event) - { - if (KEY_STRATEGY_ID_ORDER.equals(event.getProperty())) - { - fireStrategyOrderChanged(); - } - } - }; - - _prefStore.addPropertyChangeListener(_propertyListener); - } - _listeners.addIfAbsent(propListener); - } - - void removeListener(final PropertyListener propListener) - { - if (!assertNotDisposed()) - { - return; - } - _listeners.remove(propListener); - - if (_listeners.isEmpty()) - { - _prefStore.removePropertyChangeListener(_propertyListener); - _propertyListener = null; - } - } - - private void fireStrategyOrderChanged() - { - if (!assertNotDisposed()) - { - return; - } - for (final PropertyListener listener : _listeners) - { - listener.strategyOrderChanged(); - } - } - - /** - * @return false if the assertion fails - */ - private boolean assertNotDisposed() - { - if (_isDisposed.get()) - { - JSFCorePlugin.log(new Exception("Stack trace only"), "TLDRegistryPreferences is disposed"); - return false; - } - return true; - } - - /** - * IPreferenceStore The default preference loader - */ - public void load() - { - load(_prefStore); - } - - /** - * @return the ordered list provider for the strategy id ordering - */ - public OrderedListProvider getOrderedListProvider() - { - return new MyOrderedListProvider(); - } - - /** - * @return the strategy id ordering - */ - public List<OrderableObject> getStrategyIdOrdering() - { - return _ids; - } - - /** - * @param ids - */ - public void setStrategyIdOrdering(final List<OrderableObject> ids) - { - _ids = ids; - } - - /** - * @return the list of strategy ids in the order they should be consulted - */ - public List<String> getEnabledIds() - { - final List<String> strategies = new ArrayList<String>(); - - for (final OrderableObject id : _ids) - { - if (id.isEnabled()) - { - StrategyIdentifier strategyId = (StrategyIdentifier) id.getObject(); - strategies.add(strategyId.getId()); - } - } - return strategies; - } - - /** - * Loads preferences from prefStore - * - * @param prefStore - */ - private void load(final IPreferenceStore prefStore) - { - if (!prefStore.contains(KEY_STRATEGY_ID_ORDER)) - { - prefStore.setDefault(KEY_STRATEGY_ID_ORDER, - serialize(DEFAULT_STRATEGY_ORDER)); - } - List<OrderableObject> ids = deserialize(prefStore - .getString(KEY_STRATEGY_ID_ORDER)); - if (ids == null) - { - ids = deserialize(serialize(DEFAULT_STRATEGY_ORDER)); - } - _ids = ids; - final List<OrderableObject> originalList = new ArrayList<OrderableObject>(); - for (final OrderableObject id : _ids) - { - final OrderableObject copy = id.clone(); - originalList.add(copy); - } - _originalIds = Collections.unmodifiableList(originalList); - } - - private String serialize(final List<OrderableObject> ids) - { - final StringBuffer buffer = new StringBuffer(); - - for (final OrderableObject id : ids) - { - StrategyIdentifier strategyId = (StrategyIdentifier) id.getObject(); - buffer.append("dummyValue"); - buffer.append(","); - buffer.append(strategyId.getId()); - buffer.append(","); - buffer.append(id.isEnabled()); - buffer.append(","); - } - return buffer.toString(); - } - - private List<OrderableObject> deserialize(final String serializedList) - { - final List<OrderableObject> list = new ArrayList<OrderableObject>(); - final String[] ids = serializedList.split(","); - if ((ids.length % 3) != 0) - { - return null; - } - - for (int i = 0; i < ids.length; i += 3) - { - /// ingore the dummy value: final String displayName = ids[i]; - String id = ids[i + 1]; - final String enabled = ids[i + 2]; - - // fix old id for meta-data resolver - if ("org.eclipse.jst.jsf.THISISTEMPORARY".equals(id)) - { - id = DefaultJSPTagResolver.ID; - } - - final StrategyDescriptor desc = ALL_KNOWN_STRATEGIES.get(id); - - if (desc == null) - { - JSFCorePlugin.log(new Exception("Stack trace only"), "Error: unknown strategy id: "+id); - } - else - { - final StrategyIdentifier strategyIdentifier = new StrategyIdentifier(desc); - list.add(new OrderableObject(strategyIdentifier - , Boolean.valueOf(enabled).booleanValue())); - } - } - return list; - } - - /** - * Commits but does not store the preferences - * - * @param prefStore - */ - public void commit(final IPreferenceStore prefStore) - { - prefStore.setValue(KEY_STRATEGY_ID_ORDER, - serialize(getStrategyIdOrdering())); - // refresh local copy of preferences - load(); - } - - /** - * Reverts the model to it's defaults. Does not commit to pref store. - */ - public void setDefaults() - { - setStrategyIdOrdering(new ArrayList<OrderableObject>( - DEFAULT_STRATEGY_ORDER)); - } - - /** - * @return true if this preference object's properties have - * changed since load() was last called. - */ - public boolean isDirty() - { - // dirty if the current list is not equal to the original list - // generated at load time. - return !(_ids.equals(_originalIds)); - } - - /** - * Used as the model for sorting and enabling strategy identifiers. - * - */ - public static class StrategyIdentifier - { - private final StrategyDescriptor _descriptor; - - StrategyIdentifier(final StrategyDescriptor descriptor) - { - _descriptor = descriptor; - } - - /** - * @return the id - */ - public String getId() - { - return _descriptor.getId(); - } - - @Override - public boolean equals(Object obj) - { - if (obj instanceof StrategyIdentifier) - { - return getId().equals(((StrategyIdentifier)obj).getId()); - } - return false; - } - - @Override - public int hashCode() - { - return getId().hashCode(); - } - - /** - * @return the display name of the strategy - */ - public String getDisplayName() - { - return _descriptor.getDisplayName(); - } - } - - private class MyOrderedListProvider extends OrderedListProvider - { - @Override - protected List<OrderableObject> createAndPopulateOrderedObjects() - { - return _ids; - } - } - - static abstract class PropertyListener - { - public abstract void strategyOrderChanged(); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/registry/TLDTagRegistry.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/registry/TLDTagRegistry.java deleted file mode 100644 index 5e9bc685a..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/registry/TLDTagRegistry.java +++ /dev/null @@ -1,474 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.model.jsp.registry; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.ConcurrentLinkedQueue; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.MultiStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.jst.jsf.common.internal.managedobject.IManagedObject; -import org.eclipse.jst.jsf.common.internal.policy.IdentifierOrderedIteratorPolicy; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.Namespace; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.core.internal.JSFCoreTraceOptions; -import org.eclipse.jst.jsf.designtime.internal.view.model.AbstractTagRegistry; -import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.CompositeTagResolvingStrategy; -import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.DefaultJSPTagResolver; -import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.TLDNamespace; -import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.TagIntrospectingStrategy; -import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.UnresolvedJSPTagResolvingStrategy; -import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.persistence.PersistedDataTagStrategy; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.CMDocumentFactoryTLD; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDDocument; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDElementDeclaration; -import org.eclipse.jst.jsp.core.taglib.ITLDRecord; -import org.eclipse.jst.jsp.core.taglib.ITaglibRecord; -import org.eclipse.jst.jsp.core.taglib.TaglibIndex; - -/** - * Registry of all tld-defined tags for a particular project classpath - * - * @author cbateman - * - */ -public final class TLDTagRegistry extends AbstractTagRegistry implements - IManagedObject -{ - // INSTANCE - private final IProject _project; - private final Map<String, TLDNamespace> _nsResolved; - private final CompositeTagResolvingStrategy<TLDElementDeclaration> _resolver; - private boolean _hasBeenInitialized = false; - private final ConcurrentLinkedQueue<LibraryOperation> _changeOperations = new ConcurrentLinkedQueue<LibraryOperation>(); - private final Job _changeJob; - private final PersistedDataTagStrategy _persistedTagStrategy; - private TagIndexListener _tagIndexListener; - private final TLDRegistryPreferences _prefs; - private final MyPropertyListener _myPropertyListener; - - TLDTagRegistry(final IProject project) - { - _project = project; - _nsResolved = new HashMap<String, TLDNamespace>(); - - _prefs = new TLDRegistryPreferences(JSFCorePlugin.getDefault().getPreferenceStore()); - _myPropertyListener = new MyPropertyListener(); - _prefs.addListener(_myPropertyListener); - _prefs.load(); - final IdentifierOrderedIteratorPolicy<String> policy = - getTagResolvingPolicy(); - - _resolver = new CompositeTagResolvingStrategy<TLDElementDeclaration>( - policy); - - // add the strategies - _resolver.addStrategy(new TagIntrospectingStrategy(_project)); - _resolver.addStrategy(new DefaultJSPTagResolver(_project)); - // makes sure that a tag element will always be created for any - // given tag definition even if other methods fail - _resolver.addStrategy(new UnresolvedJSPTagResolvingStrategy()); - _persistedTagStrategy = new PersistedDataTagStrategy(_project); - _persistedTagStrategy.init(); - _resolver.addStrategy(_persistedTagStrategy); - - _changeJob = new ChangeJob(project.getName()); - } - - private IdentifierOrderedIteratorPolicy<String> getTagResolvingPolicy() - { - // strategy ordering - final List<String> prefOrdering = _prefs.getEnabledIds(); - final List<String> strategyOrdering = new ArrayList<String>(prefOrdering); - - // this strategy must always be here, always last - strategyOrdering.add(UnresolvedJSPTagResolvingStrategy.ID); - - final IdentifierOrderedIteratorPolicy<String> policy = new IdentifierOrderedIteratorPolicy<String>( - strategyOrdering); - // exclude things that are not explicitly listed in the policy. That - // way preference-based disablement will cause those strategies to - // be excluded. - policy.setExcludeNonExplicitValues(true); - return policy; - } - - protected final void doDispose() - { - if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY) - { - JSFCoreTraceOptions.log("TLDTagRegistry: Disposing for project " - + _project.toString()); - } - - // call checkpoint to flush serializable data - checkpoint(); - //_persistedTagStrategy.dispose(); - - _nsResolved.clear(); - _changeOperations.clear(); - - if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY) - { - JSFCoreTraceOptions - .log("TLDTagRegistry: Done disposing registry for " - + _project.toString()); - } - } - - @Override - protected void cleanupPersistentState() - { - // TODO - } - - public synchronized void checkpoint() - { - try - { - _persistedTagStrategy.save(_nsResolved); - } - catch (IOException e) - { - JSFCorePlugin.log(e, "Checkpointing JSP tags failed"); - } - catch (ClassNotFoundException e) - { - JSFCorePlugin.log(e, "Checkpointing JSP tags failed"); - } - } - - @Override - protected Job getRefreshJob(final boolean flushCaches) - { - return new Job("Refreshing JSP tag registry for " + _project.getName()) - { - @Override - protected IStatus run(final IProgressMonitor monitor) - { - if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY) - { - JSFCoreTraceOptions.log("TLDTagRegistry.refresh: start"); - } - - synchronized (TLDTagRegistry.this) - { - if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY) - { - JSFCoreTraceOptions - .log("TLDTagRegistry.refresh: start"); - } - - final List<Namespace> namespaces = new ArrayList( - _nsResolved.values()); - - if (flushCaches) - { - _persistedTagStrategy.clear(); - } - // if we aren't flushing caches, then check point the - // current namespace data, so it isn't lost when we clear - // the namespaces - else - { - checkpoint(); - } - - _nsResolved.clear(); - - fireEvent(new TagRegistryChangeEvent(TLDTagRegistry.this, - TagRegistryChangeEvent.EventType.REMOVED_NAMESPACE, - namespaces)); - initialize(true); - - if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY) - { - JSFCoreTraceOptions - .log("TLDTagRegistry.refresh: finished"); - } - return Status.OK_STATUS; - } - } - }; - } - - /** - */ - private void initialize(boolean fireEvent) - { - if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY) - { - JSFCoreTraceOptions.log("TLDTagRegistry.initialize: start"); - } - - final ITaglibRecord[] tldrecs = TaglibIndex - .getAvailableTaglibRecords(_project.getFullPath()); - final List<Namespace> affectedObjects = new ArrayList<Namespace>(); - for (final ITaglibRecord tldrec : tldrecs) - { - // defer the event - final Namespace ns = initialize(tldrec, fireEvent); - - if (ns != null) - { - affectedObjects.add(ns); - } - } - - _hasBeenInitialized = true; - - // if tag index listener does exist, add it - if (_tagIndexListener == null) - { - if (JSFCoreTraceOptions.TRACE_TLDREGISTRYMANAGER) - { - JSFCoreTraceOptions - .log("TLDRegistryManager: installing tag index listener due to create instance for " - + _project.toString()); - } - - _tagIndexListener = new TagIndexListener(this); - TaglibIndex.addTaglibIndexListener(_tagIndexListener); - } - - // if (affectedObjects.size() > 0) - // { - // fireEvent(new TagRegistryChangeEvent(this, - // TagRegistryChangeEvent.EventType.ADDED_NAMESPACE, - // affectedObjects)); - // } - - if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY) - { - JSFCoreTraceOptions.log("TLDTagRegistry.initialize: finished"); - } - } - - TLDNamespace initialize(final ITaglibRecord tagRecord, - final boolean fireEvent) - { - if (tagRecord.getRecordType() == ITLDRecord.URL) - { - if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY_CHANGES) - { - JSFCoreTraceOptions.log("TLDTagRegistry.initialize_TagRecord: Initializing new tld record: "+tagRecord.toString()); - } - long startTime = 0; - - if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY_PERF) - { - startTime = System.nanoTime(); - } - - final CMDocumentFactoryTLD factory = new CMDocumentFactoryTLD(); - final TLDDocument doc = (TLDDocument) factory - .createCMDocument(tagRecord); - if (doc != null) - { - final TLDNamespace ns = new TLDNamespace(doc, _resolver); - _nsResolved.put(doc.getUri(), ns); - - if (fireEvent) - { - fireEvent(new TagRegistryChangeEvent(this, - TagRegistryChangeEvent.EventType.ADDED_NAMESPACE, - Collections.singletonList(ns))); - } - - if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY_PERF) - { - System.out.printf("Time to update namespace %s was %d\n", - ns.getNSUri(), Long.valueOf(System.nanoTime() - - startTime)); - } - return ns; - } - } - else - { - if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY_CHANGES) - { - JSFCoreTraceOptions.log("TLDTagRegistry.initialize_TagRecord: Skipping tag record for "+tagRecord.toString()); - } - - } - // no new namespace - return null; - } - - void remove(final ITaglibRecord tagRecord) - { - // this is safer, since we likely fail to create a TLDDocument for - // a tagRecord that has been removed. - final String uri = tagRecord.getDescriptor().getURI(); - final TLDNamespace ns = _nsResolved.remove(uri); - - if (ns != null) - { - fireEvent(new TagRegistryChangeEvent(this, - TagRegistryChangeEvent.EventType.REMOVED_NAMESPACE, - Collections.singletonList(ns))); - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.jsf.designtime.internal.view.model.jsp.registry.ITagRegistry#getAllTagLibraries() - */ - public final synchronized Collection<? extends Namespace> getAllTagLibraries() - { - if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY) - { - JSFCoreTraceOptions.log("TLDTagRegistry.getAllTagLibraries: start"); - } - long startTime = 0; - - if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY_PERF) - { - startTime = System.nanoTime(); - } - - if (!_hasBeenInitialized) - { - initialize(false); - } - - final Set<TLDNamespace> allTagLibraries = new HashSet<TLDNamespace>(); - allTagLibraries.addAll(_nsResolved.values()); - - if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY_PERF) - { - System.out.println("Time to getAllTagLibraries for JSP: "+(System.nanoTime()-startTime)); - } - if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY) - { - JSFCoreTraceOptions - .log("TLDTagRegistry.getAllTagLibraries: finished"); - } - return allTagLibraries; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.jsf.designtime.internal.view.model.jsp.registry.ITagRegistry#getTagLibrary(java.lang.String) - */ - public final synchronized Namespace getTagLibrary(final String uri) - { - if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY) - { - JSFCoreTraceOptions.log("TLDTagRegistry.getTagLibrary: start uri=" - + uri); - } - - if (!_hasBeenInitialized) - { - initialize(false); - } - - final Namespace ns = _nsResolved.get(uri); - - if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY) - { - JSFCoreTraceOptions - .log("TLDTagRegistry.getTagLibrary: finished, result=" - + ns.toString()); - } - return ns; - } - - @Override - public String toString() - { - return String - .format( - "TLDRegistry for project %s, isDisposed=%s, hasBeenInitialized=%s, numberOfNamespace=%d", - _project.toString(), Boolean.valueOf(isDisposed()), - Boolean.valueOf(_hasBeenInitialized), Integer - .valueOf(_nsResolved.size())); - } - - void addLibraryOperation(final LibraryOperation operation) - { - _changeOperations.add(operation); - _changeJob.schedule(); - } - - - private class ChangeJob extends Job - { - private int _rescheduleTime = -1; - - public ChangeJob(final String projectName) - { - super("Update job for project " + projectName); - } - - @Override - protected IStatus run(final IProgressMonitor monitor) - { - synchronized (TLDTagRegistry.this) - { - _rescheduleTime = -1; - - LibraryOperation operation = null; - final MultiStatus multiStatus = new MultiStatus( - JSFCorePlugin.PLUGIN_ID, 0, "Result of change job", - new Throwable()); - while ((operation = _changeOperations.poll()) != null) - { - _rescheduleTime = 10000; // ms - - operation.run(); - multiStatus.add(operation.getResult()); - } - - if (_rescheduleTime >= 0 && !monitor.isCanceled()) - { - // if any operations were found on this run, reschedule - // to run again in 10seconds based on the assumption that - // events may be coming in bursts - schedule(_rescheduleTime); - } - - return multiStatus; - } - } - } - - private class MyPropertyListener extends TLDRegistryPreferences.PropertyListener - { - @Override - public void strategyOrderChanged() - { - synchronized(TLDTagRegistry.this) - { - _prefs.load(); - final IdentifierOrderedIteratorPolicy<String> policy = - getTagResolvingPolicy(); - _resolver.setPolicy(policy); - } - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/registry/TagIndexListener.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/registry/TagIndexListener.java deleted file mode 100644 index 0c075af57..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/registry/TagIndexListener.java +++ /dev/null @@ -1,104 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -/** - * - */ -package org.eclipse.jst.jsf.designtime.internal.view.model.jsp.registry; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.jsf.core.internal.JSFCoreTraceOptions; -import org.eclipse.jst.jsp.core.taglib.ITaglibIndexDelta; -import org.eclipse.jst.jsp.core.taglib.ITaglibIndexListener; - -class TagIndexListener implements ITaglibIndexListener -{ - private final TLDTagRegistry _registry; - private final LibraryOperationFactory _factory; - - TagIndexListener(final TLDTagRegistry registry) - { - _registry = registry; - _factory = new LibraryOperationFactory(_registry); - } - - public void indexChanged(final ITaglibIndexDelta delta) - { - if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY_CHANGES) - { - JSFCoreTraceOptions.log("TagIndexListener.indexChanged: start"); - } - - visitDelta(delta); - - if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY_CHANGES) - { - JSFCoreTraceOptions.log("TagIndexListener.indexChanged: finish"); - } - } - - private void visitDelta(final ITaglibIndexDelta delta) - { - final IProject project = delta.getProject(); - - if (_registry != null && !_registry.isDisposed() - && delta.getTaglibRecord() != null) - { - switch (delta.getKind()) - { - case ITaglibIndexDelta.ADDED: - { - if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY_CHANGES) - { - JSFCoreTraceOptions.log(String.format( - "Processing add change: project=%s", project - .getName())); - } - - _registry.addLibraryOperation(_factory - .createAddOperation(delta.getTaglibRecord())); - } - break; - case ITaglibIndexDelta.REMOVED: - { - if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY_CHANGES) - { - JSFCoreTraceOptions - .log(String - .format( - "Processing remove change: project=%s, tagrecord=%s", - project.getName())); - } - _registry.addLibraryOperation(_factory - .createRemoveOperation(delta.getTaglibRecord())); - } - break; - case ITaglibIndexDelta.CHANGED: - { - if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY_CHANGES) - { - JSFCoreTraceOptions.log(String.format( - "Processing change: project=%s, tagrecord=%s", - project.getName())); - } - _registry.addLibraryOperation(_factory - .createChangeOperation(delta.getTaglibRecord())); - } - break; - } - } - - // visit children - for (final ITaglibIndexDelta child : delta.getAffectedChildren()) - { - visitDelta(child); - } - } -}
\ No newline at end of file diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/messages.properties b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/messages.properties deleted file mode 100644 index adccd455f..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/messages.properties +++ /dev/null @@ -1,18 +0,0 @@ -############################################################################### -# Copyright (c) 2001, 2007 Oracle Corporation and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle Corporation - initial API and implementation -############################################################################### -AbstractDataModelVariableFactory.DataModel.Symbol.RowVariable.DetailedDescription=Row variable for dataTable -JSPDefaultSymbolFactory.Resource.bundle.map.detailedDescription=Resource bundle map for bundle <i> -JSPDefaultSymbolFactory.Problem.ErrorCreatingVariable=Error creating loadBundle variable -ResourceBundleSymbolSourceProvider.DetailedDescription=Resource bundle map for bundle <i> -DefaultBeanSymbolSourceProvider.AdditionalInformation.Name=Name: -DefaultBeanSymbolSourceProvider.AdditionalInformation.Type=Type: -DefaultBeanSymbolSourceProvider.AdditionalInformation.Scope=Scope: -DefaultBeanSymbolSourceProvider.AdditionalInformation.Description=Description: diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/package-info.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/package-info.java deleted file mode 100644 index 9f687e3ef..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/package-info.java +++ /dev/null @@ -1,16 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - * - ********************************************************************************/ - -/** - * JSF Design Time Application Manager Framework. - */ -package org.eclipse.jst.jsf.designtime; diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/resolver/AbstractStructuredDocumentSymbolResolverFactory.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/resolver/AbstractStructuredDocumentSymbolResolverFactory.java deleted file mode 100644 index 3fb922cff..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/resolver/AbstractStructuredDocumentSymbolResolverFactory.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.resolver; - -import org.eclipse.jst.jsf.context.IModelContext; - -/** - * A base class for symbol resolver factories. - * - * @author cbateman - * - */ -public abstract class AbstractStructuredDocumentSymbolResolverFactory implements - IStructuredDocumentSymbolResolverFactory -{ - /** - * @see org.eclipse.jst.jsf.designtime.resolver.IStructuredDocumentSymbolResolverFactory#getSymbolContextResolver(org.eclipse.jst.jsf.context.IModelContext) - */ - public abstract ISymbolContextResolver getSymbolContextResolver(IModelContext context); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/resolver/AbstractSymbolContextResolver.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/resolver/AbstractSymbolContextResolver.java deleted file mode 100644 index aa766a770..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/resolver/AbstractSymbolContextResolver.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.resolver; - -import org.eclipse.jst.jsf.context.IModelContext; -import org.eclipse.jst.jsf.context.symbol.IMethodSymbol; -import org.eclipse.jst.jsf.context.symbol.IObjectSymbol; -import org.eclipse.jst.jsf.context.symbol.ISymbol; - - -/** - * An abstract that should sub-classed by clients wishing to implement - * the ISymbolContextResolver interface - * - * @author cbateman - * - */ -public abstract class AbstractSymbolContextResolver implements ISymbolContextResolver -{ - public abstract ISymbol[] getAllVariables(); - - public abstract IMethodSymbol getMethod(IObjectSymbol base, Object methodName); - - public abstract ISymbol[] getMethods(IObjectSymbol base); - - public abstract ISymbol[] getProperties(ISymbol symbol); - - public abstract ISymbol getProperty(ISymbol symbol, Object propertyName); - - public abstract ISymbol getVariable(String name); - - public abstract boolean canResolveContext(IModelContext modelContext); - - /** - * Default implementation - * - * We should avoid returning true unless we are positive that changing - * to this context won't change the way symbols are resolved. - */ - public boolean hasSameResolution(IModelContext modelContext) - { - return false; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/resolver/CachingSymbolContextResolver.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/resolver/CachingSymbolContextResolver.java deleted file mode 100644 index 200b144a0..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/resolver/CachingSymbolContextResolver.java +++ /dev/null @@ -1,214 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.resolver; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.jst.jsf.context.IModelContext; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext; -import org.eclipse.jst.jsf.context.symbol.IMethodSymbol; -import org.eclipse.jst.jsf.context.symbol.IObjectSymbol; -import org.eclipse.jst.jsf.context.symbol.ISymbol; -import org.eclipse.jst.jsf.context.symbol.SymbolFactory; - -/** - * A symbol resolver that delegates to the default SymbolContextResolver, but - * caches the results and returns those on subsequent calls. - * - * WARNING: this resolver is suitable *only* in situations where the state - * of dependent symbol sources won't change between calls. This resolver makes - * no attempt to ensure that cached data is in sync with changes to symbols - * such addition, modification or removal of Java class underlying beans. - * - * NOTE: this resolver is experimental and should NOT be considered API - * - * Clients should not use this resolver directly. Access it through the factory instead - * @author cbateman - * - */ -public final class CachingSymbolContextResolver extends AbstractSymbolContextResolver -{ - private final static ISymbol SYMBOL_NOT_FOUND = SymbolFactory.eINSTANCE.createIComponentSymbol(); - private final static IMethodSymbol METHOD_SYMBOL_NOT_FOUND = - SymbolFactory.eINSTANCE.createIMethodSymbol(); - - private final SymbolContextResolver _delegate; - - private final Map<String, ISymbol> _variablesByName = new HashMap<String, ISymbol>(); - private ISymbol[] _allVariables; - - private final Map<ISymbol, Map<Object, ISymbol>> _propertiesByOwner = - new HashMap<ISymbol, Map<Object,ISymbol>>(); - private ISymbol[] _allProperties; - - private final Map<IObjectSymbol, Map<Object, IMethodSymbol>> _methodsByOwner = - new HashMap<IObjectSymbol, Map<Object,IMethodSymbol>>(); - private ISymbol[] _allMethods; - - /** - * @param context - */ - public CachingSymbolContextResolver(final IStructuredDocumentContext context) - { - _delegate = new SymbolContextResolver(context); - } - - @Override - public boolean canResolveContext(final IModelContext modelContext) - { - return _delegate.canResolveContext(modelContext); - } - - @Override - public ISymbol[] getAllVariables() - { - if (_allVariables == null) - { - _allVariables = _delegate.getAllVariables(); - } - return _allVariables; - } - - @Override - public IMethodSymbol getMethod(final IObjectSymbol base, final Object methodName) - { - Map<Object, IMethodSymbol> methods = _methodsByOwner.get(base); - - if (methods == null) - { - methods = new HashMap<Object, IMethodSymbol>(); - _methodsByOwner.put(base, methods); - } - - IMethodSymbol method = methods.get(methodName); - - if (method == SYMBOL_NOT_FOUND) - { - method = null; - } - else - { - if (method == null) - { - method = _delegate.getMethod(base, methodName); - - if (method == null) - { - // if the delegate couldn't find the property, - // then mark this in case it is requested again - methods.put(methodName, METHOD_SYMBOL_NOT_FOUND); - } - else - { - methods.put(methodName, method); - } - } - } - return method; - } - - @Override - public ISymbol[] getMethods(final IObjectSymbol base) - { - if (_allMethods == null) - { - _allMethods = _delegate.getMethods(base); - } - return _allMethods; - } - - @Override - public ISymbol[] getProperties(final ISymbol symbol) - { - if (_allProperties == null) - { - _allProperties = _delegate.getProperties(symbol); - } - return _allProperties; - } - - @Override - public ISymbol getProperty(final ISymbol symbol, final Object propertyName) - { - Map<Object, ISymbol> properties = _propertiesByOwner.get(symbol); - - if (properties == null) - { - properties = new HashMap<Object, ISymbol>(); - _propertiesByOwner.put(symbol, properties); - } - - ISymbol property = properties.get(propertyName); - - if (property == SYMBOL_NOT_FOUND) - { - property = null; - } - else - { - if (property == null) - { - property = _delegate.getProperty(symbol, propertyName); - - if (property == null) - { - // if the delegate couldn't find the property, - // then mark this in case it is requested again - properties.put(propertyName, SYMBOL_NOT_FOUND); - } - else - { - properties.put(propertyName, property); - } - } - } - return property; - } - - @Override - public ISymbol getVariable(final String name) - { - ISymbol variable = _variablesByName.get(name); - - // if the symbol was not found, return null but avoid calling the - // delegate again - if (variable == SYMBOL_NOT_FOUND) - { - variable = null; - } - else - { - if (variable == null) - { - variable = _delegate.getVariable(name); - - if (variable == null) - { - // if the delegate couldn't find the variable, - // then mark this in case it is requested again - _variablesByName.put(name, SYMBOL_NOT_FOUND); - } - else - { - _variablesByName.put(name, variable); - } - } - } - return variable; - } - - @Override - public boolean hasSameResolution(IModelContext modelContext) - { - return _delegate.hasSameResolution(modelContext); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/resolver/IStructuredDocumentSymbolResolverFactory.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/resolver/IStructuredDocumentSymbolResolverFactory.java deleted file mode 100644 index cdc8b145e..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/resolver/IStructuredDocumentSymbolResolverFactory.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.resolver; - -import org.eclipse.jst.jsf.context.IModelContext; - -/** - * A factory for symbol context resolvers. - * - * Clients may use but implement this interface. To implement, sub-class - * AbstractStructuredDocumentSymbolResolverFactory - * - * @author cbateman - * - */ -public interface IStructuredDocumentSymbolResolverFactory -{ - /** - * @param context - * @return a new instance of symbol resolver for context - */ - public ISymbolContextResolver getSymbolContextResolver(IModelContext context); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/resolver/ISymbolContextResolver.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/resolver/ISymbolContextResolver.java deleted file mode 100644 index 605104311..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/resolver/ISymbolContextResolver.java +++ /dev/null @@ -1,90 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.designtime.resolver; - -import org.eclipse.jst.jsf.context.IModelContext; -import org.eclipse.jst.jsf.context.resolver.IDocumentContextResolver; -import org.eclipse.jst.jsf.context.symbol.IMethodSymbol; -import org.eclipse.jst.jsf.context.symbol.IObjectSymbol; -import org.eclipse.jst.jsf.context.symbol.ISymbol; - -/** - * Resolves symbols and possible symbols in a given context - * - * May NOT be sub-classed or implemented by clients. - * Sub-class AbstractSymbolContextResolver to implement. - * - * @author cbateman - * - */ -public interface ISymbolContextResolver extends IDocumentContextResolver -{ - /** - * Gets the most appropriate symbol in the current context - * based on name. Most "appropriate" may take into account - * scoping and other rules. - * - * @param name - * @return a symbol - */ - ISymbol getVariable(String name); - - /** - * @return all valid symbols in the current context - */ - ISymbol[] getAllVariables(); - - /** - * @param symbol - * @param propertyName - * @return the property symbol called propertyName or null if not found - */ - ISymbol getProperty(ISymbol symbol, Object propertyName); - - /** - * @param symbol - * @return all properties of symbol - */ - ISymbol[] getProperties(ISymbol symbol); - - /** - * @param base - * @param methodName - * @return the method of base matching methodName or null if not found - */ - IMethodSymbol getMethod(IObjectSymbol base, Object methodName); - - /** - * @param base - * @return all methods belonging to base - */ - ISymbol[] getMethods(IObjectSymbol base); - - /** - * This is meant to be used things like caching to determine if caches - * need to be flushed for different contexts. If you are in doubt, always - * return false. - * - * NOTE: this method should not be used to determine if symbols previously - * returned by this resolver have changed to do changes in the underlying - * application such as change to a managed bean. This method only needs - * to check if what variable, properties and methods may have resolved - * different, because of the context itself. - * - * @param modelContext - * @since 3.0 - * @return true if the instance of this resolver would resolve everything - * exactly the same with this modelContext. False otherwise. - */ - boolean hasSameResolution(final IModelContext modelContext); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/resolver/StructuredDocumentSymbolResolverFactory.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/resolver/StructuredDocumentSymbolResolverFactory.java deleted file mode 100644 index 69fc6beb5..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/resolver/StructuredDocumentSymbolResolverFactory.java +++ /dev/null @@ -1,83 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.designtime.resolver; - -import org.eclipse.jst.jsf.context.AbstractDelegatingFactory; -import org.eclipse.jst.jsf.context.IModelContext; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext; -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument; - -/** - * Factory create resolver capable of resolving symbols in a structured document - * - * Clients may not sub-class. - * - * @author cbateman - * - */ -public final class StructuredDocumentSymbolResolverFactory extends - AbstractDelegatingFactory implements IStructuredDocumentSymbolResolverFactory -{ - private static StructuredDocumentSymbolResolverFactory INSTANCE; - - /** - * @return the singleton factory instance - */ - public final static synchronized StructuredDocumentSymbolResolverFactory getInstance() - { - if (INSTANCE == null) - { - // no delegates supported - INSTANCE = new StructuredDocumentSymbolResolverFactory(new Class[0]); - } - - return INSTANCE; - } - - private StructuredDocumentSymbolResolverFactory(Class[] supportedDelegateTypes) - { - super(supportedDelegateTypes); - } - - /** - * @param context - * @return a new instance of symbol resolver for context - */ - public ISymbolContextResolver getSymbolContextResolver(IModelContext context) { - ISymbolContextResolver resolver = internalGetSymbolContextResolver(context); - - if (resolver == null) - { - resolver = delegateGetSymbolContextResolver(context); - } - - return resolver; - } - - private ISymbolContextResolver internalGetSymbolContextResolver(IModelContext context) - { - if (context instanceof IStructuredDocumentContext && - ((IStructuredDocumentContext)context).getStructuredDocument() instanceof IStructuredDocument) - { - return new SymbolContextResolver((IStructuredDocumentContext) context); - } - - return null; - } - - private ISymbolContextResolver delegateGetSymbolContextResolver(IModelContext context) - { - // no delegates currently supported - return null; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/resolver/SymbolContextResolver.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/resolver/SymbolContextResolver.java deleted file mode 100644 index 3652db19e..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/resolver/SymbolContextResolver.java +++ /dev/null @@ -1,225 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.designtime.resolver; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IResource; -import org.eclipse.jst.jsf.context.IModelContext; -import org.eclipse.jst.jsf.context.resolver.structureddocument.IStructuredDocumentContextResolverFactory; -import org.eclipse.jst.jsf.context.resolver.structureddocument.IWorkspaceContextResolver; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext; -import org.eclipse.jst.jsf.context.symbol.IMethodSymbol; -import org.eclipse.jst.jsf.context.symbol.IObjectSymbol; -import org.eclipse.jst.jsf.context.symbol.ISymbol; -import org.eclipse.jst.jsf.designtime.DesignTimeApplicationManager; -import org.eclipse.jst.jsf.designtime.context.DTFacesContext; - -/** - * A symbol context resolver - * Clients may NOT sub-class. - * - * @author cbateman - * - */ -/*package*/ final class SymbolContextResolver extends AbstractSymbolContextResolver -{ - private final IStructuredDocumentContext _context; - private IWorkspaceContextResolver _wkspResolver; // = null; lazy created through getWorkspaceResolver - - /** - * @param context - */ - /* package */SymbolContextResolver(IStructuredDocumentContext context) - { - _context = context; - } - - public ISymbol getVariable(String name) - { - final IFile file = getFile(); - - if (file != null) - { - final DesignTimeApplicationManager manager = - DesignTimeApplicationManager.getInstance(file.getProject()); - - if (manager != null) - { - final DTFacesContext facesContext = manager.getFacesContext(file); - - return manager.getVariableResolver(). - resolveVariable(facesContext, name, file); - } - } - - return null; - } - - public ISymbol[] getAllVariables() - { - final IFile file = getFile(); - - if (file != null) - { - final DesignTimeApplicationManager manager = - DesignTimeApplicationManager.getInstance(file.getProject()); - - if (manager != null) - { - final DTFacesContext facesContext = manager.getFacesContext(file); - - if (facesContext != null) - { - return manager.getVariableResolver(). - getAllVariables(facesContext, file); - } - } - } - - return ISymbol.EMPTY_SYMBOL_ARRAY; - } - - public ISymbol getProperty(ISymbol symbol, Object propertyName) - { - final IFile file = getFile(); - - if (file != null) - { - final DesignTimeApplicationManager manager = - DesignTimeApplicationManager.getInstance(file.getProject()); - - if (manager != null) - { - return manager.getPropertyResolver().getProperty(symbol, propertyName); - } - } - - return null; - } - - public ISymbol[] getProperties(ISymbol symbol) - { - final IFile file = getFile(); - - if (file != null) - { - final DesignTimeApplicationManager manager = - DesignTimeApplicationManager.getInstance(file.getProject()); - - if (manager != null) - { - return manager.getPropertyResolver().getAllProperties(symbol); - } - } - return ISymbol.EMPTY_SYMBOL_ARRAY; - } - - public IMethodSymbol getMethod(IObjectSymbol base, Object methodName) - { - final IFile file = getFile(); - - if (file != null) - { - final DesignTimeApplicationManager manager = - DesignTimeApplicationManager.getInstance(file.getProject()); - - if (manager != null) - { - return manager.getMethodResolver().getMethod(base, methodName); - } - } - - return null; - } - - public ISymbol[] getMethods(IObjectSymbol base) - { - final IFile file = getFile(); - - if (file != null) - { - final DesignTimeApplicationManager manager = - DesignTimeApplicationManager.getInstance(file.getProject()); - - if (manager != null) - { - return manager.getMethodResolver().getMethods(base); - } - } - - return new IMethodSymbol[0]; - } - - - public boolean canResolveContext(IModelContext modelContext) - { - return modelContext.getAdapter(IStructuredDocumentContext.class) != null; - } - - /** - * @return a lazily loaded workspace resolver for this resolver's context - */ - protected final IWorkspaceContextResolver getWorkspaceResolver() - { - if (_wkspResolver == null) - { - _wkspResolver = getWorkspaceResolver(_context); - } - - return _wkspResolver; - } - - private IWorkspaceContextResolver getWorkspaceResolver(final IStructuredDocumentContext context) - { - return IStructuredDocumentContextResolverFactory.INSTANCE - .getWorkspaceContextResolver(context); - } - - /** - * @return the underlying IFile for my context or null if can't be determined - */ - protected final IFile getFile() - { - return getFile(getWorkspaceResolver()); - } - - private IFile getFile(final IWorkspaceContextResolver resolver) - { - - if (resolver != null) - { - IResource curRes = resolver.getResource(); - - if (curRes instanceof IFile) - { - return (IFile) curRes; - } - } - - return null; - - } - - @Override - public boolean hasSameResolution(IModelContext modelContext) - { - if (canResolveContext(modelContext)) - { - return getFile().equals(getFile(getWorkspaceResolver((IStructuredDocumentContext) modelContext))); - } - - // if we can't even resolve the context, then we certainly don't have - // the same resolution - return false; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/resolver/package-info.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/resolver/package-info.java deleted file mode 100644 index 31457bbd9..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/resolver/package-info.java +++ /dev/null @@ -1,16 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - * - ********************************************************************************/ - -/** - * Model Context Resolvers for EL symbols. - */ -package org.eclipse.jst.jsf.designtime.resolver; diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/symbols/AbstractDataModelVariableFactory.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/symbols/AbstractDataModelVariableFactory.java deleted file mode 100644 index b2f89c3e6..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/symbols/AbstractDataModelVariableFactory.java +++ /dev/null @@ -1,255 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.designtime.symbols; - -import org.eclipse.core.resources.IFile; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.Signature; -import org.eclipse.jst.jsf.common.internal.types.TypeConstants; -import org.eclipse.jst.jsf.common.internal.types.ValueType; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext; -import org.eclipse.jst.jsf.context.symbol.ERuntimeSource; -import org.eclipse.jst.jsf.context.symbol.ISymbol; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.core.internal.tld.IJSFConstants; -import org.eclipse.jst.jsf.validation.internal.appconfig.AppConfigValidationUtil; -import org.w3c.dom.Element; - -/** - * A framework provided variable factory for EL model objects that are - * constructed based on DataModel's dervied from an EL expression. - * - * @author cbateman - * - */ -public abstract class AbstractDataModelVariableFactory -{ - private final JSFSymbolFactory _symbolFactory = new JSFSymbolFactory(); - - /** - * @param elText - * The EL expression text. Must not be null - * @param elContext - * The document context pointing to elText in the source - * document. Must not be null - * @param file - * The workspace resource that contains elText. Must not be null. - * @return the value expression resolved from elText or null if it cannot be - * resolved or elText doesn't resolve to value expression (i.e. is a - * method expression) - * @deprecated use JSFSymbolFactory.getValueTypeFromEL instead. - */ - public final ValueType createValueExpression(final String elText, - final IStructuredDocumentContext elContext, final IFile file) - { - return getSymbolFactory().getValueTypeFromEL(elText, elContext, file); - } - - /** - * @return the symbol factory used by this variable factory - */ - public final JSFSymbolFactory getSymbolFactory() - { - return _symbolFactory; - } - - /** - * @param symbolName - * The name of the symbol to be created. Must not be null - * @param signature - * The type signature of the array type. Must not be null - * @param javaProject - * must not be null - * @return a symbol based approximating an implicit DataModel wrapper for an - * array - * @deprecated use JSFSymbolFactory.createArraySymbol instead - */ - protected final ISymbol createArraySymbol(final String symbolName, - final String signature, final IJavaProject javaProject) - { - return getSymbolFactory().createArraySymbol(symbolName, signature, - ERuntimeSource.TAG_INSTANTIATED_SYMBOL_LITERAL, javaProject); - } - - /** - * Implements default rules for taking an non-array value expression and - * resolving it to a ISymbol modelling a JSF DataModel - * - * @param symbolName - * @param valueType - * @param javaProject - * @return a symbol where valueType is considered to be the base type upon - * which a data model would be created. This combines the - * possibility that the value expression is either an explicit - * DataModel implementation or a non-DataModel type for which JSF be - * default provides an implicit wrapper model. - * - * List is treated as a special case here, since their are two subcases: 1) - * the list is a raw type, in which case it must be treated as implicit and - * opaque (as to the type of the variable created) 2) the list has Java 5 - * type argument information that can be used to infer the type of the row - * variable - */ - public ISymbol createFromType(String symbolName, ValueType valueType, - IJavaProject javaProject) - { - return internalCreateFromBaseType(symbolName, valueType, javaProject); - } - - private ISymbol internalCreateFromBaseType(String symbolName, - ValueType valueType, IJavaProject javaProject) - { - // based on JSF 1.1 spec section 4.2.1.4 the data model - // value binding can be one of a number of object that will - // get an implicit DataModel wrapper at runtime - - // could be an array - if (Signature.getArrayCount(valueType.getSignature()) > 0) - { - return getSymbolFactory() - .createArraySymbol(symbolName, valueType.getSignature(), - ERuntimeSource.TAG_INSTANTIATED_SYMBOL_LITERAL, - javaProject); - } - - // if is a list, then we have extra work to do if it - // is generic and has info about its contents - if (valueType.isInstanceOf(TypeConstants.TYPE_LIST)) - { - return getSymbolFactory().createFromList(symbolName, valueType, ERuntimeSource.TAG_INSTANTIATED_SYMBOL_LITERAL, null, javaProject); - } - // if is JSTL ResultSet, java ResultSet or DataModel - // return the default symbol -- in the absence of definite - // template info, these row containers are opaque to us - else if (valueType - .isInstanceOf(TypeConstants.TYPE_JAVAX_SERVLET_JSP_JSTL_SQL_RESULT) - || valueType.isInstanceOf(TypeConstants.TYPE_RESULT_SET) - || valueType.isInstanceOf(TypeConstants.TYPE_DATA_MODEL)) - { - return getSymbolFactory().createDefaultSymbol(symbolName, ERuntimeSource.TAG_INSTANTIATED_SYMBOL_LITERAL, Messages - .getString("AbstractDataModelVariableFactory.DataModel.Symbol.RowVariable.DetailedDescription")); - } - - // in other cases, we assume that the value is an explicit single row - // scalar object - return getSymbolFactory().createScalarSymbol(symbolName, valueType.getSignature(), - ERuntimeSource.TAG_INSTANTIATED_SYMBOL_LITERAL, javaProject); - } - - /** - * @param symbolName - * The name of the symbol to create. Must not be null. - * @param valueType - * The value expression representing the implicit list. The - * signature on the valueType must be a list. Must not be null. - * @param javaProject - * The JavaProject whose classpath will be used to resolve types. - * Must not be null. - * - * @return a symbol that approximates as best as possible an implicit - * DataModel for java.util.List value expressions. If the List has - * resolvable Java 5 type arguments, then a scalar symbol will be - * created using this type information. If it is a raw type, then - * createDefaultSymbol() is called - * @deprecated use JSFSymbolFactory.createFromList - */ - protected final ISymbol createFromList(String symbolName, - ValueType valueType, IJavaProject javaProject) - { - return getSymbolFactory().createFromList(symbolName, valueType, - ERuntimeSource.TAG_INSTANTIATED_SYMBOL_LITERAL, null, - javaProject); - } - - /** - * @param symbolName - * The name of the symbol to create. Must not be null. - * @param signature - * The fully resolved type signature of the scalar. Must not be - * null. - * @param javaProject - * The JavaProject whose classpath is to be used to resolve type - * information for signture. Must not be null. - * @return a symbol approximating a scalar object DataModel wrapper. The row - * variable for the data model becomes of type signature - * @deprecated use JSFSymbolFactory.createScalarSymbol instead. - */ - protected final ISymbol createScalarSymbol(final String symbolName, - final String signature, final IJavaProject javaProject) - { - return getSymbolFactory().createScalarSymbol(symbolName, signature, - ERuntimeSource.TAG_INSTANTIATED_SYMBOL_LITERAL, javaProject); - } - - /** - * @param symbolName - * The name of the symbol to create. Must not be null - * @return a default symbol that eliminates bogus warnings for this - * dataTable's row variable in cases where something better is - * resolvable. Note that this is not ideal, since will result in any - * property being accepted on the variable with this name. - * @deprecated use JSFSymbolFactory.createDefaultSymbol instead. - */ - public final ISymbol createDefaultSymbol(final String symbolName) - { - return getSymbolFactory() - .createDefaultSymbol( - symbolName, - ERuntimeSource.TAG_INSTANTIATED_SYMBOL_LITERAL, - Messages - .getString("AbstractDataModelVariableFactory.DataModel.Symbol.RowVariable.DetailedDescription")); - } - - /** - * @param dataTableElement - * the DOM element that has a "value" attribute. Must not be - * null. - * @return the el text from the 'value attribute of a dataTable element or - * null if not found - */ - protected static String getELText(final Element dataTableElement) - { - assert dataTableElement != null; - String attrVal = dataTableElement - .getAttribute(IJSFConstants.ATTR_VALUE); - - if (attrVal != null) - { - return AppConfigValidationUtil.extractELExpression(attrVal) - .getElText(); - } - return null; - } - - /** - * @return the variable source name. Protects against null in the abstract - * method - */ - protected final String internalGetVariableSourceName() - { - String variableSourceName = getVariableSourceName(); - - if (variableSourceName == null) - { - JSFCorePlugin.log("Missing variableSourceName", new Throwable()); //$NON-NLS-1$ - return "**missing variable source name**"; //$NON-NLS-1$ - } - - return variableSourceName; - } - - /** - * @return a user displayable name for the source of variables created by - * this factory Must not return null. - */ - protected abstract String getVariableSourceName(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/symbols/DefaultBeanSymbolSourceProvider.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/symbols/DefaultBeanSymbolSourceProvider.java deleted file mode 100644 index 2f6181642..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/symbols/DefaultBeanSymbolSourceProvider.java +++ /dev/null @@ -1,218 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.designtime.symbols; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jst.jsf.context.symbol.ERuntimeSource; -import org.eclipse.jst.jsf.context.symbol.IBeanInstanceSymbol; -import org.eclipse.jst.jsf.context.symbol.IJavaTypeDescriptor2; -import org.eclipse.jst.jsf.context.symbol.ISymbol; -import org.eclipse.jst.jsf.context.symbol.SymbolFactory; -import org.eclipse.jst.jsf.context.symbol.source.ISymbolConstants; -import org.eclipse.jst.jsf.core.jsfappconfig.JSFAppConfigManager; -import org.eclipse.jst.jsf.facesconfig.emf.DescriptionType; -import org.eclipse.jst.jsf.facesconfig.emf.ManagedBeanScopeType; -import org.eclipse.jst.jsf.facesconfig.emf.ManagedBeanType; - -/** - * Self-factory provider of bean symbol information for a particular project. - * - * Context is determined by querying all known managed beans declared in a - * web project. - * - * Client may sub-class - * - * @author cbateman - * - */ -public class DefaultBeanSymbolSourceProvider -{ - private static DefaultBeanSymbolSourceProvider INSTANCE; - - /** - * @return the singleton instance of the provider - */ - public static DefaultBeanSymbolSourceProvider getInstance() - { - if (INSTANCE == null) - { - INSTANCE = new DefaultBeanSymbolSourceProvider(); - } - - return INSTANCE; - } - - /** - * No external instantiation - * - * Left protected to allow sub-classing - */ - protected DefaultBeanSymbolSourceProvider() {/* empty */} - - /** - * @param context - * @param symbolScopeMask - * @return all bean symbols for the context at scopes matching symbolScopeMask - */ - public ISymbol[] getSymbols(IAdaptable context, int symbolScopeMask) - { - final IFile file = FileContextUtil.deriveIFileFromContext(context); - if (file != null) - { - final IProject myProject = file.getProject(); - List managedBeans = getManagedBeanSymbols(myProject, symbolScopeMask); - return (ISymbol[]) managedBeans.toArray(ISymbol.EMPTY_SYMBOL_ARRAY); - } - - return ISymbol.EMPTY_SYMBOL_ARRAY; - } - - /** - * @param name - * @param context - * @param symbolScopeMask - * @return the symbol called name, in context/symbolScope - */ - public ISymbol getSymbol(final String name, final IAdaptable context, - final int symbolScopeMask) - { - return SymbolUtil. - findSymbolByName(getSymbols(context, symbolScopeMask), name); - } - - /** - * @param prefix - * @param context - * @param symbolScopeMask - * @return all symbols for context and symbolScopeMask that start with - * prefix - */ - public ISymbol[] getSymbols(String prefix, IAdaptable context, - int symbolScopeMask) { - return SymbolUtil. - filterSymbolsByPrefix(getSymbols(context, symbolScopeMask), prefix); - } - - private List getManagedBeanSymbols(IProject iProject, int symbolScopeMask) - { - List symbols = new ArrayList(); - - final JSFAppConfigManager configManager = JSFAppConfigManager.getInstance(iProject); - - - if (configManager != null) - { - for (final Iterator aIt = configManager.getManagedBeans().iterator(); aIt.hasNext();) - { - ManagedBeanType bean = (ManagedBeanType) aIt.next(); - - // only bother with all this if we care about the scope of this bean - if (isBeanScopeInMask(bean.getManagedBeanScope(), symbolScopeMask)) - { - final String name = bean.getManagedBeanName().getTextContent(); - final String detailedDescription = createAdditionalProposalInfo(bean); - IBeanInstanceSymbol symbol = SymbolFactory.eINSTANCE.createIBeanInstanceSymbol(); - symbol.setName(name); - symbol.setDetailedDescription(detailedDescription); - symbol.setRuntimeSource(ERuntimeSource.MANAGED_BEAN_SYMBOL_LITERAL); - try - { - IJavaProject javaProject = JavaCore.create(iProject); - IType type = javaProject.findType(bean.getManagedBeanClass().getTextContent()); - - // don't bother setting a type descriptor if we - // can't find a type - if (type != null) - { - IJavaTypeDescriptor2 javaTypeDescriptor = - SymbolFactory.eINSTANCE.createIJavaTypeDescriptor2(); - javaTypeDescriptor.setType(type); - symbol.setJavaTypeDescriptor(javaTypeDescriptor); - } - } - catch (JavaModelException t) - { - // do nothing; skip type info for this bean - } - symbols.add(symbol); - } - } - } - - return symbols; - } - - private String createAdditionalProposalInfo(ManagedBeanType beanType) - { - StringBuffer additionalInfo = new StringBuffer("<p><b>"); //$NON-NLS-1$ - additionalInfo.append(Messages.getString("DefaultBeanSymbolSourceProvider.AdditionalInformation.Name")); //$NON-NLS-1$ - additionalInfo.append(" </b>"); //$NON-NLS-1$ - additionalInfo.append(beanType.getManagedBeanName().getTextContent()); - additionalInfo.append("</p><p><b>"); //$NON-NLS-1$ - additionalInfo.append(Messages.getString("DefaultBeanSymbolSourceProvider.AdditionalInformation.Type")); //$NON-NLS-1$ - additionalInfo.append(" </b>"); //$NON-NLS-1$ - additionalInfo.append(beanType.getManagedBeanClass().getTextContent()); - additionalInfo.append("</p><p><b>"); //$NON-NLS-1$ - additionalInfo.append(Messages.getString("DefaultBeanSymbolSourceProvider.AdditionalInformation.Scope")); //$NON-NLS-1$ - additionalInfo.append(" </b>"); //$NON-NLS-1$ - additionalInfo.append(beanType.getManagedBeanScope().getTextContent()); - additionalInfo.append("</p>"); //$NON-NLS-1$ - - StringBuffer descBuffer = new StringBuffer(); - - for (final Iterator it = beanType.getDescription().iterator(); it.hasNext();) - { - final DescriptionType descType = (DescriptionType) it.next(); - final String appendString = descType.getTextContent(); - if (appendString != null) - { - descBuffer.append(appendString); - } - } - - if (descBuffer.length() > 0) - { - additionalInfo.append("<p><b>"); //$NON-NLS-1$ - additionalInfo.append(Messages.getString("DefaultBeanSymbolSourceProvider.AdditionalInformation.Description")); //$NON-NLS-1$ - additionalInfo.append("</b>"); //$NON-NLS-1$ - additionalInfo.append(descBuffer); - additionalInfo.append("</p>"); //$NON-NLS-1$ - } - - return additionalInfo.toString(); - } - - - private boolean isBeanScopeInMask(final ManagedBeanScopeType scope, final int scopeMask) - { - final int testScope = ISymbolConstants.getMaskForString(scope.getTextContent()); - - if (testScope != -1) - { - return (scopeMask & testScope) != 0; - } - - // no other cases supported - return false; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/symbols/DefaultBuiltInSymbolProvider.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/symbols/DefaultBuiltInSymbolProvider.java deleted file mode 100644 index 7583a7b13..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/symbols/DefaultBuiltInSymbolProvider.java +++ /dev/null @@ -1,313 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.designtime.symbols; - -import java.util.AbstractMap; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.jst.jsf.context.symbol.ERuntimeSource; -import org.eclipse.jst.jsf.context.symbol.IInstanceSymbol; -import org.eclipse.jst.jsf.context.symbol.IMapTypeDescriptor; -import org.eclipse.jst.jsf.context.symbol.ISymbol; -import org.eclipse.jst.jsf.context.symbol.SymbolFactory; -import org.eclipse.jst.jsf.context.symbol.source.ISymbolConstants; -import org.eclipse.jst.jsf.designtime.DesignTimeApplicationManager; -import org.eclipse.jst.jsf.designtime.context.IDTExternalContext; - -/** - * Provides the default built-in JSF symbols - * - * Clients may sub-class - * - * @author cbateman - * - */ -public class DefaultBuiltInSymbolProvider -{ - private static DefaultBuiltInSymbolProvider INSTANCE; - private static final JSFSymbolFactory _symbolFactory; - - /** - * @return the singleton instance - */ - public synchronized static DefaultBuiltInSymbolProvider getInstance() - { - if (INSTANCE == null) - { - INSTANCE = new DefaultBuiltInSymbolProvider(); - } - - return INSTANCE; - } - - private static final String APPLICATION_SCOPE = "applicationScope"; //$NON-NLS-1$ - private static final String SESSION_SCOPE = "sessionScope"; //$NON-NLS-1$ - private static final String REQUEST_SCOPE = "requestScope"; //$NON-NLS-1$ - private static final String COOKIE_IMPLICIT_OBJ = "cookie"; //$NON-NLS-1$ - private static final String FACES_CONTEXT_IMPLICIT_OBJ = "facesContext"; //$NON-NLS-1$ - private static final String HEADER_IMPLICIT_OBJ = "header"; //$NON-NLS-1$ - private static final String HEADER_VALUES_IMPLICIT_OBJ = "headerValues"; //$NON-NLS-1$ - private static final String INIT_PARAM_IMPLICIT_OBJ = "initParam"; //$NON-NLS-1$ - private static final String PARAM_IMPLICIT_OBJ = "param"; //$NON-NLS-1$ - private static final String PARAM_VALUES_IMPLICIT_OBJ = "paramValues"; //$NON-NLS-1$ - private static final String VIEW_IMPLICIT_OBJ = "view"; //$NON-NLS-1$ - - private static final String FACES_CONTEXT_FULLY_QUALIFIED_CLASS = "javax.faces.context.FacesContext"; //$NON-NLS-1$ - private static final String VIEW_FULLY_QUALIFIED_CLASS = "javax.faces.component.UIViewRoot"; //$NON-NLS-1$ - - private static final ISymbol SYMBOL_COOKIE_IMPLICIT_OBJ; - private static final ISymbol SYMBOL_HEADER_IMPLICIT_OBJ; - private static final ISymbol SYMBOL_HEADER_VALUES_IMPLICIT_OBJ; - private static final ISymbol SYMBOL_PARAM_IMPLICIT_OBJ; - private static final ISymbol SYMBOL_PARAM_VALUES_IMPLICIT_OBJ; - private static final ISymbol SYMBOL_INIT_PARAM_IMPLICIT_OBJ; - - static - { - _symbolFactory = new JSFSymbolFactory(); - // invariant request scope variables - SYMBOL_COOKIE_IMPLICIT_OBJ = _symbolFactory.createUnknownInstanceSymbol(COOKIE_IMPLICIT_OBJ, ERuntimeSource.BUILT_IN_SYMBOL_LITERAL); - SYMBOL_HEADER_IMPLICIT_OBJ = _symbolFactory.createUnknownInstanceSymbol(HEADER_IMPLICIT_OBJ, ERuntimeSource.BUILT_IN_SYMBOL_LITERAL); - SYMBOL_HEADER_VALUES_IMPLICIT_OBJ = _symbolFactory.createUnknownInstanceSymbol(HEADER_VALUES_IMPLICIT_OBJ, ERuntimeSource.BUILT_IN_SYMBOL_LITERAL); - SYMBOL_PARAM_IMPLICIT_OBJ = _symbolFactory.createUnknownInstanceSymbol(PARAM_IMPLICIT_OBJ, ERuntimeSource.BUILT_IN_SYMBOL_LITERAL); - SYMBOL_PARAM_VALUES_IMPLICIT_OBJ = _symbolFactory.createUnknownInstanceSymbol(PARAM_VALUES_IMPLICIT_OBJ, ERuntimeSource.BUILT_IN_SYMBOL_LITERAL); - - // invariant application scope variables - SYMBOL_INIT_PARAM_IMPLICIT_OBJ = _symbolFactory.createUnknownInstanceSymbol(INIT_PARAM_IMPLICIT_OBJ, ERuntimeSource.BUILT_IN_SYMBOL_LITERAL); - } - - - /** - * No direct instantiation -- use getInstance - * - * Made protected to allow sub-classing - */ - protected DefaultBuiltInSymbolProvider() - { - // nothing to do. - } - - /** - * @param context - * @param symbolScopeMask - * @return all symbols for context in scopes matching symbolScopeMask - */ - public ISymbol[] getSymbols(final IAdaptable context, - final int symbolScopeMask) - { - final IFile fileContext = FileContextUtil - .deriveIFileFromContext(context); - return (ISymbol[]) getSymbolsForScope(fileContext, symbolScopeMask) - .toArray(ISymbol.EMPTY_SYMBOL_ARRAY); - } - - /** - * @param name - * @param context - * @param symbolScopeMask - * @return the symbol in context matching name or null if not found - */ - public ISymbol getSymbol(final String name, final IAdaptable context, - final int symbolScopeMask) - { - final IFile file = FileContextUtil.deriveIFileFromContext(context); - - ISymbol symbol = null; - if ((symbolScopeMask & ISymbolConstants.SYMBOL_SCOPE_REQUEST) != 0) - { - symbol = getRequestScopeSymbols(file).get(name); - } - if ((symbolScopeMask & ISymbolConstants.SYMBOL_SCOPE_SESSION) != 0 - && symbol == null) - { - symbol = getSessionScopeSymbols(file).get(name); - } - if ((symbolScopeMask & ISymbolConstants.SYMBOL_SCOPE_APPLICATION) != 0 - && symbol == null) - { - symbol = getApplicationScopeSymbols(file).get(name); - } - - return symbol; - } - - /** - * @param prefix - * @param context - * @param symbolScopeMask - * @return all implicit symbols for context starting with prefix in scopes - * matching symbolScopeMask - */ - public ISymbol[] getSymbols(final String prefix, final IAdaptable context, - final int symbolScopeMask) - { - final IFile file = FileContextUtil.deriveIFileFromContext(context); - - final List<ISymbol> symbols = new ArrayList<ISymbol>(); - if ((symbolScopeMask & ISymbolConstants.SYMBOL_SCOPE_REQUEST) != 0) - { - symbols.addAll(getRequestScopeSymbols(file).values()); - } - if ((symbolScopeMask & ISymbolConstants.SYMBOL_SCOPE_SESSION) != 0) - { - symbols.addAll(getSessionScopeSymbols(file).values()); - } - if ((symbolScopeMask & ISymbolConstants.SYMBOL_SCOPE_APPLICATION) != 0) - { - symbols.addAll(getApplicationScopeSymbols(file).values()); - } - return symbols.toArray(ISymbol.EMPTY_SYMBOL_ARRAY); - } - - private List getSymbolsForScope(final IFile file, final int symbolScopeMask) - { - final List symbols = new ArrayList(); - if ((symbolScopeMask & ISymbolConstants.SYMBOL_SCOPE_REQUEST) != 0) - { - symbols.addAll(getRequestScopeSymbols(file).values()); - } - if ((symbolScopeMask & ISymbolConstants.SYMBOL_SCOPE_SESSION) != 0) - { - symbols.addAll(getSessionScopeSymbols(file).values()); - } - if ((symbolScopeMask & ISymbolConstants.SYMBOL_SCOPE_APPLICATION) != 0) - { - symbols.addAll(getApplicationScopeSymbols(file).values()); - } - - return symbols; - } - - private Map<String, ISymbol> getRequestScopeSymbols(final IFile file) - { - final Map<String, ISymbol> requestSymbols = new HashMap<String, ISymbol>(); - - ISymbol symbol = createScopeSymbol(file, - ISymbolConstants.SYMBOL_SCOPE_REQUEST, REQUEST_SCOPE); - requestSymbols.put(symbol.getName(), symbol); - - requestSymbols.put(SYMBOL_COOKIE_IMPLICIT_OBJ.getName(), SYMBOL_COOKIE_IMPLICIT_OBJ); - requestSymbols.put(SYMBOL_HEADER_IMPLICIT_OBJ.getName(), SYMBOL_HEADER_IMPLICIT_OBJ); - requestSymbols.put(SYMBOL_HEADER_VALUES_IMPLICIT_OBJ.getName(), SYMBOL_HEADER_VALUES_IMPLICIT_OBJ); - requestSymbols.put(SYMBOL_PARAM_IMPLICIT_OBJ.getName(), SYMBOL_PARAM_IMPLICIT_OBJ); - requestSymbols.put(SYMBOL_PARAM_VALUES_IMPLICIT_OBJ.getName(), SYMBOL_PARAM_VALUES_IMPLICIT_OBJ); - - // TODO: these aren't maps; need to find way to handle - symbol = _symbolFactory.createBeanOrUnknownInstanceSymbol(file - .getProject(), FACES_CONTEXT_FULLY_QUALIFIED_CLASS, - FACES_CONTEXT_IMPLICIT_OBJ, - ERuntimeSource.BUILT_IN_SYMBOL_LITERAL); - requestSymbols.put(symbol.getName(), symbol); - - symbol = _symbolFactory.createBeanOrUnknownInstanceSymbol(file - .getProject(), VIEW_FULLY_QUALIFIED_CLASS, VIEW_IMPLICIT_OBJ, - ERuntimeSource.BUILT_IN_SYMBOL_LITERAL); - requestSymbols.put(symbol.getName(), symbol); - - return Collections.unmodifiableMap(requestSymbols); - } - - private Map<String,ISymbol> getSessionScopeSymbols(final IFile file) - { - ISymbol symbol = createScopeSymbol(file, - ISymbolConstants.SYMBOL_SCOPE_SESSION, SESSION_SCOPE); - - return Collections.unmodifiableMap - (Collections.singletonMap(symbol.getName(), symbol)); - } - - private Map<String,ISymbol> getApplicationScopeSymbols(final IFile file) - { - final Map<String,ISymbol> symbols = new HashMap<String, ISymbol>(); - - // TODO: may be able to resolve this one based on web.xml - symbols.put(SYMBOL_INIT_PARAM_IMPLICIT_OBJ.getName(), SYMBOL_INIT_PARAM_IMPLICIT_OBJ); - - ISymbol symbol = createScopeSymbol(file, - ISymbolConstants.SYMBOL_SCOPE_APPLICATION, APPLICATION_SCOPE); - symbols.put(symbol.getName(), symbol); - - return Collections.unmodifiableMap(symbols); - } - - private ISymbol createScopeSymbol(final IFile file, final int scopeMask, - final String name) - { - final Map mapSource = new ScopeMap(file, scopeMask); - final IMapTypeDescriptor typeDesc = SymbolFactory.eINSTANCE - .createIBoundedMapTypeDescriptor(); - typeDesc.setMapSource(mapSource); - typeDesc.setImmutable(false); // scope maps are mutable - final IInstanceSymbol symbol = SymbolFactory.eINSTANCE - .createIInstanceSymbol(); - symbol.setName(name); - symbol.setRuntimeSource(ERuntimeSource.BUILT_IN_SYMBOL_LITERAL); - symbol.setTypeDescriptor(typeDesc); - // TODO:symbol.setDetailedDescription("A Map of the application scope - // attribute values, keyed by attribute name"); - - return symbol; - } - - private static class ScopeMap extends AbstractMap - { - private final IFile _externalContextKey; - private final int _scopeMask; - - ScopeMap(final IFile externalContextKey, final int scopeMask) - { - _externalContextKey = externalContextKey; - _scopeMask = scopeMask; - } - - @Override - public Set entrySet() - { - final Map scopeMap = new HashMap(); - // do beans first so in case of name collision, beans are hidden - final DefaultBeanSymbolSourceProvider beanProvider = DefaultBeanSymbolSourceProvider - .getInstance(); - - final ISymbol beanSymbols[] = beanProvider.getSymbols( - _externalContextKey, _scopeMask); - - for (final ISymbol beanSymbol : beanSymbols) - { - scopeMap.put(beanSymbol.getName(), beanSymbol); - } - - final DesignTimeApplicationManager manager = DesignTimeApplicationManager - .getInstance(_externalContextKey.getProject()); - - if (manager != null) - { - - final IDTExternalContext externalContext = manager - .getFacesContext(_externalContextKey) - .getDTExternalContext(_externalContextKey); - - scopeMap.putAll(externalContext.getMapForScope(_scopeMask)); - } - - return scopeMap.entrySet(); - - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/symbols/DefaultDataTableSymbolFactory.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/symbols/DefaultDataTableSymbolFactory.java deleted file mode 100644 index 54111fe1c..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/symbols/DefaultDataTableSymbolFactory.java +++ /dev/null @@ -1,92 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.designtime.symbols; - -import org.eclipse.core.resources.IFile; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jst.jsf.common.internal.types.ValueType; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContextFactory; -import org.eclipse.jst.jsf.context.symbol.ERuntimeSource; -import org.eclipse.jst.jsf.context.symbol.ISymbol; -import org.w3c.dom.Element; - -/** - * The default factory for creating DataModel symbols based on an value - * expression in a dataTable. - * - * Clients may sub-class. - * - * @author cbateman - * - */ -public class DefaultDataTableSymbolFactory -{ - private final AbstractDataModelVariableFactory _dataModelSymbolFactory; - - /** - * @param dataModelSymbolFactory - */ - public DefaultDataTableSymbolFactory( - final AbstractDataModelVariableFactory dataModelSymbolFactory) - { - assert dataModelSymbolFactory != null; - _dataModelSymbolFactory = dataModelSymbolFactory; - } - - /** - * @param symbolName - * the name of the symbol to be created. Must not be null. - * @param dataTableElement - * the DOM element representing the dataTable tag. - * @param context - * the document context pointing to dataTableElement - * @return a symbol named symbolName based on the variable declared by - * dataTableElement - */ - public ISymbol createSymbolForDataTableValue(final String symbolName, - final Element dataTableElement, - final IStructuredDocumentContext context) - { - final String elText = AbstractDataModelVariableFactory - .getELText(dataTableElement); - final IFile file = FileContextUtil.deriveIFileFromContext(context); - - if (elText != null && file != null) - { - final IStructuredDocumentContext elContext = IStructuredDocumentContextFactory.INSTANCE - .getContext(context.getStructuredDocument(), - dataTableElement.getAttributeNode("value")); //$NON-NLS-1$ - - final IJavaProject javaProject = JavaCore.create(file.getProject()); - - final ValueType valueExpr = new JSFSymbolFactory() - .getValueTypeFromEL(elText, elContext, file); - - if (valueExpr != null) - { - // otherwise, we have to try to resolve the base type and see - // if it's an instanceof any of the supported implicit or - // explict types - return _dataModelSymbolFactory.createFromType(symbolName, - valueExpr, javaProject); - } - } - - // by default create a default - return _dataModelSymbolFactory.getSymbolFactory().createDefaultSymbol( - symbolName, ERuntimeSource.TAG_INSTANTIATED_SYMBOL_LITERAL, - null); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/symbols/FileContextUtil.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/symbols/FileContextUtil.java deleted file mode 100644 index 30e9e7b1d..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/symbols/FileContextUtil.java +++ /dev/null @@ -1,106 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.designtime.symbols; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.jst.jsf.context.resolver.structureddocument.IStructuredDocumentContextResolverFactory; -import org.eclipse.jst.jsf.context.resolver.structureddocument.IWorkspaceContextResolver; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext; - -/** - * Utility for deriving an IFile from an IAdaptable - * - * @author cbateman - * - */ -public final class FileContextUtil -{ - /** - * @param context - * @return an IFile derived from context or null if not derivable - */ - public static IFile deriveIFileFromContext(IAdaptable context) - { - // - if (context instanceof IFile) - { - return (IFile) context; - } - else if (context.getAdapter(IFile.class) != null) - { - return (IFile) context.getAdapter(IFile.class); - } - else if (context instanceof IStructuredDocumentContext) - { - return deriveIFileFromContext((IStructuredDocumentContext)context); - } - else - { - IStructuredDocumentContext sdContext = - (IStructuredDocumentContext) context.getAdapter(IStructuredDocumentContext.class); - - if (sdContext != null) - { - return deriveIFileFromContext(sdContext); - } - } - - return null; - } - - private static IFile deriveIFileFromContext(IStructuredDocumentContext context) - { - IWorkspaceContextResolver resolver = - IStructuredDocumentContextResolverFactory. - INSTANCE. - getWorkspaceContextResolver(context); - - if (resolver != null) - { - IResource res = resolver.getResource(); - - if (res instanceof IFile) - { - return (IFile) res; - } - } - - return null; - } - - /** - * Convenience method for getting the IProject for a document context. - * - * @param context - * @return the project associated with context or null if can't be derived - */ - public static IProject getProject(final IStructuredDocumentContext context) - { - final IWorkspaceContextResolver wkResolver = IStructuredDocumentContextResolverFactory.INSTANCE - .getWorkspaceContextResolver(context); - - if (wkResolver != null) - { - return wkResolver.getProject(); - } - return null; - } - - private FileContextUtil() - { - // no instantiation - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/symbols/JSFSymbolFactory.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/symbols/JSFSymbolFactory.java deleted file mode 100644 index 2ef108d72..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/symbols/JSFSymbolFactory.java +++ /dev/null @@ -1,420 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Matthias Fuessel -- extracted from https://bugs.eclipse.org/bugs/show_bug.cgi?id=215461 - * Cameron Bateman/Oracle - integrated and moved data table code here. - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.designtime.symbols; - -import java.util.Arrays; -import java.util.HashMap; - -import org.eclipse.core.resources.IFile; -import org.eclipse.emf.common.util.ECollections; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.Signature; -import org.eclipse.jst.jsf.common.internal.types.TypeConstants; -import org.eclipse.jst.jsf.common.internal.types.ValueType; -import org.eclipse.jst.jsf.common.util.TypeUtil; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext; -import org.eclipse.jst.jsf.context.symbol.ERuntimeSource; -import org.eclipse.jst.jsf.context.symbol.IBeanInstanceSymbol; -import org.eclipse.jst.jsf.context.symbol.IComponentSymbol; -import org.eclipse.jst.jsf.context.symbol.IInstanceSymbol; -import org.eclipse.jst.jsf.context.symbol.IJavaTypeDescriptor2; -import org.eclipse.jst.jsf.context.symbol.IMapTypeDescriptor; -import org.eclipse.jst.jsf.context.symbol.IObjectSymbol; -import org.eclipse.jst.jsf.context.symbol.ISymbol; -import org.eclipse.jst.jsf.context.symbol.InitializedSymbolFactory; -import org.eclipse.jst.jsf.context.symbol.SymbolFactory; -import org.eclipse.jst.jsf.context.symbol.internal.util.IObjectSymbolBasedValueType; -import org.eclipse.jst.jsf.designtime.resolver.IStructuredDocumentSymbolResolverFactory; -import org.eclipse.jst.jsf.designtime.resolver.StructuredDocumentSymbolResolverFactory; -import org.eclipse.jst.jsf.validation.internal.IJSFViewValidator.IValidationReporter; -import org.eclipse.jst.jsf.validation.internal.IJSFViewValidator.ReporterAdapter; -import org.eclipse.jst.jsf.validation.internal.el.ELExpressionValidator; -import org.eclipse.jst.jsf.validation.internal.el.IExpressionSemanticValidator; - -/** - * Factory for creating symbols for variables/message bundles that are - * contributed by components/tags. This Factory can be used by descendants of - * {@link org.eclipse.jst.jsf.context.symbol.source.AbstractContextSymbolFactory} in order to create the symbols they want - * to contribute. - * - * It provides also methods for getting the resulting {@link ValueType} from an - * EL expression and the "row" type signature from an DataModel/Array/List - * {@link ValueType}. - * - * NOTE: C.B March 26, 2008 -- commented out portions are left for the future - * because the rely on enhancements to the symbol model that could not be made - * in the current release. Other portions of the original ComponentSymbolFactory - * have been moved to {@link org.eclipse.jst.jsf.context.symbol.InitializedSymbolFactory} - * This reflects the split between things deemed to be generic EL (put in common - * plugin) and things deemed to be JSF-specific (put here). - * - */ -public final class JSFSymbolFactory extends InitializedSymbolFactory -{ - /** - * @param elText The EL expression text. Must not be null - * @param elContext The document context pointing to elText in the source document. Must not be null - * @param file The workspace resource that contains elText. Must not be null. - * @param symbolResolverFactory - * @return the value expression resolved from elText or null if it cannot - * be resolved or elText doesn't resolve to value expression (i.e. is a method expression) - */ - public ValueType getValueTypeFromEL(final String elText, - final IStructuredDocumentContext elContext, final IFile file, IStructuredDocumentSymbolResolverFactory symbolResolverFactory) - { - assert elText != null; - assert elContext != null; - assert file != null; - - // TODO investigate if infinite recursion; use ASTResolver instead?? - final IValidationReporter reporter = new ReporterAdapter(); - final ELExpressionValidator validator = - new ELExpressionValidator( - elContext, elText, symbolResolverFactory, reporter); - validator.validateXMLNode(); - final IExpressionSemanticValidator semValidator = validator - .getSemanticValidator(); - if (semValidator != null - && semValidator.getExpressionType() instanceof ValueType) - { - return (ValueType) semValidator.getExpressionType(); - } - return null; - } - - /** - * Convenience for {@link JSFSymbolFactory#getValueTypeFromEL(String, IStructuredDocumentContext, IFile, IStructuredDocumentSymbolResolverFactory)} - * using StructuredDocumentSymbolResolverFactory.getInstance(). - * - * @param elText - * @param elContext - * @param file - * @return a ValueType or null - */ - public ValueType getValueTypeFromEL(final String elText, - final IStructuredDocumentContext elContext, final IFile file) - { - return getValueTypeFromEL(elText, elContext, file, StructuredDocumentSymbolResolverFactory.getInstance()); - } - - /** - * @param type - * @return <code>true</code>, if the given {@link ValueType} represents - * an instance of <code>javax.faces.model.DataModel</code> - */ - private boolean isFacesDataModel(ValueType type) - { - return type.isInstanceOf(TypeConstants.TYPE_DATA_MODEL); - } - - /** - * Tries to guess the row type of a <code>javax.faces.DataModel</code> - * instance. This will only work if <code>type</code> is a descendant that - * narrows down the return type of "getRowData()". - * - * @param type - * @return the row type of the given DataModel. Will return - * <code>null</code> if <code>type</code> is no DataModel or if - * nothing more specific than <code>Object</code> can be - * determined - */ - public String getRowSignatureFromDataModel(ValueType type) - { - if (type instanceof IObjectSymbolBasedValueType) - { - ISymbol resSymbol = ((IObjectSymbolBasedValueType) type) - .getSymbol().call( - "getRowData", ECollections.emptyEList(), "res"); //$NON-NLS-1$ //$NON-NLS-2$ - if (resSymbol != null && resSymbol instanceof IObjectSymbol) - { - // TODO full signature - final String signature = ((IObjectSymbol) resSymbol) - .getTypeDescriptor().getTypeSignature(); - if (!TypeConstants.TYPE_JAVAOBJECT.equals(signature)) - { - return signature; - } - } - } - return null; - } - - /** - * @param type - * @return <code>true</code>, if <code>type</code> is a collection or - * array - */ - public boolean isContainerType(ValueType type) - { - return type.isArray() - || type.isInstanceOf(TypeConstants.TYPE_COLLECTION); - } - - /** - * @param type - - * the type of the <code>value</code> property - * @return the type signature of the row variable for every type that - * <code>UIData</code> takes as <code>value</code> property. - * Will return <code>null</code> if no type or nothing more - * specific than <code>Object</code> can be determined - */ - public String getRowSignatureFromValueType(ValueType type) - { - if (isContainerType(type)) - { - return getElementSignatureFromContainerType(type); - } - if (isFacesDataModel(type)) - { - return getRowSignatureFromDataModel(type); - } - // Otherwise, according to jsf spec, treat value as single row: - // TODO full signature - return type.getSignature(); - } - - /** - * @param symbolName The name of the symbol to be created. Must not be null - * @param signature The type signature of the array type. Must not be null - * @param source the runtime source - * @param javaProject must not be null - * @return a symbol based approximating an implicit DataModel wrapper for an array - */ - public final ISymbol createArraySymbol(final String symbolName, final String signature, final ERuntimeSource source, final IJavaProject javaProject) - { - assert symbolName != null; - assert signature != null; - assert javaProject != null; - - final String arrayElementType = Signature.getElementType(signature); - final int arrayCount = Signature.getArrayCount(signature); - String adjustedSignature = null; - - // if it is a single array nesting, then it will just be the element type, - // but if it is a multi-dim array, then the scalar element will be an array - // with one less nesting level. It's a strange corner case to have an implicit - // array of something as a row type, but it is a valid case. I suppose - // it may be happen if you want to have tables of tables in which the nested tables - // in turn use nested variables as their type... - if (arrayCount > 0) - { - adjustedSignature = Signature.createArraySignature(arrayElementType, arrayCount-1); - } - else - { - adjustedSignature = arrayElementType; - } - - return createScalarSymbol(symbolName, adjustedSignature, source, javaProject); - } - - /** - * @param symbolName The name of the symbol to create. Must not be null. - * @param signature The fully resolved type signature of the scalar. Must not be null. - * @param source - * @param javaProject The JavaProject whose classpath is to be used to resolve type information for signture. Must not be null. - * @return a symbol approximating a scalar object DataModel wrapper. The row variable for the - * data model becomes of type signature - */ - public final ISymbol createScalarSymbol(final String symbolName, final String signature, final ERuntimeSource source, final IJavaProject javaProject) - { - assert symbolName != null; - assert signature != null; - assert javaProject != null; - - final String elementType = Signature.getElementType(signature); - - IJavaTypeDescriptor2 desc = - SymbolFactory.eINSTANCE.createIJavaTypeDescriptor2(); - final int arrayCount = Signature.getArrayCount(signature); - if (arrayCount > 0) - { - desc.setArrayCount(arrayCount); - } - - IType type = TypeUtil.resolveType(javaProject, elementType); - if (type != null) - { - desc.setType(type); - } - else - { - desc.setTypeSignatureDelegate(Signature.getTypeErasure(signature)); - } - desc.getTypeParameterSignatures().addAll(Arrays.asList(Signature.getTypeArguments(signature))); - - IComponentSymbol symbol = SymbolFactory.eINSTANCE.createIComponentSymbol(); - symbol.setName(symbolName); - symbol.setTypeDescriptor(desc); - symbol.setRuntimeSource(ERuntimeSource.TAG_INSTANTIATED_SYMBOL_LITERAL); - return symbol; - } - - /** - * @param symbolName The name of the symbol to create. Must not be null. - * @param valueType The value expression representing the implicit list. The signature - * on the valueType must be a list. Must not be null. - * @param source - * @param description - * @param javaProject The JavaProject whose classpath will be used to resolve types. Must not be null. - * - * @return a symbol that approximates as best as possible an implicit DataModel for java.util.List value expressions. If the List has - * resolvable Java 5 type arguments, then a scalar symbol will be created - * using this type information. If it is a raw type, then - * createDefaultSymbol() is called - */ - public final ISymbol createFromList(String symbolName, ValueType valueType, ERuntimeSource source, String description, IJavaProject javaProject) - { - assert symbolName != null; - assert valueType != null; - assert javaProject != null; - assert TypeConstants.TYPE_LIST.equals(valueType.getSignature()); - - final String[] typeArguments = valueType.getTypeArguments(); - - if (typeArguments != null && typeArguments.length > 0) - { - // a list has a single type argument - final String typeArg = typeArguments[0]; - - if (Signature.getTypeSignatureKind(typeArg) == Signature.CLASS_TYPE_SIGNATURE) - { - return createScalarSymbol(symbolName, typeArg, source, javaProject); - } - } - - // if no resolvable type signatures, do the default thing - return createDefaultSymbol(symbolName, ERuntimeSource.TAG_INSTANTIATED_SYMBOL_LITERAL, description); - } - - /** - * @param symbolName The name of the symbol to create. Must not be null - * @param source - * @param description - * @return a default symbol that eliminates bogus warnings for this dataTable's - * row variable in cases where something better is resolvable. Note that this is - * not ideal, since will result in any property being accepted on the variable with - * this name. - */ - public final ISymbol createDefaultSymbol(final String symbolName, final ERuntimeSource source, final String description) - { - assert symbolName != null; - - final IMapTypeDescriptor typeDesc = - SymbolFactory.eINSTANCE.createIBoundedMapTypeDescriptor(); - // empty map source - typeDesc.setMapSource(new HashMap()); - final IComponentSymbol symbol = - SymbolFactory.eINSTANCE.createIComponentSymbol(); - symbol.setName(symbolName); - symbol.setTypeDescriptor(typeDesc); - symbol.setDetailedDescription(description); //$NON-NLS-1$ - symbol.setRuntimeSource(source); - return symbol; - } - - /** - * FUTURE use: added to support future API feature. Should not be used. - * @param symbolName - * @param bundleName - * @param project - * @return an instance symbol for the message bundle - */ - public IInstanceSymbol createMessageBundleSymbol(final String symbolName, final String bundleName, IJavaProject project) - { - // FUTURE USE - throw new UnsupportedOperationException("see https://bugs.eclipse.org/bugs/show_bug.cgi?id=215461"); - } - - /** - * FUTURE use: added to support future API feature. Should not be used. - * @param symbolName - * @param fullyQualifiedName - * @param source - * @param description - * @param javaProject - * @return an instance symbol for the message bundle - */ - public IBeanInstanceSymbol createManagedBeanSymbol(final String symbolName, final String fullyQualifiedName, - ERuntimeSource source, final String description, final IJavaProject javaProject) - { - // FUTURE USE - throw new UnsupportedOperationException("see https://bugs.eclipse.org/bugs/show_bug.cgi?id=215461"); - } - -// / /** -// * @param symbolName -// * @param signature -// * @param javaProject -// * @return a symbol for a bean -// */ -// public IComponentBeanSymbol createBeanSymbolFromSignature( -// final String symbolName, final String signature, -// final IJavaProject javaProject) -// { -// IJavaTypeDescriptor2 desc = createTypeDescriptorFromSignature( -// signature, javaProject); -// -// IComponentBeanSymbol symbol = SymbolFactory.eINSTANCE -// .createIComponentBeanSymbol(); -// symbol.setName(symbolName); -// symbol.setTypeDescriptor(desc); -// symbol.setRuntimeSource(ERuntimeSource.TAG_INSTANTIATED_SYMBOL_LITERAL); -// return symbol; -// } - -// /** -// * @param symbolName -// * @param bundleName -// * @param project -// * @return a symbol for a message bundle -// */ -// public IMessageBundleSymbol createMessageBundleSymbolFromBundleName(final String symbolName, final String bundleName, IJavaProject project) { -// final IMessageBundleTypeDescriptor typeDesc = SymbolFactory.eINSTANCE.createIMessageBundleTypeDescriptor(); -// try { -// Map mapSource = ResourceBundleMapSourceFactory.getResourceBundleMapSource(project.getProject(), bundleName); -// typeDesc.setMapSource(mapSource); -// } catch (JavaModelException e) { -// JSFCorePlugin.log(e, "Error creating resource map for bundle '"bundleName "'"); //$NON-NLS-1$ //$NON-NLS-2$ -// } catch (IOException e) { -// JSFCorePlugin.log(e, "Error creating resource map for bundle '"bundleName "'"); //$NON-NLS-1$ //$NON-NLS-2$ -// } catch (CoreException e) { -// JSFCorePlugin.log(e, "Error creating resource map for bundle '"bundleName "'"); //$NON-NLS-1$ //$NON-NLS-2$ -// } -// final IMessageBundleSymbol symbol = SymbolFactory.eINSTANCE.createIMessageBundleSymbol(); -// symbol.setName(symbolName); -// symbol.setTypeDescriptor(typeDesc); -// symbol.setDetailedDescription(NLS.bind(Messages.getString("ComponentSymbolFactory.IMessageBundleSymbol.detailedDescription"), bundleName)); //$NON-NLS-1$ -// return symbol; -// } -// /** -// * Sets the symbol to be defined only inside the given element -// * -// * @param symbol -// * @param slement -// */ -// public void setDefinitionRange(final IComponentVar symbol, -// final Element slement) -// { -// if (slement instanceof IndexedRegion) -// { -// final IndexedRegion defRegion = (IndexedRegion) slement; -// final int defOffset = defRegion.getStartOffset(); -// final int defLength = defRegion.getLength(); -// symbol.setDefinitionRange(defOffset, defLength); -// } -// } - -}
\ No newline at end of file diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/symbols/Messages.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/symbols/Messages.java deleted file mode 100644 index e68910e60..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/symbols/Messages.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.symbols; - -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -/*package*/ class Messages { - private static final String BUNDLE_NAME = "org.eclipse.jst.jsf.designtime.messages"; //$NON-NLS-1$ - - private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle - .getBundle(BUNDLE_NAME); - - private Messages() { - // no external instantiation - } - - /** - * @param key - * @return the resource or !key! if not found. - */ - public static String getString(String key) { - try { - return RESOURCE_BUNDLE.getString(key); - } catch (MissingResourceException e) { - return '!' + key + '!'; - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/symbols/SymbolUtil.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/symbols/SymbolUtil.java deleted file mode 100644 index 18a8594c5..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/symbols/SymbolUtil.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.designtime.symbols; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.jst.jsf.context.symbol.ISymbol; - -/** - * Utilities for symbol handling - * - * @author cbateman - * - */ -public final class SymbolUtil -{ - /** - * @param symbols - * @param name - * @return the symbol in symbols matching name or null if not there - */ - public static ISymbol findSymbolByName(final ISymbol[] symbols, final String name) - { - for (int i = 0; i < symbols.length; i++) - { - if (name.equals(symbols[i].getName())) - { - return symbols[i]; - } - } - - // if not found, return null - return null; - } - - /** - * @param allSymbols - * @param prefix - * @return an array of symbols filtered based on name.startsWith(prefix) - */ - public static ISymbol[] filterSymbolsByPrefix(final ISymbol[] allSymbols, final String prefix) - { - List filteredSymbols = new ArrayList(allSymbols.length); - for (int i = 0; i < allSymbols.length; i++) - { - if (allSymbols[i].getName().startsWith(prefix)) - { - filteredSymbols.add(allSymbols[i]); - } - } - - return (ISymbol[]) filteredSymbols.toArray(ISymbol.EMPTY_SYMBOL_ARRAY); - } - - private SymbolUtil() - { - // no external instantiation - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/symbols/package-info.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/symbols/package-info.java deleted file mode 100644 index 6ccfac93d..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/symbols/package-info.java +++ /dev/null @@ -1,16 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - * - ********************************************************************************/ - -/** - * Design Time EL Symbol Contribution framework. - */ -package org.eclipse.jst.jsf.designtime.symbols; diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/AbstractMetaDataEnabledFeature.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/AbstractMetaDataEnabledFeature.java deleted file mode 100644 index c022bd901..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/AbstractMetaDataEnabledFeature.java +++ /dev/null @@ -1,156 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.metadataprocessors; - -import java.util.Collections; -import java.util.List; - -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jst.jsf.common.metadata.Entity; -import org.eclipse.jst.jsf.common.metadata.Trait; -import org.eclipse.jst.jsf.common.metadata.internal.IImageDescriptorProvider; -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataSourceModelProvider; -import org.eclipse.jst.jsf.common.metadata.internal.TraitValueHelper; -import org.eclipse.jst.jsf.common.metadata.query.TaglibDomainMetaDataQueryHelper; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext; -import org.eclipse.jst.jsf.metadataprocessors.features.IPossibleValues; - -/** - * Simple abstract class that implementers of {@link IMetaDataEnabledFeature} can subclass in the <b>TagLibDomain</b> of metadata - * <p><b>Provisional API - subject to change</b></p>* - */ -public abstract class AbstractMetaDataEnabledFeature implements IMetaDataEnabledFeature{ - - private MetaDataContext mdContext; - private IStructuredDocumentContext sdContext; - - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.metadataprocessors.IMetaDataEnabledFeature#setMetaDataContext(org.eclipse.jst.jsf.metadataprocessors.MetaDataContext) - */ - public void setMetaDataContext(final MetaDataContext context) { - this.mdContext = context; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.metadataprocessors.IMetaDataEnabledFeature#getMetaDataContext() - */ - public MetaDataContext getMetaDataContext() { - return mdContext; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.metadataprocessors.IMetaDataEnabledFeature#setStructuredDocumentContext(org.eclipse.wtp.jsf.context.structureddocument.IStructuredDocumentContext) - */ - public void setStructuredDocumentContext(final IStructuredDocumentContext context) { - this.sdContext = context; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.metadataprocessors.IMetaDataEnabledFeature#getStructuredDocumentContext() - */ - public IStructuredDocumentContext getStructuredDocumentContext() { - return sdContext; - } - -// private IProject getProject(){ -// if (_project == null){ -// _project = IStructuredDocumentContextResolverFactory.INSTANCE.getWorkspaceContextResolver(sdContext).getProject(); -// } -// return _project; -// } - - - //common metadata accessors - /** - * Return the single expected String value for a given property. - * - * @param traitName property name - * @return String value - */ - protected String getTraitValueAsString(final String traitName){ - Trait t = getTraitForEntityUsingContext(traitName); - if (t != null){ - return TraitValueHelper.getValueAsString(t); - } - - return null; - - } - - /** - * Return the List of values for a given property. - * - * @param traitName trait name - * @return List of String values - */ - protected List getTraitValueAsListOfStrings(final String traitName){ - Trait t = getTraitForEntityUsingContext(traitName); - if (t != null){ - return TraitValueHelper.getValueAsListOfStrings(t); - } - - return Collections.EMPTY_LIST; - } - - /** - * Return a boolean value for the given named trait . - * - * @param traitName property name - * @return boolean value. Returns false if trait was not located. - */ - protected boolean getTraitValueAsBoolean(final String traitName){ - Trait t = getTraitForEntityUsingContext(traitName); - if (t != null){ - return TraitValueHelper.getValueAsBoolean(t); - } - - return false; - - } - private Trait getTraitForEntityUsingContext(final String traitName) { - //look for trait on given entity - final Entity entity = getMetaDataContext().getEntity(); - return TaglibDomainMetaDataQueryHelper.getTrait(entity, traitName); - } - - /** - * @return small-icon name - */ - protected String getSmallIcon() { - return getTraitValueAsString(IPossibleValues.POSSIBLE_VALUES_SMALL_ICON_PROP_NAME); - } - - /** - * @return ImageDescriptor from the small-icon property for annotation from the same - * source model provider as the trait - */ - protected ImageDescriptor getImage() { - final String smallIcon = getSmallIcon(); - if (smallIcon == null) - return null; - - try { - Trait t = getMetaDataContext().getTrait(); - IMetaDataSourceModelProvider provider = t.getSourceModelProvider(); - IImageDescriptorProvider ip = (IImageDescriptorProvider)provider.getAdapter(IImageDescriptorProvider.class); - if (ip != null){ - return ip.getImageDescriptor(smallIcon); - } - } catch (RuntimeException e) { - //TODO: log error? - - } - return null; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/AbstractRootTypeDescriptor.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/AbstractRootTypeDescriptor.java deleted file mode 100644 index 00b1ed842..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/AbstractRootTypeDescriptor.java +++ /dev/null @@ -1,108 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.metadataprocessors; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.runtime.Assert; -import org.eclipse.jst.jsf.metadataprocessors.internal.IMetaDataEnabledFeatureExtension; -import org.eclipse.jst.jsf.metadataprocessors.internal.MetaDataEnabledFeatureAdapterFactory; -import org.eclipse.jst.jsf.metadataprocessors.internal.MetaDataEnabledFeatureRegistry; - - -/** - * Default implementation that a metadata type should strongly consider for using as it's root. - * This implementation allows for a class implementing {@link ITypeDescriptor} to also contain features so - * that it is not necessary to declare the features using the MetaDataEnabledFeatures ext-pt - * <p><b>Provisional API - subject to change</b></p> - * @author Gerry Kessler - Oracle - */ -public abstract class AbstractRootTypeDescriptor extends AbstractMetaDataEnabledFeature - implements ITypeDescriptor { - - private IType type; - - /** - * Default implementation that will return <code>this</code> if it supports the processing feature, - * and all {@link IMetaDataEnabledFeature}s that also support this feature on this type. The caller can determine - * which one or more of the returned processors to use. - * - * @param processingFeature class - * @return List of <code>IMetaDataEnabledFeature</code>s that support the - * specified featureType interface. - * - * @see org.eclipse.jst.jsf.metadataprocessors.ITypeDescriptor#getFeatureAdapters(java.lang.Class) - */ - public List getFeatureAdapters(Class processingFeature) { - Assert.isTrue(processingFeature.isInterface()); - List ret = new ArrayList(3); - if (processingFeature.isInstance(this)) { -// ((IMetaDataEnabledFeature)this).setBundleID(type.getBundleID()); - ret.add(this); - } - - //add extensions here - ret.addAll(findMetaDataEnabledFeaturesForThisType(processingFeature)); - return ret; - - } - - /** - * This implementation relies on the the feature implementor using a subclass of AbstractRootTypeDescriptor - * which implements {@link IMetaDataEnabledFeature}. - * - * @param processingFeature - * @return list of <code>IMetaDataEnabledFeature</code>s - */ - protected final List<IMetaDataEnabledFeature> findMetaDataEnabledFeaturesForThisType(Class processingFeature) { - Map <String, IMetaDataEnabledFeature> mapOfFeatures = new HashMap<String, IMetaDataEnabledFeature>(); - List extensions = MetaDataEnabledFeatureRegistry.getInstance() - .getFeatures(getTypeExtension().getTypeID()); - - if (!extensions.isEmpty()){ - for (int i=0;i<extensions.size();i++){ - IMetaDataEnabledFeatureExtension aFeature = (IMetaDataEnabledFeatureExtension)extensions.get(i); - IMetaDataEnabledFeature feature = MetaDataEnabledFeatureAdapterFactory.getInstance().getFeatureAdapter(aFeature, processingFeature); - if (feature != null && processingFeature.isInstance(feature) - && ! mapOfFeatures.containsKey(aFeature.getClassName())){ - mapOfFeatures.put(aFeature.getClassName(),feature); - } - } - } - List<IMetaDataEnabledFeature> ret = new ArrayList<IMetaDataEnabledFeature>(mapOfFeatures.size()); - for (IMetaDataEnabledFeature feature: mapOfFeatures.values()){ - ret.add(feature); - } - return ret; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.metadataprocessors.ITypeDescriptor#getRuntimeType() - */ - public IType getTypeExtension() { - return type; - } - - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.metadataprocessors.ITypeDescriptor#setRuntimeType(org.eclipse.jst.jsf.metadataprocessors.internal.AbstractMetaDataEnabledType) - */ - public void setTypeExtension(IType type) { - this.type = type; - } - - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/DefaultTypeDescriptor.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/DefaultTypeDescriptor.java deleted file mode 100644 index 49b5ad916..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/DefaultTypeDescriptor.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.metadataprocessors; - - -/** - * Type descriptor that is created if no class if provided for the implementation - * in the AttributeValueRuntimeTypes extension point. - * <p><b>Provisional API - subject to change</b></p> - * @author Gerry Kessler - Oracle - * - */ -public class DefaultTypeDescriptor extends AbstractRootTypeDescriptor { - // abstract super contains no abstract methods, so do nothing: automatic default -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/IMetaDataEnabledFeature.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/IMetaDataEnabledFeature.java deleted file mode 100644 index f25054ddf..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/IMetaDataEnabledFeature.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.metadataprocessors; - -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext; - -/** - * Required interface used by the MetaData feature processing framework. - * All features must extend this interface. - * <p><b>Provisional API - subject to change</b></p> - * @author Gerry Kessler - Oracle - * - */ -public abstract interface IMetaDataEnabledFeature { - - /** - * Sets structured document context that this feature will operating on - * @param context - */ - public void setStructuredDocumentContext(IStructuredDocumentContext context); - - /** - * Gets structured document context that this feature will operating on - * @return IStructuredDocumentContext - */ - public IStructuredDocumentContext getStructuredDocumentContext(); - - /** - * Sets metadata model context that this feature will operating on - * @param context - */ - public void setMetaDataContext(MetaDataContext context); - - /** - * Gets metadata model context that this feature will be operating on. - * @return MetaDataContext - */ - public MetaDataContext getMetaDataContext(); - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/IType.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/IType.java deleted file mode 100644 index 7466b576c..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/IType.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.metadataprocessors; - - -/** - * Interface representing the information contained by the type registries. - * Encapsulates the IConfigurationElement information. - * <p><b>Provisional API - subject to change</b></p> - * @author Gerry Kessler - Oracle - * - */ -public interface IType { - /** - * @return type id - */ - public String getTypeID(); - /** - * @return bundle id where it is defined - */ - public String getBundleID(); - /** - * @return classname for the type that must be located within the bundle - */ - public String getClassName(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/ITypeDescriptor.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/ITypeDescriptor.java deleted file mode 100644 index 0031ebb76..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/ITypeDescriptor.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.metadataprocessors; - -import java.util.List; - -/** - * Interface describing the runtime type of a metadata enabled annotation. - * The type descriptor will load the feature adapters for a certain kind of - * feature that it supports. The type descriptor is registered by an extension point. - * <p><b>Provisional API - subject to change</b></p> - * @see IMetaDataEnabledFeature - * @see AbstractRootTypeDescriptor - * @see org.eclipse.jst.jsf.metadataprocessors.internal.AbstractMetaDataEnabledTypeFactory - * @see IType - * - * @author Gerry Kessler - Oracle - * - */ -public interface ITypeDescriptor { - /** - * @param type - * The IType must be set after the ITypeDescriptor is constructed - */ - public void setTypeExtension(IType type); - /** - * @return IType - * Must not be null - */ - public IType getTypeExtension(); - - /** - * @param processingFeature interface class - * @return List of <code>IMetaDataEnabledFeature</code>s that support the - * specified processingFeature interface. - */ - public List<IMetaDataEnabledFeature> getFeatureAdapters(Class processingFeature); - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/MetaDataContext.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/MetaDataContext.java deleted file mode 100644 index 5876340d2..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/MetaDataContext.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.metadataprocessors; - -import org.eclipse.jst.jsf.common.metadata.Entity; -import org.eclipse.jst.jsf.common.metadata.Trait; - - -/** - * The current meta data model context being used for processing. - * <p><b>Provisional API - subject to change</b></p> - * - */ -public class MetaDataContext { - private Trait trait; - private Entity entity; - - /** - * Constructor - * @param entity - * @param trait - */ - public MetaDataContext(Entity entity, Trait trait) { - this.entity = entity; - this.trait = trait; - } - - /** - * @return Entity - */ - public Entity getEntity(){ - return entity; - } - /** - * @return Trait - */ - public Trait getTrait(){ - return trait; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/MetaDataEnabledProcessingFactory.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/MetaDataEnabledProcessingFactory.java deleted file mode 100644 index 0b3f15782..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/MetaDataEnabledProcessingFactory.java +++ /dev/null @@ -1,177 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.metadataprocessors; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.jsf.common.dom.AttributeIdentifier; -import org.eclipse.jst.jsf.common.metadata.Entity; -import org.eclipse.jst.jsf.common.metadata.Trait; -import org.eclipse.jst.jsf.common.metadata.internal.TraitValueHelper; -import org.eclipse.jst.jsf.common.metadata.query.ITaglibDomainMetaDataModelContext; -import org.eclipse.jst.jsf.common.metadata.query.TaglibDomainMetaDataQueryHelper; -import org.eclipse.jst.jsf.context.resolver.structureddocument.IStructuredDocumentContextResolverFactory; -import org.eclipse.jst.jsf.context.resolver.structureddocument.IWorkspaceContextResolver; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext; -import org.eclipse.jst.jsf.metadataprocessors.internal.AttributeValueRuntimeTypeFactory; - -/** - * Singleton class that will produce <code>IMetaDataEnabledFeature</code>s - * that the caller can use for processing. - * <p> - * <b>Provisional API - subject to change</b> - * </p> - * - * @author Gerry Kessler - Oracle - * - */ -public final class MetaDataEnabledProcessingFactory { - private static MetaDataEnabledProcessingFactory INSTANCE; - - /** - * Name of property in annotation file to use when applying a runtime type - * to an attribute value - */ - public static final String ATTRIBUTE_VALUE_RUNTIME_TYPE_PROP_NAME = "attribute-value-runtime-type"; - - /** - * @return singleton instance - */ - public static MetaDataEnabledProcessingFactory getInstance() { - if (INSTANCE == null) { - INSTANCE = new MetaDataEnabledProcessingFactory(); - } - return INSTANCE; - } - - private MetaDataEnabledProcessingFactory() { - super(); - } - - /** - * Returns list of <code>IMetaDataEnabledFeature</code> adapters for the - * given Taglibrary attribute. - * - * Adapters will be scanned for first by uri, element, attribute and if not - * found, uri, "*", attribute and if still not found by "*", "*", attribute. - * - * @param featureType - * feature type. eg. <code>IPossibleValues</code>, - * <code>IValidValues</code>, etc. Must be subclass of - * IMetaDataEnabledFeature. - * @param sdContext - * @param uri - * annotation file uri - * @param elementName - * @param attributeName - * @return returns null - if the metadata was not found <br> - * returns empty list - if not a - * <code>IMetaDataEnabledFeature</code> processor or is not valid - * or does not support the specified feature - * - * @see MetaDataEnabledProcessingFactory#ATTRIBUTE_VALUE_RUNTIME_TYPE_PROP_NAME - */ - public List<IMetaDataEnabledFeature> getAttributeValueRuntimeTypeFeatureProcessors( - Class featureType, IStructuredDocumentContext sdContext, - String uri, String elementName, String attributeName) { - - // look up the attribute's runtime type from MD - IProject _project = null; - if (sdContext != null) { - IWorkspaceContextResolver resolver = IStructuredDocumentContextResolverFactory.INSTANCE - .getWorkspaceContextResolver(sdContext); - _project = resolver != null ? resolver.getProject() : null; - } - String _elem = elementName + "/" + attributeName; - String _uri = uri; - ITaglibDomainMetaDataModelContext modelContext = TaglibDomainMetaDataQueryHelper - .createMetaDataModelContext(_project, _uri); - Entity attrEntity = TaglibDomainMetaDataQueryHelper.getEntity(modelContext, - _elem); - - if (attrEntity != null) - return getAttributeValueRuntimeTypeFeatureProcessors(featureType, sdContext, attrEntity); - - return Collections.EMPTY_LIST; - - } - - /** - * A convenience method fully equivalent to: - * - * getAttributeValueRuntimeTypeFeatureProcessors - * (featureType, sdContext, attributeId.getTagIdentifier().getUri() - * , attributeId.getTagIdentifier().getTagName(), - * attributeId.getName()) - * @param featureType - * @param sdContext - * @param attributeId - * @return the meta-data enabled feature - */ - public List<IMetaDataEnabledFeature> getAttributeValueRuntimeTypeFeatureProcessors( - Class featureType, IStructuredDocumentContext sdContext, - AttributeIdentifier attributeId) - { - return getAttributeValueRuntimeTypeFeatureProcessors - (featureType, sdContext, attributeId.getTagIdentifier().getUri() - , attributeId.getTagIdentifier().getTagName(), - attributeId.getName()); - } - - /** - * @param featureType - * @param sdContext - * @param attrEntity - * @return returns null - if the meta data was not found <br> - * returns empty list - if not a - * <code>IMetaDataEnabledFeature</code> processor or is not valid - * or does not support the specified feature - */ - public List<IMetaDataEnabledFeature> getAttributeValueRuntimeTypeFeatureProcessors( - Class featureType, IStructuredDocumentContext sdContext, - Entity attrEntity) { - - Trait trait = TaglibDomainMetaDataQueryHelper.getTrait(attrEntity, - ATTRIBUTE_VALUE_RUNTIME_TYPE_PROP_NAME); - - if (trait == null) { - return Collections.EMPTY_LIST; - } - - List<IMetaDataEnabledFeature> retList = new ArrayList<IMetaDataEnabledFeature>(2); - String typeId = TraitValueHelper.getValueAsString(trait); - - // get the implementing class for the type - ITypeDescriptor type = AttributeValueRuntimeTypeFactory.getInstance() - .getType(typeId); - if (type != null) { - MetaDataContext context = new MetaDataContext(attrEntity, trait); - // get all the feature adapters (IMetaDataEnabledFeature) for this - // type - List<IMetaDataEnabledFeature> featureAdapters = type.getFeatureAdapters(featureType); - for (int j = 0; j < featureAdapters.size(); j++) { - // set the context in the feature - featureAdapters.get(j).setMetaDataContext(context); - featureAdapters.get(j).setStructuredDocumentContext(sdContext); - retList.add(featureAdapters.get(j)); - } - - } - // return list of IMetaDataEnabledFeatures for this type - return Collections.unmodifiableList(retList); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/TaglibMetadataContext.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/TaglibMetadataContext.java deleted file mode 100644 index 71809e830..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/TaglibMetadataContext.java +++ /dev/null @@ -1,84 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.metadataprocessors; - -import org.eclipse.core.runtime.Assert; -import org.eclipse.jst.jsf.common.metadata.Entity; -import org.eclipse.jst.jsf.common.metadata.Trait; - -/** - * Binds tag library context to the metadata context - * <p><b>Provisional API - subject to change</b></p> - * @deprecated - should not have been public, and no reason anyone should be using this class - */ -public class TaglibMetadataContext extends MetaDataContext { - - private String uri; - private String tagName; - private String attributeName; - - /** - * Constructor - * - * @param uri - must not be null - * @param tagName - must not be null - * @param attributeName - may be null - * @param entity - the metadata entity represented by the tag or attribute - * @param trait - the metadata trait of interest - */ - public TaglibMetadataContext(String uri, String tagName, String attributeName, Entity entity, Trait trait){ - super(entity, trait); - this.uri = uri; - this.tagName = tagName; - this.attributeName = attributeName; - } - - /** - * Package-private Constructor - * - * @param tagAttrEntity - must be tag attribute entity and not null - * @param trait - */ - /*package*/ TaglibMetadataContext(Entity tagAttrEntity, Trait trait){ - super(tagAttrEntity, trait); - Assert.isNotNull(tagAttrEntity); - this.uri = tagAttrEntity.getModel().getCurrentModelContext().getUri(); - if (!(tagAttrEntity.eContainer() instanceof Entity)) - { - throw new IllegalArgumentException("tagAttrEntity must be contained in a tag Entity to use this constructor"); - } - this.tagName = ((Entity)tagAttrEntity.eContainer()).getId(); - this.attributeName = tagAttrEntity.getId(); - } - - /** - * @return URI - */ - public String getUri() { - return uri; - } - - /** - * @return Tag name - should not be null - */ - public String getTagName() { - return tagName; - } - - /** - * @return Attribute name - may be null - */ - public String getAttributeName() { - return attributeName; - } - - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/ELIsNotValidException.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/ELIsNotValidException.java deleted file mode 100644 index f1b5b1698..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/ELIsNotValidException.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.metadataprocessors.features; - -/** - * Exception - * - * <p><b>Provisional API - subject to change</b></p> - */ -public class ELIsNotValidException extends Exception { - private static final long serialVersionUID = 1L; - - /** - * Constructor - * @param msg - */ - public ELIsNotValidException(String msg){ - super(msg); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/ICreateValues.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/ICreateValues.java deleted file mode 100644 index 6c25a65d8..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/ICreateValues.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.metadataprocessors.features; - -import org.eclipse.jst.jsf.metadataprocessors.IMetaDataEnabledFeature; - -/** - * @author Gerry Kessler - Oracle - * - * Experimental - not currently used - * <p><b>Provisional API - subject to change</b></p> - * - */ -public interface ICreateValues extends IMetaDataEnabledFeature{ - /** - * @return object created - */ - public Object createValue(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/IDefaultValue.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/IDefaultValue.java deleted file mode 100644 index 93d93b812..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/IDefaultValue.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.metadataprocessors.features; - -import org.eclipse.jst.jsf.metadataprocessors.IMetaDataEnabledFeature; - -/** - * Interface providing a default value. - * - * @author Gerry Kessler - Oracle - * - * <p><b>Provisional API - subject to change</b></p> - * - */ -public interface IDefaultValue extends IMetaDataEnabledFeature { - /** - * Default name of property in annotation file to use when supplying default values from meta-data - */ - String DEFAULT_VALUE_PROP_NAME = "default-value"; - - /** - * @return default value or null if one not defined - */ - public String getDefaultValue(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/IPossibleValue.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/IPossibleValue.java deleted file mode 100644 index d4cdbf955..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/IPossibleValue.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.metadataprocessors.features; - -import org.eclipse.jface.resource.ImageDescriptor; - -/** - * Interface for providing lists of possible values - * Values can be different than displayed values. - * - * <p><b>Provisional API - subject to change</b></p> - * - */ -public interface IPossibleValue { - /** - * @return value to set. should not return null. - */ - public String getValue(); - /** - * @return value to display in a proposal which can be different than what is set. Must not return null. - */ - public String getDisplayValue(); - /** - * @return ImageDescriptor for image to be displayed in a proposal. May be null. - */ - public ImageDescriptor getIcon(); - /** - * @return true if is known to be the default value. - */ - public boolean isDefaultValue(); - - /** - * @return additional information that could be used for descriptive help - * May be null - */ - public String getAdditionalInformation(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/IPossibleValues.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/IPossibleValues.java deleted file mode 100644 index 4d43d8706..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/IPossibleValues.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.metadataprocessors.features; - -import java.util.List; - -import org.eclipse.jst.jsf.metadataprocessors.IMetaDataEnabledFeature; - -/** - * Interface for providing possible values. - * - * <p><b>Provisional API - subject to change</b></p> - * @author Gerry Kessler - Oracle - * - */ -public interface IPossibleValues extends IMetaDataEnabledFeature{ - - /** - * Default name of property in annotation file to use when supplying possible values from meta-data - */ - public static final String POSSIBLE_VALUES_PROP_NAME = "valid-values"; - /** - * Default name of property in annotation file to use when supplying possible displayed values from meta-data - */ - public static final String POSSIBLE_VALUES_FOR_DISPLAY_PROP_NAME = "displayed-values"; - /** - * Default name of property in annotation file to use when supplying icon displayed values from meta-data - */ - public static final String POSSIBLE_VALUES_SMALL_ICON_PROP_NAME = "small-icon"; - /** - * @return List of IPossibleValue instances representing possible values - * Implementer must ensure that an empty rather than null list is returned if no values are posssible. - */ - public List getPossibleValues(); - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/IValidELValues.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/IValidELValues.java deleted file mode 100644 index ca0b8f697..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/IValidELValues.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.metadataprocessors.features; - -import org.eclipse.jst.jsf.common.internal.types.CompositeType; -import org.eclipse.jst.jsf.metadataprocessors.IMetaDataEnabledFeature; - -/** - * An {@link IMetaDataEnabledFeature} for semantic validation of EL Values - * - * <p><b>Provisional API - subject to change</b></p> - */ -public interface IValidELValues extends IMetaDataEnabledFeature { - /** - * Expected runtime type for EL value - * @return CompositeType - * @throws ELIsNotValidException - */ - public CompositeType getExpectedRuntimeType() throws ELIsNotValidException; -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/IValidValues.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/IValidValues.java deleted file mode 100644 index 25baa406a..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/IValidValues.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.metadataprocessors.features; - -import java.util.List; - -import org.eclipse.jst.jsf.metadataprocessors.IMetaDataEnabledFeature; - -/** - * An {@link IMetaDataEnabledFeature} for validating values using metadata - * - * <p><b>Provisional API - subject to change</b></p> - */ -public interface IValidValues extends IMetaDataEnabledFeature{ - /** - * Trait name for valid-values - */ - public static final String VALID_VALUES_PROP_NAME = "valid-values"; - - /** - * Trait name for valid-values-code - */ - public static final String VALID_VALUES_CODE_PROP_NAME = VALID_VALUES_PROP_NAME + "-code"; - /** - * Trait name for valid-values-severity - */ - public static final String VALID_VALUES_SEVERITY_PROP_NAME = VALID_VALUES_PROP_NAME + "-severity"; - /** - * Trait name for valid-values-message - */ - public static final String VALID_VALUES_MESSAGE_PROP_NAME = VALID_VALUES_PROP_NAME + "-message"; - /** - * Trait name for valid-maximum - */ - public static final String VALID_VALUES_MAX_PROP_NAME = "valid-maximum"; - /** - * Trait name for valid-minimum - */ - public static final String VALID_VALUES_MIN_PROP_NAME = "valid-minimum"; - /** - * @param value fully resolved value as String - * @return true if is valid - */ - public boolean isValidValue(String value); - /** - * @return List of IValidationMessage objects if invalid - * Must return empty list rather than null - * Call to isValidValue(String value) required before this should be called. - */ - public List getValidationMessages(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/IValidationMessage.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/IValidationMessage.java deleted file mode 100644 index 4f29c782d..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/IValidationMessage.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.metadataprocessors.features; - -/** - * Interface for validation messages for metadata features - * - * <p><b>Provisional API - subject to change</b></p> - */ -public interface IValidationMessage { - /** - * @return localized string desribing validation issue - * Should not be null; - */ - public String getMessage(); - - /** - * @return String representing a validation code associated with validation issue - * Can return null - */ - public String getCode(); - - /** - * @return integer value representing severity. - * Valid values are 0 (IStatus.INFO), 1 (IStatus.WARNING) and 4 (IStatus.ERROR) - */ - public int getSeverity(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/PossibleValue.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/PossibleValue.java deleted file mode 100644 index dbbde0636..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/PossibleValue.java +++ /dev/null @@ -1,135 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.metadataprocessors.features; - -import org.eclipse.jface.resource.ImageDescriptor; - - -/** - * Implements {@link IPossibleValues} - * - * <p><b>Provisional API - subject to change</b></p> - * - */ -public class PossibleValue implements IPossibleValue { - private String value; - private String displayValue; - private ImageDescriptor smallIcon; - private boolean isDefault = false; - private String additionalInfo; - - /** - * Constructor when display value is same as stored value - * @param value - */ - public PossibleValue(String value){ - this.value = value; - } - - /** - * Constructor when display-value may be different than stored value - * @param value - * @param displayValue - */ - public PossibleValue(String value, String displayValue){ - this.value = value; - this.displayValue = displayValue; - } - - /** - * Constructor when display-value may be different than stored value - * and a default value is known - * @param value - * @param displayValue - * @param isDefaultValue - */ - public PossibleValue(String value, String displayValue, boolean isDefaultValue) { - this.value = value; - this.displayValue = displayValue; - this.isDefault = isDefaultValue; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.metadataprocessors.features.IPossibleValue#getValue() - */ - public String getValue() { - return value; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.metadataprocessors.features.IPossibleValue#getDisplayValue() - */ - public String getDisplayValue() { - if (displayValue == null) - return value; - return displayValue; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.metadataprocessors.features.IPossibleValue#getIcon() - */ - public ImageDescriptor getIcon() { - return smallIcon; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.metadataprocessors.features.IPossibleValue#isDefaultValue() - */ - public boolean isDefaultValue() { - return isDefault; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.metadataprocessors.features.IPossibleValue#getAdditionalInformation() - */ - public String getAdditionalInformation() { - return additionalInfo; - } - - /** - * @param value - */ - public void setValue(String value) { - this.value = value; - } - - /** - * @param displayValue - */ - public void setDisplayValue(String displayValue) { - this.displayValue = displayValue; - } - - /** - * @param smallIcon - */ - public void setIcon(ImageDescriptor smallIcon) { - this.smallIcon = smallIcon; - } - - /** - * @param isDefault - */ - public void setIsDefault(boolean isDefault) { - this.isDefault = isDefault; - } - - /** - * @param additionalInfo - */ - public void setAdditionalInformation(String additionalInfo){ - this.additionalInfo = additionalInfo; - } - - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/ValidationMessage.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/ValidationMessage.java deleted file mode 100644 index 5aaf29e1a..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/ValidationMessage.java +++ /dev/null @@ -1,76 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.metadataprocessors.features; - -import org.eclipse.core.runtime.IStatus; - -/** - * Metadata Validation Message implementation - * - * <p><b>Provisional API - subject to change</b></p> - */ -public class ValidationMessage implements IValidationMessage { - - private String code; - private String msg; - private int severity = IStatus.WARNING; - - /** - * Constructor - * @param msg - */ - public ValidationMessage(String msg){ - this.msg = msg; - } - - /** - * Constructor - * @param msg - * @param code - * @param severity - */ - public ValidationMessage(String msg, String code, int severity){ - this.msg = msg; - this.code = code; - this.severity = severity; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.metadataprocessors.features.IValidationMessage#getMessage() - */ - public String getMessage() { - return msg; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.metadataprocessors.features.IValidationMessage#getCode() - */ - public String getCode() { - return code; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.metadataprocessors.features.IValidationMessage#getSeverity() - */ - public int getSeverity() { - return severity; - } - - /** - * @param msg - */ - public void setMessage(String msg) { - this.msg = msg; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/package-info.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/package-info.java deleted file mode 100644 index 552ffe61c..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ - -/** - * Provides tooling services for tag attribute values - * based on the org.eclipse.jst.jsf.core.AttributeValueRuntimeTypes. - * <p> - * New features can added to the system using the org.eclipse.jst.jsf.core.MetaDataEnabledFeatures - * extension-point. This extension point provides the binding of a AttributeValueRuntimeTypes to a feature - * so that new behaviors can be added to existing types. - * - * <p><b>Provisional API - subject to change</b></p> - */ -package org.eclipse.jst.jsf.metadataprocessors.features; diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/internal/AbstractMetaDataEnabledType.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/internal/AbstractMetaDataEnabledType.java deleted file mode 100644 index 0ae2de2d7..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/internal/AbstractMetaDataEnabledType.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.metadataprocessors.internal; - -import org.eclipse.jst.jsf.metadataprocessors.IType; - - -/** - * Class that encapuslates the information from the - * <code>AttributeValueRuntimeTypes</code> and - * <code>MetaDataEnabledFeatures</code> - * extension points. - * - * @author Gerry Kessler - Oracle - * - */ -public class AbstractMetaDataEnabledType implements IType{ - String typeId; - String bundleId; - String klass; - - AbstractMetaDataEnabledType(String bundleID, String id, String klass){ - this.bundleId = bundleID; - this.typeId = bundleId + "." + id; - this.klass = klass; - } - - public String getTypeID(){ - return typeId; - } - - public String getBundleID(){ - return bundleId; - } - - public String getClassName(){ - return klass; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/internal/AbstractMetaDataEnabledTypeFactory.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/internal/AbstractMetaDataEnabledTypeFactory.java deleted file mode 100644 index 6e2d1f48c..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/internal/AbstractMetaDataEnabledTypeFactory.java +++ /dev/null @@ -1,126 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.metadataprocessors.internal; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.metadataprocessors.IType; -import org.eclipse.jst.jsf.metadataprocessors.ITypeDescriptor; -import org.osgi.framework.Bundle; - -/** - * Abstract factory producing <code>ITypeDescriptor</code>s - * from instances of <code>AbstractMetaDataEnabledType</code>s - * - * @author Gerry Kessler - Oracle - * - */ -public abstract class AbstractMetaDataEnabledTypeFactory { - /** - * The factory instance - * TODO: why is this defined here it is only used in sub-classes?? - */ - protected static AbstractMetaDataEnabledTypeFactory INSTANCE; - - /** - * No arg constructor - */ - protected AbstractMetaDataEnabledTypeFactory(){ - super(); - } - - /** - * Concrete factory must pass instances of the it's types. - * - * @param typeId - * @return list of instances identified by the type id - */ - public abstract ITypeDescriptor getType(String typeId); - - /** - * @param type - * @return instance of ITypeDescriptor identified by the type id - */ - public ITypeDescriptor getType(AbstractMetaDataEnabledType type){ - - return createType(type); - - } - - /** - * @param type - * @return class identified by the type id - */ - public Class getClassForType(IType type){ - return createTypeClass(type); - - } - - /** - * Creates instances of <code>ITypeDescriptor</code>s from - * <code>AbstractMetaDataEnabledType</code>s - * - * @param atype - * @return the meta-data type descriptor - */ - protected ITypeDescriptor createType(IType atype){ - if (atype != null){ - ITypeDescriptor desc = createDescriptorInstance(atype); - if (desc != null){ - desc.setTypeExtension(atype); - return desc; - } - } - return null; - } - - - private Class createTypeClass(IType type){ - String className = type.getClassName(); - try { - Bundle bundle =Platform.getBundle(type.getBundleID()); - if (bundle == null){ - JSFCorePlugin.log(IStatus.ERROR, type.getBundleID() + " could not be created to load " + className); - return null; - } - Class klass = bundle.loadClass(className); - if (klass != null){ - //make sure the class can support the feature/extended interface - if (ITypeDescriptor.class.isAssignableFrom(klass)) - { - return klass; - } - JSFCorePlugin.log(IStatus.INFO, className + " was not found in " + type.getBundleID() +" for " + type.getTypeID()); - } - } catch (ClassNotFoundException e) { - JSFCorePlugin.log(IStatus.ERROR, className + " was not found in " + type.getBundleID() +" for " + type.getTypeID()); - } - return null; - } - - private ITypeDescriptor createDescriptorInstance(IType type){ - String className = type.getClassName(); - try { - Class klass = createTypeClass(type); - if (klass != null){ - return (ITypeDescriptor)klass.newInstance(); - } - } catch (InstantiationException e) { - JSFCorePlugin.log(IStatus.ERROR, "InstantiationException: " + className + " in " + type.getBundleID() +" for " + type.getTypeID()); - } catch (IllegalAccessException e) { - JSFCorePlugin.log(IStatus.ERROR, "IllegalAccessException: " + className + " in " + type.getBundleID() +" for " + type.getTypeID()); - } - return null; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/internal/AbstractMetaDataEnabledTypeRegistry.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/internal/AbstractMetaDataEnabledTypeRegistry.java deleted file mode 100644 index 5c4b0b2c0..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/internal/AbstractMetaDataEnabledTypeRegistry.java +++ /dev/null @@ -1,106 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.metadataprocessors.internal; - -import java.util.HashMap; - -import org.eclipse.core.runtime.IExtension; -import org.eclipse.core.runtime.IExtensionPoint; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.InvalidRegistryObjectException; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; - -/** - * Abstract registry of <code>AbstractMetaDataEnabledType<code> - * mapped by type id. - * - * @author Gerry Kessler - Oracle - * - */ -public abstract class AbstractMetaDataEnabledTypeRegistry { - private final HashMap typeMap; //map of types keyed by id - private final String ext_pt_id; //type ext-pt id - - /** - * @param extPtId - */ - public AbstractMetaDataEnabledTypeRegistry(String extPtId){ - typeMap = new HashMap(); - ext_pt_id = extPtId; - - readRegistry(); - } - - /** - * @param bundleID - * @param id - * @param klass - * @param runtimeType - */ - protected void registerType(String bundleID, String id, String klass, String runtimeType){ - AbstractMetaDataEnabledType atype = new AbstractMetaDataEnabledType(bundleID, id, klass); - if (!typeMap.containsKey(atype.getTypeID())){ - typeMap.put(atype.getTypeID(), atype); - } - else { - //is there any point in putting this more in the user's face? this is really an internal error. - JSFCorePlugin.log(IStatus.ERROR, "Duplicate RuntimeTypeId being registered from " + ext_pt_id + ": " + atype.getTypeID()); - } - } - - /** - * Return the metadata enabled type for the given id - * @param id - * @return type - */ - public AbstractMetaDataEnabledType getType(String id){ - if (typeMap.containsKey(id)) - { - return (AbstractMetaDataEnabledType)typeMap.get(id); - } - return null; - } - - /** - * Reads the extensions for a particular type id - */ - protected void readRegistry() { - try { - IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(JSFCorePlugin.PLUGIN_ID, ext_pt_id); - IExtension[] extensions = point.getExtensions(); - for (int i=0;i < extensions.length;i++){ - IExtension ext = extensions[i]; - for (int j=0;j < ext.getConfigurationElements().length;j++){ - final String bundleId = ext.getConfigurationElements()[j].getContributor().getName(); - final String id = ext.getConfigurationElements()[j].getAttribute("id"); - String klass = ext.getConfigurationElements()[j].getAttribute("class"); - final String runtimeType = ext.getConfigurationElements()[j].getAttribute("runtime-type"); - if (klass == null || klass.trim().equals("")){ - klass = getDefaultClassName(); - } - registerType(bundleId, id, klass, runtimeType); - } - } - } catch (InvalidRegistryObjectException e) { - JSFCorePlugin.log(e, "Unable to read " + JSFCorePlugin.PLUGIN_ID + ext_pt_id + " registry"); - } - } - - /** - * @return default classname to use for the type - */ - protected abstract String getDefaultClassName(); - - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/internal/AttributeValueRuntimeTypeFactory.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/internal/AttributeValueRuntimeTypeFactory.java deleted file mode 100644 index 78638e287..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/internal/AttributeValueRuntimeTypeFactory.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.metadataprocessors.internal; - -import org.eclipse.jst.jsf.metadataprocessors.ITypeDescriptor; - - -/** - * Factory producing <code>IMetaDataEnabledFeature</code>s from - * <code>AttributeValueRuntimeType</code> objects - * - * @author Gerry Kessler - Oracle - * - */ -public class AttributeValueRuntimeTypeFactory extends AbstractMetaDataEnabledTypeFactory{ - - /** - * @return the single instance... TODO: why is this allocated here if it is - * declared in super? - */ - public static AttributeValueRuntimeTypeFactory getInstance(){ - if (INSTANCE == null){ - INSTANCE = new AttributeValueRuntimeTypeFactory(); - } - return (AttributeValueRuntimeTypeFactory)INSTANCE; - } - - private AttributeValueRuntimeTypeFactory(){ - super(); - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.metadataprocessors.internal.AbstractMetaDataEnabledTypeFactory#getType(java.lang.String) - */ - public ITypeDescriptor getType(String typeId){ - - return createType(AttributeValueRuntimeTypeRegistry.getInstance().getType(typeId)); - - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/internal/AttributeValueRuntimeTypeRegistry.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/internal/AttributeValueRuntimeTypeRegistry.java deleted file mode 100644 index 9deab17ae..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/internal/AttributeValueRuntimeTypeRegistry.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.metadataprocessors.internal; - -/** - * Registry of <code>AbstractMetaDataEnabledType</code>s that are loaded from - * the <code>AttributeValueRuntimeValueType</code> extension point - * - * @author Gerry Kessler - Oracle - * - */ -public class AttributeValueRuntimeTypeRegistry extends AbstractMetaDataEnabledTypeRegistry { - - private static final String EXTPTID = "AttributeValueRuntimeTypes"; - private static final String DEFAULT_CLASS = "org.eclipse.jst.jsf.metadataprocessors.DefaultTypeDescriptor"; - private static AttributeValueRuntimeTypeRegistry INSTANCE; - - /** - * @return singleton instance - */ - public static AttributeValueRuntimeTypeRegistry getInstance(){ - if (INSTANCE == null){ - INSTANCE = new AttributeValueRuntimeTypeRegistry(); - } - return INSTANCE; - } - - private AttributeValueRuntimeTypeRegistry(){ - super(EXTPTID); - } - - protected String getDefaultClassName() { - return DEFAULT_CLASS; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/internal/IMetaDataEnabledFeatureExtension.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/internal/IMetaDataEnabledFeatureExtension.java deleted file mode 100644 index bde9ca613..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/internal/IMetaDataEnabledFeatureExtension.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.metadataprocessors.internal; - -/** - * Interface used to bind feature extensions to metadata enabled types - * - */ -public interface IMetaDataEnabledFeatureExtension { - /** - * @return bundle id - */ - public String getBundleID(); - /** - * @return type id - */ - public String getTypeID(); - /** - * @return class name to use for type. Must be located within the bundle. - */ - public String getClassName(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/internal/MetaDataEnabledFeatureAdapterFactory.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/internal/MetaDataEnabledFeatureAdapterFactory.java deleted file mode 100644 index 9cb0303d0..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/internal/MetaDataEnabledFeatureAdapterFactory.java +++ /dev/null @@ -1,158 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.metadataprocessors.internal; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.metadataprocessors.IMetaDataEnabledFeature; -import org.eclipse.jst.jsf.metadataprocessors.IType; -import org.eclipse.jst.jsf.metadataprocessors.ITypeDescriptor; -import org.osgi.framework.Bundle; - -/** - * Factory producing <code>IMetaDataEnabledFeature</code>s from - * <code>IType</code> objects that implement a specified feature - * - * @author Gerry Kessler - Oracle - * - */ -public final class MetaDataEnabledFeatureAdapterFactory { - private static MetaDataEnabledFeatureAdapterFactory INSTANCE; - private Map<String, Class> typesCache; - /** - * @return singleton instance - */ - public static MetaDataEnabledFeatureAdapterFactory getInstance(){ - if (INSTANCE == null){ - INSTANCE = new MetaDataEnabledFeatureAdapterFactory(); - } - return INSTANCE; - } - - private MetaDataEnabledFeatureAdapterFactory(){ - super(); - typesCache = new HashMap<String, Class>(); - } - - - /** - * Given the feature extension, create and return the {@link IMetaDataEnabledFeature} for a given processing feature - * @param feature - * @param processingFeature class - * @return IMetaDataEnabledFeature - */ - public IMetaDataEnabledFeature getFeatureAdapter(IMetaDataEnabledFeatureExtension feature, Class processingFeature){ - if (feature != null){ - return createFeature(feature, processingFeature); - } - return null; - } - - /** - * Given the feature extension, create and return the {@link IMetaDataEnabledFeature} for a given processing feature if - * that the type that the feature is bound to is a subclass of the the type - * @param feature - * @param processingFeature class - * @param type - * @return IMetaDataEnabledFeature. <br>Will return null if the type that the feature extension is bound to, - * is not a subclass of the supplied type - */ - public IMetaDataEnabledFeature getFeatureAdapterForSubclass(IMetaDataEnabledFeatureExtension feature, Class processingFeature, IType type){ - if (feature != null ){ - ITypeDescriptor aType = AttributeValueRuntimeTypeFactory.getInstance().getType(feature.getTypeID()); - Class klass = aType.getTypeExtension().getClass(); - if (klass.asSubclass(type.getClass()) != null) - return createFeature(feature, processingFeature); - } - return null; - } - -// private Class getOrCreateTypeClassFor(IMetaDataEnabledFeatureExtension featureExt){ -// Class klass = null; -// String className; -// ITypeDescriptor type = AttributeValueRuntimeTypeFactory.getInstance().getType(featureExt.getTypeID()); -// try { -// if (! typesCache.containsKey(featureExt.getTypeID())){ -// Bundle bundle =Platform.getBundle(featureExt.getBundleID()); -// if (bundle == null){ -// JSFCorePlugin.log(IStatus.ERROR, featureExt.getBundleID() + " could not be created to load " + className); -// return null; -// } -// klass = bundle.loadClass(className); -// if (klass != null){ -// typesCache.put(featureExt.getTypeID(), klass); -// } -// } -// else -// klass = typesCache.get(featureExt.getTypeID()); -// -// return klass; -// if (!IMetaDataEnabledFeature.class.isAssignableFrom(klass)){ -// JSFCorePlugin.log(IStatus.INFO, className + " is not a IMetaDataEnabledFeature. " + featureExt.getBundleID() +" : " + featureExt.getTypeID()); -// } -// else if (klass != null && processingFeature.isAssignableFrom(klass)){ -// IMetaDataEnabledFeature obj = (IMetaDataEnabledFeature)klass.newInstance(); -// return obj; -// } -// -// } catch (ClassNotFoundException e) { -// JSFCorePlugin.log(IStatus.ERROR, className + " was not found in " + featureExt.getBundleID() +" for " + featureExt.getTypeID()); -// } catch (InstantiationException e) { -// JSFCorePlugin.log(IStatus.ERROR, "InstantiationException: " + className + " in " + featureExt.getBundleID() +" for " + featureExt.getTypeID()); -// } catch (IllegalAccessException e) { -// JSFCorePlugin.log(IStatus.ERROR, "IllegalAccessException: " + className + " in " + featureExt.getBundleID() +" for " + featureExt.getTypeID()); -// } -// return null; -// } - - private IMetaDataEnabledFeature createFeature(IMetaDataEnabledFeatureExtension featureExt, Class processingFeature){ - String className = featureExt.getClassName(); - Class klass = null; - try { - if (! typesCache.containsKey(featureExt.getTypeID())){ - Bundle bundle =Platform.getBundle(featureExt.getBundleID()); - if (bundle == null){ - JSFCorePlugin.log(IStatus.ERROR, featureExt.getBundleID() + " could not be created to load " + className); - return null; - } - klass = bundle.loadClass(className); - if (klass != null){ - typesCache.put(featureExt.getTypeID(), klass); - } - } - else - klass = typesCache.get(featureExt.getTypeID()); - - if (!IMetaDataEnabledFeature.class.isAssignableFrom(klass)){ - JSFCorePlugin.log(IStatus.INFO, className + " is not a IMetaDataEnabledFeature. " + featureExt.getBundleID() +" : " + featureExt.getTypeID()); - } - else if (klass != null && processingFeature.isAssignableFrom(klass)){ - IMetaDataEnabledFeature obj = (IMetaDataEnabledFeature)klass.newInstance(); - return obj; - } - - } catch (ClassNotFoundException e) { - JSFCorePlugin.log(IStatus.ERROR, className + " was not found in " + featureExt.getBundleID() +" for " + featureExt.getTypeID()); - } catch (InstantiationException e) { - JSFCorePlugin.log(IStatus.ERROR, "InstantiationException: " + className + " in " + featureExt.getBundleID() +" for " + featureExt.getTypeID()); - } catch (IllegalAccessException e) { - JSFCorePlugin.log(IStatus.ERROR, "IllegalAccessException: " + className + " in " + featureExt.getBundleID() +" for " + featureExt.getTypeID()); - } - return null; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/internal/MetaDataEnabledFeatureExtension.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/internal/MetaDataEnabledFeatureExtension.java deleted file mode 100644 index ae90a9a5e..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/internal/MetaDataEnabledFeatureExtension.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.metadataprocessors.internal; - - -/** - * - * @author Gerry Kessler - Oracle - * - */ -public class MetaDataEnabledFeatureExtension implements IMetaDataEnabledFeatureExtension{ - - private String klass; - private String typeId; - private String bundleId; - - MetaDataEnabledFeatureExtension(String bundleID, String typeId, String klass) { - this.bundleId = bundleID; - this.typeId = typeId; - this.klass = klass; - } - - public String getBundleID() { - return bundleId; - } - - public String getClassName() { - return klass; - } - - public String getTypeID() { - return typeId; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/internal/MetaDataEnabledFeatureRegistry.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/internal/MetaDataEnabledFeatureRegistry.java deleted file mode 100644 index 17b5a41e4..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/internal/MetaDataEnabledFeatureRegistry.java +++ /dev/null @@ -1,177 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.metadataprocessors.internal; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.runtime.IExtension; -import org.eclipse.core.runtime.IExtensionPoint; -import org.eclipse.core.runtime.InvalidRegistryObjectException; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.metadataprocessors.IType; - -/** - * Registry of <code>AbstractMetaDataEnabledType</code>s loaded from - * the <code>MetaDataEnabledFeatures</code> extension point - * - * A map of features keyed by type id - * - */ -public class MetaDataEnabledFeatureRegistry{ - private static final String EXTPTID = "MetaDataEnabledFeatures"; - private Map<String, List<IMetaDataEnabledFeatureExtension>> featuresMap; - private Map<String, Class> typeCacheMap; - private static MetaDataEnabledFeatureRegistry INSTANCE; - - /** - * @return the singleton instance of the MetaDataEnabledFeatureRegistry - */ - public static synchronized MetaDataEnabledFeatureRegistry getInstance(){ - if (INSTANCE == null){ - INSTANCE = new MetaDataEnabledFeatureRegistry(); - } - return INSTANCE; - } - - private MetaDataEnabledFeatureRegistry(){ - featuresMap = new HashMap<String, List<IMetaDataEnabledFeatureExtension>>(); - typeCacheMap = new HashMap<String, Class>(); - readRegistry(); - } - - /** - * Reads the MetaDataEnabledFeatures extensions into a registry - */ - protected void readRegistry() { - try { - IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(JSFCorePlugin.PLUGIN_ID, EXTPTID); - IExtension[] extensions = point.getExtensions(); - for (int i=0;i < extensions.length;i++){ - IExtension ext = extensions[i]; - for (int j=0;j < ext.getConfigurationElements().length;j++){ - final String bundleId = ext.getConfigurationElements()[j].getContributor().getName(); - final String id = ext.getConfigurationElements()[j].getAttribute("typeid"); - final String klass = ext.getConfigurationElements()[j].getAttribute("class"); - registerFeature(bundleId, id, klass); - } - } - } catch (InvalidRegistryObjectException e) { - JSFCorePlugin.log(e, "Unable to read " + JSFCorePlugin.PLUGIN_ID + EXTPTID + " registry"); - } - } - - /** - * Create {@link IMetaDataEnabledFeatureExtension}s and add to registry - * @param bundleID - * @param typeId - * @param klass - */ - protected void registerFeature(String bundleID, String typeId, String klass){ - IMetaDataEnabledFeatureExtension aFeature = new MetaDataEnabledFeatureExtension(bundleID, typeId, klass); - if (canCreateTypeForFeatureExtension(aFeature)){ - if (!featuresMap.containsKey(typeId)){ - List list = new ArrayList(); - list.add(aFeature); - featuresMap.put(typeId, list); - } - else { - List list = featuresMap.get(typeId); - list.add(aFeature); - } - } - } - - - private boolean canCreateTypeForFeatureExtension(IMetaDataEnabledFeatureExtension feature) { - if (! typeCacheMap.containsKey(feature.getTypeID())){ - IType type = AttributeValueRuntimeTypeRegistry.getInstance().getType(feature.getTypeID()); - if (type != null){ - Class typeClass = AttributeValueRuntimeTypeFactory.getInstance().getClassForType(type); - typeCacheMap.put(feature.getTypeID(), typeClass); - } - else - return false; - } - return typeCacheMap.get(feature.getTypeID()) != null; - } - - /** - * @param typeId - * @return List of <code>AbstractMetaDataEnabledRuntimeTypeExtensions</code> - * for a given by type id - * - * TODO: make more efficient... no need to keep calculating features for subtypes. - */ - public List<IMetaDataEnabledFeatureExtension> getFeatures(String typeId) { - - if (!featuresMap.containsKey(typeId)) - featuresMap.put(typeId,new ArrayList()); - - //copy current featuresMapped to typeId into return list - List<IMetaDataEnabledFeatureExtension> srcList = featuresMap.get(typeId); - List<IMetaDataEnabledFeatureExtension> ret = new ArrayList<IMetaDataEnabledFeatureExtension>(srcList.size()); - copy(ret, srcList); - - List subs = getFeatureExtensionsForMatchingSubclass(typeId); - for (Iterator<IMetaDataEnabledFeatureExtension> it=subs.iterator();it.hasNext();){ - IMetaDataEnabledFeatureExtension featureExt = it.next(); - if (!ret.contains(featureExt)) - ret.add(featureExt); - } - return ret; - - } - - private void copy(List<IMetaDataEnabledFeatureExtension> destList, - List<IMetaDataEnabledFeatureExtension> srcList) { - for (Iterator<IMetaDataEnabledFeatureExtension> it=srcList.iterator();it.hasNext();){ - destList.add(it.next()); - } - } - - /** - * If the feature adapter is mapped to a type which is a superclass of the type of interest, then the feature adapter is an extension of that type - * @param typeId - * @return list of IMetaDataEnabledFeatureExtension - */ - private List<IMetaDataEnabledFeatureExtension> getFeatureExtensionsForMatchingSubclass(String typeId) { - IType type = AttributeValueRuntimeTypeRegistry.getInstance().getType(typeId); - Class typeClass = AttributeValueRuntimeTypeFactory.getInstance().getClassForType(type); - - List<IMetaDataEnabledFeatureExtension> ret = new ArrayList<IMetaDataEnabledFeatureExtension>(); - // loop thru all of the type classes mapped to feature adapters that are subclasses of the type - for (Iterator it=typeCacheMap.keySet().iterator();it.hasNext();){ - String featureTypeId = (String)it.next(); - Class featureTypeClass = typeCacheMap.get(featureTypeId); - try { -// if (featureTypeClass.equals(typeClass)){ -// ret.add(featureTypeClass); -// } -// else - if (typeClass.asSubclass(featureTypeClass) != null) { - ret.addAll(featuresMap.get(featureTypeId)); - } - } catch (ClassCastException e) {// - } - - } - return ret; - } - - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/package-info.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/package-info.java deleted file mode 100644 index 44cf369d7..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/package-info.java +++ /dev/null @@ -1,22 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ - -/** - * Provides tooling support for taglibraries using the Design-time Metadata - * feature (org.eclipse.jst.jsf.common.metadata). - * <p> - * The MetaDataEnabledProcessingFactory singleton instance is the entry point. The tool requests - * the IMetaDataEnabled feature for a particular tag attribute, and through metadata, will locate the - * "metadata processing" feature using the attribute value runtime type system. - * <p><b>Provisional API - subject to change</b></p> - */ -package org.eclipse.jst.jsf.metadataprocessors; diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/tagdisplay/internal/paletteinfos/PaletteInfo.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/tagdisplay/internal/paletteinfos/PaletteInfo.java deleted file mode 100644 index 1c2508082..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/tagdisplay/internal/paletteinfos/PaletteInfo.java +++ /dev/null @@ -1,323 +0,0 @@ -/** - * Copyright (c) 2007 Oracle Corporation - * - * $Id: PaletteInfo.java,v 1.2 2008/03/30 21:22:24 cbateman Exp $ - */ -package org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos; - -import org.eclipse.emf.ecore.EObject; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Palette Info</b></em>'. - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfo#getId <em>Id</em>}</li> - * <li>{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfo#getTag <em>Tag</em>}</li> - * <li>{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfo#getDisplayLabel <em>Display Label</em>}</li> - * <li>{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfo#getDescription <em>Description</em>}</li> - * <li>{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfo#getExpert <em>Expert</em>}</li> - * <li>{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfo#getHidden <em>Hidden</em>}</li> - * <li>{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfo#getSmallIcon <em>Small Icon</em>}</li> - * <li>{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfo#getLargeIcon <em>Large Icon</em>}</li> - * <li>{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfo#getTagCreation <em>Tag Creation</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfosPackage#getPaletteInfo() - * @model - * @generated - */ -public interface PaletteInfo extends EObject { - /** - * the trait id name - */ - public static final String TRAIT_ID = "paletteInfo"; - /** - * the display label name - */ - public static final String TRAIT_DISPLAY_LABEL = "display-label"; - /** - * the trait description name - */ - public static final String TRAIT_DESCRIPTION = "description"; - /** - * the expert trait - */ - public static final String TRAIT_IS_EXPERT = "expert"; - /** - * the hiddent trait - */ - public static final String TRAIT_IS_HIDDEN = "hidden"; - /** - * the small icon trait - */ - public static final String TRAIT_SMALL_ICON = "small-icon"; - /** - * the large icon trait - */ - public static final String TRAIT_LARGE_ICON = "large-icon"; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String copyright = "Copyright (c) 2007 Oracle Corporation"; - - /** - * Returns the value of the '<em><b>Id</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Id</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Id</em>' attribute. - * @see #setId(String) - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfosPackage#getPaletteInfo_Id() - * @model required="true" - * @generated - */ - String getId(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfo#getId <em>Id</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Id</em>' attribute. - * @see #getId() - * @generated - */ - void setId(String value); - - /** - * Returns the value of the '<em><b>Tag</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Tag</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Tag</em>' attribute. - * @see #setTag(String) - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfosPackage#getPaletteInfo_Tag() - * @model - * @generated - */ - String getTag(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfo#getTag <em>Tag</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Tag</em>' attribute. - * @see #getTag() - * @generated - */ - void setTag(String value); - - /** - * Returns the value of the '<em><b>Display Label</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Display Label</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Display Label</em>' attribute. - * @see #setDisplayLabel(String) - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfosPackage#getPaletteInfo_DisplayLabel() - * @model extendedMetaData="kind='element' name='display-label'" - * @generated - */ - String getDisplayLabel(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfo#getDisplayLabel <em>Display Label</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Display Label</em>' attribute. - * @see #getDisplayLabel() - * @generated - */ - void setDisplayLabel(String value); - - /** - * Returns the value of the '<em><b>Description</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Description</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Description</em>' attribute. - * @see #setDescription(String) - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfosPackage#getPaletteInfo_Description() - * @model extendedMetaData="kind='element'" - * @generated - */ - String getDescription(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfo#getDescription <em>Description</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Description</em>' attribute. - * @see #getDescription() - * @generated - */ - void setDescription(String value); - - /** - * Returns the value of the '<em><b>Expert</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Expert</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Expert</em>' attribute. - * @see #setExpert(Boolean) - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfosPackage#getPaletteInfo_Expert() - * @model extendedMetaData="kind='element'" - * @generated - */ - Boolean getExpert(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfo#getExpert <em>Expert</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Expert</em>' attribute. - * @see #getExpert() - * @generated - */ - void setExpert(Boolean value); - - /** - * Returns the value of the '<em><b>Hidden</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Hidden</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Hidden</em>' attribute. - * @see #setHidden(Boolean) - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfosPackage#getPaletteInfo_Hidden() - * @model extendedMetaData="kind='element'" - * @generated - */ - Boolean getHidden(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfo#getHidden <em>Hidden</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Hidden</em>' attribute. - * @see #getHidden() - * @generated - */ - void setHidden(Boolean value); - - /** - * Returns the value of the '<em><b>Small Icon</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Small Icon</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Small Icon</em>' attribute. - * @see #setSmallIcon(String) - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfosPackage#getPaletteInfo_SmallIcon() - * @model extendedMetaData="kind='element' name='small-icon'" - * @generated - */ - String getSmallIcon(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfo#getSmallIcon <em>Small Icon</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Small Icon</em>' attribute. - * @see #getSmallIcon() - * @generated - */ - void setSmallIcon(String value); - - /** - * Returns the value of the '<em><b>Large Icon</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Large Icon</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Large Icon</em>' attribute. - * @see #setLargeIcon(String) - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfosPackage#getPaletteInfo_LargeIcon() - * @model extendedMetaData="kind='element' name='large-icon'" - * @generated - */ - String getLargeIcon(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfo#getLargeIcon <em>Large Icon</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Large Icon</em>' attribute. - * @see #getLargeIcon() - * @generated - */ - void setLargeIcon(String value); - - /** - * Returns the value of the '<em><b>Tag Creation</b></em>' reference. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Tag Creation</em>' reference isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Tag Creation</em>' reference. - * @see #setTagCreation(TagCreationInfo) - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfosPackage#getPaletteInfo_TagCreation() - * @model extendedMetaData="kind='element' name='tag-create'" - * @generated - */ - TagCreationInfo getTagCreation(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfo#getTagCreation <em>Tag Creation</em>}' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Tag Creation</em>' reference. - * @see #getTagCreation() - * @generated - */ - void setTagCreation(TagCreationInfo value); - - /** - * <!-- begin-user-doc --> - * @return true if is expert - * <!-- end-user-doc --> - * @model kind="operation" - * @generated - */ - boolean isExpert(); - - /** - * <!-- begin-user-doc --> - * @return true if is hidden - * <!-- end-user-doc --> - * @model kind="operation" - * @generated - */ - boolean isHidden(); - -} // PaletteInfo diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/tagdisplay/internal/paletteinfos/PaletteInfos.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/tagdisplay/internal/paletteinfos/PaletteInfos.java deleted file mode 100644 index a6f2ba47c..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/tagdisplay/internal/paletteinfos/PaletteInfos.java +++ /dev/null @@ -1,67 +0,0 @@ -/** - * Copyright (c) 2007 Oracle Corporation - * - * $Id: PaletteInfos.java,v 1.2 2008/03/30 21:22:24 cbateman Exp $ - */ -package org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos; - -import org.eclipse.emf.common.util.EList; - -import org.eclipse.emf.ecore.EObject; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Palette Infos</b></em>'. - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfos#getInfos <em>Infos</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfosPackage#getPaletteInfos() - * @model - * @generated - */ -public interface PaletteInfos extends EObject { - /** - * the palette infos trait id - */ - public static final String TRAIT_ID = "paletteInfos"; - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String copyright = "Copyright (c) 2007 Oracle Corporation"; - - /** - * Returns the value of the '<em><b>Infos</b></em>' containment reference list. - * The list contents are of type {@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfo}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Infos</em>' containment reference list isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Infos</em>' containment reference list. - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfosPackage#getPaletteInfos_Infos() - * @model type="org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfo" containment="true" - * extendedMetaData="kind='element' name='item'" - * @generated - */ - EList getInfos(); - - /** - * <!-- begin-user-doc --> - * @param id - * @return the pallette info corresponding to id. - * <!-- end-user-doc --> - * @model idRequired="true" - * @generated - */ - PaletteInfo findPaletteInfoById(String id); - -} // PaletteInfos diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/tagdisplay/internal/paletteinfos/PaletteInfosFactory.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/tagdisplay/internal/paletteinfos/PaletteInfosFactory.java deleted file mode 100644 index 2929af31c..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/tagdisplay/internal/paletteinfos/PaletteInfosFactory.java +++ /dev/null @@ -1,88 +0,0 @@ -/** - * Copyright (c) 2007 Oracle Corporation - * - * $Id: PaletteInfosFactory.java,v 1.1 2008/03/25 19:31:30 gkessler Exp $ - */ -package org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos; - -import org.eclipse.emf.ecore.EFactory; - -/** - * <!-- begin-user-doc --> - * The <b>Factory</b> for the model. - * It provides a create method for each non-abstract class of the model. - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfosPackage - * @generated - */ -public interface PaletteInfosFactory extends EFactory { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String copyright = "Copyright (c) 2007 Oracle Corporation"; - - /** - * The singleton instance of the factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - PaletteInfosFactory eINSTANCE = org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.impl.PaletteInfosFactoryImpl.init(); - - /** - * Returns a new object of class '<em>Palette Infos</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Palette Infos</em>'. - * @generated - */ - PaletteInfos createPaletteInfos(); - - /** - * Returns a new object of class '<em>Palette Info</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Palette Info</em>'. - * @generated - */ - PaletteInfo createPaletteInfo(); - - /** - * Returns a new object of class '<em>Tag Creation Info</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Tag Creation Info</em>'. - * @generated - */ - TagCreationInfo createTagCreationInfo(); - - /** - * Returns a new object of class '<em>Tag Creation Template</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Tag Creation Template</em>'. - * @generated - */ - TagCreationTemplate createTagCreationTemplate(); - - /** - * Returns a new object of class '<em>Tag Creation Attribute</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Tag Creation Attribute</em>'. - * @generated - */ - TagCreationAttribute createTagCreationAttribute(); - - /** - * Returns the package supported by this factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the package supported by this factory. - * @generated - */ - PaletteInfosPackage getPaletteInfosPackage(); - -} //PaletteInfosFactory diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/tagdisplay/internal/paletteinfos/PaletteInfosPackage.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/tagdisplay/internal/paletteinfos/PaletteInfosPackage.java deleted file mode 100644 index 377ff4309..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/tagdisplay/internal/paletteinfos/PaletteInfosPackage.java +++ /dev/null @@ -1,709 +0,0 @@ -/** - * Copyright (c) 2007 Oracle Corporation - * - * $Id: PaletteInfosPackage.java,v 1.1 2008/03/25 19:31:30 gkessler Exp $ - */ -package org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; - -/** - * <!-- begin-user-doc --> - * The <b>Package</b> for the model. - * It contains accessors for the meta objects to represent - * <ul> - * <li>each class,</li> - * <li>each feature of each class,</li> - * <li>each enum,</li> - * <li>and each data type</li> - * </ul> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfosFactory - * @model kind="package" - * @generated - */ -@SuppressWarnings("hiding") -public interface PaletteInfosPackage extends EPackage { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String copyright = "Copyright (c) 2007 Oracle Corporation"; - - /** - * The package name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNAME = "paletteinfos"; - - /** - * The package namespace URI. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNS_URI = "http://org.eclipse.jsf.pagedesigner/paletteInfos.ecore"; - - /** - * The package namespace name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNS_PREFIX = "pi"; - - /** - * The singleton instance of the package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - PaletteInfosPackage eINSTANCE = org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.impl.PaletteInfosPackageImpl.init(); - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.impl.PaletteInfosImpl <em>Palette Infos</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.impl.PaletteInfosImpl - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.impl.PaletteInfosPackageImpl#getPaletteInfos() - * @generated - */ - int PALETTE_INFOS = 0; - - /** - * The feature id for the '<em><b>Infos</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int PALETTE_INFOS__INFOS = 0; - - /** - * The number of structural features of the '<em>Palette Infos</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int PALETTE_INFOS_FEATURE_COUNT = 1; - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.impl.PaletteInfoImpl <em>Palette Info</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.impl.PaletteInfoImpl - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.impl.PaletteInfosPackageImpl#getPaletteInfo() - * @generated - */ - int PALETTE_INFO = 1; - - /** - * The feature id for the '<em><b>Id</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int PALETTE_INFO__ID = 0; - - /** - * The feature id for the '<em><b>Tag</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int PALETTE_INFO__TAG = 1; - - /** - * The feature id for the '<em><b>Display Label</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int PALETTE_INFO__DISPLAY_LABEL = 2; - - /** - * The feature id for the '<em><b>Description</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int PALETTE_INFO__DESCRIPTION = 3; - - /** - * The feature id for the '<em><b>Expert</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int PALETTE_INFO__EXPERT = 4; - - /** - * The feature id for the '<em><b>Hidden</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int PALETTE_INFO__HIDDEN = 5; - - /** - * The feature id for the '<em><b>Small Icon</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int PALETTE_INFO__SMALL_ICON = 6; - - /** - * The feature id for the '<em><b>Large Icon</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int PALETTE_INFO__LARGE_ICON = 7; - - /** - * The feature id for the '<em><b>Tag Creation</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int PALETTE_INFO__TAG_CREATION = 8; - - /** - * The number of structural features of the '<em>Palette Info</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int PALETTE_INFO_FEATURE_COUNT = 9; - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.impl.TagCreationInfoImpl <em>Tag Creation Info</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.impl.TagCreationInfoImpl - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.impl.PaletteInfosPackageImpl#getTagCreationInfo() - * @generated - */ - int TAG_CREATION_INFO = 2; - - /** - * The feature id for the '<em><b>Attributes</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int TAG_CREATION_INFO__ATTRIBUTES = 0; - - /** - * The feature id for the '<em><b>Template</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int TAG_CREATION_INFO__TEMPLATE = 1; - - /** - * The number of structural features of the '<em>Tag Creation Info</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int TAG_CREATION_INFO_FEATURE_COUNT = 2; - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.impl.TagCreationTemplateImpl <em>Tag Creation Template</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.impl.TagCreationTemplateImpl - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.impl.PaletteInfosPackageImpl#getTagCreationTemplate() - * @generated - */ - int TAG_CREATION_TEMPLATE = 3; - - /** - * The feature id for the '<em><b>Template</b></em>' containment reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int TAG_CREATION_TEMPLATE__TEMPLATE = 0; - - /** - * The number of structural features of the '<em>Tag Creation Template</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int TAG_CREATION_TEMPLATE_FEATURE_COUNT = 1; - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.impl.TagCreationAttributeImpl <em>Tag Creation Attribute</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.impl.TagCreationAttributeImpl - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.impl.PaletteInfosPackageImpl#getTagCreationAttribute() - * @generated - */ - int TAG_CREATION_ATTRIBUTE = 4; - - /** - * The feature id for the '<em><b>Id</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int TAG_CREATION_ATTRIBUTE__ID = 0; - - /** - * The feature id for the '<em><b>Value</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int TAG_CREATION_ATTRIBUTE__VALUE = 1; - - /** - * The number of structural features of the '<em>Tag Creation Attribute</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int TAG_CREATION_ATTRIBUTE_FEATURE_COUNT = 2; - - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfos <em>Palette Infos</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Palette Infos</em>'. - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfos - * @generated - */ - EClass getPaletteInfos(); - - /** - * Returns the meta object for the containment reference list '{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfos#getInfos <em>Infos</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the containment reference list '<em>Infos</em>'. - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfos#getInfos() - * @see #getPaletteInfos() - * @generated - */ - EReference getPaletteInfos_Infos(); - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfo <em>Palette Info</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Palette Info</em>'. - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfo - * @generated - */ - EClass getPaletteInfo(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfo#getId <em>Id</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Id</em>'. - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfo#getId() - * @see #getPaletteInfo() - * @generated - */ - EAttribute getPaletteInfo_Id(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfo#getTag <em>Tag</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Tag</em>'. - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfo#getTag() - * @see #getPaletteInfo() - * @generated - */ - EAttribute getPaletteInfo_Tag(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfo#getDisplayLabel <em>Display Label</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Display Label</em>'. - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfo#getDisplayLabel() - * @see #getPaletteInfo() - * @generated - */ - EAttribute getPaletteInfo_DisplayLabel(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfo#getDescription <em>Description</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Description</em>'. - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfo#getDescription() - * @see #getPaletteInfo() - * @generated - */ - EAttribute getPaletteInfo_Description(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfo#getExpert <em>Expert</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Expert</em>'. - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfo#getExpert() - * @see #getPaletteInfo() - * @generated - */ - EAttribute getPaletteInfo_Expert(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfo#getHidden <em>Hidden</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Hidden</em>'. - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfo#getHidden() - * @see #getPaletteInfo() - * @generated - */ - EAttribute getPaletteInfo_Hidden(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfo#getSmallIcon <em>Small Icon</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Small Icon</em>'. - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfo#getSmallIcon() - * @see #getPaletteInfo() - * @generated - */ - EAttribute getPaletteInfo_SmallIcon(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfo#getLargeIcon <em>Large Icon</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Large Icon</em>'. - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfo#getLargeIcon() - * @see #getPaletteInfo() - * @generated - */ - EAttribute getPaletteInfo_LargeIcon(); - - /** - * Returns the meta object for the reference '{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfo#getTagCreation <em>Tag Creation</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the reference '<em>Tag Creation</em>'. - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfo#getTagCreation() - * @see #getPaletteInfo() - * @generated - */ - EReference getPaletteInfo_TagCreation(); - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.TagCreationInfo <em>Tag Creation Info</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Tag Creation Info</em>'. - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.TagCreationInfo - * @generated - */ - EClass getTagCreationInfo(); - - /** - * Returns the meta object for the containment reference list '{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.TagCreationInfo#getAttributes <em>Attributes</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the containment reference list '<em>Attributes</em>'. - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.TagCreationInfo#getAttributes() - * @see #getTagCreationInfo() - * @generated - */ - EReference getTagCreationInfo_Attributes(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.TagCreationInfo#getTemplate <em>Template</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Template</em>'. - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.TagCreationInfo#getTemplate() - * @see #getTagCreationInfo() - * @generated - */ - EAttribute getTagCreationInfo_Template(); - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.TagCreationTemplate <em>Tag Creation Template</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Tag Creation Template</em>'. - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.TagCreationTemplate - * @generated - */ - EClass getTagCreationTemplate(); - - /** - * Returns the meta object for the containment reference '{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.TagCreationTemplate#getTemplate <em>Template</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the containment reference '<em>Template</em>'. - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.TagCreationTemplate#getTemplate() - * @see #getTagCreationTemplate() - * @generated - */ - EReference getTagCreationTemplate_Template(); - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.TagCreationAttribute <em>Tag Creation Attribute</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Tag Creation Attribute</em>'. - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.TagCreationAttribute - * @generated - */ - EClass getTagCreationAttribute(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.TagCreationAttribute#getId <em>Id</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Id</em>'. - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.TagCreationAttribute#getId() - * @see #getTagCreationAttribute() - * @generated - */ - EAttribute getTagCreationAttribute_Id(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.TagCreationAttribute#getValue <em>Value</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Value</em>'. - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.TagCreationAttribute#getValue() - * @see #getTagCreationAttribute() - * @generated - */ - EAttribute getTagCreationAttribute_Value(); - - /** - * Returns the factory that creates the instances of the model. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the factory that creates the instances of the model. - * @generated - */ - PaletteInfosFactory getPaletteInfosFactory(); - - /** - * <!-- begin-user-doc --> - * Defines literals for the meta objects that represent - * <ul> - * <li>each class,</li> - * <li>each feature of each class,</li> - * <li>each enum,</li> - * <li>and each data type</li> - * </ul> - * <!-- end-user-doc --> - * @generated - */ - interface Literals { - /** - * The meta object literal for the '{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.impl.PaletteInfosImpl <em>Palette Infos</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.impl.PaletteInfosImpl - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.impl.PaletteInfosPackageImpl#getPaletteInfos() - * @generated - */ - EClass PALETTE_INFOS = eINSTANCE.getPaletteInfos(); - - /** - * The meta object literal for the '<em><b>Infos</b></em>' containment reference list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference PALETTE_INFOS__INFOS = eINSTANCE.getPaletteInfos_Infos(); - - /** - * The meta object literal for the '{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.impl.PaletteInfoImpl <em>Palette Info</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.impl.PaletteInfoImpl - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.impl.PaletteInfosPackageImpl#getPaletteInfo() - * @generated - */ - EClass PALETTE_INFO = eINSTANCE.getPaletteInfo(); - - /** - * The meta object literal for the '<em><b>Id</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute PALETTE_INFO__ID = eINSTANCE.getPaletteInfo_Id(); - - /** - * The meta object literal for the '<em><b>Tag</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute PALETTE_INFO__TAG = eINSTANCE.getPaletteInfo_Tag(); - - /** - * The meta object literal for the '<em><b>Display Label</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute PALETTE_INFO__DISPLAY_LABEL = eINSTANCE.getPaletteInfo_DisplayLabel(); - - /** - * The meta object literal for the '<em><b>Description</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute PALETTE_INFO__DESCRIPTION = eINSTANCE.getPaletteInfo_Description(); - - /** - * The meta object literal for the '<em><b>Expert</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute PALETTE_INFO__EXPERT = eINSTANCE.getPaletteInfo_Expert(); - - /** - * The meta object literal for the '<em><b>Hidden</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute PALETTE_INFO__HIDDEN = eINSTANCE.getPaletteInfo_Hidden(); - - /** - * The meta object literal for the '<em><b>Small Icon</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute PALETTE_INFO__SMALL_ICON = eINSTANCE.getPaletteInfo_SmallIcon(); - - /** - * The meta object literal for the '<em><b>Large Icon</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute PALETTE_INFO__LARGE_ICON = eINSTANCE.getPaletteInfo_LargeIcon(); - - /** - * The meta object literal for the '<em><b>Tag Creation</b></em>' reference feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference PALETTE_INFO__TAG_CREATION = eINSTANCE.getPaletteInfo_TagCreation(); - - /** - * The meta object literal for the '{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.impl.TagCreationInfoImpl <em>Tag Creation Info</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.impl.TagCreationInfoImpl - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.impl.PaletteInfosPackageImpl#getTagCreationInfo() - * @generated - */ - EClass TAG_CREATION_INFO = eINSTANCE.getTagCreationInfo(); - - /** - * The meta object literal for the '<em><b>Attributes</b></em>' containment reference list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference TAG_CREATION_INFO__ATTRIBUTES = eINSTANCE.getTagCreationInfo_Attributes(); - - /** - * The meta object literal for the '<em><b>Template</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute TAG_CREATION_INFO__TEMPLATE = eINSTANCE.getTagCreationInfo_Template(); - - /** - * The meta object literal for the '{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.impl.TagCreationTemplateImpl <em>Tag Creation Template</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.impl.TagCreationTemplateImpl - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.impl.PaletteInfosPackageImpl#getTagCreationTemplate() - * @generated - */ - EClass TAG_CREATION_TEMPLATE = eINSTANCE.getTagCreationTemplate(); - - /** - * The meta object literal for the '<em><b>Template</b></em>' containment reference feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference TAG_CREATION_TEMPLATE__TEMPLATE = eINSTANCE.getTagCreationTemplate_Template(); - - /** - * The meta object literal for the '{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.impl.TagCreationAttributeImpl <em>Tag Creation Attribute</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.impl.TagCreationAttributeImpl - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.impl.PaletteInfosPackageImpl#getTagCreationAttribute() - * @generated - */ - EClass TAG_CREATION_ATTRIBUTE = eINSTANCE.getTagCreationAttribute(); - - /** - * The meta object literal for the '<em><b>Id</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute TAG_CREATION_ATTRIBUTE__ID = eINSTANCE.getTagCreationAttribute_Id(); - - /** - * The meta object literal for the '<em><b>Value</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute TAG_CREATION_ATTRIBUTE__VALUE = eINSTANCE.getTagCreationAttribute_Value(); - - } - -} //PaletteInfosPackage diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/tagdisplay/internal/paletteinfos/TagCreationAttribute.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/tagdisplay/internal/paletteinfos/TagCreationAttribute.java deleted file mode 100644 index d84b1ad19..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/tagdisplay/internal/paletteinfos/TagCreationAttribute.java +++ /dev/null @@ -1,87 +0,0 @@ -/** - * Copyright (c) 2007 Oracle Corporation - * - * $Id: TagCreationAttribute.java,v 1.1 2008/03/25 19:31:30 gkessler Exp $ - */ -package org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos; - -import org.eclipse.emf.ecore.EObject; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Tag Creation Attribute</b></em>'. - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.TagCreationAttribute#getId <em>Id</em>}</li> - * <li>{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.TagCreationAttribute#getValue <em>Value</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfosPackage#getTagCreationAttribute() - * @model - * @generated - */ -public interface TagCreationAttribute extends EObject { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String copyright = "Copyright (c) 2007 Oracle Corporation"; - - /** - * Returns the value of the '<em><b>Id</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Id</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Id</em>' attribute. - * @see #setId(String) - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfosPackage#getTagCreationAttribute_Id() - * @model required="true" - * @generated - */ - String getId(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.TagCreationAttribute#getId <em>Id</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Id</em>' attribute. - * @see #getId() - * @generated - */ - void setId(String value); - - /** - * Returns the value of the '<em><b>Value</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Value</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Value</em>' attribute. - * @see #setValue(String) - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfosPackage#getTagCreationAttribute_Value() - * @model - * @generated - */ - String getValue(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.TagCreationAttribute#getValue <em>Value</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Value</em>' attribute. - * @see #getValue() - * @generated - */ - void setValue(String value); - -} // TagCreationAttribute diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/tagdisplay/internal/paletteinfos/TagCreationInfo.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/tagdisplay/internal/paletteinfos/TagCreationInfo.java deleted file mode 100644 index fb3b9378c..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/tagdisplay/internal/paletteinfos/TagCreationInfo.java +++ /dev/null @@ -1,84 +0,0 @@ -/** - * Copyright (c) 2007 Oracle Corporation - * - * $Id: TagCreationInfo.java,v 1.1 2008/03/25 19:31:30 gkessler Exp $ - */ -package org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos; - -import org.eclipse.emf.common.util.EList; - -import org.eclipse.emf.ecore.EObject; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Tag Creation Info</b></em>'. - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.TagCreationInfo#getAttributes <em>Attributes</em>}</li> - * <li>{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.TagCreationInfo#getTemplate <em>Template</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfosPackage#getTagCreationInfo() - * @model - * @generated - */ -public interface TagCreationInfo extends EObject { - /** - * the name of the trait id - */ - public static final String TRAIT_ID = "tag-create"; - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String copyright = "Copyright (c) 2007 Oracle Corporation"; - - /** - * Returns the value of the '<em><b>Attributes</b></em>' containment reference list. - * The list contents are of type {@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.TagCreationAttribute}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Attributes</em>' containment reference list isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Attributes</em>' containment reference list. - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfosPackage#getTagCreationInfo_Attributes() - * @model type="org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.TagCreationAttribute" containment="true" - * extendedMetaData="kind='element' name='attribute'" - * @generated - */ - EList getAttributes(); - - /** - * Returns the value of the '<em><b>Template</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Template</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Template</em>' attribute. - * @see #setTemplate(Object) - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfosPackage#getTagCreationInfo_Template() - * @model dataType="org.eclipse.emf.ecore.xml.type.AnySimpleType" - * @generated - */ - Object getTemplate(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.TagCreationInfo#getTemplate <em>Template</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Template</em>' attribute. - * @see #getTemplate() - * @generated - */ - void setTemplate(Object value); - -} // TagCreationInfo diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/tagdisplay/internal/paletteinfos/TagCreationTemplate.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/tagdisplay/internal/paletteinfos/TagCreationTemplate.java deleted file mode 100644 index c06f5d857..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/tagdisplay/internal/paletteinfos/TagCreationTemplate.java +++ /dev/null @@ -1,60 +0,0 @@ -/** - * Copyright (c) 2007 Oracle Corporation - * - * $Id: TagCreationTemplate.java,v 1.1 2008/03/25 19:31:30 gkessler Exp $ - */ -package org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos; - -import org.eclipse.emf.ecore.EObject; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Tag Creation Template</b></em>'. - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.TagCreationTemplate#getTemplate <em>Template</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfosPackage#getTagCreationTemplate() - * @model - * @generated - */ -public interface TagCreationTemplate extends EObject { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String copyright = "Copyright (c) 2007 Oracle Corporation"; - - /** - * Returns the value of the '<em><b>Template</b></em>' containment reference. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Template</em>' containment reference isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Template</em>' containment reference. - * @see #setTemplate(EObject) - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfosPackage#getTagCreationTemplate_Template() - * @model containment="true" - * @generated - */ - EObject getTemplate(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.TagCreationTemplate#getTemplate <em>Template</em>}' containment reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Template</em>' containment reference. - * @see #getTemplate() - * @generated - */ - void setTemplate(EObject value); - -} // TagCreationTemplate diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/tagdisplay/internal/paletteinfos/impl/PaletteInfoImpl.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/tagdisplay/internal/paletteinfos/impl/PaletteInfoImpl.java deleted file mode 100644 index 1d0717b7e..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/tagdisplay/internal/paletteinfos/impl/PaletteInfoImpl.java +++ /dev/null @@ -1,727 +0,0 @@ -/** - * Copyright (c) 2007 Oracle Corporation - * - * $Id: PaletteInfoImpl.java,v 1.1 2008/03/25 19:31:28 gkessler Exp $ - */ -package org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.impl; - -import java.util.Iterator; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.InternalEObject; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.impl.EObjectImpl; -import org.eclipse.jst.jsf.common.metadata.Entity; -import org.eclipse.jst.jsf.common.metadata.Model; -import org.eclipse.jst.jsf.common.metadata.Trait; -import org.eclipse.jst.jsf.common.metadata.internal.TraitValueHelper; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfo; -import org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfosPackage; -import org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.TagCreationInfo; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Palette Info</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.impl.PaletteInfoImpl#getId <em>Id</em>}</li> - * <li>{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.impl.PaletteInfoImpl#getTag() <em>Tag</em>}</li> - * <li>{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.impl.PaletteInfoImpl#getDisplayLabel <em>Display Label</em>}</li> - * <li>{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.impl.PaletteInfoImpl#getDescription <em>Description</em>}</li> - * <li>{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.impl.PaletteInfoImpl#getExpert <em>Expert</em>}</li> - * <li>{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.impl.PaletteInfoImpl#getHidden <em>Hidden</em>}</li> - * <li>{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.impl.PaletteInfoImpl#getSmallIcon <em>Small Icon</em>}</li> - * <li>{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.impl.PaletteInfoImpl#getLargeIcon <em>Large Icon</em>}</li> - * <li>{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.impl.PaletteInfoImpl#getTagCreation <em>Tag Creation</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class PaletteInfoImpl extends EObjectImpl implements PaletteInfo { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright (c) 2007 Oracle Corporation"; - - /** - * The default value of the '{@link #getId() <em>Id</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getId() - * @generated - * @ordered - */ - protected static final String ID_EDEFAULT = null; - - /** - * The cached value of the '{@link #getId() <em>Id</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getId() - * @generated - * @ordered - */ - protected String id = ID_EDEFAULT; - - /** - * The default value of the '{@link #getTag() <em>Tag</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getTag() - * @generated - * @ordered - */ - protected static final String TAG_EDEFAULT = null; - - /** - * The cached value of the '{@link #getTag() <em>Tag</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getTag() - * @generated - * @ordered - */ - protected String tag = TAG_EDEFAULT; - - /** - * The default value of the '{@link #getDisplayLabel() <em>Display Label</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getDisplayLabel() - * @generated - * @ordered - */ - protected static final String DISPLAY_LABEL_EDEFAULT = null; - - /** - * The cached value of the '{@link #getDisplayLabel() <em>Display Label</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getDisplayLabel() - * @generated - * @ordered - */ - protected String displayLabel = DISPLAY_LABEL_EDEFAULT; - - /** - * The default value of the '{@link #getDescription() <em>Description</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getDescription() - * @generated - * @ordered - */ - protected static final String DESCRIPTION_EDEFAULT = null; - - /** - * The cached value of the '{@link #getDescription() <em>Description</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getDescription() - * @generated - * @ordered - */ - protected String description = DESCRIPTION_EDEFAULT; - - /** - * The default value of the '{@link #getExpert() <em>Expert</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getExpert() - * @generated - * @ordered - */ - protected static final Boolean EXPERT_EDEFAULT = null; - - /** - * The cached value of the '{@link #getExpert() <em>Expert</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getExpert() - * @generated - * @ordered - */ - protected Boolean expert = EXPERT_EDEFAULT; - - /** - * The default value of the '{@link #getHidden() <em>Hidden</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getHidden() - * @generated - * @ordered - */ - protected static final Boolean HIDDEN_EDEFAULT = null; - - /** - * The cached value of the '{@link #getHidden() <em>Hidden</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getHidden() - * @generated - * @ordered - */ - protected Boolean hidden = HIDDEN_EDEFAULT; - - /** - * The default value of the '{@link #getSmallIcon() <em>Small Icon</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getSmallIcon() - * @generated - * @ordered - */ - protected static final String SMALL_ICON_EDEFAULT = null; - - /** - * The cached value of the '{@link #getSmallIcon() <em>Small Icon</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getSmallIcon() - * @generated - * @ordered - */ - protected String smallIcon = SMALL_ICON_EDEFAULT; - - /** - * The default value of the '{@link #getLargeIcon() <em>Large Icon</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getLargeIcon() - * @generated - * @ordered - */ - protected static final String LARGE_ICON_EDEFAULT = null; - - /** - * The cached value of the '{@link #getLargeIcon() <em>Large Icon</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getLargeIcon() - * @generated - * @ordered - */ - protected String largeIcon = LARGE_ICON_EDEFAULT; - - /** - * The cached value of the '{@link #getTagCreation() <em>Tag Creation</em>}' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getTagCreation() - * @generated - * @ordered - */ - protected TagCreationInfo tagCreation = null; - - private Entity _tag; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected PaletteInfoImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EClass eStaticClass() { - return PaletteInfosPackage.Literals.PALETTE_INFO; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getId() { - return id; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setId(String newId) { - String oldId = id; - id = newId; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, PaletteInfosPackage.PALETTE_INFO__ID, oldId, id)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - public String getTag() { - return tag != null ? tag : getId(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setTag(String newTag) { - String oldTag = tag; - tag = newTag; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, PaletteInfosPackage.PALETTE_INFO__TAG, oldTag, tag)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - public String getDisplayLabel() { - if (displayLabel == null){ - return getTagTraitValueAsString(getTag(), TRAIT_DISPLAY_LABEL); - } - return getNLSedValue(displayLabel); - } - - private String getNLSedValue(final String rawValue) { - String value = TraitValueHelper.getNLSValue((Trait)this.eContainer.eContainer(), rawValue); - return value; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - private String getTagTraitValueAsString(final String _id, final String traitKey) { - EObject obj = getTagTraitValue(getTag(), traitKey); - if (obj != null){ - return TraitValueHelper.getValueAsString((Trait)obj.eContainer()); - } - return null; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - private EObject getTagTraitValue(final String tagName, final String traitKey) { - Entity tag_ = getTag(tagName); - if (tag_ != null){ - for (Iterator it=tag_.getTraits().iterator();it.hasNext();){ - Trait trait = (Trait)it.next(); - if (traitKey.equals(trait.getId())) - return trait.getValue(); - } - } - return null; - } - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - private Entity getTag(String tagName) { - if (_tag == null){ - //rely on PaletteInfos objects being inside a Model trait only - try { - Model model = (Model)this.eContainer().eContainer().eContainer(); - //we could probably do better than this... oh well - //FIXME: C.B: this is really bad! We could probably do better than - // write code that expects to throw ClassCastExceptions and then hides them? I hope so! - _tag = findTag(model, tagName); - } catch (ClassCastException e) { -// PDPlugin.getLogger(getClass()).error(e); - JSFCorePlugin.log(e, "ClassCastException in getTag() for " + tagName); - return null; - } - } - return _tag; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - private Entity findTag(Model model, String tagid) { - for (Iterator it=model.getChildEntities().iterator();it.hasNext();){ - Entity tag_ = (Entity)it.next(); - if (tagid.equals(tag_.getId())) - return tag_; - } - return null; - } - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setDisplayLabel(String newDisplayLabel) { - String oldDisplayLabel = displayLabel; - displayLabel = newDisplayLabel; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, PaletteInfosPackage.PALETTE_INFO__DISPLAY_LABEL, oldDisplayLabel, displayLabel)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - public String getDescription() { - if (description == null){ - return getTagTraitValueAsString(getId(), TRAIT_DESCRIPTION); - } - return getNLSedValue(description); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setDescription(String newDescription) { - String oldDescription = description; - description = newDescription; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, PaletteInfosPackage.PALETTE_INFO__DESCRIPTION, oldDescription, description)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Boolean getExpert() { - return expert; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setExpert(Boolean newExpert) { - Boolean oldExpert = expert; - expert = newExpert; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, PaletteInfosPackage.PALETTE_INFO__EXPERT, oldExpert, expert)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Boolean getHidden() { - return hidden; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setHidden(Boolean newHidden) { - Boolean oldHidden = hidden; - hidden = newHidden; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, PaletteInfosPackage.PALETTE_INFO__HIDDEN, oldHidden, hidden)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - public String getSmallIcon() { - if (smallIcon == null){ - return getTagTraitValueAsString(getId(), TRAIT_SMALL_ICON); - } - return smallIcon; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setSmallIcon(String newSmallIcon) { - String oldSmallIcon = smallIcon; - smallIcon = newSmallIcon; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, PaletteInfosPackage.PALETTE_INFO__SMALL_ICON, oldSmallIcon, smallIcon)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - public String getLargeIcon() { - if (largeIcon == null){ - return getTagTraitValueAsString(getId(), TRAIT_LARGE_ICON); - } - return largeIcon; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setLargeIcon(String newLargeIcon) { - String oldLargeIcon = largeIcon; - largeIcon = newLargeIcon; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, PaletteInfosPackage.PALETTE_INFO__LARGE_ICON, oldLargeIcon, largeIcon)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - public TagCreationInfo getTagCreation() { - if (tagCreation != null && tagCreation.eIsProxy()) { - InternalEObject oldTagCreation = (InternalEObject)tagCreation; - tagCreation = (TagCreationInfo)eResolveProxy(oldTagCreation); - if (tagCreation != oldTagCreation) { - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.RESOLVE, PaletteInfosPackage.PALETTE_INFO__TAG_CREATION, oldTagCreation, tagCreation)); - } - } - else if (tagCreation == null){ - //delegate to entity if it exists - return (TagCreationInfo)getTagTraitValue(getTag(), "tag-create"); - } - return tagCreation; - } - - /** - * <!-- begin-user-doc --> - * @return the tag creation info - * <!-- end-user-doc --> - * @generated - */ - public TagCreationInfo basicGetTagCreation() { - return tagCreation; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setTagCreation(TagCreationInfo newTagCreation) { - TagCreationInfo oldTagCreation = tagCreation; - tagCreation = newTagCreation; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, PaletteInfosPackage.PALETTE_INFO__TAG_CREATION, oldTagCreation, tagCreation)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - public boolean isExpert() { - if (expert == null){ - String val = getTagTraitValueAsString(getId(), "expert"); - return Boolean.valueOf(val).booleanValue(); - } - return expert.booleanValue(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - public boolean isHidden() { - if (hidden == null){ - String val = getTagTraitValueAsString(getId(), "hidden"); - return Boolean.valueOf(val).booleanValue(); - } - return hidden.booleanValue(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case PaletteInfosPackage.PALETTE_INFO__ID: - return getId(); - case PaletteInfosPackage.PALETTE_INFO__TAG: - return getTag(); - case PaletteInfosPackage.PALETTE_INFO__DISPLAY_LABEL: - return getDisplayLabel(); - case PaletteInfosPackage.PALETTE_INFO__DESCRIPTION: - return getDescription(); - case PaletteInfosPackage.PALETTE_INFO__EXPERT: - return getExpert(); - case PaletteInfosPackage.PALETTE_INFO__HIDDEN: - return getHidden(); - case PaletteInfosPackage.PALETTE_INFO__SMALL_ICON: - return getSmallIcon(); - case PaletteInfosPackage.PALETTE_INFO__LARGE_ICON: - return getLargeIcon(); - case PaletteInfosPackage.PALETTE_INFO__TAG_CREATION: - if (resolve) return getTagCreation(); - return basicGetTagCreation(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case PaletteInfosPackage.PALETTE_INFO__ID: - setId((String)newValue); - return; - case PaletteInfosPackage.PALETTE_INFO__TAG: - setTag((String)newValue); - return; - case PaletteInfosPackage.PALETTE_INFO__DISPLAY_LABEL: - setDisplayLabel((String)newValue); - return; - case PaletteInfosPackage.PALETTE_INFO__DESCRIPTION: - setDescription((String)newValue); - return; - case PaletteInfosPackage.PALETTE_INFO__EXPERT: - setExpert((Boolean)newValue); - return; - case PaletteInfosPackage.PALETTE_INFO__HIDDEN: - setHidden((Boolean)newValue); - return; - case PaletteInfosPackage.PALETTE_INFO__SMALL_ICON: - setSmallIcon((String)newValue); - return; - case PaletteInfosPackage.PALETTE_INFO__LARGE_ICON: - setLargeIcon((String)newValue); - return; - case PaletteInfosPackage.PALETTE_INFO__TAG_CREATION: - setTagCreation((TagCreationInfo)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eUnset(int featureID) { - switch (featureID) { - case PaletteInfosPackage.PALETTE_INFO__ID: - setId(ID_EDEFAULT); - return; - case PaletteInfosPackage.PALETTE_INFO__TAG: - setTag(TAG_EDEFAULT); - return; - case PaletteInfosPackage.PALETTE_INFO__DISPLAY_LABEL: - setDisplayLabel(DISPLAY_LABEL_EDEFAULT); - return; - case PaletteInfosPackage.PALETTE_INFO__DESCRIPTION: - setDescription(DESCRIPTION_EDEFAULT); - return; - case PaletteInfosPackage.PALETTE_INFO__EXPERT: - setExpert(EXPERT_EDEFAULT); - return; - case PaletteInfosPackage.PALETTE_INFO__HIDDEN: - setHidden(HIDDEN_EDEFAULT); - return; - case PaletteInfosPackage.PALETTE_INFO__SMALL_ICON: - setSmallIcon(SMALL_ICON_EDEFAULT); - return; - case PaletteInfosPackage.PALETTE_INFO__LARGE_ICON: - setLargeIcon(LARGE_ICON_EDEFAULT); - return; - case PaletteInfosPackage.PALETTE_INFO__TAG_CREATION: - setTagCreation((TagCreationInfo)null); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean eIsSet(int featureID) { - switch (featureID) { - case PaletteInfosPackage.PALETTE_INFO__ID: - return ID_EDEFAULT == null ? id != null : !ID_EDEFAULT.equals(id); - case PaletteInfosPackage.PALETTE_INFO__TAG: - return TAG_EDEFAULT == null ? tag != null : !TAG_EDEFAULT.equals(tag); - case PaletteInfosPackage.PALETTE_INFO__DISPLAY_LABEL: - return DISPLAY_LABEL_EDEFAULT == null ? displayLabel != null : !DISPLAY_LABEL_EDEFAULT.equals(displayLabel); - case PaletteInfosPackage.PALETTE_INFO__DESCRIPTION: - return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description); - case PaletteInfosPackage.PALETTE_INFO__EXPERT: - return EXPERT_EDEFAULT == null ? expert != null : !EXPERT_EDEFAULT.equals(expert); - case PaletteInfosPackage.PALETTE_INFO__HIDDEN: - return HIDDEN_EDEFAULT == null ? hidden != null : !HIDDEN_EDEFAULT.equals(hidden); - case PaletteInfosPackage.PALETTE_INFO__SMALL_ICON: - return SMALL_ICON_EDEFAULT == null ? smallIcon != null : !SMALL_ICON_EDEFAULT.equals(smallIcon); - case PaletteInfosPackage.PALETTE_INFO__LARGE_ICON: - return LARGE_ICON_EDEFAULT == null ? largeIcon != null : !LARGE_ICON_EDEFAULT.equals(largeIcon); - case PaletteInfosPackage.PALETTE_INFO__TAG_CREATION: - return tagCreation != null; - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String toString() { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (id: "); - result.append(id); - result.append(", tag: "); - result.append(tag); - result.append(", displayLabel: "); - result.append(displayLabel); - result.append(", description: "); - result.append(description); - result.append(", expert: "); - result.append(expert); - result.append(", hidden: "); - result.append(hidden); - result.append(", smallIcon: "); - result.append(smallIcon); - result.append(", largeIcon: "); - result.append(largeIcon); - result.append(')'); - return result.toString(); - } - -} //PaletteInfoImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/tagdisplay/internal/paletteinfos/impl/PaletteInfosFactoryImpl.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/tagdisplay/internal/paletteinfos/impl/PaletteInfosFactoryImpl.java deleted file mode 100644 index 9d68ced18..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/tagdisplay/internal/paletteinfos/impl/PaletteInfosFactoryImpl.java +++ /dev/null @@ -1,152 +0,0 @@ -/** - * Copyright (c) 2007 Oracle Corporation - * - * $Id: PaletteInfosFactoryImpl.java,v 1.1 2008/03/25 19:31:28 gkessler Exp $ - */ -package org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.impl; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.impl.EFactoryImpl; -import org.eclipse.emf.ecore.plugin.EcorePlugin; -import org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfo; -import org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfos; -import org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfosFactory; -import org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfosPackage; -import org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.TagCreationAttribute; -import org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.TagCreationInfo; -import org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.TagCreationTemplate; - -/** - * <!-- begin-user-doc --> - * An implementation of the model <b>Factory</b>. - * <!-- end-user-doc --> - * @generated - */ -public class PaletteInfosFactoryImpl extends EFactoryImpl implements PaletteInfosFactory { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright (c) 2007 Oracle Corporation"; - - /** - * Creates the default factory implementation. - * <!-- begin-user-doc --> - * @return the palette info factory - * <!-- end-user-doc --> - * @generated - */ - public static PaletteInfosFactory init() { - try { - PaletteInfosFactory thePaletteInfosFactory = (PaletteInfosFactory)EPackage.Registry.INSTANCE.getEFactory("http://org.eclipse.jsf.pagedesigner/paletteInfos.ecore"); - if (thePaletteInfosFactory != null) { - return thePaletteInfosFactory; - } - } - catch (Exception exception) { - EcorePlugin.INSTANCE.log(exception); - } - return new PaletteInfosFactoryImpl(); - } - - /** - * Creates an instance of the factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public PaletteInfosFactoryImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EObject create(EClass eClass) { - switch (eClass.getClassifierID()) { - case PaletteInfosPackage.PALETTE_INFOS: return createPaletteInfos(); - case PaletteInfosPackage.PALETTE_INFO: return createPaletteInfo(); - case PaletteInfosPackage.TAG_CREATION_INFO: return createTagCreationInfo(); - case PaletteInfosPackage.TAG_CREATION_TEMPLATE: return createTagCreationTemplate(); - case PaletteInfosPackage.TAG_CREATION_ATTRIBUTE: return createTagCreationAttribute(); - default: - throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public PaletteInfo createPaletteInfo() { - PaletteInfoImpl paletteInfo = new PaletteInfoImpl(); - return paletteInfo; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public TagCreationInfo createTagCreationInfo() { - TagCreationInfoImpl tagCreationInfo = new TagCreationInfoImpl(); - return tagCreationInfo; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public TagCreationTemplate createTagCreationTemplate() { - TagCreationTemplateImpl tagCreationTemplate = new TagCreationTemplateImpl(); - return tagCreationTemplate; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public TagCreationAttribute createTagCreationAttribute() { - TagCreationAttributeImpl tagCreationAttribute = new TagCreationAttributeImpl(); - return tagCreationAttribute; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public PaletteInfos createPaletteInfos() { - PaletteInfosImpl paletteInfos = new PaletteInfosImpl(); - return paletteInfos; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public PaletteInfosPackage getPaletteInfosPackage() { - return (PaletteInfosPackage)getEPackage(); - } - - /** - * <!-- begin-user-doc --> - * @return the palette info package - * <!-- end-user-doc --> - * @deprecated - * @generated - */ - public static PaletteInfosPackage getPackage() { - return PaletteInfosPackage.eINSTANCE; - } - -} //PaletteInfosFactoryImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/tagdisplay/internal/paletteinfos/impl/PaletteInfosImpl.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/tagdisplay/internal/paletteinfos/impl/PaletteInfosImpl.java deleted file mode 100644 index 0b1e219e0..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/tagdisplay/internal/paletteinfos/impl/PaletteInfosImpl.java +++ /dev/null @@ -1,165 +0,0 @@ -/** - * Copyright (c) 2007 Oracle Corporation - * - * $Id: PaletteInfosImpl.java,v 1.1 2008/03/25 19:31:28 gkessler Exp $ - */ -package org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.impl; - -import java.util.Collection; -import java.util.Iterator; - -import org.eclipse.emf.common.notify.NotificationChain; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.InternalEObject; -import org.eclipse.emf.ecore.impl.EObjectImpl; -import org.eclipse.emf.ecore.util.EObjectContainmentEList; -import org.eclipse.emf.ecore.util.InternalEList; -import org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfo; -import org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfos; -import org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfosPackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Palette Infos</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.impl.PaletteInfosImpl#getInfos <em>Infos</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class PaletteInfosImpl extends EObjectImpl implements PaletteInfos { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright (c) 2007 Oracle Corporation"; - - /** - * The cached value of the '{@link #getInfos() <em>Infos</em>}' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getInfos() - * @generated - * @ordered - */ - protected EList infos; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected PaletteInfosImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EClass eStaticClass() { - return PaletteInfosPackage.Literals.PALETTE_INFOS; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EList getInfos() { - if (infos == null) { - infos = new EObjectContainmentEList(PaletteInfo.class, this, PaletteInfosPackage.PALETTE_INFOS__INFOS); - } - return infos; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - public PaletteInfo findPaletteInfoById(String id) { - for (Iterator it=getInfos().iterator();it.hasNext();){ - PaletteInfo info = (PaletteInfo)it.next(); - if (id.equals(info.getId())) - return info; - } - return null; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { - switch (featureID) { - case PaletteInfosPackage.PALETTE_INFOS__INFOS: - return ((InternalEList)getInfos()).basicRemove(otherEnd, msgs); - } - return super.eInverseRemove(otherEnd, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case PaletteInfosPackage.PALETTE_INFOS__INFOS: - return getInfos(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case PaletteInfosPackage.PALETTE_INFOS__INFOS: - getInfos().clear(); - getInfos().addAll((Collection)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eUnset(int featureID) { - switch (featureID) { - case PaletteInfosPackage.PALETTE_INFOS__INFOS: - getInfos().clear(); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean eIsSet(int featureID) { - switch (featureID) { - case PaletteInfosPackage.PALETTE_INFOS__INFOS: - return infos != null && !infos.isEmpty(); - } - return super.eIsSet(featureID); - } - -} //PaletteInfosImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/tagdisplay/internal/paletteinfos/impl/PaletteInfosPackageImpl.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/tagdisplay/internal/paletteinfos/impl/PaletteInfosPackageImpl.java deleted file mode 100644 index 7abbfbba7..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/tagdisplay/internal/paletteinfos/impl/PaletteInfosPackageImpl.java +++ /dev/null @@ -1,520 +0,0 @@ -/** - * Copyright (c) 2007 Oracle Corporation - * - * $Id: PaletteInfosPackageImpl.java,v 1.1 2008/03/25 19:31:28 gkessler Exp $ - */ -package org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.impl; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EOperation; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; - -import org.eclipse.emf.ecore.impl.EPackageImpl; - -import org.eclipse.emf.ecore.xml.type.XMLTypePackage; - -import org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfo; -import org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfos; -import org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfosFactory; -import org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfosPackage; -import org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.TagCreationAttribute; -import org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.TagCreationInfo; -import org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.TagCreationTemplate; - -/** - * <!-- begin-user-doc --> - * An implementation of the model <b>Package</b>. - * <!-- end-user-doc --> - * @generated - */ -public class PaletteInfosPackageImpl extends EPackageImpl implements PaletteInfosPackage { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright (c) 2007 Oracle Corporation"; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass paletteInfosEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass paletteInfoEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass tagCreationInfoEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass tagCreationTemplateEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass tagCreationAttributeEClass = null; - - /** - * Creates an instance of the model <b>Package</b>, registered with - * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package - * package URI value. - * <p>Note: the correct way to create the package is via the static - * factory method {@link #init init()}, which also performs - * initialization of the package, or returns the registered package, - * if one already exists. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.ecore.EPackage.Registry - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfosPackage#eNS_URI - * @see #init() - * @generated - */ - private PaletteInfosPackageImpl() { - super(eNS_URI, PaletteInfosFactory.eINSTANCE); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private static boolean isInited = false; - - /** - * Creates, registers, and initializes the <b>Package</b> for this - * model, and for any others upon which it depends. Simple - * dependencies are satisfied by calling this method on all - * dependent packages before doing anything else. This method drives - * initialization for interdependent packages directly, in parallel - * with this package, itself. - * <p>Of this package and its interdependencies, all packages which - * have not yet been registered by their URI values are first created - * and registered. The packages are then initialized in two steps: - * meta-model objects for all of the packages are created before any - * are initialized, since one package's meta-model objects may refer to - * those of another. - * <p>Invocation of this method will not affect any packages that have - * already been initialized. - * <!-- begin-user-doc --> - * @return the palette info package - * <!-- end-user-doc --> - * @see #eNS_URI - * @see #createPackageContents() - * @see #initializePackageContents() - * @generated - */ - public static PaletteInfosPackage init() { - if (isInited) return (PaletteInfosPackage)EPackage.Registry.INSTANCE.getEPackage(PaletteInfosPackage.eNS_URI); - - // Obtain or create and register package - PaletteInfosPackageImpl thePaletteInfosPackage = (PaletteInfosPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(eNS_URI) instanceof PaletteInfosPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(eNS_URI) : new PaletteInfosPackageImpl()); - - isInited = true; - - // Initialize simple dependencies - XMLTypePackage.eINSTANCE.eClass(); - - // Create package meta-data objects - thePaletteInfosPackage.createPackageContents(); - - // Initialize created meta-data - thePaletteInfosPackage.initializePackageContents(); - - // Mark meta-data to indicate it can't be changed - thePaletteInfosPackage.freeze(); - - return thePaletteInfosPackage; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getPaletteInfos() { - return paletteInfosEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getPaletteInfos_Infos() { - return (EReference)paletteInfosEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getPaletteInfo() { - return paletteInfoEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getPaletteInfo_Id() { - return (EAttribute)paletteInfoEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getPaletteInfo_Tag() { - return (EAttribute)paletteInfoEClass.getEStructuralFeatures().get(1); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getPaletteInfo_DisplayLabel() { - return (EAttribute)paletteInfoEClass.getEStructuralFeatures().get(2); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getPaletteInfo_Description() { - return (EAttribute)paletteInfoEClass.getEStructuralFeatures().get(3); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getPaletteInfo_Expert() { - return (EAttribute)paletteInfoEClass.getEStructuralFeatures().get(4); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getPaletteInfo_Hidden() { - return (EAttribute)paletteInfoEClass.getEStructuralFeatures().get(5); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getPaletteInfo_SmallIcon() { - return (EAttribute)paletteInfoEClass.getEStructuralFeatures().get(6); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getPaletteInfo_LargeIcon() { - return (EAttribute)paletteInfoEClass.getEStructuralFeatures().get(7); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getPaletteInfo_TagCreation() { - return (EReference)paletteInfoEClass.getEStructuralFeatures().get(8); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getTagCreationInfo() { - return tagCreationInfoEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getTagCreationInfo_Attributes() { - return (EReference)tagCreationInfoEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getTagCreationInfo_Template() { - return (EAttribute)tagCreationInfoEClass.getEStructuralFeatures().get(1); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getTagCreationTemplate() { - return tagCreationTemplateEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getTagCreationTemplate_Template() { - return (EReference)tagCreationTemplateEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getTagCreationAttribute() { - return tagCreationAttributeEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getTagCreationAttribute_Id() { - return (EAttribute)tagCreationAttributeEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getTagCreationAttribute_Value() { - return (EAttribute)tagCreationAttributeEClass.getEStructuralFeatures().get(1); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public PaletteInfosFactory getPaletteInfosFactory() { - return (PaletteInfosFactory)getEFactoryInstance(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private boolean isCreated = false; - - /** - * Creates the meta-model objects for the package. This method is - * guarded to have no affect on any invocation but its first. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void createPackageContents() { - if (isCreated) return; - isCreated = true; - - // Create classes and their features - paletteInfosEClass = createEClass(PALETTE_INFOS); - createEReference(paletteInfosEClass, PALETTE_INFOS__INFOS); - - paletteInfoEClass = createEClass(PALETTE_INFO); - createEAttribute(paletteInfoEClass, PALETTE_INFO__ID); - createEAttribute(paletteInfoEClass, PALETTE_INFO__TAG); - createEAttribute(paletteInfoEClass, PALETTE_INFO__DISPLAY_LABEL); - createEAttribute(paletteInfoEClass, PALETTE_INFO__DESCRIPTION); - createEAttribute(paletteInfoEClass, PALETTE_INFO__EXPERT); - createEAttribute(paletteInfoEClass, PALETTE_INFO__HIDDEN); - createEAttribute(paletteInfoEClass, PALETTE_INFO__SMALL_ICON); - createEAttribute(paletteInfoEClass, PALETTE_INFO__LARGE_ICON); - createEReference(paletteInfoEClass, PALETTE_INFO__TAG_CREATION); - - tagCreationInfoEClass = createEClass(TAG_CREATION_INFO); - createEReference(tagCreationInfoEClass, TAG_CREATION_INFO__ATTRIBUTES); - createEAttribute(tagCreationInfoEClass, TAG_CREATION_INFO__TEMPLATE); - - tagCreationTemplateEClass = createEClass(TAG_CREATION_TEMPLATE); - createEReference(tagCreationTemplateEClass, TAG_CREATION_TEMPLATE__TEMPLATE); - - tagCreationAttributeEClass = createEClass(TAG_CREATION_ATTRIBUTE); - createEAttribute(tagCreationAttributeEClass, TAG_CREATION_ATTRIBUTE__ID); - createEAttribute(tagCreationAttributeEClass, TAG_CREATION_ATTRIBUTE__VALUE); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private boolean isInitialized = false; - - /** - * Complete the initialization of the package and its meta-model. This - * method is guarded to have no affect on any invocation but its first. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void initializePackageContents() { - if (isInitialized) return; - isInitialized = true; - - // Initialize package - setName(eNAME); - setNsPrefix(eNS_PREFIX); - setNsURI(eNS_URI); - - // Obtain other dependent packages - XMLTypePackage theXMLTypePackage = (XMLTypePackage)EPackage.Registry.INSTANCE.getEPackage(XMLTypePackage.eNS_URI); - - // Add supertypes to classes - - // Initialize classes and features; add operations and parameters - initEClass(paletteInfosEClass, PaletteInfos.class, "PaletteInfos", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEReference(getPaletteInfos_Infos(), this.getPaletteInfo(), null, "infos", null, 0, -1, PaletteInfos.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - - EOperation op = addEOperation(paletteInfosEClass, this.getPaletteInfo(), "findPaletteInfoById", 0, 1); - addEParameter(op, ecorePackage.getEString(), "id", 1, 1); - - initEClass(paletteInfoEClass, PaletteInfo.class, "PaletteInfo", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEAttribute(getPaletteInfo_Id(), ecorePackage.getEString(), "id", null, 1, 1, PaletteInfo.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getPaletteInfo_Tag(), ecorePackage.getEString(), "tag", null, 0, 1, PaletteInfo.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getPaletteInfo_DisplayLabel(), ecorePackage.getEString(), "displayLabel", null, 0, 1, PaletteInfo.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getPaletteInfo_Description(), ecorePackage.getEString(), "description", null, 0, 1, PaletteInfo.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getPaletteInfo_Expert(), ecorePackage.getEBooleanObject(), "expert", null, 0, 1, PaletteInfo.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getPaletteInfo_Hidden(), ecorePackage.getEBooleanObject(), "hidden", null, 0, 1, PaletteInfo.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getPaletteInfo_SmallIcon(), ecorePackage.getEString(), "smallIcon", null, 0, 1, PaletteInfo.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getPaletteInfo_LargeIcon(), ecorePackage.getEString(), "largeIcon", null, 0, 1, PaletteInfo.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEReference(getPaletteInfo_TagCreation(), this.getTagCreationInfo(), null, "tagCreation", null, 0, 1, PaletteInfo.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - - addEOperation(paletteInfoEClass, ecorePackage.getEBoolean(), "isExpert", 0, 1); - - addEOperation(paletteInfoEClass, ecorePackage.getEBoolean(), "isHidden", 0, 1); - - initEClass(tagCreationInfoEClass, TagCreationInfo.class, "TagCreationInfo", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEReference(getTagCreationInfo_Attributes(), this.getTagCreationAttribute(), null, "attributes", null, 0, -1, TagCreationInfo.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getTagCreationInfo_Template(), theXMLTypePackage.getAnySimpleType(), "template", null, 0, 1, TagCreationInfo.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - - initEClass(tagCreationTemplateEClass, TagCreationTemplate.class, "TagCreationTemplate", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEReference(getTagCreationTemplate_Template(), ecorePackage.getEObject(), null, "template", null, 0, 1, TagCreationTemplate.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - - initEClass(tagCreationAttributeEClass, TagCreationAttribute.class, "TagCreationAttribute", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEAttribute(getTagCreationAttribute_Id(), ecorePackage.getEString(), "id", null, 1, 1, TagCreationAttribute.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getTagCreationAttribute_Value(), ecorePackage.getEString(), "value", null, 0, 1, TagCreationAttribute.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - - // Create resource - createResource(eNS_URI); - - // Create annotations - // http:///org/eclipse/emf/ecore/util/ExtendedMetaData - createExtendedMetaDataAnnotations(); - } - - /** - * Initializes the annotations for <b>http:///org/eclipse/emf/ecore/util/ExtendedMetaData</b>. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void createExtendedMetaDataAnnotations() { - String source = "http:///org/eclipse/emf/ecore/util/ExtendedMetaData"; - addAnnotation - (getPaletteInfos_Infos(), - source, - new String[] { - "kind", "element", - "name", "item" - }); - addAnnotation - (getPaletteInfo_DisplayLabel(), - source, - new String[] { - "kind", "element", - "name", "display-label" - }); - addAnnotation - (getPaletteInfo_Description(), - source, - new String[] { - "kind", "element" - }); - addAnnotation - (getPaletteInfo_Expert(), - source, - new String[] { - "kind", "element" - }); - addAnnotation - (getPaletteInfo_Hidden(), - source, - new String[] { - "kind", "element" - }); - addAnnotation - (getPaletteInfo_SmallIcon(), - source, - new String[] { - "kind", "element", - "name", "small-icon" - }); - addAnnotation - (getPaletteInfo_LargeIcon(), - source, - new String[] { - "kind", "element", - "name", "large-icon" - }); - addAnnotation - (getPaletteInfo_TagCreation(), - source, - new String[] { - "kind", "element", - "name", "tag-create" - }); - addAnnotation - (getTagCreationInfo_Attributes(), - source, - new String[] { - "kind", "element", - "name", "attribute" - }); - } - -} //PaletteInfosPackageImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/tagdisplay/internal/paletteinfos/impl/TagCreationAttributeImpl.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/tagdisplay/internal/paletteinfos/impl/TagCreationAttributeImpl.java deleted file mode 100644 index 4109b42f2..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/tagdisplay/internal/paletteinfos/impl/TagCreationAttributeImpl.java +++ /dev/null @@ -1,221 +0,0 @@ -/** - * Copyright (c) 2007 Oracle Corporation - * - * $Id: TagCreationAttributeImpl.java,v 1.1 2008/03/25 19:31:28 gkessler Exp $ - */ -package org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.impl; - -import org.eclipse.emf.common.notify.Notification; - -import org.eclipse.emf.ecore.EClass; - -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.impl.EObjectImpl; - -import org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfosPackage; -import org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.TagCreationAttribute; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Tag Creation Attribute</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.impl.TagCreationAttributeImpl#getId <em>Id</em>}</li> - * <li>{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.impl.TagCreationAttributeImpl#getValue <em>Value</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class TagCreationAttributeImpl extends EObjectImpl implements TagCreationAttribute { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright (c) 2007 Oracle Corporation"; - - /** - * The default value of the '{@link #getId() <em>Id</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getId() - * @generated - * @ordered - */ - protected static final String ID_EDEFAULT = null; - - /** - * The cached value of the '{@link #getId() <em>Id</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getId() - * @generated - * @ordered - */ - protected String id = ID_EDEFAULT; - - /** - * The default value of the '{@link #getValue() <em>Value</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getValue() - * @generated - * @ordered - */ - protected static final String VALUE_EDEFAULT = null; - - /** - * The cached value of the '{@link #getValue() <em>Value</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getValue() - * @generated - * @ordered - */ - protected String value = VALUE_EDEFAULT; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TagCreationAttributeImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EClass eStaticClass() { - return PaletteInfosPackage.Literals.TAG_CREATION_ATTRIBUTE; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getId() { - return id; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setId(String newId) { - String oldId = id; - id = newId; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, PaletteInfosPackage.TAG_CREATION_ATTRIBUTE__ID, oldId, id)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getValue() { - return value; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setValue(String newValue) { - String oldValue = value; - value = newValue; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, PaletteInfosPackage.TAG_CREATION_ATTRIBUTE__VALUE, oldValue, value)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case PaletteInfosPackage.TAG_CREATION_ATTRIBUTE__ID: - return getId(); - case PaletteInfosPackage.TAG_CREATION_ATTRIBUTE__VALUE: - return getValue(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case PaletteInfosPackage.TAG_CREATION_ATTRIBUTE__ID: - setId((String)newValue); - return; - case PaletteInfosPackage.TAG_CREATION_ATTRIBUTE__VALUE: - setValue((String)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eUnset(int featureID) { - switch (featureID) { - case PaletteInfosPackage.TAG_CREATION_ATTRIBUTE__ID: - setId(ID_EDEFAULT); - return; - case PaletteInfosPackage.TAG_CREATION_ATTRIBUTE__VALUE: - setValue(VALUE_EDEFAULT); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean eIsSet(int featureID) { - switch (featureID) { - case PaletteInfosPackage.TAG_CREATION_ATTRIBUTE__ID: - return ID_EDEFAULT == null ? id != null : !ID_EDEFAULT.equals(id); - case PaletteInfosPackage.TAG_CREATION_ATTRIBUTE__VALUE: - return VALUE_EDEFAULT == null ? value != null : !VALUE_EDEFAULT.equals(value); - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String toString() { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (id: "); - result.append(id); - result.append(", value: "); - result.append(value); - result.append(')'); - return result.toString(); - } - -} //TagCreationAttributeImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/tagdisplay/internal/paletteinfos/impl/TagCreationInfoImpl.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/tagdisplay/internal/paletteinfos/impl/TagCreationInfoImpl.java deleted file mode 100644 index 327f928c5..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/tagdisplay/internal/paletteinfos/impl/TagCreationInfoImpl.java +++ /dev/null @@ -1,224 +0,0 @@ -/** - * Copyright (c) 2007 Oracle Corporation - * - * $Id: TagCreationInfoImpl.java,v 1.1 2008/03/25 19:31:28 gkessler Exp $ - */ -package org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.impl; - -import java.util.Collection; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.NotificationChain; - -import org.eclipse.emf.common.util.EList; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.InternalEObject; - -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.impl.EObjectImpl; - -import org.eclipse.emf.ecore.util.EObjectContainmentEList; -import org.eclipse.emf.ecore.util.InternalEList; - -import org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfosPackage; -import org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.TagCreationAttribute; -import org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.TagCreationInfo; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Tag Creation Info</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.impl.TagCreationInfoImpl#getAttributes <em>Attributes</em>}</li> - * <li>{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.impl.TagCreationInfoImpl#getTemplate <em>Template</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class TagCreationInfoImpl extends EObjectImpl implements TagCreationInfo { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright (c) 2007 Oracle Corporation"; - - /** - * The cached value of the '{@link #getAttributes() <em>Attributes</em>}' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getAttributes() - * @generated - * @ordered - */ - protected EList attributes; - - /** - * The default value of the '{@link #getTemplate() <em>Template</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getTemplate() - * @generated - * @ordered - */ - protected static final Object TEMPLATE_EDEFAULT = null; - - /** - * The cached value of the '{@link #getTemplate() <em>Template</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getTemplate() - * @generated - * @ordered - */ - protected Object template = TEMPLATE_EDEFAULT; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TagCreationInfoImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EClass eStaticClass() { - return PaletteInfosPackage.Literals.TAG_CREATION_INFO; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EList getAttributes() { - if (attributes == null) { - attributes = new EObjectContainmentEList(TagCreationAttribute.class, this, PaletteInfosPackage.TAG_CREATION_INFO__ATTRIBUTES); - } - return attributes; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Object getTemplate() { - return template; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setTemplate(Object newTemplate) { - Object oldTemplate = template; - template = newTemplate; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, PaletteInfosPackage.TAG_CREATION_INFO__TEMPLATE, oldTemplate, template)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { - switch (featureID) { - case PaletteInfosPackage.TAG_CREATION_INFO__ATTRIBUTES: - return ((InternalEList)getAttributes()).basicRemove(otherEnd, msgs); - } - return super.eInverseRemove(otherEnd, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case PaletteInfosPackage.TAG_CREATION_INFO__ATTRIBUTES: - return getAttributes(); - case PaletteInfosPackage.TAG_CREATION_INFO__TEMPLATE: - return getTemplate(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case PaletteInfosPackage.TAG_CREATION_INFO__ATTRIBUTES: - getAttributes().clear(); - getAttributes().addAll((Collection)newValue); - return; - case PaletteInfosPackage.TAG_CREATION_INFO__TEMPLATE: - setTemplate(newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eUnset(int featureID) { - switch (featureID) { - case PaletteInfosPackage.TAG_CREATION_INFO__ATTRIBUTES: - getAttributes().clear(); - return; - case PaletteInfosPackage.TAG_CREATION_INFO__TEMPLATE: - setTemplate(TEMPLATE_EDEFAULT); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean eIsSet(int featureID) { - switch (featureID) { - case PaletteInfosPackage.TAG_CREATION_INFO__ATTRIBUTES: - return attributes != null && !attributes.isEmpty(); - case PaletteInfosPackage.TAG_CREATION_INFO__TEMPLATE: - return TEMPLATE_EDEFAULT == null ? template != null : !TEMPLATE_EDEFAULT.equals(template); - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String toString() { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (template: "); - result.append(template); - result.append(')'); - return result.toString(); - } - -} //TagCreationInfoImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/tagdisplay/internal/paletteinfos/impl/TagCreationTemplateImpl.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/tagdisplay/internal/paletteinfos/impl/TagCreationTemplateImpl.java deleted file mode 100644 index edad1eb0e..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/tagdisplay/internal/paletteinfos/impl/TagCreationTemplateImpl.java +++ /dev/null @@ -1,183 +0,0 @@ -/** - * Copyright (c) 2007 Oracle Corporation - * - * $Id: TagCreationTemplateImpl.java,v 1.1 2008/03/25 19:31:28 gkessler Exp $ - */ -package org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.impl; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.NotificationChain; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.InternalEObject; - -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.impl.EObjectImpl; - -import org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfosPackage; -import org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.TagCreationTemplate; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Tag Creation Template</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.impl.TagCreationTemplateImpl#getTemplate <em>Template</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class TagCreationTemplateImpl extends EObjectImpl implements TagCreationTemplate { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright (c) 2007 Oracle Corporation"; - - /** - * The cached value of the '{@link #getTemplate() <em>Template</em>}' containment reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getTemplate() - * @generated - * @ordered - */ - protected EObject template; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TagCreationTemplateImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EClass eStaticClass() { - return PaletteInfosPackage.Literals.TAG_CREATION_TEMPLATE; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EObject getTemplate() { - return template; - } - - /** - * <!-- begin-user-doc --> - * @param newTemplate - * @param msgs - * @return the notification chain - * <!-- end-user-doc --> - * @generated - */ - public NotificationChain basicSetTemplate(EObject newTemplate, NotificationChain msgs) { - EObject oldTemplate = template; - template = newTemplate; - if (eNotificationRequired()) { - ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, PaletteInfosPackage.TAG_CREATION_TEMPLATE__TEMPLATE, oldTemplate, newTemplate); - if (msgs == null) msgs = notification; else msgs.add(notification); - } - return msgs; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setTemplate(EObject newTemplate) { - if (newTemplate != template) { - NotificationChain msgs = null; - if (template != null) - msgs = ((InternalEObject)template).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - PaletteInfosPackage.TAG_CREATION_TEMPLATE__TEMPLATE, null, msgs); - if (newTemplate != null) - msgs = ((InternalEObject)newTemplate).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - PaletteInfosPackage.TAG_CREATION_TEMPLATE__TEMPLATE, null, msgs); - msgs = basicSetTemplate(newTemplate, msgs); - if (msgs != null) msgs.dispatch(); - } - else if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, PaletteInfosPackage.TAG_CREATION_TEMPLATE__TEMPLATE, newTemplate, newTemplate)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { - switch (featureID) { - case PaletteInfosPackage.TAG_CREATION_TEMPLATE__TEMPLATE: - return basicSetTemplate(null, msgs); - } - return super.eInverseRemove(otherEnd, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case PaletteInfosPackage.TAG_CREATION_TEMPLATE__TEMPLATE: - return getTemplate(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case PaletteInfosPackage.TAG_CREATION_TEMPLATE__TEMPLATE: - setTemplate((EObject)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eUnset(int featureID) { - switch (featureID) { - case PaletteInfosPackage.TAG_CREATION_TEMPLATE__TEMPLATE: - setTemplate((EObject)null); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean eIsSet(int featureID) { - switch (featureID) { - case PaletteInfosPackage.TAG_CREATION_TEMPLATE__TEMPLATE: - return template != null; - } - return super.eIsSet(featureID); - } - -} //TagCreationTemplateImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/tagdisplay/internal/paletteinfos/util/PaletteInfosAdapterFactory.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/tagdisplay/internal/paletteinfos/util/PaletteInfosAdapterFactory.java deleted file mode 100644 index 020473a6b..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/tagdisplay/internal/paletteinfos/util/PaletteInfosAdapterFactory.java +++ /dev/null @@ -1,194 +0,0 @@ -/** - * Copyright (c) 2007 Oracle Corporation - * - * $Id: PaletteInfosAdapterFactory.java,v 1.1 2008/03/25 19:31:30 gkessler Exp $ - */ -package org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.util; - -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.common.notify.Notifier; - -import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; - -import org.eclipse.emf.ecore.EObject; - -import org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.*; - -/** - * <!-- begin-user-doc --> - * The <b>Adapter Factory</b> for the model. - * It provides an adapter <code>createXXX</code> method for each class of the model. - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfosPackage - * @generated - */ -public class PaletteInfosAdapterFactory extends AdapterFactoryImpl { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright (c) 2007 Oracle Corporation"; - - /** - * The cached model package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected static PaletteInfosPackage modelPackage; - - /** - * Creates an instance of the adapter factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public PaletteInfosAdapterFactory() { - if (modelPackage == null) { - modelPackage = PaletteInfosPackage.eINSTANCE; - } - } - - /** - * Returns whether this factory is applicable for the type of the object. - * <!-- begin-user-doc --> - * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model. - * <!-- end-user-doc --> - * @return whether this factory is applicable for the type of the object. - * @generated - */ - public boolean isFactoryForType(Object object) { - if (object == modelPackage) { - return true; - } - if (object instanceof EObject) { - return ((EObject)object).eClass().getEPackage() == modelPackage; - } - return false; - } - - /** - * The switch that delegates to the <code>createXXX</code> methods. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected PaletteInfosSwitch modelSwitch = - new PaletteInfosSwitch() { - public Object casePaletteInfos(PaletteInfos object) { - return createPaletteInfosAdapter(); - } - public Object casePaletteInfo(PaletteInfo object) { - return createPaletteInfoAdapter(); - } - public Object caseTagCreationInfo(TagCreationInfo object) { - return createTagCreationInfoAdapter(); - } - public Object caseTagCreationTemplate(TagCreationTemplate object) { - return createTagCreationTemplateAdapter(); - } - public Object caseTagCreationAttribute(TagCreationAttribute object) { - return createTagCreationAttributeAdapter(); - } - public Object defaultCase(EObject object) { - return createEObjectAdapter(); - } - }; - - /** - * Creates an adapter for the <code>target</code>. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param target the object to adapt. - * @return the adapter for the <code>target</code>. - * @generated - */ - public Adapter createAdapter(Notifier target) { - return (Adapter)modelSwitch.doSwitch((EObject)target); - } - - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfos <em>Palette Infos</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfos - * @generated - */ - public Adapter createPaletteInfosAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfo <em>Palette Info</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfo - * @generated - */ - public Adapter createPaletteInfoAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.TagCreationInfo <em>Tag Creation Info</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.TagCreationInfo - * @generated - */ - public Adapter createTagCreationInfoAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.TagCreationTemplate <em>Tag Creation Template</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.TagCreationTemplate - * @generated - */ - public Adapter createTagCreationTemplateAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.TagCreationAttribute <em>Tag Creation Attribute</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.TagCreationAttribute - * @generated - */ - public Adapter createTagCreationAttributeAdapter() { - return null; - } - - /** - * Creates a new adapter for the default case. - * <!-- begin-user-doc --> - * This default implementation returns null. - * <!-- end-user-doc --> - * @return the new adapter. - * @generated - */ - public Adapter createEObjectAdapter() { - return null; - } - -} //PaletteInfosAdapterFactory diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/tagdisplay/internal/paletteinfos/util/PaletteInfosSwitch.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/tagdisplay/internal/paletteinfos/util/PaletteInfosSwitch.java deleted file mode 100644 index 1059181f7..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/tagdisplay/internal/paletteinfos/util/PaletteInfosSwitch.java +++ /dev/null @@ -1,223 +0,0 @@ -/** - * Copyright (c) 2007 Oracle Corporation - * - * $Id: PaletteInfosSwitch.java,v 1.1 2008/03/25 19:31:30 gkessler Exp $ - */ -package org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.util; - -import java.util.List; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; - -import org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.*; - -/** - * <!-- begin-user-doc --> - * The <b>Switch</b> for the model's inheritance hierarchy. - * It supports the call {@link #doSwitch(EObject) doSwitch(object)} - * to invoke the <code>caseXXX</code> method for each class of the model, - * starting with the actual class of the object - * and proceeding up the inheritance hierarchy - * until a non-null result is returned, - * which is the result of the switch. - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.tagdisplay.internal.paletteinfos.PaletteInfosPackage - * @generated - */ -public class PaletteInfosSwitch { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright (c) 2007 Oracle Corporation"; - - /** - * The cached model package - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected static PaletteInfosPackage modelPackage; - - /** - * Creates an instance of the switch. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public PaletteInfosSwitch() { - if (modelPackage == null) { - modelPackage = PaletteInfosPackage.eINSTANCE; - } - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * @param theEObject - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - public Object doSwitch(EObject theEObject) { - return doSwitch(theEObject.eClass(), theEObject); - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * @param theEClass - * @param theEObject - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - protected Object doSwitch(EClass theEClass, EObject theEObject) { - if (theEClass.eContainer() == modelPackage) { - return doSwitch(theEClass.getClassifierID(), theEObject); - } - List eSuperTypes = theEClass.getESuperTypes(); - return - eSuperTypes.isEmpty() ? - defaultCase(theEObject) : - doSwitch((EClass)eSuperTypes.get(0), theEObject); - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * @param classifierID - * @param theEObject - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - protected Object doSwitch(int classifierID, EObject theEObject) { - switch (classifierID) { - case PaletteInfosPackage.PALETTE_INFOS: { - PaletteInfos paletteInfos = (PaletteInfos)theEObject; - Object result = casePaletteInfos(paletteInfos); - if (result == null) result = defaultCase(theEObject); - return result; - } - case PaletteInfosPackage.PALETTE_INFO: { - PaletteInfo paletteInfo = (PaletteInfo)theEObject; - Object result = casePaletteInfo(paletteInfo); - if (result == null) result = defaultCase(theEObject); - return result; - } - case PaletteInfosPackage.TAG_CREATION_INFO: { - TagCreationInfo tagCreationInfo = (TagCreationInfo)theEObject; - Object result = caseTagCreationInfo(tagCreationInfo); - if (result == null) result = defaultCase(theEObject); - return result; - } - case PaletteInfosPackage.TAG_CREATION_TEMPLATE: { - TagCreationTemplate tagCreationTemplate = (TagCreationTemplate)theEObject; - Object result = caseTagCreationTemplate(tagCreationTemplate); - if (result == null) result = defaultCase(theEObject); - return result; - } - case PaletteInfosPackage.TAG_CREATION_ATTRIBUTE: { - TagCreationAttribute tagCreationAttribute = (TagCreationAttribute)theEObject; - Object result = caseTagCreationAttribute(tagCreationAttribute); - if (result == null) result = defaultCase(theEObject); - return result; - } - default: return defaultCase(theEObject); - } - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Palette Infos</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Palette Infos</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object casePaletteInfos(PaletteInfos object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Palette Info</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Palette Info</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object casePaletteInfo(PaletteInfo object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Tag Creation Info</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Tag Creation Info</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object caseTagCreationInfo(TagCreationInfo object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Tag Creation Template</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Tag Creation Template</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object caseTagCreationTemplate(TagCreationTemplate object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Tag Creation Attribute</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Tag Creation Attribute</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object caseTagCreationAttribute(TagCreationAttribute object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch, but this is the last case anyway. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>EObject</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) - * @generated - */ - public Object defaultCase(EObject object) { - return null; - } - -} //PaletteInfosSwitch diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/AbstractEnumerationType.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/AbstractEnumerationType.java deleted file mode 100644 index fda6dd5a0..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/AbstractEnumerationType.java +++ /dev/null @@ -1,137 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - * Vadim Dmitriev - * - ********************************************************************************/ -package org.eclipse.jst.jsf.taglibprocessing.attributevalues; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jst.jsf.common.internal.types.CompositeType; -import org.eclipse.jst.jsf.metadataprocessors.AbstractRootTypeDescriptor; -import org.eclipse.jst.jsf.metadataprocessors.features.ELIsNotValidException; -import org.eclipse.jst.jsf.metadataprocessors.features.IDefaultValue; -import org.eclipse.jst.jsf.metadataprocessors.features.IPossibleValues; -import org.eclipse.jst.jsf.metadataprocessors.features.IValidELValues; -import org.eclipse.jst.jsf.metadataprocessors.features.IValidValues; -import org.eclipse.jst.jsf.metadataprocessors.features.ValidationMessage; - -/** - * Abstract meta-data processing type representing an enumeration attribute value runtime type - * <p><b>Provisional API - subject to change</b></p> - */ -public abstract class AbstractEnumerationType extends AbstractRootTypeDescriptor implements IValidValues, IDefaultValue, IValidELValues{ - private List validationMessages; - - /** - * An empty list - */ - protected static List EMPTY_LIST = new ArrayList(0); - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.metadataprocessors.features.IValidValues#getValidationMessages() - */ - public List getValidationMessages() { - if (validationMessages == null){ - validationMessages = new ArrayList(); - } - return validationMessages; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.metadataprocessors.features.IDefaultValue#getDefaultValue() - */ - public String getDefaultValue() { - return getTraitValueAsString(IDefaultValue.DEFAULT_VALUE_PROP_NAME); - } - - /** - * @return possible values of type as list of Strings using - * {@link IPossibleValues}.POSSIBLE_VALUES_PROP_NAME trait name - */ - protected List getMDPossibleValues() { - return getTraitValueAsListOfStrings(IPossibleValues.POSSIBLE_VALUES_PROP_NAME); - } - - /** - * @return possible values of type to dislay as list of Strings using - * {@link IPossibleValues}.POSSIBLE_VALUES_FOR_DISPLAY_PROP_NAME trait name - */ - protected List getMDPossibleValuesForDisplay() { - return getTraitValueAsListOfStrings(IPossibleValues.POSSIBLE_VALUES_FOR_DISPLAY_PROP_NAME); - } - - /** - * @return list of valid values as list of Strings using - * {@link IValidValues}.VALID_VALUES_PROP_NAME trait name - */ - protected List getMDValidValues() { - return getTraitValueAsListOfStrings(IValidValues.VALID_VALUES_PROP_NAME); - } - - /** - * @return Validation message for type using - * {@link IValidValues}.VALID_VALUES_MESSAGE_PROP_NAME trait name - */ - protected String getMDValidationMessage() { - return getTraitValueAsString(IValidValues.VALID_VALUES_MESSAGE_PROP_NAME); - } - - /** - * @return Validation severity int value for type using - * {@link IValidValues}.VALID_VALUES_SEVERITY_PROP_NAME trait name - */ - protected int getMDValidationSeverity() { - String val = getTraitValueAsString(IValidValues.VALID_VALUES_SEVERITY_PROP_NAME); - if (val == null) - return IStatus.WARNING; - - int severity = Integer.valueOf(val).intValue(); - return severity; - } - - /** - * @return Validation code as String value for type using - * {@link IValidValues}.VALID_VALUES_CODE_PROP_NAME trait name - */ - protected String getMDValidationCode() { - return getTraitValueAsString(IValidValues.VALID_VALUES_CODE_PROP_NAME); - } - - /** - * Create a {@link ValidationMessage} from metadata or use default message - * and add it to the collection of validation messages - * @param defaultMsg - */ - protected void addNewValidationMessage(String defaultMsg) { - String msg = getMDValidationMessage(); - if (msg == null || msg.equals("")) //$NON-NLS-1$ - msg = defaultMsg; - - String code = getMDValidationCode(); - int severity = getMDValidationSeverity(); - ValidationMessage val = new ValidationMessage(msg, code, severity); - getValidationMessages().add(val); - } - - /** - * @return the value of {@link org.eclipse.jst.jsf.common.internal.types.IAssignable}.ASSIGNMENT_TYPE_NONE. Subclasses to override. - */ - protected int getAssignmentType(){ - return 0; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.metadataprocessors.features.IValidELValues#getExpectedRuntimeType() - */ - public abstract CompositeType getExpectedRuntimeType() throws ELIsNotValidException; -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/ActionType.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/ActionType.java deleted file mode 100644 index d072810c2..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/ActionType.java +++ /dev/null @@ -1,182 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.taglibprocessing.attributevalues; - -import java.net.URL; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.FileLocator; -import org.eclipse.core.runtime.Path; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jst.jsf.context.resolver.structureddocument.IStructuredDocumentContextResolverFactory; -import org.eclipse.jst.jsf.context.resolver.structureddocument.IWorkspaceContextResolver; -import org.eclipse.jst.jsf.core.jsfappconfig.JSFAppConfigManager; -import org.eclipse.jst.jsf.facesconfig.FacesConfigPlugin; -import org.eclipse.jst.jsf.facesconfig.emf.DisplayNameType; -import org.eclipse.jst.jsf.facesconfig.emf.NavigationCaseType; -import org.eclipse.jst.jsf.facesconfig.emf.NavigationRuleType; -import org.eclipse.jst.jsf.metadataprocessors.features.IPossibleValues; -import org.eclipse.jst.jsf.metadataprocessors.features.IValidationMessage; -import org.eclipse.jst.jsf.metadataprocessors.features.PossibleValue; -import org.eclipse.jst.jsf.metadataprocessors.features.ValidationMessage; -import org.eclipse.osgi.util.NLS; -import org.osgi.framework.Bundle; - -/** - * Meta-data processing type representing an "action" attribute - * - * <p><b>Provisional API - subject to change</b></p> - * @author Gerry Kessler - Oracle - */ -public class ActionType extends MethodBindingType implements IPossibleValues{ - /** - * Image to use if metadata defined image cannot be created - */ - protected static final ImageDescriptor MISSING_IMAGE = ImageDescriptor.getMissingImageDescriptor(); - - private static final String IMAGE_NAME = "/icons/full/obj16/NavigationCaseType.gif"; //$NON-NLS-1$ - private ImageDescriptor imageDescriptor; - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.taglibprocessing.attributevalues.MethodBindingType#isValidValue(java.lang.String) - */ - public boolean isValidValue(String value){ - if (value == null || (value != null && value.length() == 0)) { - IValidationMessage msg = new ValidationMessage(Messages.ActionType_invalid_empty_value); - getValidationMessages().add(msg); - return false; - } - //any other value should be one of the possible values - //optimize - IWorkspaceContextResolver wr = IStructuredDocumentContextResolverFactory.INSTANCE.getWorkspaceContextResolver(getStructuredDocumentContext()); - if (wr == null) - return true;//shouldn't get here - - //in case that this is not JSF faceted or missing configs, need to pass - if (JSFAppConfigManager.getInstance(wr.getProject()) == null) - return true; - - IFile jsp = (IFile)wr.getResource(); - List rules = JSFAppConfigManager.getInstance(wr.getProject()).getNavigationRulesForPage(jsp); - for(Iterator it=rules.iterator();it.hasNext();){ - NavigationRuleType rule = (NavigationRuleType)it.next(); - for (Iterator cases=rule.getNavigationCase().iterator();cases.hasNext();){ - NavigationCaseType navCase = (NavigationCaseType)cases.next(); - if (navCase.getFromOutcome() != null && - value.equals(navCase.getFromOutcome().getTextContent().trim())) - return true; - } - } - IValidationMessage msg = new ValidationMessage(Messages.ActionType_invalid_value); - getValidationMessages().add(msg); - return false; - - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.metadataprocessors.features.IPossibleValues#getPossibleValues() - */ - public List getPossibleValues() { - List ret = new ArrayList(); - if (getStructuredDocumentContext() == null) - return ret; - - IWorkspaceContextResolver wr = IStructuredDocumentContextResolverFactory.INSTANCE.getWorkspaceContextResolver(getStructuredDocumentContext()); - if (wr != null && JSFAppConfigManager.getInstance(wr.getProject()) != null) {//may not be JSF faceted project or know faces-config){ - IFile jsp = (IFile)wr.getResource(); - List rules = JSFAppConfigManager.getInstance(wr.getProject()).getNavigationRulesForPage(jsp); - for(Iterator it=rules.iterator();it.hasNext();){ - NavigationRuleType rule = (NavigationRuleType)it.next(); - if (rule != null) - ret.addAll(createProposals(rule)); - } - } - return ret; - } - - private List createProposals(NavigationRuleType rule) { - List ret = new ArrayList(); - List cases = rule.getNavigationCase(); - for(Iterator it=cases.iterator();it.hasNext();){ - NavigationCaseType navCase = (NavigationCaseType)it.next(); - PossibleValue pv = createProposal(rule, navCase); - if (pv != null) - ret.add(pv); - } - return ret; - } - - private PossibleValue createProposal(NavigationRuleType rule, NavigationCaseType navCase) { - PossibleValue pv = null; - String value = null; - String ruleDisp = null; - String navDisplay = null; - String navAction = null; - String toViewId = null; - - if (navCase.getFromOutcome() != null) - value = navCase.getFromOutcome().getTextContent(); - if (navCase.getToViewId()!= null) - toViewId = navCase.getToViewId().getTextContent(); - if (rule.getFromViewId() != null) - ruleDisp = rule.getFromViewId().getTextContent(); - if (navCase.getDisplayName() != null - && navCase.getDisplayName().size() > 0) { - navDisplay = ((DisplayNameType) navCase - .getDisplayName().get(0)).getTextContent(); - } - if (navCase.getFromAction() != null) { - navAction= navCase.getFromAction().getTextContent(); - } - if (navDisplay == null || navDisplay.trim().equals("")) //$NON-NLS-1$ - navDisplay = NLS.bind(Messages.ActionType_navcase_display, new String[]{value, toViewId}); - - if (value != null){ - pv = new PossibleValue(value, navDisplay); - pv.setIcon(getNavCaseImageDescriptor()); - pv.setAdditionalInformation("from-outcome: "+value //$NON-NLS-1$ - + "<br>to-view-id: " + toViewId //$NON-NLS-1$ - + "<br>from-view-id: " + ruleDisp //$NON-NLS-1$ - + "<br>from-action: " + (navAction == null ? "null" : navAction)); //$NON-NLS-1$ //$NON-NLS-2$ - } - - return pv; - } - - - private ImageDescriptor getNavCaseImageDescriptor() { - ImageDescriptor ret = super.getImage(); - if (ret != null && ret != MISSING_IMAGE) - return ret; - - if (imageDescriptor == null){ - imageDescriptor = getImageDesc(IMAGE_NAME); - } - return imageDescriptor; - - } - - private ImageDescriptor getImageDesc(String img) - { - Bundle bundle = FacesConfigPlugin.getPlugin().getBundle(); - URL url = FileLocator.find(bundle, new Path(img), null); - ImageDescriptor desc = ImageDescriptor.createFromURL(url); - if (desc == MISSING_IMAGE){ - return null; - } - return desc; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/BindingType.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/BindingType.java deleted file mode 100644 index 6932796c6..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/BindingType.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.taglibprocessing.attributevalues; - -import org.eclipse.jst.jsf.metadataprocessors.AbstractRootTypeDescriptor; - -/** - * Abstract meta-data processing type representing a binding - * - * <p><b>Provisional API - subject to change</b></p> - * @author Gerry Kessler - Oracle - */ -public abstract class BindingType extends AbstractRootTypeDescriptor{ - // TODO: what's the point of this? -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/BooleanType.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/BooleanType.java deleted file mode 100644 index cd90e74be..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/BooleanType.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.taglibprocessing.attributevalues; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.jst.jsf.metadataprocessors.features.IDefaultValue; -import org.eclipse.jst.jsf.metadataprocessors.features.IPossibleValues; -import org.eclipse.jst.jsf.metadataprocessors.features.IValidValues; -import org.eclipse.jst.jsf.metadataprocessors.features.PossibleValue; - -/** - * Meta-data processing type representing a boolean attribute value runtime type - * that implements IPossibleValues, IValidValues, IDefaultValue, IValidELValues - * - * <p><b>Provisional API - subject to change</b></p> - * @author Gerry Kessler - Oracle - */ -public class BooleanType extends EnumerationType implements IValidValues, IPossibleValues, IDefaultValue{ - private static final String TRUE_VAL = "true"; //$NON-NLS-1$ - private static final String FALSE_VAL = "false"; //$NON-NLS-1$ - - private static final String BOOLTYPE_VALIDATION_MSG = Messages.BooleanType_invalid_values; - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.taglibprocessing.attributevalues.EnumerationType#getReturnType() - */ - protected String getReturnType(){ return "boolean";} //$NON-NLS-1$ - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.metadataprocessors.features.IPossibleValues#getPossibleValues() - */ - public List getPossibleValues() { - String def = getDefaultValue(); - List vals = new ArrayList(); - vals.add(new PossibleValue(TRUE_VAL, TRUE_VAL, def != null && def.equals(TRUE_VAL) )); - vals.add(new PossibleValue(FALSE_VAL, FALSE_VAL, def != null && def.equals(FALSE_VAL) )); - return vals; - } - - /** - * Type coercion according to JSP 2.0 spec: JSP.1.14.2.1 Conversions from String values - * Although not completely faithful to spec, we will validate values as either 'true' or 'false' - * @see org.eclipse.jst.jsf.metadataprocessors.features.IValidValues#isValidValue(java.lang.String) - **/ - public boolean isValidValue(String value) { - if(TRUE_VAL.equalsIgnoreCase(value) || FALSE_VAL.equalsIgnoreCase(value)) { - return true; - } - addNewValidationMessage(BOOLTYPE_VALIDATION_MSG); - return false; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/CSSClassType.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/CSSClassType.java deleted file mode 100644 index 57a0625f8..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/CSSClassType.java +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.taglibprocessing.attributevalues; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -import org.eclipse.jst.jsf.context.resolver.structureddocument.IDOMContextResolver; -import org.eclipse.jst.jsf.context.resolver.structureddocument.internal.impl.StructuredDocumentContextResolverFactory; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.metadataprocessors.AbstractRootTypeDescriptor; -import org.eclipse.jst.jsf.metadataprocessors.IMetaDataEnabledFeature; -import org.eclipse.jst.jsf.metadataprocessors.features.IPossibleValue; -import org.eclipse.jst.jsf.metadataprocessors.features.IPossibleValues; -import org.eclipse.jst.jsf.metadataprocessors.features.PossibleValue; -import org.eclipse.wst.css.core.internal.provisional.adapters.IStyleSheetListAdapter; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSNode; -import org.eclipse.wst.css.core.internal.util.CSSClassTraverser; -import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier; -import org.w3c.dom.Document; -import org.w3c.dom.stylesheets.StyleSheetList; - -/** - * Represents a style class attribute type - * <p><b>Provisional API - subject to change</b></p> - */ -public class CSSClassType extends AbstractRootTypeDescriptor implements - IMetaDataEnabledFeature, IPossibleValues { - - private List<IPossibleValue> _pvs; - - public List<IPossibleValue> getPossibleValues() { - if (_pvs == null){ - IDOMContextResolver resolver = StructuredDocumentContextResolverFactory.getInstance().getDOMContextResolver(getStructuredDocumentContext()); - _pvs = getCSSClasses(resolver.getDOMDocument()); - } - return _pvs; - } - - private List<IPossibleValue> getCSSClasses(Document doc) { - List result = new ArrayList(); - String [] names = internalGetCSSClasses(doc); - for (int i=0;i<names.length;i++){ - IPossibleValue pv = new PossibleValue(names[i]); - result.add(pv); - } - return result; - } - - //code duplicated from pagedesigner CSSUtils. Uses internal CSSClassTraverser - private static String[] internalGetCSSClasses(Document doc) { - Collection c = Collections.EMPTY_SET; - if (doc instanceof INodeNotifier) { - IStyleSheetListAdapter adapter = (IStyleSheetListAdapter) ((INodeNotifier) doc) - .getAdapterFor(IStyleSheetListAdapter.class); - StyleSheetList ssl = (adapter == null ? null : adapter - .getStyleSheets()); - - CSSClassTraverser traverser = new CSSClassTraverser(); - if (ssl != null) { - for (int i = 0, numStyles = ssl.getLength(); i < numStyles; i++) { - // loop for styles (<style> and <link>) - org.w3c.dom.stylesheets.StyleSheet ss = ssl.item(i); - - try { - traverser.apply((ICSSNode) ss); - } catch (ClassCastException ex) { - JSFCorePlugin.log(ex, "Unable to cast to CSS style"); - } - } - c = traverser.getClassNames(); - } - } - String[] result = new String[c.size()]; - c.toArray(result); - return result; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/CSSIdType.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/CSSIdType.java deleted file mode 100644 index 4fa8ee1cc..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/CSSIdType.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.taglibprocessing.attributevalues; - -import org.eclipse.jst.jsf.metadataprocessors.AbstractRootTypeDescriptor; -import org.eclipse.jst.jsf.metadataprocessors.IMetaDataEnabledFeature; - -/** - * Represents CSS id attribute type - * EXPERIMENTAL - may change or disappear - * - */ -public class CSSIdType extends AbstractRootTypeDescriptor implements - IMetaDataEnabledFeature { - - /** - * Constructor - */ - public CSSIdType() { - // TODO Auto-generated constructor stub - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/CSSStyleType.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/CSSStyleType.java deleted file mode 100644 index 1c7f35bf6..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/CSSStyleType.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.taglibprocessing.attributevalues; - -import org.eclipse.jst.jsf.metadataprocessors.AbstractRootTypeDescriptor; -import org.eclipse.jst.jsf.metadataprocessors.IMetaDataEnabledFeature; - -/** - * Represents CSS style attribute. - * No features currently supported. - * - * <p><b>Provisional API - subject to change</b></p> - * - */ -public class CSSStyleType extends AbstractRootTypeDescriptor implements - IMetaDataEnabledFeature { - - /** - * Constructor - */ - public CSSStyleType() { - // - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/CharacterType.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/CharacterType.java deleted file mode 100644 index 5ec13d825..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/CharacterType.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.taglibprocessing.attributevalues; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.jst.jsf.metadataprocessors.AbstractRootTypeDescriptor; -import org.eclipse.jst.jsf.metadataprocessors.IMetaDataEnabledFeature; -import org.eclipse.jst.jsf.metadataprocessors.features.IValidValues; -import org.eclipse.jst.jsf.metadataprocessors.features.IValidationMessage; -import org.eclipse.jst.jsf.metadataprocessors.features.ValidationMessage; - -/** - * Represents a single unicode character - */ -public class CharacterType extends AbstractRootTypeDescriptor implements - IMetaDataEnabledFeature, IValidValues{ - - private List _msgs; - - /** - * Constructor - */ - public CharacterType() { - super(); - } - - public List<IValidationMessage> getValidationMessages() { - if (_msgs == null){ - _msgs = new ArrayList<IValidationMessage>(1); - } - return _msgs; - } - - public boolean isValidValue(String value) { - if (value.length() != 1) - getValidationMessages().add(new ValidationMessage(Messages.CharacterType_0)); - - return getValidationMessages().size() == 0; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/ColorType.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/ColorType.java deleted file mode 100644 index 897a399ea..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/ColorType.java +++ /dev/null @@ -1,128 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle Corporation., and others - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Yury Kats/Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.taglibprocessing.attributevalues; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jst.jsf.metadataprocessors.features.IPossibleValues; -import org.eclipse.jst.jsf.metadataprocessors.features.PossibleValue; -import org.eclipse.swt.graphics.ImageData; -import org.eclipse.swt.graphics.PaletteData; -import org.eclipse.swt.graphics.RGB; - -/** - * Meta-data processing type representing a color. - * A color is defined as in html spec http://www.w3.org/TR/html4/types.html#type-color - * - * <p><b>Provisional API - subject to change</b></p> - * - * @author ykats - */ - -public class ColorType extends EnumerationType implements IPossibleValues { - - /** - * List of standard colors - * See http://www.w3.org/TR/html4/types.html#type-color - */ - private final static String[] COLORS = {"Black", "Silver", "Gray", "White", "Maroon", "Red", "Purple", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ - "Fuchsia", "Green", "Lime", "Olive", "Yellow", "Navy", "Blue", "Teal","Aqua"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ - //if ordering changes, must change RGB[] ordering - - private RGB[] _rgb; - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.taglibprocessing.attributevalues.EnumerationType#getReturnType() - */ - protected String getReturnType(){ return "java.lang.String";} //$NON-NLS-1$ - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.metadataprocessors.features.IValidValues#isValidValue(java.lang.String) - */ - public boolean isValidValue(String value) { - boolean bValid = true; - String trimmedVal = value.trim(); - if (trimmedVal.length() == 0) - bValid = false; - else if (trimmedVal.charAt(0) == '#' && trimmedVal.length() == 7) { - for (int i=1; i<7; i++) { - if (trimmedVal.charAt(i) < '0' || - (trimmedVal.charAt(i) > '9' && trimmedVal.charAt(i) < 'A') || - (trimmedVal.charAt(i) > 'F' && trimmedVal.charAt(i) < 'a') || - trimmedVal.charAt(i) > 'f') { - bValid = false; - break; - } - } - } - else { - bValid = false; - for (int i = 0; i < COLORS.length; i++) { - if(trimmedVal.equalsIgnoreCase(COLORS[i])) { - bValid = true; - break; - } - } - } - - if(!bValid) { - addNewValidationMessage(Messages.ColorType_invalid_color); - } - - return getValidationMessages().isEmpty(); - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.metadataprocessors.features.IPossibleValues#getPossibleValues() - */ - public List getPossibleValues() { - List ret = new ArrayList(COLORS.length); - for (int i=0;i < COLORS.length;i++){ - PossibleValue pv = new PossibleValue(COLORS[i]); - pv.setIcon(createImage(i)); - ret.add(pv); - } - return ret; - } - - private ImageDescriptor createImage(int color) { - PaletteData pd = getPaletteData(color); - return ImageDescriptor.createFromImageData(new ImageData(16, 16, 1, pd)); - } - - private PaletteData getPaletteData(int color){ - if (_rgb == null){ - _rgb = new RGB[16]; - _rgb[0] = new RGB(0,0,0);//black - _rgb[1] = new RGB(192,192,192);//silver - _rgb[2] = new RGB(128,128,128);//gray - _rgb[3] = new RGB(255,255,255);//white - _rgb[4] = new RGB(128,0,0);//Maroon - _rgb[5] = new RGB(255,0,0);//Red - _rgb[6] = new RGB(128,0,128);//Purple - _rgb[7] = new RGB(255,0,255);//Fuchsia - _rgb[8] = new RGB(0,128,0);//Green - _rgb[9] = new RGB(0,255,0);//Lime - _rgb[10] = new RGB(128,128,0);//Olive - _rgb[11] = new RGB(255,255,0);//Yellow - _rgb[12] = new RGB(0,0,128);//Navy - _rgb[13] = new RGB(0,0,255);//Blue - _rgb[14] = new RGB(0,128,128);//Teal - _rgb[15] = new RGB(0,255,255);//Aqua - } - RGB[] rgbColor = new RGB[1]; - System.arraycopy(_rgb, color, rgbColor, 0, 1); - return new PaletteData(rgbColor); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/ComponentBindingType.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/ComponentBindingType.java deleted file mode 100644 index 4e394ede7..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/ComponentBindingType.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.taglibprocessing.attributevalues; - - -import org.eclipse.jst.jsf.metadataprocessors.features.IValidELValues; -import org.eclipse.jst.jsf.metadataprocessors.features.IValidValues; -import org.eclipse.jst.jsf.metadataprocessors.features.IValidationMessage; -import org.eclipse.jst.jsf.metadataprocessors.features.ValidationMessage; - -/** - * Meta-data processing type representing a "binding" attribute - * - * <p><b>Provisional API - subject to change</b></p> - * @author Gerry Kessler - Oracle - */ -public class ComponentBindingType extends ValueBindingType implements - IValidValues, IValidELValues { - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.metadataprocessors.features.IValidValues#isValidValue(java.lang.String) - */ - public boolean isValidValue(String value) { - //Strings are invalid. Requires a EL value binding. - IValidationMessage msg = new ValidationMessage(Messages.ComponentBindingType_invalid_value); - getValidationMessages().add(msg); - return false; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/ComponentIDType.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/ComponentIDType.java deleted file mode 100644 index 82c995761..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/ComponentIDType.java +++ /dev/null @@ -1,80 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.taglibprocessing.attributevalues; - - -import org.eclipse.jst.jsf.common.internal.types.CompositeType; -import org.eclipse.jst.jsf.metadataprocessors.features.ELIsNotValidException; -import org.eclipse.jst.jsf.metadataprocessors.features.IValidELValues; -import org.eclipse.jst.jsf.metadataprocessors.features.IValidValues; -import org.eclipse.jst.jsf.metadataprocessors.features.IValidationMessage; -import org.eclipse.jst.jsf.metadataprocessors.features.ValidationMessage; - -/** - * Meta-data processing type representing an "id" attribute - * Represents an ID or NAME HTML attribute type. - * <br> - * Attribute values of type ID and NAME must begin with a letter in the range A-Z or a-z or underscore ("_") and - * may be followed by letters (A-Z, a-z), digits (0-9), hyphens ("-"), underscores ("_"), colons (":"), - * and periods ("."). - * - * <p><b>Provisional API - subject to change</b></p> - * @author Gerry Kessler - Oracle - * TODO: finish regex validation - */ -public class ComponentIDType extends ValueBindingType implements - IValidValues, IValidELValues { - -// private static Pattern idPattern1 = Pattern.compile("[A-Za-z_]");; -// private static Pattern idPattern2 = Pattern.compile("^[:\\w\\.\\-]*"); - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.taglibprocessing.attributevalues.ValueBindingType#getExpectedRuntimeType() - */ - public CompositeType getExpectedRuntimeType() throws ELIsNotValidException { - throw new ELIsNotValidException(Messages.ComponentIDType_invalid_as_el); - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.metadataprocessors.features.IValidValues#isValidValue(java.lang.String) - */ - public boolean isValidValue(String value) { - IValidationMessage msg = null; - if (value != null && value.trim().length() == 0) - msg = new ValidationMessage(Messages.ComponentIDType_invalid_value); - else { - //we could validate uniqueness, but will not for the time being. This would require a DT FacesContext. - //any other coercion rules apply here? - return true; - } - getValidationMessages().add(msg); - return false; - -// if (value != null && value.trim().length() == 0) -// msg = new ValidationMessage(Messages.ComponentIDType_invalid_value); -// -//// else if (!idPattern.matcher(value.trim()).find()) -//// fail = true; -// else if (!idPattern1.matcher(value.trim().substring(0, 1)).find()) -// msg = new ValidationMessage("id must begin with alpha character"); -// else if ((value.trim().length() > 1) && (!( idPattern2.matcher(value.trim().substring(1)).find()))) -// msg = new ValidationMessage("illegal characters in id: must be alphanum, period, colon, and hyphen only"); -// else { -// //we could validate uniqueness, but will not for the time being. This would require a DT FacesContext. -// //any other coercion rules apply here? -// } -// if (msg != null) -// getValidationMessages().add(msg); -// -// return getValidationMessages().size() == 0; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/ContentType.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/ContentType.java deleted file mode 100644 index 4fb9ec442..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/ContentType.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle Corporation., and others - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Yury Kats/Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.taglibprocessing.attributevalues; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.jst.jsf.metadataprocessors.features.IPossibleValues; -import org.eclipse.jst.jsf.metadataprocessors.features.PossibleValue; - -/** - * Meta-data processing type representing a content (MIME) type. - * A ContentType is defined as in 4.0 html spec http://www.w3.org/TR/html401/types.html#h-6.7 - * - * <p><b>Provisional API - subject to change</b></p> - */ - -public class ContentType extends EnumerationType implements IPossibleValues { - - /** - * List of some of the more common content (MIME) types - * See http://www.w3.org/TR/html4/types.html#type-color - */ - private final static String[] commontypes = { - "text/html", //$NON-NLS-1$ - "text/css", //$NON-NLS-1$ - "image/jpeg", //$NON-NLS-1$ - "image/gif", //$NON-NLS-1$ - "audio/mpeg", //$NON-NLS-1$ - "video/mpeg", //$NON-NLS-1$ - "video/quicktime", //$NON-NLS-1$ - "text/javascript" //$NON-NLS-1$ - }; - - protected String getReturnType(){ return "java.lang.String";} //$NON-NLS-1$ - - public boolean isValidValue(String value) { - boolean bValid = true; - if (value == null || value.trim().length() == 0) - bValid = false; - - if(!bValid) { - addNewValidationMessage(Messages.ContentType_MIME_not_empty); - } - - return getValidationMessages().isEmpty(); - } - - public List getPossibleValues() { - List ret = new ArrayList(commontypes.length); - for (int i=0;i < commontypes.length;i++){ - PossibleValue pv = new PossibleValue(commontypes[i]); - ret.add(pv); - } - return ret; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/CurrencyCodeType.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/CurrencyCodeType.java deleted file mode 100644 index 4dc6db80d..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/CurrencyCodeType.java +++ /dev/null @@ -1,232 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle Corporation., and others - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.taglibprocessing.attributevalues; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.jst.jsf.metadataprocessors.features.IPossibleValues; -import org.eclipse.jst.jsf.metadataprocessors.features.PossibleValue; - -/** - * ISO-4217 Currency codes - */ -public class CurrencyCodeType extends EnumerationType implements IPossibleValues { - private static final CurrencyCodeMap _map = new CurrencyCodeMap(); - - @Override - protected String getReturnType() { - return "java.lang.String"; //$NON-NLS-1$ - } - - public List getPossibleValues() { - List ret = new ArrayList(); - for(Iterator it = _map.keySet().iterator();it.hasNext();){ - String key = (String)it.next(); - String value = _map.get(key); - PossibleValue pv = new PossibleValue(key, value); - ret.add(pv); - } - return ret; - } - - public boolean isValidValue(String value) { - if(!_map.containsKey(value.toUpperCase())) { - addNewValidationMessage(Messages.CurrencyCodeType_invalid); - } - - return getValidationMessages().isEmpty(); - } - - private static class CurrencyCodeMap extends HashMap<String, String> { - - private static final long serialVersionUID = 1L; - - CurrencyCodeMap(){ - put("AED",Messages.CurrencyCodeType_2); //$NON-NLS-1$ - put("AFA",Messages.CurrencyCodeType_3); //$NON-NLS-1$ - put("ALL",Messages.CurrencyCodeType_4); //$NON-NLS-1$ - put("AMD",Messages.CurrencyCodeType_5); //$NON-NLS-1$ - put("ANG",Messages.CurrencyCodeType_6); //$NON-NLS-1$ - put("AOA",Messages.CurrencyCodeType_7); //$NON-NLS-1$ - put("ARS",Messages.CurrencyCodeType_8); //$NON-NLS-1$ - put("AUD",Messages.CurrencyCodeType_9); //$NON-NLS-1$ - put("AWG",Messages.CurrencyCodeType_10); //$NON-NLS-1$ - put("AZM",Messages.CurrencyCodeType_11); //$NON-NLS-1$ - put("BAM",Messages.CurrencyCodeType_12); //$NON-NLS-1$ - put("BBD",Messages.CurrencyCodeType_13); //$NON-NLS-1$ - put("BDT",Messages.CurrencyCodeType_14); //$NON-NLS-1$ - put("BGN",Messages.CurrencyCodeType_15); //$NON-NLS-1$ - put("BHD",Messages.CurrencyCodeType_16); //$NON-NLS-1$ - put("BIF",Messages.CurrencyCodeType_17); //$NON-NLS-1$ - put("BMD",Messages.CurrencyCodeType_18); //$NON-NLS-1$ - put("BND",Messages.CurrencyCodeType_19); //$NON-NLS-1$ - put("BOB",Messages.CurrencyCodeType_20); //$NON-NLS-1$ - put("BRL",Messages.CurrencyCodeType_21); //$NON-NLS-1$ - put("BSD",Messages.CurrencyCodeType_22); //$NON-NLS-1$ - put("BTN",Messages.CurrencyCodeType_23); //$NON-NLS-1$ - put("BWP",Messages.CurrencyCodeType_24); //$NON-NLS-1$ - put("BYR",Messages.CurrencyCodeType_25); //$NON-NLS-1$ - put("BZD",Messages.CurrencyCodeType_26); //$NON-NLS-1$ - put("CAD",Messages.CurrencyCodeType_27); //$NON-NLS-1$ - put("CDF",Messages.CurrencyCodeType_28); //$NON-NLS-1$ - put("CHF",Messages.CurrencyCodeType_29); //$NON-NLS-1$ - put("CLP",Messages.CurrencyCodeType_30); //$NON-NLS-1$ - put("CNY",Messages.CurrencyCodeType_31); //$NON-NLS-1$ - put("COP",Messages.CurrencyCodeType_32); //$NON-NLS-1$ - put("CRC",Messages.CurrencyCodeType_33); //$NON-NLS-1$ - put("CSD",Messages.CurrencyCodeType_34); //$NON-NLS-1$ - put("CUP",Messages.CurrencyCodeType_35); //$NON-NLS-1$ - put("CVE",Messages.CurrencyCodeType_36); //$NON-NLS-1$ - put("CYP",Messages.CurrencyCodeType_37); //$NON-NLS-1$ - put("CZK",Messages.CurrencyCodeType_38); //$NON-NLS-1$ - put("DJF",Messages.CurrencyCodeType_39); //$NON-NLS-1$ - put("DKK",Messages.CurrencyCodeType_40); //$NON-NLS-1$ - put("DOP",Messages.CurrencyCodeType_41); //$NON-NLS-1$ - put("DZD",Messages.CurrencyCodeType_42); //$NON-NLS-1$ - put("EEK",Messages.CurrencyCodeType_43); //$NON-NLS-1$ - put("EGP",Messages.CurrencyCodeType_44); //$NON-NLS-1$ - put("ERN",Messages.CurrencyCodeType_45); //$NON-NLS-1$ - put("ETB",Messages.CurrencyCodeType_46); //$NON-NLS-1$ - put("EUR",Messages.CurrencyCodeType_47); //$NON-NLS-1$ - put("FJD",Messages.CurrencyCodeType_48); //$NON-NLS-1$ - put("FKP",Messages.CurrencyCodeType_49); //$NON-NLS-1$ - put("GBP",Messages.CurrencyCodeType_50); //$NON-NLS-1$ - put("GEL",Messages.CurrencyCodeType_51); //$NON-NLS-1$ - put("GGP",Messages.CurrencyCodeType_52); //$NON-NLS-1$ - put("GHC",Messages.CurrencyCodeType_53); //$NON-NLS-1$ - put("GIP",Messages.CurrencyCodeType_54); //$NON-NLS-1$ - put("GMD",Messages.CurrencyCodeType_55); //$NON-NLS-1$ - put("GNF",Messages.CurrencyCodeType_56); //$NON-NLS-1$ - put("GTQ",Messages.CurrencyCodeType_57); //$NON-NLS-1$ - put("GYD",Messages.CurrencyCodeType_58); //$NON-NLS-1$ - put("HKD",Messages.CurrencyCodeType_59); //$NON-NLS-1$ - put("HNL",Messages.CurrencyCodeType_60); //$NON-NLS-1$ - put("HRK",Messages.CurrencyCodeType_61); //$NON-NLS-1$ - put("HTG",Messages.CurrencyCodeType_62); //$NON-NLS-1$ - put("HUF",Messages.CurrencyCodeType_63); //$NON-NLS-1$ - put("IDR",Messages.CurrencyCodeType_64); //$NON-NLS-1$ - put("ILS",Messages.CurrencyCodeType_65); //$NON-NLS-1$ - put("IMP",Messages.CurrencyCodeType_66); //$NON-NLS-1$ - put("INR",Messages.CurrencyCodeType_67); //$NON-NLS-1$ - put("IQD",Messages.CurrencyCodeType_68); //$NON-NLS-1$ - put("IRR",Messages.CurrencyCodeType_69); //$NON-NLS-1$ - put("ISK",Messages.CurrencyCodeType_70); //$NON-NLS-1$ - put("JEP",Messages.CurrencyCodeType_71); //$NON-NLS-1$ - put("JMD",Messages.CurrencyCodeType_72); //$NON-NLS-1$ - put("JOD",Messages.CurrencyCodeType_73); //$NON-NLS-1$ - put("JPY",Messages.CurrencyCodeType_74); //$NON-NLS-1$ - put("KES",Messages.CurrencyCodeType_75); //$NON-NLS-1$ - put("KGS",Messages.CurrencyCodeType_76); //$NON-NLS-1$ - put("KHR",Messages.CurrencyCodeType_77); //$NON-NLS-1$ - put("KMF",Messages.CurrencyCodeType_78); //$NON-NLS-1$ - put("KPW",Messages.CurrencyCodeType_79); //$NON-NLS-1$ - put("KRW",Messages.CurrencyCodeType_80); //$NON-NLS-1$ - put("KWD",Messages.CurrencyCodeType_81); //$NON-NLS-1$ - put("KYD",Messages.CurrencyCodeType_82); //$NON-NLS-1$ - put("KZT",Messages.CurrencyCodeType_83); //$NON-NLS-1$ - put("LAK",Messages.CurrencyCodeType_84); //$NON-NLS-1$ - put("LBP",Messages.CurrencyCodeType_85); //$NON-NLS-1$ - put("LKR",Messages.CurrencyCodeType_86); //$NON-NLS-1$ - put("LRD",Messages.CurrencyCodeType_87); //$NON-NLS-1$ - put("LSL",Messages.CurrencyCodeType_88); //$NON-NLS-1$ - put("LTL",Messages.CurrencyCodeType_89); //$NON-NLS-1$ - put("LVL",Messages.CurrencyCodeType_90); //$NON-NLS-1$ - put("LYD",Messages.CurrencyCodeType_91); //$NON-NLS-1$ - put("MAD",Messages.CurrencyCodeType_92); //$NON-NLS-1$ - put("MDL",Messages.CurrencyCodeType_93); //$NON-NLS-1$ - put("MGA",Messages.CurrencyCodeType_94); //$NON-NLS-1$ - put("MKD",Messages.CurrencyCodeType_95); //$NON-NLS-1$ - put("MMK",Messages.CurrencyCodeType_96); //$NON-NLS-1$ - put("MNT",Messages.CurrencyCodeType_97); //$NON-NLS-1$ - put("MOP",Messages.CurrencyCodeType_98); //$NON-NLS-1$ - put("MRO",Messages.CurrencyCodeType_99); //$NON-NLS-1$ - put("MTL",Messages.CurrencyCodeType_100); //$NON-NLS-1$ - put("MUR",Messages.CurrencyCodeType_101); //$NON-NLS-1$ - put("MVR",Messages.CurrencyCodeType_102); //$NON-NLS-1$ - put("MWK",Messages.CurrencyCodeType_103); //$NON-NLS-1$ - put("MXN",Messages.CurrencyCodeType_104); //$NON-NLS-1$ - put("MYR",Messages.CurrencyCodeType_105); //$NON-NLS-1$ - put("MZM",Messages.CurrencyCodeType_106); //$NON-NLS-1$ - put("NAD",Messages.CurrencyCodeType_107); //$NON-NLS-1$ - put("NGN",Messages.CurrencyCodeType_108); //$NON-NLS-1$ - put("NIO",Messages.CurrencyCodeType_109); //$NON-NLS-1$ - put("NOK",Messages.CurrencyCodeType_110); //$NON-NLS-1$ - put("NPR",Messages.CurrencyCodeType_111); //$NON-NLS-1$ - put("NZD",Messages.CurrencyCodeType_112); //$NON-NLS-1$ - put("OMR",Messages.CurrencyCodeType_113); //$NON-NLS-1$ - put("PAB",Messages.CurrencyCodeType_114); //$NON-NLS-1$ - put("PEN",Messages.CurrencyCodeType_115); //$NON-NLS-1$ - put("PGK",Messages.CurrencyCodeType_116); //$NON-NLS-1$ - put("PHP",Messages.CurrencyCodeType_117); //$NON-NLS-1$ - put("PKR",Messages.CurrencyCodeType_118); //$NON-NLS-1$ - put("PLN",Messages.CurrencyCodeType_119); //$NON-NLS-1$ - put("PYG",Messages.CurrencyCodeType_120); //$NON-NLS-1$ - put("QAR",Messages.CurrencyCodeType_121); //$NON-NLS-1$ - put("ROL",Messages.CurrencyCodeType_122); //$NON-NLS-1$ - put("RUB",Messages.CurrencyCodeType_123); //$NON-NLS-1$ - put("RWF",Messages.CurrencyCodeType_124); //$NON-NLS-1$ - put("SAR",Messages.CurrencyCodeType_125); //$NON-NLS-1$ - put("SBD",Messages.CurrencyCodeType_126); //$NON-NLS-1$ - put("SCR",Messages.CurrencyCodeType_127); //$NON-NLS-1$ - put("SDD",Messages.CurrencyCodeType_128); //$NON-NLS-1$ - put("SEK",Messages.CurrencyCodeType_129); //$NON-NLS-1$ - put("SGD",Messages.CurrencyCodeType_130); //$NON-NLS-1$ - put("SHP",Messages.CurrencyCodeType_131); //$NON-NLS-1$ - put("SIT",Messages.CurrencyCodeType_132); //$NON-NLS-1$ - put("SKK",Messages.CurrencyCodeType_133); //$NON-NLS-1$ - put("SLL",Messages.CurrencyCodeType_134); //$NON-NLS-1$ - put("SOS",Messages.CurrencyCodeType_135); //$NON-NLS-1$ - put("SPL",Messages.CurrencyCodeType_136); //$NON-NLS-1$ - put("SRD",Messages.CurrencyCodeType_137); //$NON-NLS-1$ - put("STD",Messages.CurrencyCodeType_138); //$NON-NLS-1$ - put("SVC",Messages.CurrencyCodeType_139); //$NON-NLS-1$ - put("SYP",Messages.CurrencyCodeType_140); //$NON-NLS-1$ - put("SZL",Messages.CurrencyCodeType_141); //$NON-NLS-1$ - put("THB",Messages.CurrencyCodeType_142); //$NON-NLS-1$ - put("TJS",Messages.CurrencyCodeType_143); //$NON-NLS-1$ - put("TMM",Messages.CurrencyCodeType_144); //$NON-NLS-1$ - put("TND",Messages.CurrencyCodeType_145); //$NON-NLS-1$ - put("TOP",Messages.CurrencyCodeType_146); //$NON-NLS-1$ - put("TRL",Messages.CurrencyCodeType_147); //$NON-NLS-1$ - put("TRY",Messages.CurrencyCodeType_148); //$NON-NLS-1$ - put("TTD",Messages.CurrencyCodeType_149); //$NON-NLS-1$ - put("TVD",Messages.CurrencyCodeType_150); //$NON-NLS-1$ - put("TWD",Messages.CurrencyCodeType_151); //$NON-NLS-1$ - put("TZS",Messages.CurrencyCodeType_152); //$NON-NLS-1$ - put("UAH",Messages.CurrencyCodeType_153); //$NON-NLS-1$ - put("UGX",Messages.CurrencyCodeType_154); //$NON-NLS-1$ - put("USD",Messages.CurrencyCodeType_155); //$NON-NLS-1$ - put("UYU",Messages.CurrencyCodeType_156); //$NON-NLS-1$ - put("UZS",Messages.CurrencyCodeType_157); //$NON-NLS-1$ - put("VEB",Messages.CurrencyCodeType_158); //$NON-NLS-1$ - put("VND",Messages.CurrencyCodeType_159); //$NON-NLS-1$ - put("VUV",Messages.CurrencyCodeType_160); //$NON-NLS-1$ - put("WST",Messages.CurrencyCodeType_161); //$NON-NLS-1$ - put("XAF",Messages.CurrencyCodeType_162); //$NON-NLS-1$ - put("XAG",Messages.CurrencyCodeType_163); //$NON-NLS-1$ - put("XAU",Messages.CurrencyCodeType_164); //$NON-NLS-1$ - put("XCD",Messages.CurrencyCodeType_165); //$NON-NLS-1$ - put("XDR",Messages.CurrencyCodeType_166); //$NON-NLS-1$ - put("XOF",Messages.CurrencyCodeType_167); //$NON-NLS-1$ - put("XPD",Messages.CurrencyCodeType_168); //$NON-NLS-1$ - put("XPF",Messages.CurrencyCodeType_169); //$NON-NLS-1$ - put("XPT",Messages.CurrencyCodeType_170); //$NON-NLS-1$ - put("YER",Messages.CurrencyCodeType_171); //$NON-NLS-1$ - put("ZAR",Messages.CurrencyCodeType_172); //$NON-NLS-1$ - put("ZMK",Messages.CurrencyCodeType_173); //$NON-NLS-1$ - put("ZWD",Messages.CurrencyCodeType_174); //$NON-NLS-1$ - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/DateTimePatternType.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/DateTimePatternType.java deleted file mode 100644 index 5d061053c..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/DateTimePatternType.java +++ /dev/null @@ -1,84 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle Corporation., and others - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.taglibprocessing.attributevalues; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.jst.jsf.context.resolver.structureddocument.IDOMContextResolver; -import org.eclipse.jst.jsf.context.resolver.structureddocument.IStructuredDocumentContextResolverFactory; -import org.eclipse.jst.jsf.metadataprocessors.AbstractRootTypeDescriptor; -import org.eclipse.jst.jsf.metadataprocessors.features.IPossibleValues; -import org.eclipse.jst.jsf.metadataprocessors.features.PossibleValue; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr; -import org.w3c.dom.Node; - -/** - * Meta-data processing type representing a Date, Time and DateTime Pattern types. - * - * <p><b>Provisional API - subject to change</b></p> - * - */ - -public class DateTimePatternType extends AbstractRootTypeDescriptor implements IPossibleValues{ - //should we ever validate the patterns, extend EnumerationType - final private static String[] DATEPATTERNS = {"M/d/yy", "EEE, M/d/yy", "MM/dd/yyyy", "EEE, MM/dd/yyyy", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ - "MMM d, yyyy", "EEE, MMM d, yyyy", "MMMM d, yyyy", "EEEE, MMMM d, yyyy", "MMMM yyyy" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ }; - }; - - final private static String[] TIMEPATTERNS = {"hh:mm", "hh:mm z", "HH:mm z", "HH:mm:ss z" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ - }; - - final private static String[] DATETIMEPATTERNS = {"M/d/yy hh:mm", "EEE, M/d/yy hh:mm", "MM/dd/yyyy HH:mm:ss z", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - "EEE, MM/dd/yyyy HH:mm:ss z", "MMM d, yyyy HH:mm z", "EEE, MMM d, yyyy HH:mm z", "MMMM d, yyyy HH:mm z", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - "EEEE, MMMM d, yyyy HH:mm z" //$NON-NLS-1$ - }; - - public List getPossibleValues() { - List ret = new ArrayList(); - String typeVal = getTypeValue(); - if ("date".equalsIgnoreCase(typeVal)){ //$NON-NLS-1$ - for (int i=0;i<DATEPATTERNS.length;i++){ - ret.add(new PossibleValue(DATEPATTERNS[i])); - } - } - else if ("time".equalsIgnoreCase(typeVal)){ //$NON-NLS-1$ - for (int i=0;i<TIMEPATTERNS.length;i++){ - ret.add(new PossibleValue(TIMEPATTERNS[i])); - } - } - else { - for (int i=0;i<DATETIMEPATTERNS.length;i++){ - ret.add(new PossibleValue(DATETIMEPATTERNS[i])); - } - } - return ret; - } - - private String getTypeValue() { - if (getStructuredDocumentContext() != null){ - IDOMContextResolver resolver = IStructuredDocumentContextResolverFactory.INSTANCE.getDOMContextResolver(getStructuredDocumentContext()); - if (resolver != null){ - Node aNode = resolver.getNode(); - if (aNode instanceof IDOMAttr) { - Node tagNode = ((IDOMAttr)aNode).getOwnerElement(); - IDOMAttr typeNode = (IDOMAttr) tagNode.getAttributes().getNamedItem("type"); //$NON-NLS-1$ - if (typeNode != null) - return typeNode.getValue(); - } - } - } - return ""; //$NON-NLS-1$ - } - - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/DirectBindingType.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/DirectBindingType.java deleted file mode 100644 index 2c5f7c0b1..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/DirectBindingType.java +++ /dev/null @@ -1,21 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.taglibprocessing.attributevalues; -/** - * Abstract meta-data processing type - * - * <p><b>Provisional API - subject to change</b></p> - * @author Gerry Kessler - Oracle - */ -public abstract class DirectBindingType extends BindingType { - // TODO: what is the point of this? -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/DoubleType.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/DoubleType.java deleted file mode 100644 index 0e73d4a9a..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/DoubleType.java +++ /dev/null @@ -1,89 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.taglibprocessing.attributevalues; - -import java.util.List; - -import org.eclipse.osgi.util.NLS; - -/** - * Meta-data processing type representing a "double" attribute value runtime type - * - * <p><b>Provisional API - subject to change</b></p> - * @author Gerry Kessler - Oracle - */ -public class DoubleType extends NumberType { - private static final String INVALID_DOUBLE = Messages.DoubleType_invalid_double; - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.taglibprocessing.attributevalues.EnumerationType#getReturnType() - */ - protected String getReturnType(){ return "double";} //$NON-NLS-1$ - - /** - * Type coercion according to JSP 2.0 spec: JSP.1.14.2.1 Conversions from String values - * @see org.eclipse.jst.jsf.metadataprocessors.features.IValidValues#isValidValue(java.lang.String) - **/ - public boolean isValidValue(String value) { - try { - Double dbl = Double.valueOf(value); - exceedsMaxValue(dbl.doubleValue()); - lessThanMinValue(dbl.doubleValue()); - if (!(minFound || maxFound)){ - List validVals = getMDValidValues(); - if (!validVals.isEmpty()){ - if (!validVals.contains(value)){ - addNewValidationMessage(Messages.DoubleType_invalid_member);//fix me - } - } - } - return getValidationMessages().isEmpty(); - } catch (NumberFormatException e) { - addNewValidationMessage(INVALID_DOUBLE); - return false; - } - - } - - private void exceedsMaxValue(double dbl) { - String strMax = getValidMaximumValue(); - if (strMax != null){ - try { - double max = Double.valueOf(strMax).doubleValue(); - maxFound = true; - if (dbl > max){ - addNewValidationMessage(NLS.bind(EXCEEDS_MAX, strMax)); - } - } catch (NumberFormatException e) { - //TODO: ignore error???? or log it???? - } - } - - } - - private void lessThanMinValue(double dbl) { - String strMin = getValidMinimumValue(); - if (strMin != null){ - try { - double max = Double.valueOf(strMin).doubleValue(); - minFound = true; - if (dbl < max){ - addNewValidationMessage(NLS.bind(LESS_THAN_MIN, strMin)); - } - } catch (NumberFormatException e) { - //TODO: ignore error???? or log it???? - } - } - - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/EnumerationType.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/EnumerationType.java deleted file mode 100644 index f92684fe8..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/EnumerationType.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler/Oracle - initial API and implementation - * Vadim Dmitriev - * - ********************************************************************************/ -package org.eclipse.jst.jsf.taglibprocessing.attributevalues; - -import org.eclipse.jdt.core.Signature; -import org.eclipse.jst.jsf.common.internal.types.CompositeType; -import org.eclipse.jst.jsf.metadataprocessors.features.ELIsNotValidException; - -/** - * Abstract meta-data processing type representing an enumeration attribute value runtime type - * with a single signature - * - * @author Gerry Kessler - Oracle - */ -public abstract class EnumerationType extends AbstractEnumerationType -{ - - /** - * @return return Java type as string (i.e. boolean, java.lang.String, etc.) - * Must not be null. - */ - protected abstract String getReturnType(); - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.metadataprocessors.features.IValidELValues#getExpectedRuntimeType() - */ - public CompositeType getExpectedRuntimeType() throws ELIsNotValidException - { - String type = Signature.createTypeSignature(getReturnType(), true); - return new CompositeType(type, getAssignmentType()); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/ExpressionBindingType.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/ExpressionBindingType.java deleted file mode 100644 index 1ae1d98de..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/ExpressionBindingType.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.taglibprocessing.attributevalues; - -import java.util.ArrayList; -import java.util.List; - -/** - * Abstract meta-data processing type representing an expression binding attribute value runtime type - * - * <p><b>Provisional API - subject to change</b></p> - * @author Gerry Kessler - Oracle - */ -public abstract class ExpressionBindingType extends BindingType { - /** - * Valid values is any fully qualified Java type or primitive. - * Assign a value for each parameter in order - */ - public static final String RUNTIME_PARAMS_TYPES = "runtime-param-types"; //$NON-NLS-1$ - /** - * Valid values is any fully qualified Java type or primitive. - */ - public static final String RUNTIME_RETURN_TYPE = "runtime-return-type"; //$NON-NLS-1$ - /** - * Value should be set true or false. If not specified, the default inmplementation assumes false. - */ - public static final String RUNTIME_SETTER_REQUIRED = "runtime-type-setter-required"; //$NON-NLS-1$ - private List validationMessages; - - - /** - * @return String value of the "runtime-return-type" trait - */ - protected String getReturnType() { - return getTraitValueAsString(RUNTIME_RETURN_TYPE); - } - - /** - * @return String[] value of the "runtime-param-types" trait - */ - protected String[] getParams() { - List params = getTraitValueAsListOfStrings(RUNTIME_PARAMS_TYPES); - - return (String[])params.toArray(new String[0]); - } - - /** - * @return lits of validation messages - */ - public List getValidationMessages() { - if (validationMessages == null){ - validationMessages = new ArrayList(); - } - return validationMessages; - } - - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/FacesConfigConverterIDFeatures.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/FacesConfigConverterIDFeatures.java deleted file mode 100644 index 79b1c5b38..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/FacesConfigConverterIDFeatures.java +++ /dev/null @@ -1,127 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.taglibprocessing.attributevalues; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.jst.jsf.core.jsfappconfig.JSFAppConfigManager; -import org.eclipse.jst.jsf.facesconfig.emf.ConverterType; -import org.eclipse.jst.jsf.metadataprocessors.features.PossibleValue; -import org.eclipse.osgi.util.NLS; - -/** - * Meta-data processing feature representing an attribute value requiring a "converterid" - * - * <p><b>Provisional API - subject to change</b></p> - * @author Gerry Kessler - Oracle - */ -public class FacesConfigConverterIDFeatures extends FacesConfigIdentifierFeatures { - - /** - * Faces converter classname - */ - protected static final String CONVERTER = "javax.faces.convert.Converter"; //$NON-NLS-1$ - /** - * Imagename to use when displaying converter - */ - protected static final String IMAGE_NAME = "/icons/full/obj16/FacesConfig_Converter.gif"; //$NON-NLS-1$ - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.taglibprocessing.attributevalues.FacesConfigIdentifierFeatures#getElements(org.eclipse.jst.jsf.core.jsfappconfig.JSFAppConfigManager) - */ - protected List getElements(JSFAppConfigManager mgr) { - if (mgr != null) - return mgr.getConverters(); - return new ArrayList(0); - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.taglibprocessing.attributevalues.FacesConfigIdentifierFeatures#getReturnType() - */ - protected String getReturnType(){ return CONVERTER;} - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.taglibprocessing.attributevalues.FacesConfigIdentifierFeatures#getPossibleValueProposals(java.util.List) - */ - protected List getPossibleValueProposals(List elements) { - List ret = new ArrayList(); - Collections.sort(elements, new ConverterSorter()); - for (Iterator it = elements.iterator();it.hasNext();){ - ConverterType obj = (ConverterType)it.next(); - if (obj.getConverterId() != null && obj.getConverterId().getTextContent() != null){ - PossibleValue pv = createProposal(obj.getConverterId().getTextContent(), obj.getDisplayName(), obj.getDescription()); - if (pv != null){ - pv.setIcon(getImage()); - ret.add(pv); - } - } - } - return ret; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.taglibprocessing.attributevalues.FacesConfigIdentifierFeatures#getImageName() - */ - protected String getImageName() { - return IMAGE_NAME; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.taglibprocessing.attributevalues.FacesConfigIdentifierFeatures#getMyValidationMessage(java.lang.String) - */ - protected String getMyValidationMessage(String value) { - if (value == null || value.trim().equals("")) //$NON-NLS-1$ - return Messages.FacesConfigConverterIDFeatures_converterid_empty; - - return NLS.bind(Messages.FacesConfigIdentifierType_invalid_converter_id, new String[]{singleQuote(value)}); - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.taglibprocessing.attributevalues.FacesConfigIdentifierFeatures#getElementIDs(org.eclipse.jst.jsf.core.jsfappconfig.JSFAppConfigManager) - */ - protected List getElementIDs(JSFAppConfigManager mgr) { - List elements = getElements(mgr); - List ret = new ArrayList(elements.size()); - for (Iterator it = elements.iterator();it.hasNext();){ - ConverterType aType = (ConverterType)it.next(); - if (aType.getConverterId() != null && aType.getConverterId().getTextContent() != null){ - String id = aType.getConverterId().getTextContent(); - if (id != null) - ret.add(id.trim()); - } - } - return ret; - } - - /** - * - * Converter ID Sorter - incomplete - */ - private static class ConverterSorter implements Comparator, Serializable { - /** - * - */ - private static final long serialVersionUID = 5255291244511783735L; - - public int compare(Object o1, Object o2) { - //TODO - return 0; - - } - - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/FacesConfigConverterIDType.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/FacesConfigConverterIDType.java deleted file mode 100644 index 3e81d0484..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/FacesConfigConverterIDType.java +++ /dev/null @@ -1,20 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.taglibprocessing.attributevalues; - -/** - * Type representing a FacesConfig Converter attribute - * - * <p><b>Provisional API - subject to change</b></p> - */ -public class FacesConfigConverterIDType extends FacesConfigIdentifierType { - // FIXME: why do we have an empty class? -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/FacesConfigIdentifierFeatures.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/FacesConfigIdentifierFeatures.java deleted file mode 100644 index b22f4d1ec..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/FacesConfigIdentifierFeatures.java +++ /dev/null @@ -1,305 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.taglibprocessing.attributevalues; - -import java.net.URL; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.FileLocator; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Path; -import org.eclipse.emf.common.util.EList; -import org.eclipse.jdt.core.Signature; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jst.jsf.common.internal.types.CompositeType; -import org.eclipse.jst.jsf.common.internal.types.IAssignable; -import org.eclipse.jst.jsf.context.resolver.structureddocument.IStructuredDocumentContextResolverFactory; -import org.eclipse.jst.jsf.context.resolver.structureddocument.IWorkspaceContextResolver; -import org.eclipse.jst.jsf.core.jsfappconfig.JSFAppConfigManager; -import org.eclipse.jst.jsf.facesconfig.FacesConfigPlugin; -import org.eclipse.jst.jsf.facesconfig.emf.DescriptionType; -import org.eclipse.jst.jsf.facesconfig.emf.DisplayNameType; -import org.eclipse.jst.jsf.metadataprocessors.AbstractMetaDataEnabledFeature; -import org.eclipse.jst.jsf.metadataprocessors.features.ELIsNotValidException; -import org.eclipse.jst.jsf.metadataprocessors.features.IPossibleValues; -import org.eclipse.jst.jsf.metadataprocessors.features.IValidELValues; -import org.eclipse.jst.jsf.metadataprocessors.features.IValidValues; -import org.eclipse.jst.jsf.metadataprocessors.features.IValidationMessage; -import org.eclipse.jst.jsf.metadataprocessors.features.PossibleValue; -import org.eclipse.jst.jsf.metadataprocessors.features.ValidationMessage; -import org.osgi.framework.Bundle; - -/** - * Abstract meta-data processing feature representing a faces-config type - * - * <p><b>Provisional API - subject to change</b></p> - * @author Gerry Kessler - Oracle - */ -public abstract class FacesConfigIdentifierFeatures extends AbstractMetaDataEnabledFeature - implements IPossibleValues, IValidValues, IValidELValues{ - - /** - * Meta-data property name to use for identifying the faces-config type - * - * see jsf_core.xml converterID and validatorID attributes - */ - public static final String ID_TYPE_PROP_NAME = "config-type"; //$NON-NLS-1$ - - /** - * Missing image descriptor - */ - protected static final ImageDescriptor MISSING_IMAGE = ImageDescriptor.getMissingImageDescriptor(); - - /** - * Name of image file to use with content assist proposals - */ - protected String imageName; - private ImageDescriptor imageDescriptor; - /** - * Validation messages to return - */ - protected List validationMessages; - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.metadataprocessors.features.IPossibleValues#getPossibleValues() - */ - public List getPossibleValues() { - List ret = new ArrayList(); - List idTypes = getConfigTypes(); - - if (idTypes != null){ - for (int i=0;i<idTypes.size();i++){ - //verify this feature can deal with this type - if (getReturnType().equals(idTypes.get(i))){ - ret.addAll(createPossibleValues()); - } - } - } - - return ret; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.metadataprocessors.features.IValidValues#isValidValue(java.lang.String) - */ - public boolean isValidValue(String value) { - List idTypes = getConfigTypes(); - if (idTypes != null){ - for (int i=0;i<idTypes.size();i++){ - if (getReturnType().equals(idTypes.get(i))){ - if (hasValue(getElementIDs(getJSFAppConfigMgr()), value)){ - getValidationMessages().clear(); - return true; - } - getValidationMessages().add(getValidationMessage(value)); - } - } - } - return false; - } - - private boolean hasValue(List elements, String value) { - for (Iterator it=elements.iterator();it.hasNext();){ - if (value.equals(it.next())) - return true; - } - return false; - } - - /** - * @param value of the attribute - * @return the validation message String - */ - protected abstract String getMyValidationMessage(String value); - - /** - * Creates an IValidationMessage - * @param value - * @return IValidationMessage - */ - protected IValidationMessage getValidationMessage(String value) { - String msg; - msg = getCMValidationMessage(); - if (msg == null){ - msg = getMyValidationMessage(value); - } - String code = getCMValidationCode(); - int severity = getCMValidationSeverity(); - - IValidationMessage valMsg = new ValidationMessage(msg, code, severity); - return valMsg; - } - - /** - * - * @param value - * @return single-quoted value - */ - protected String singleQuote(String value){ - return "'" + value+"'"; //$NON-NLS-1$ //$NON-NLS-2$ - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.metadataprocessors.features.IValidValues#getValidationMessages() - */ - public List getValidationMessages(){ - if (validationMessages == null){ - validationMessages = new ArrayList(); - } - return validationMessages; - } - - /** - * @param jsfAppConfigManager - * @return list of faces-config element for the specified config-type - */ - protected abstract List getElements(JSFAppConfigManager jsfAppConfigManager); - /** - * @param elements - * @return list of IPossibleValue objects for the specified list of config elements - */ - protected abstract List getPossibleValueProposals(List elements); - /** - * @return image name relative to the FacesConfigEditPlugin where the images are stored - */ - protected abstract String getImageName(); - - private List createPossibleValues() { - return getPossibleValueProposals(getElements(getJSFAppConfigMgr())); - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.metadataprocessors.AbstractMetaDataEnabledFeature#getImage() - */ - protected ImageDescriptor getImage() { - ImageDescriptor ret = super.getImage(); - if (ret != null && ret != MISSING_IMAGE) - return ret; - - if (imageDescriptor == null){ - imageDescriptor = getImageDesc(getImageName()); - } - return imageDescriptor; - - } - - //return FacesConfigPlugin relative image descriptor - private ImageDescriptor getImageDesc(String img) { - Bundle bundle = FacesConfigPlugin.getPlugin().getBundle(); - URL url = FileLocator.find(bundle, new Path(img), null); - ImageDescriptor desc = ImageDescriptor.createFromURL(url); - if (desc == MISSING_IMAGE){ - return null; - } - return desc; - } - - /** - * @param value - * @param displayName - * @param description - * @return PossibleValue object - */ - protected PossibleValue createProposal(String value, EList displayName, EList description) { - String display = value; - if (displayName.size() > 0) { - DisplayNameType displayNameType= (DisplayNameType) displayName.get(0); - display = displayNameType.getTextContent(); - } - String desc = null; - if (description.size() > 0) { - DescriptionType descType= (DescriptionType) description.get(0); - desc = descType.getTextContent(); - } - PossibleValue pv = new PossibleValue(value, display); - if (desc != null) - pv.setAdditionalInformation(desc); - - return pv; - - } - - private List getConfigTypes() { - return getTraitValueAsListOfStrings(ID_TYPE_PROP_NAME); - -// return CMAnnotationHelper.getCMAttributePropertyValues(getMetaDataContext().getBundleId(), -// getMetaDataContext().getUri(), getMetaDataContext().getElementName(), -// getMetaDataContext().getAttributeName(), ID_TYPE_PROP_NAME); - } - - private JSFAppConfigManager getJSFAppConfigMgr(){ - return JSFAppConfigManager.getInstance(getProject()); - } - - private IProject getProject() { - IWorkspaceContextResolver resolver = IStructuredDocumentContextResolverFactory.INSTANCE.getWorkspaceContextResolver(getStructuredDocumentContext()); - if (resolver != null) - return resolver.getProject(); - - return null; - } - - /** - * @param jsfAppConfigManager - * @return list of identifier Strings for config-type - */ - protected abstract List getElementIDs(JSFAppConfigManager jsfAppConfigManager); - - /** - * @return the config-type - */ - protected abstract String getReturnType(); - /** - * @return int value of {@link IAssignable}.ASSIGNMENT_TYPE_RHS & {@link IAssignable}.ASSIGNMENT_TYPE_LHS - */ - protected int getAssignmentType(){ - //TODO: fix me to get from meta-data(?) - return IAssignable.ASSIGNMENT_TYPE_RHS & IAssignable.ASSIGNMENT_TYPE_LHS; - } - public CompositeType getExpectedRuntimeType() throws ELIsNotValidException { - String type = Signature.createTypeSignature(getReturnType(), true); - return new CompositeType(type, getAssignmentType()); - } - - /** - * @return String value of {@link IValidValues}.VALID_VALUES_MESSAGE_PROP_NAME trait - */ - protected String getCMValidationMessage() { - //TODO: Standard Validation stuff - should be moved somewhere else - return getTraitValueAsString(IValidValues.VALID_VALUES_MESSAGE_PROP_NAME); - } - - /** - * @return int value of {@link IValidValues}.VALID_VALUES_SEVERITY_PROP_NAME trait - */ - protected int getCMValidationSeverity() { - String val = getTraitValueAsString(IValidValues.VALID_VALUES_SEVERITY_PROP_NAME); - if (val == null) - return IStatus.WARNING; - - int severity = Integer.valueOf(val).intValue(); - return severity; - } - - /** - * @return String value of {@link IValidValues}.VALID_VALUES_CODE_PROP_NAME trait - */ - protected String getCMValidationCode() { - return getTraitValueAsString(IValidValues.VALID_VALUES_CODE_PROP_NAME); - } - -} - - diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/FacesConfigIdentifierType.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/FacesConfigIdentifierType.java deleted file mode 100644 index 5ac934d7c..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/FacesConfigIdentifierType.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.taglibprocessing.attributevalues; - -/** - * Meta-data processing type representing a faces-config type - * - * <p><b>Provisional API - subject to change</b></p> - * @author Gerry Kessler - Oracle - */ -public abstract class FacesConfigIdentifierType extends IdentifierType { - // FIXME: why do we have an empty class? -} - - - - diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/FacesConfigValidatorIDFeatures.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/FacesConfigValidatorIDFeatures.java deleted file mode 100644 index 2a2711ab0..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/FacesConfigValidatorIDFeatures.java +++ /dev/null @@ -1,126 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.taglibprocessing.attributevalues; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.jst.jsf.core.jsfappconfig.JSFAppConfigManager; -import org.eclipse.jst.jsf.facesconfig.emf.ValidatorType; -import org.eclipse.jst.jsf.metadataprocessors.features.PossibleValue; -import org.eclipse.osgi.util.NLS; - -/** - * ValidatorID attribute feature - * - * <p><b>Provisional API - subject to change</b></p> - * - */ -public class FacesConfigValidatorIDFeatures extends FacesConfigIdentifierFeatures { - - /** - * Faces validator classname - */ - protected static final String VALIDATOR = "javax.faces.validator.Validator"; //$NON-NLS-1$ - /** - * Imagename to use when displaying validator - */ - protected static final String IMAGE_NAME = "/icons/full/obj16/FacesConfig_Validator.gif"; //$NON-NLS-1$ - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.taglibprocessing.attributevalues.FacesConfigIdentifierFeatures#getReturnType() - */ - protected String getReturnType(){ return VALIDATOR;} - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.taglibprocessing.attributevalues.FacesConfigIdentifierFeatures#getElements(org.eclipse.jst.jsf.core.jsfappconfig.JSFAppConfigManager) - */ - protected List getElements(JSFAppConfigManager mgr) { - if (mgr != null) - return mgr.getValidators(); - return new ArrayList(0); - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.taglibprocessing.attributevalues.FacesConfigIdentifierFeatures#getPossibleValueProposals(java.util.List) - */ - protected List getPossibleValueProposals(List elements) { - List ret = new ArrayList(); - Collections.sort(elements, new ValidatorSorter()); - for (Iterator it = elements.iterator();it.hasNext();){ - ValidatorType obj = (ValidatorType)it.next(); - if (obj.getValidatorId() != null && obj.getValidatorId().getTextContent() != null){ - PossibleValue pv = createProposal(obj.getValidatorId().getTextContent(), obj.getDisplayName(), obj.getDescription()); - if (pv != null){ - pv.setIcon(getImage()); - ret.add(pv); - } - } - } - return ret; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.taglibprocessing.attributevalues.FacesConfigIdentifierFeatures#getImageName() - */ - protected String getImageName() { - return IMAGE_NAME; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.taglibprocessing.attributevalues.FacesConfigIdentifierFeatures#getMyValidationMessage(java.lang.String) - */ - protected String getMyValidationMessage(String value) { - if (value == null || value.trim().equals("")) //$NON-NLS-1$ - return Messages.FacesConfigValidatorIDFeatures_validatorid_empty; - - return NLS.bind(Messages.FacesConfigIdentifierType_invalid_validator_id, new String[]{singleQuote(value)}); - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.taglibprocessing.attributevalues.FacesConfigIdentifierFeatures#getElementIDs(org.eclipse.jst.jsf.core.jsfappconfig.JSFAppConfigManager) - */ - protected List getElementIDs(JSFAppConfigManager mgr) { - List elements = getElements(mgr); - List ret = new ArrayList(elements.size()); - for (Iterator it = elements.iterator();it.hasNext();){ - ValidatorType aType = (ValidatorType)it.next(); - if (aType.getValidatorId() != null && aType.getValidatorId().getTextContent() != null){ - String id = aType.getValidatorId().getTextContent(); - if (id != null) - ret.add(id.trim()); - } - } - return ret; - } - - /** - * Validator id sorter - incomplete - */ - private static class ValidatorSorter implements Comparator, Serializable { - /** - * - */ - private static final long serialVersionUID = -398026037193914126L; - - public int compare(Object o1, Object o2) { - //TODO - return 0; - - } - - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/FacesConfigValidatorIDType.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/FacesConfigValidatorIDType.java deleted file mode 100644 index 65f0504e8..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/FacesConfigValidatorIDType.java +++ /dev/null @@ -1,20 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.taglibprocessing.attributevalues; - -/** - * Type representing a FacesConfig Validator attribute - * - * <p><b>Provisional API - subject to change</b></p> - */ -public class FacesConfigValidatorIDType extends FacesConfigIdentifierType { - // FIXME: why do we have an empty class? -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/IdentifierType.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/IdentifierType.java deleted file mode 100644 index 134e23d9a..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/IdentifierType.java +++ /dev/null @@ -1,22 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.taglibprocessing.attributevalues; - -/** - * Abstract meta-data processing type representing an identifier binding type - * - * <p><b>Provisional API - subject to change</b></p> - * @author Gerry Kessler - Oracle - */ -public abstract class IdentifierType extends DirectBindingType { - // TODO: parent is already abstract; what's the point? -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/IntegerType.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/IntegerType.java deleted file mode 100644 index 6fcbdb747..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/IntegerType.java +++ /dev/null @@ -1,90 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.taglibprocessing.attributevalues; - -import java.util.List; - -import org.eclipse.osgi.util.NLS; - -/** - * Meta-data processing type representing an integer attribute value runtime type - * that implements IValidValues, IDefaultValue, IValidELValues - * - * <p><b>Provisional API - subject to change</b></p> - * @author Gerry Kessler - Oracle - */ -public class IntegerType extends NumberType { - private static final String INVALID_INTEGER = Messages.IntegerType_invalid_integer; - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.taglibprocessing.attributevalues.EnumerationType#getReturnType() - */ - protected String getReturnType(){ return "int";} //$NON-NLS-1$ - - /** - * Type coercion according to JSP 2.0 spec: JSP.1.14.2.1 Conversions from String values - * @see org.eclipse.jst.jsf.metadataprocessors.features.IValidValues#isValidValue(java.lang.String) - **/ - public boolean isValidValue(String value) { - try { - Integer anInt = Integer.valueOf(value); - exceedsMaxValue(anInt.intValue()); - lessThanMinValue(anInt.intValue()); - if (!(minFound || maxFound)){ - List validVals = getMDValidValues(); - if (!validVals.isEmpty()){ - if (!validVals.contains(value)){ - addNewValidationMessage(Messages.IntegerType_invalid_member);//fix me - } - } - } - return getValidationMessages().isEmpty(); - } catch (NumberFormatException e) { - addNewValidationMessage(INVALID_INTEGER); - return false; - } - - } - - private void exceedsMaxValue(int anInt) { - String strMax = getValidMaximumValue(); - if (strMax != null){ - try { - int max = Integer.valueOf(strMax).intValue(); - maxFound = true; - if (anInt > max){ - addNewValidationMessage(NLS.bind(EXCEEDS_MAX, strMax)); - } - } catch (NumberFormatException e) { - //TODO: ignore error???? or log it???? - } - } - - } - - private void lessThanMinValue(int anInt) { - String strMin = getValidMinimumValue(); - if (strMin != null){ - try { - int max = Integer.valueOf(strMin).intValue(); - minFound = true; - if (anInt < max){ - addNewValidationMessage(NLS.bind(LESS_THAN_MIN, strMin)); - } - } catch (NumberFormatException e) { - //TODO: ignore error???? or log it???? - } - } - - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/JavaClassType.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/JavaClassType.java deleted file mode 100644 index 912c81808..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/JavaClassType.java +++ /dev/null @@ -1,498 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.taglibprocessing.attributevalues; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jdt.core.Flags; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IPackageFragmentRoot; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.ITypeHierarchy; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jdt.core.search.IJavaSearchConstants; -import org.eclipse.jdt.core.search.IJavaSearchScope; -import org.eclipse.jdt.core.search.SearchEngine; -import org.eclipse.jdt.core.search.SearchMatch; -import org.eclipse.jdt.core.search.SearchParticipant; -import org.eclipse.jdt.core.search.SearchPattern; -import org.eclipse.jdt.core.search.SearchRequestor; -import org.eclipse.jst.jsf.context.resolver.structureddocument.IStructuredDocumentContextResolverFactory; -import org.eclipse.jst.jsf.context.resolver.structureddocument.IWorkspaceContextResolver; -import org.eclipse.jst.jsf.metadataprocessors.features.IPossibleValues; -import org.eclipse.jst.jsf.metadataprocessors.features.IValidValues; -import org.eclipse.jst.jsf.metadataprocessors.features.PossibleValue; -import org.eclipse.jst.jsf.metadataprocessors.features.ValidationMessage; - -/** - * Provides possible values and validates attribute values that should be fully qualified Java types. - * A type can be verified against multiple "valid-interfaces" and/or a "valid-superclass" from meta-data. - * Code checks to ensure the class can be instantiated (i.e. not abstract, anonymous or inner class) - * Search is scoped to within the current project only. - * - * (Until https://bugs.eclipse.org/bugs/show_bug.cgi?id=142044 is fixed, only the first found will be used) - * - * <p><b>Provisional API - subject to change</b></p> - * @author Gerry Kessler - Oracle - * - */ -public class JavaClassType extends ObjectType implements IPossibleValues, IValidValues{ - /** - * Trait name for valid interfaces - */ - public static final String POSSIBLE_VALUES_INTERFACES_PROP_NAME = "valid-interfaces"; //$NON-NLS-1$ - /** - * Trait name for valid superclass - */ - public static final String POSSIBLE_VALUES_SUPERCLASS_PROP_NAME = "valid-superclass"; //$NON-NLS-1$ - - private List validationMsgs; - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.metadataprocessors.features.IPossibleValues#getPossibleValues() - */ - public List getPossibleValues() { - List results = getTypes(); - if (results != null && !results.isEmpty()){ - - Set vals = new HashSet(results.size()); - Set checkedTypes = new HashSet(); - for (Iterator it = results.iterator();it.hasNext();){ - SearchMatch match = (SearchMatch)it.next(); - IType res = (IType)match.getElement(); - addValidSubClasses(res, vals, checkedTypes); - } - return createPossibleValues(vals); - } - return new ArrayList(0); - } - - private List createPossibleValues(Set vals) { - List list = new ArrayList(vals.size()); - Iterator it = vals.iterator(); - while(it.hasNext()){ - IJavaElement elem = (IJavaElement)it.next(); - list.add(createPossibleValue(elem)); - } - return list; - } - - private void addValidSubClasses(IType res, Set vals, Set checkedTypes) { - - try { - //check to see if we have already checked the hiearchy - if (checkedTypes.contains(res)) - return; - - //should we add itself? - if (isInnerOrAnonymousClass(res)) - return; - if (!isAbstractClass(res)) - vals.add(res); //since it is a set, dupes will not be added - - - ITypeHierarchy hierarchy = res.newTypeHierarchy(getJavaProject(), null); - IType[] subclasses = hierarchy.getSubclasses(res); - checkedTypes.add(res); - for (int i=0;i<subclasses.length;i++){ - addValidSubClasses(subclasses[i], vals, checkedTypes); - } - } catch (JavaModelException e) { - //ignore - } - } - - private IWorkspaceContextResolver getWorkspaceContextResolver(){ - if (getStructuredDocumentContext() == null) - return null; - - return IStructuredDocumentContextResolverFactory.INSTANCE.getWorkspaceContextResolver(getStructuredDocumentContext()); - } - - private List getTypes(){ - IJavaProject jp = getJavaProject(); - if (jp == null) - return null; - - List elems = new ArrayList(); - elems.addAll(getInterfaces(jp)); - IType sc = getSuperClass(jp); - if (sc != null) - elems.add(sc); - - if (elems.size() > 0){ - SearchRequestor requestor = new Searcher(); - SearchEngine engine = new SearchEngine(); - - IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[]{jp});//, IJavaSearchScope.SOURCES | IJavaSearchScope.APPLICATION_LIBRARIES | IJavaSearchScope.); - SearchPattern combined = SearchPattern.createPattern((IJavaElement)elems.get(0), IJavaSearchConstants.IMPLEMENTORS, 0); - -// Until this bug is fixed, stub it out... only the first interface/superclass will be used. -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=142044 -// for(int i=1;i<elems.size();i++){ -// final SearchPattern other = SearchPattern.createPattern((IJavaElement)elems.get(i), IJavaSearchConstants.IMPLEMENTORS, 0); -// combined = SearchPattern.createAndPattern(combined, other); -// } - - try { - engine.search(combined, new SearchParticipant[] {SearchEngine.getDefaultSearchParticipant()}, scope, requestor, null); - - } catch (CoreException e) { - //ignore - } - - return ((Searcher)requestor).getResults(); - } - - return Collections.EMPTY_LIST; - } - - private IJavaProject getJavaProject() { - IWorkspaceContextResolver resolver = getWorkspaceContextResolver(); - if (resolver != null){ - IProject proj = resolver.getProject(); - if (proj != null) - return JavaCore.create(proj); - } - return null; - } - - private List getInterfaces(IJavaProject jp) { - List ret = new ArrayList(); - List propVals = getInterfaceNames(); - - for (Iterator it = propVals.iterator();it.hasNext();){ - String propVal = (String)it.next(); - IType interfase = null; - try { - interfase = findType(jp, propVal); - if (interfase != null){ - ret.add(interfase); - } - } catch (JavaModelException e) { - // suppress and fall-through to return empty list - } - - } - return ret; - } - - private IType getSuperClass(IJavaProject jp){ - IType superclass = null; - try { - String sc = getSuperClassName(); - if (sc != null && !sc.trim().equals("")){ //$NON-NLS-1$ - superclass = findType(jp, sc ); - if (superclass != null){ - return superclass; - } - } - } catch (JavaModelException e) { - //ignore - } - return null; - } - - private PossibleValue createPossibleValue(IJavaElement val) { - return new PossibleValue(((IType)val).getFullyQualifiedName()); - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.metadataprocessors.features.IValidValues#getValidationMessages() - */ - public List getValidationMessages() { - if (validationMsgs == null){ - validationMsgs = new ArrayList(); - } - return validationMsgs; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.metadataprocessors.features.IValidValues#isValidValue(java.lang.String) - */ - public boolean isValidValue(String value) { - if (value == null || value.trim().equals("")){ //$NON-NLS-1$ - getValidationMessages().add(new ValidationMessage(Messages.JavaClassType_invalid_type)); - return false; - } - IJavaProject jp = getJavaProject(); - if (jp == null) - return false; - - //first verify that the value specified is a resolvable type - IType type = getTypeForValue(jp, value); - if (type != null){ - //ensure that it is not abstract or anonymous - if (!isInnerOrAnonymousClass(type) && !isAbstractClass(type)){ - //now verify that it meets the criteria - ITypeHierarchy hierarchy; - try { - hierarchy = type.newTypeHierarchy(jp, null); - } catch (JavaModelException e) { - return false; - } - - //check that all interfaces - List<String> interfaceNames = getInterfaceNames(); - for (Iterator<String> it=interfaceNames.iterator();it.hasNext();){ - //check that all interfaces are satisfied by type - IType interfase = getTypeForValue(jp, it.next()); - if (interfase == null){ - addNewValidationMessage(Messages.JavaClassType_not_found); - return false; - } - else if (! containsType(hierarchy.getAllSupertypes(type), interfase)){ - addNewValidationMessage(Messages.JavaClassType_not_found); - return false; - } - } - //interfaces have been satisfied now check the superclass if specified - IType superClass = getSuperClass(jp); - if (superClass != null && superClass.equals(type)) - return true; - else if (superClass != null && !containsType(hierarchy.getAllSuperclasses(type), superClass )){ - addNewValidationMessage(Messages.JavaClassType_not_found); - return false; - } - return true; -// List results = getTypes(); -// if (!results.isEmpty()){ -// for (Iterator it = results.iterator();it.hasNext();){ -// SearchMatch match = (SearchMatch)it.next(); -// IType res = (IType)match.getElement(); -// if (!isInnerOrAnonymousClass(res) ){ -// //if this is the class, then optimize to reduce expense of creating hierarchy -// if (!isAbstractClass(type) && (res.getFullyQualifiedName().equals(value)) ) -// return true; -// //check to see if value is a subtype in the hierarchy -// try { -// ITypeHierarchy hierarchy = res.newTypeHierarchy(jp, null); -// if (containsType(hierarchy.getAllSubtypes(res), type)) -// return true; -// -// } catch (JavaModelException e) { -// //ignore -// } -// } -// } -// } - } - } - addNewValidationMessage(Messages.JavaClassType_not_found); - return false; - } - - private boolean containsType(IType[] types, IType type) { - for (int i=0;i < types.length;i++) { - if (type.equals(types[i])) - return true; - } - return false; - } - - private IType getTypeForValue(IJavaProject jp, String value) { - try { - return findType(jp, value); - } catch (JavaModelException e) { - // suppress and fall through to return null - } - return null; - } - - /** - * @return String value of {@link #POSSIBLE_VALUES_SUPERCLASS_PROP_NAME} - */ - protected String getSuperClassName(){ - return getTraitValueAsString(POSSIBLE_VALUES_SUPERCLASS_PROP_NAME); -// return CMAnnotationHelper.getCMAttributePropertyValue(getMetaDataContext().getBundleId(), getMetaDataContext().getUri(), -// getMetaDataContext().getElementName(), getMetaDataContext().getAttributeName(), -// POSSIBLE_VALUES_SUPERCLASS_PROP_NAME); - - } - - /** - * @return List of values from {@link #POSSIBLE_VALUES_INTERFACES_PROP_NAME} - */ - protected List getInterfaceNames(){ - return getTraitValueAsListOfStrings(POSSIBLE_VALUES_INTERFACES_PROP_NAME); - -// return CMAnnotationHelper.getCMAttributePropertyValues(getMetaDataContext().getBundleId(), getMetaDataContext().getUri(), -// getMetaDataContext().getElementName(), getMetaDataContext().getAttributeName(), -// POSSIBLE_VALUES_INTERFACES_PROP_NAME); - - } - - /** - * Create a {@link ValidationMessage} from metadata or use default message - * and add it to the collection of validation messages - * @param defaultMsg - */ - protected void addNewValidationMessage(String defaultMsg) { - //TODO: need to refactor below as this as also in Enumeration - String msg = getCMValidationMessage(); - if (msg == null || msg.equals("")) //$NON-NLS-1$ - msg = defaultMsg; - - String code = getValidationCode(); - int severity = getValidationSeverity(); - ValidationMessage val = new ValidationMessage(msg, code, severity); - getValidationMessages().add(val); - } - - - /** - * @return validation message from meta-data using {@link IValidValues}.VALID_VALUES_MESSAGE_PROP_NAME trait. Can be null. - */ - protected String getCMValidationMessage() { - return getTraitValueAsString(IValidValues.VALID_VALUES_MESSAGE_PROP_NAME); - } - - /** - * @return validation severity as int from meta-data using {@link IValidValues}.VALID_VALUES_SEVERITY_PROP_NAME trait. IStatus.WARNING is default. - */ - protected int getValidationSeverity() { - String val = getTraitValueAsString(IValidValues.VALID_VALUES_SEVERITY_PROP_NAME); - if (val == null) - return IStatus.WARNING; - - int severity = Integer.valueOf(val).intValue(); - return severity; - } - - /** - * @return validation code as String from meta-data. Can be null. - */ - protected String getValidationCode() { - return getTraitValueAsString(IValidValues.VALID_VALUES_CODE_PROP_NAME); - } - - private boolean isInnerOrAnonymousClass(IType res) { - try { - if (res.isClass() && (res.isAnonymous() || - (Flags.isPrivate(res.getFlags())) || - res.getFullyQualifiedName().indexOf("$") > 0)) //must be better way to discover if it is an inner class //$NON-NLS-1$ - return true; - } catch (JavaModelException e) { - //ignore - } - return false; - } - - - private boolean isAbstractClass(IType res) { - try { - if (res.isClass() && Flags.isAbstract(res.getFlags())) - return true; - } catch (JavaModelException e) { - //ignore - } - return false; - } - - private static class Searcher extends SearchRequestor{ - private List results = new ArrayList(); - public void acceptSearchMatch(SearchMatch match) throws CoreException { - results.add(match); - } - - /** - * @return list of serach results - */ - public List getResults(){ - return results; - } - } - -///////////////// /////////////////////////////////////////////////////////////////////// -//remainder of this class copied from org.eclipse.jdt.internal.corext.util.JavaCoreUtil // -//TODO: find public version of this functionality // -////////////////////////////////////////////////////////////////////////////////////////// - private IType findType(IJavaProject jproject, String fullyQualifiedName) throws JavaModelException { - //workaround for bug 22883 - IType type= jproject.findType(fullyQualifiedName); - if (type != null) - return type; - - IPackageFragmentRoot[] roots= jproject.getPackageFragmentRoots(); - for (int i= 0; i < roots.length; i++) { - IPackageFragmentRoot root= roots[i]; - type= findType(root, fullyQualifiedName); - if (type != null && type.exists()) - return type; - } - return null; - } - - private IType findType(IPackageFragmentRoot root, String fullyQualifiedName) throws JavaModelException{ - IJavaElement[] children= root.getChildren(); - for (int i= 0; i < children.length; i++) { - IJavaElement element= children[i]; - if (element.getElementType() == IJavaElement.PACKAGE_FRAGMENT){ - IPackageFragment pack= (IPackageFragment)element; - if (! fullyQualifiedName.startsWith(pack.getElementName())) - continue; - IType type= findType(pack, fullyQualifiedName); - if (type != null && type.exists()) - return type; - } - } - return null; - } - - private IType findType(IPackageFragment pack, String fullyQualifiedName) throws JavaModelException{ - ICompilationUnit[] cus= pack.getCompilationUnits(); - for (int i= 0; i < cus.length; i++) { - ICompilationUnit unit= cus[i]; - IType type= findType(unit, fullyQualifiedName); - if (type != null && type.exists()) - return type; - } - return null; - } - - private IType findType(ICompilationUnit cu, String fullyQualifiedName) throws JavaModelException{ - IType[] types= cu.getAllTypes(); - for (int i= 0; i < types.length; i++) { - IType type= types[i]; - if (getFullyQualifiedName(type).equals(fullyQualifiedName)) - return type; - } - return null; - } - - private String getFullyQualifiedName(IType type) { - try { - if (type.isBinary() && !type.isAnonymous()) { - IType declaringType= type.getDeclaringType(); - if (declaringType != null) { - return getFullyQualifiedName(declaringType) + '.' + type.getElementName(); - } - } - } catch (JavaModelException e) { - // ignore - } - return type.getFullyQualifiedName('.'); - } -//////////////////////////////////////////////////////////////////////// -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/LanguageCodeType.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/LanguageCodeType.java deleted file mode 100644 index 102df5abb..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/LanguageCodeType.java +++ /dev/null @@ -1,127 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle Corporation., and others - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.taglibprocessing.attributevalues; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.jst.jsf.metadataprocessors.features.IPossibleValues; -import org.eclipse.jst.jsf.metadataprocessors.features.PossibleValue; - -/** - * Meta-data processing type representing a Language Code type. - * A Language code is defined as in html spec http://www.w3.org/TR/html4/types.html#h-6.8 - * - * <p><b>Provisional API - subject to change</b></p> - * - */ - -public class LanguageCodeType extends EnumerationType implements IPossibleValues { - private static final LanguageCodeMap _map = new LanguageCodeMap(); - - @Override - protected String getReturnType() { - return "java.lang.String"; //$NON-NLS-1$ - } - - public List getPossibleValues() { - List ret = new ArrayList(); - for(Iterator it = _map.keySet().iterator();it.hasNext();){ - String key = (String)it.next(); - String value = _map.get(key); - PossibleValue pv = new PossibleValue(key, value); - ret.add(pv); - } - return ret; - } - - public boolean isValidValue(String value) { - if(!_map.containsKey(value)) { - addNewValidationMessage(Messages.LanguageCodeType_1); - } - - return getValidationMessages().isEmpty(); - } - - /** - * Defines language code map - * - */ - private static class LanguageCodeMap extends HashMap<String, String> { - private static final long serialVersionUID = 1L; - - LanguageCodeMap() { - put("af", Messages.LanguageCodeType_118); //$NON-NLS-1$ - put("ar", Messages.LanguageCodeType_0); //$NON-NLS-1$ - put("be", Messages.LanguageCodeType_7); //$NON-NLS-1$ - put("bg", Messages.LanguageCodeType_9); //$NON-NLS-1$ - put("br", Messages.LanguageCodeType_11); //$NON-NLS-1$ - put("ca", Messages.LanguageCodeType_13); //$NON-NLS-1$ - put("cs", Messages.LanguageCodeType_15); //$NON-NLS-1$ - put("da", Messages.LanguageCodeType_17); //$NON-NLS-1$ - put("de", Messages.LanguageCodeType_19); //$NON-NLS-1$ - put("el", Messages.LanguageCodeType_21); //$NON-NLS-1$ - put("en", Messages.LanguageCodeType_23); //$NON-NLS-1$ - put("es", Messages.LanguageCodeType_25); //$NON-NLS-1$ - put("et", Messages.LanguageCodeType_27); //$NON-NLS-1$ - put("eu", Messages.LanguageCodeType_29); //$NON-NLS-1$ - put("fa", Messages.LanguageCodeType_31); //$NON-NLS-1$ - put("fi", Messages.LanguageCodeType_33); //$NON-NLS-1$ - put("fo", Messages.LanguageCodeType_35); //$NON-NLS-1$ - put("fr", Messages.LanguageCodeType_37); //$NON-NLS-1$ - put("gd", Messages.LanguageCodeType_39); //$NON-NLS-1$ - put("he", Messages.LanguageCodeType_41); //$NON-NLS-1$ - put("hi", Messages.LanguageCodeType_43); //$NON-NLS-1$ - put("hr", Messages.LanguageCodeType_45); //$NON-NLS-1$ - put("hu", Messages.LanguageCodeType_47); //$NON-NLS-1$ - put("id", Messages.LanguageCodeType_49); //$NON-NLS-1$ - put("is", Messages.LanguageCodeType_51); //$NON-NLS-1$ - put("it", Messages.LanguageCodeType_53); //$NON-NLS-1$ - put("ja", Messages.LanguageCodeType_55); //$NON-NLS-1$ - put("ko", Messages.LanguageCodeType_57); //$NON-NLS-1$ - put("lt", Messages.LanguageCodeType_59); //$NON-NLS-1$ - put("lv", Messages.LanguageCodeType_61); //$NON-NLS-1$ - put("mk", Messages.LanguageCodeType_63); //$NON-NLS-1$ - put("ms", Messages.LanguageCodeType_65); //$NON-NLS-1$ - put("mt", Messages.LanguageCodeType_67); //$NON-NLS-1$ - put("nl", Messages.LanguageCodeType_69); //$NON-NLS-1$ - put("no", Messages.LanguageCodeType_71); //$NON-NLS-1$ - put("pl", Messages.LanguageCodeType_73); //$NON-NLS-1$ - put("pt", Messages.LanguageCodeType_75); //$NON-NLS-1$ - put("rm", Messages.LanguageCodeType_77); //$NON-NLS-1$ - put("ro", Messages.LanguageCodeType_79); //$NON-NLS-1$ - put("ru", Messages.LanguageCodeType_81); //$NON-NLS-1$ - put("sk", Messages.LanguageCodeType_83); //$NON-NLS-1$ - put("sl", Messages.LanguageCodeType_85); //$NON-NLS-1$ - put("sq", Messages.LanguageCodeType_87); //$NON-NLS-1$ - put("sr", Messages.LanguageCodeType_89); //$NON-NLS-1$ - put("sv", Messages.LanguageCodeType_91); //$NON-NLS-1$ - put("sx", Messages.LanguageCodeType_93); //$NON-NLS-1$ - put("sz", Messages.LanguageCodeType_95); //$NON-NLS-1$ - put("th", Messages.LanguageCodeType_97); //$NON-NLS-1$ - put("tn", Messages.LanguageCodeType_99); //$NON-NLS-1$ - put("tr", Messages.LanguageCodeType_101); //$NON-NLS-1$ - put("ts", Messages.LanguageCodeType_103); //$NON-NLS-1$ - put("uk", Messages.LanguageCodeType_105); //$NON-NLS-1$ - put("ur", Messages.LanguageCodeType_107); //$NON-NLS-1$ - put("vi", Messages.LanguageCodeType_109); //$NON-NLS-1$ - put("xh", Messages.LanguageCodeType_111); //$NON-NLS-1$ - put("yi", Messages.LanguageCodeType_113); //$NON-NLS-1$ - put("zh", Messages.LanguageCodeType_115); //$NON-NLS-1$ - put("zu", Messages.LanguageCodeType_117); //$NON-NLS-1$ - } - - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/LengthType.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/LengthType.java deleted file mode 100644 index 70c5069fd..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/LengthType.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.taglibprocessing.attributevalues; - -/** - * Meta-data processing type representing an length attribute value runtime type. - * Does not support min and max values from MD. Length must be positive. - * that implements IValidValues, IDefaultValue, IValidELValues. - */ -public class LengthType extends IntegerType { - private static final String INVALID_LENGTH = Messages.LengthType_invalid_integer; - /** - * Type coercion according to JSP 2.0 spec: JSP.1.14.2.1 Conversions from String values - * Allows a percentage. - * @see org.eclipse.jst.jsf.metadataprocessors.features.IValidValues#isValidValue(java.lang.String) - **/ - public boolean isValidValue(String value) { - //FIXME: this is not right... px, em, etc. are also valid... and spaces between # and units are not - //see http://www.w3.org/TR/html401/types.html#h-6.6 - if (value == null) return true; - String aValue = stripPercentIfPresent(value); - try { - int anInt = Integer.valueOf(aValue).intValue(); - if (anInt < 0) - addNewValidationMessage(INVALID_LENGTH); - - return getValidationMessages().isEmpty(); - } catch (NumberFormatException e) { - addNewValidationMessage(INVALID_LENGTH); - return false; - } - - } - //will strip '%' if at end of string. If string is only '%', then will return empty which will be invalid. - private String stripPercentIfPresent(String value) { - //"%" is allowed at end - if (value.length() > 0 - && value.lastIndexOf('%') == value.length() - 1) - return value.replaceFirst("%",""); //$NON-NLS-1$ //$NON-NLS-2$ - - return value; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/LinkType.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/LinkType.java deleted file mode 100644 index ead9b79ce..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/LinkType.java +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle Corporation., and others - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.taglibprocessing.attributevalues; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.jst.jsf.metadataprocessors.features.IPossibleValues; -import org.eclipse.jst.jsf.metadataprocessors.features.PossibleValue; - -/** - * Meta-data processing type representing a Link type. - * - * Possible values are only common types; not all - * Valid values just checks for a non-empty value, and not against known link types - * - * <p><b>Provisional API - subject to change</b></p> - * - */ - -public class LinkType extends EnumerationType implements IPossibleValues{ - //common link types - private String[] _linkTypes = new String[]{ - "Alternate", //$NON-NLS-1$ - "Stylesheet", //$NON-NLS-1$ - "Start", //$NON-NLS-1$ - "Next", //$NON-NLS-1$ - "Prev", //$NON-NLS-1$ - "Contents", //$NON-NLS-1$ - "Index", //$NON-NLS-1$ - "Glossary", //$NON-NLS-1$ - "Copyright", //$NON-NLS-1$ - "Chapter", //$NON-NLS-1$ - "Section", //$NON-NLS-1$ - "Subsection", //$NON-NLS-1$ - "Appendix", //$NON-NLS-1$ - "Help", //$NON-NLS-1$ - "Bookmark" //$NON-NLS-1$ - }; - - - @Override - protected String getReturnType() { - return "java.lang.String"; //$NON-NLS-1$ - } - - public List getPossibleValues() { - List ret = new ArrayList(); - for(int i=0;i<_linkTypes.length;i++){ - PossibleValue pv = new PossibleValue(_linkTypes[i].toString(), _linkTypes[i].toString()); - ret.add(pv); - } - return ret; - } - - public boolean isValidValue(String value) { - if (value == null || value.trim().length() == 0){ - addNewValidationMessage(Messages.LinkType_16); - return false; - } - return true; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/LocaleType.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/LocaleType.java deleted file mode 100644 index cb04fdef3..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/LocaleType.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle Corporation., and others - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - * Vadim Dmitriev - * - ********************************************************************************/ -package org.eclipse.jst.jsf.taglibprocessing.attributevalues; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; -import java.util.Locale; - -import org.eclipse.jst.jsf.metadataprocessors.features.IPossibleValue; -import org.eclipse.jst.jsf.metadataprocessors.features.IPossibleValues; -import org.eclipse.jst.jsf.metadataprocessors.features.IValidELValues; -import org.eclipse.jst.jsf.metadataprocessors.features.IValidValues; -import org.eclipse.jst.jsf.metadataprocessors.features.PossibleValue; -import org.eclipse.jst.jsf.metadataprocessors.features.ValidationMessage; - -/** - * Meta-data processing type representing a Locale Code type. - * - * <p><b>Provisional API - subject to change</b></p> - * - */ - -public class LocaleType extends MultiSignatureEnumerationType implements IPossibleValues, IValidValues, IValidELValues{ - private List<IPossibleValue> _pvs; - @Override - protected String[] getReturnTypes() { - return new String[]{"java.util.Locale", "java.lang.String"}; //$NON-NLS-1$ - } - - public List getPossibleValues() { - if (_pvs == null){ - _pvs = new ArrayList(); - Locale[]_locales = getLocales(); - for(int i=0;i<_locales.length;i++){ - PossibleValue pv = new PossibleValue(_locales[i].toString(), _locales[i].getDisplayName()); - _pvs.add(pv); - } - Collections.sort(_pvs, new Comparator(){ - public int compare(Object o1, Object o2) { - PossibleValue pv1 = (PossibleValue)o1; - PossibleValue pv2 = (PossibleValue)o2; - return (pv1.getDisplayValue().compareTo(pv2.getDisplayValue())); - } - - }); - } - return _pvs; - } - - private Locale[] getLocales() { - return Locale.getAvailableLocales(); - } - - public boolean isValidValue(String value) { - Locale[]_locales = getLocales(); - for(int i=0;i<_locales.length;i++){ - Locale local = getLocales()[i]; - if (local.toString().equals(value)) - return true; - } - getValidationMessages().add(new ValidationMessage(Messages.LocaleType_1)); - return false; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/LongType.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/LongType.java deleted file mode 100644 index a7791e974..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/LongType.java +++ /dev/null @@ -1,90 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.taglibprocessing.attributevalues; - -import java.util.List; - -import org.eclipse.osgi.util.NLS; - -/** - * Meta-data processing type representing a long attribute value runtime type - * that implements IValidValues, IDefaultValue, IValidELValues - * - * <p><b>Provisional API - subject to change</b></p> - * @author Gerry Kessler - Oracle - */ -public class LongType extends NumberType { - private static final String INVALID_LONG = Messages.LongType_invalid_long; - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.taglibprocessing.attributevalues.EnumerationType#getReturnType() - */ - protected String getReturnType(){ return "long";} //$NON-NLS-1$ - - /** - * Type coercion according to JSP 2.0 spec: JSP.1.14.2.1 Conversions from String values - * @see org.eclipse.jst.jsf.metadataprocessors.features.IValidValues#isValidValue(java.lang.String) - **/ - public boolean isValidValue(String value) { - try { - Long aLong = Long.valueOf(value); - exceedsMaxValue(aLong.longValue()); - lessThanMinValue(aLong.longValue()); - if (!(minFound || maxFound)){ - List validVals = getMDValidValues(); - if (!validVals.isEmpty()){ - if (!validVals.contains(value)){ - addNewValidationMessage(Messages.LongType_invalid_member); - } - } - } - return getValidationMessages().isEmpty(); - } catch (NumberFormatException e) { - addNewValidationMessage(INVALID_LONG); - return false; - } - - } - - private void exceedsMaxValue(long aLong) { - String strMax = getValidMaximumValue(); - if (strMax != null){ - try { - long max = Long.valueOf(strMax).longValue(); - maxFound = true; - if (aLong > max){ - addNewValidationMessage(NLS.bind(EXCEEDS_MAX, strMax)); - } - } catch (NumberFormatException e) { - //TODO: ignore error???? or log it???? - } - } - - } - - private void lessThanMinValue(long aLong) { - String strMin = getValidMinimumValue(); - if (strMin != null){ - try { - long min = Long.valueOf(strMin).longValue(); - minFound = true; - if (aLong < min){ - addNewValidationMessage(NLS.bind(LESS_THAN_MIN, strMin)); - } - } catch (NumberFormatException e) { - //TODO: ignore error???? or log it???? - } - } - - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/Messages.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/Messages.java deleted file mode 100644 index 447ef788f..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/Messages.java +++ /dev/null @@ -1,1101 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.taglibprocessing.attributevalues; - -import org.eclipse.osgi.util.NLS; - -/** - * Message bundle for attributevalue types/features - * - * <p> - * <b>Provisional API - subject to change</b> - * </p> - */ -public class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.jst.jsf.taglibprocessing.attributevalues.messages"; //$NON-NLS-1$ - static { - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } - /** - * see messages.properties - */ - public static String ActionType_navcase_display; - /** - * see messages.properties - */ - public static String ActionType_invalid_value; - /** - * see messages.properties - */ - public static String ActionType_invalid_empty_value; - /** - * see messages.properties - */ - public static String BooleanType_invalid_values; - /** - * see messages.properties - */ - public static String ContentType_MIME_not_empty; - /** - * see messages.properties - */ - public static String ComponentBindingType_invalid_value; - /** - * see messages.properties - */ - public static String ComponentIDType_invalid_as_el; - /** - * see messages.properties - */ - public static String ComponentIDType_invalid_value; - /** - * see messages.properties - */ - public static String DoubleType_invalid_double; - /** - * see messages.properties - */ - public static String DoubleType_invalid_member; - /** - * see messages.properties - */ - public static String FacesConfigConverterIDFeatures_converterid_empty; - /** - * see messages.properties - */ - public static String FacesConfigIdentifierType_invalid_converter_id; - /** - * see messages.properties - */ - public static String FacesConfigIdentifierType_invalid_validator_id; - /** - * see messages.properties - */ - public static String FacesConfigValidatorIDFeatures_validatorid_empty; - /** - * see messages.properties - */ - public static String IntegerType_invalid_integer; - /** - * see messages.properties - */ - public static String IntegerType_invalid_member; - /** - * see messages.properties - */ - public static String JavaClassType_invalid_type; - /** - * see messages.properties - */ - public static String JavaClassType_not_found; - /** - * see messages.properties - */ - public static String LongType_invalid_long; - /** - * see messages.properties - */ - public static String LongType_invalid_member; - /** - * see messages.properties - */ - public static String MethodBindingType_invalid_value; - /** - * see messages.properties - */ - public static String CurrencyCodeType_invalid; - /** - * see messages.properties - */ - public static String CurrencyCodeType_10; - /** - * see messages.properties - */ - public static String CurrencyCodeType_100; - /** - * see messages.properties - */ - public static String CurrencyCodeType_101; - /** - * see messages.properties - */ - public static String CurrencyCodeType_102; - /** - * see messages.properties - */ - public static String CurrencyCodeType_103; - /** - * see messages.properties - */ - public static String CurrencyCodeType_104; - /** - * see messages.properties - */ - public static String CurrencyCodeType_105; - /** - * see messages.properties - */ - public static String CurrencyCodeType_106; - /** - * see messages.properties - */ - public static String CurrencyCodeType_107; - /** - * see messages.properties - */ - public static String CurrencyCodeType_108; - /** - * see messages.properties - */ - public static String CurrencyCodeType_109; - /** - * see messages.properties - */ - public static String CurrencyCodeType_11; - /** - * see messages.properties - */ - public static String CurrencyCodeType_110; - /** - * see messages.properties - */ - public static String CurrencyCodeType_111; - /** - * see messages.properties - */ - public static String CurrencyCodeType_112; - /** - * see messages.properties - */ - public static String CurrencyCodeType_113; - /** - * see messages.properties - */ - public static String CurrencyCodeType_114; - /** - * see messages.properties - */ - public static String CurrencyCodeType_115; - /** - * see messages.properties - */ - public static String CurrencyCodeType_116; - /** - * see messages.properties - */ - public static String CurrencyCodeType_117; - /** - * see messages.properties - */ - public static String CurrencyCodeType_118; - /** - * see messages.properties - */ - public static String CurrencyCodeType_119; - /** - * see messages.properties - */ - public static String CurrencyCodeType_12; - /** - * see messages.properties - */ - public static String CurrencyCodeType_120; - /** - * see messages.properties - */ - public static String CurrencyCodeType_121; - /** - * see messages.properties - */ - public static String CurrencyCodeType_122; - /** - * see messages.properties - */ - public static String CurrencyCodeType_123; - /** - * see messages.properties - */ - public static String CurrencyCodeType_124; - /** - * see messages.properties - */ - public static String CurrencyCodeType_125; - /** - * see messages.properties - */ - public static String CurrencyCodeType_126; - /** - * see messages.properties - */ - public static String CurrencyCodeType_127; - /** - * see messages.properties - */ - public static String CurrencyCodeType_128; - /** - * see messages.properties - */ - public static String CurrencyCodeType_129; - /** - * see messages.properties - */ - public static String CurrencyCodeType_13; - /** - * see messages.properties - */ - public static String CurrencyCodeType_130; - /** - * see messages.properties - */ - public static String CurrencyCodeType_131; - /** - * see messages.properties - */ - public static String CurrencyCodeType_132; - /** - * see messages.properties - */ - public static String CurrencyCodeType_133; - /** - * see messages.properties - */ - public static String CurrencyCodeType_134; - /** - * see messages.properties - */ - public static String CurrencyCodeType_135; - /** - * see messages.properties - */ - public static String CurrencyCodeType_136; - /** - * see messages.properties - */ - public static String CurrencyCodeType_137; - /** - * see messages.properties - */ - public static String CurrencyCodeType_138; - /** - * see messages.properties - */ - public static String CurrencyCodeType_139; - /** - * see messages.properties - */ - public static String CurrencyCodeType_14; - /** - * see messages.properties - */ - public static String CurrencyCodeType_140; - /** - * see messages.properties - */ - public static String CurrencyCodeType_141; - /** - * see messages.properties - */ - public static String CurrencyCodeType_142; - /** - * see messages.properties - */ - public static String CurrencyCodeType_143; - /** - * see messages.properties - */ - public static String CurrencyCodeType_144; - /** - * see messages.properties - */ - public static String CurrencyCodeType_145; - /** - * see messages.properties - */ - public static String CurrencyCodeType_146; - /** - * see messages.properties - */ - public static String CurrencyCodeType_147; - /** - * see messages.properties - */ - public static String CurrencyCodeType_148; - /** - * see messages.properties - */ - public static String CurrencyCodeType_149; - /** - * see messages.properties - */ - public static String CurrencyCodeType_15; - /** - * see messages.properties - */ - public static String CurrencyCodeType_150; - /** - * see messages.properties - */ - public static String CurrencyCodeType_151; - /** - * see messages.properties - */ - public static String CurrencyCodeType_152; - /** - * see messages.properties - */ - public static String CurrencyCodeType_153; - /** - * see messages.properties - */ - public static String CurrencyCodeType_154; - /** - * see messages.properties - */ - public static String CurrencyCodeType_155; - /** - * see messages.properties - */ - public static String CurrencyCodeType_156; - /** - * see messages.properties - */ - public static String CurrencyCodeType_157; - /** - * see messages.properties - */ - public static String CurrencyCodeType_158; - /** - * see messages.properties - */ - public static String CurrencyCodeType_159; - /** - * see messages.properties - */ - public static String CurrencyCodeType_16; - /** - * see messages.properties - */ - public static String CurrencyCodeType_160; - /** - * see messages.properties - */ - public static String CurrencyCodeType_161; - /** - * see messages.properties - */ - public static String CurrencyCodeType_162; - /** - * see messages.properties - */ - public static String CurrencyCodeType_163; - /** - * see messages.properties - */ - public static String CurrencyCodeType_164; - /** - * see messages.properties - */ - public static String CurrencyCodeType_165; - /** - * see messages.properties - */ - public static String CurrencyCodeType_166; - /** - * see messages.properties - */ - public static String CurrencyCodeType_167; - /** - * see messages.properties - */ - public static String CurrencyCodeType_168; - /** - * see messages.properties - */ - public static String CurrencyCodeType_169; - /** - * see messages.properties - */ - public static String CurrencyCodeType_17; - /** - * see messages.properties - */ - public static String CurrencyCodeType_170; - /** - * see messages.properties - */ - public static String CurrencyCodeType_171; - /** - * see messages.properties - */ - public static String CurrencyCodeType_172; - /** - * see messages.properties - */ - public static String CurrencyCodeType_173; - /** - * see messages.properties - */ - public static String CurrencyCodeType_174; - /** - * see messages.properties - */ - public static String CurrencyCodeType_18; - /** - * see messages.properties - */ - public static String CurrencyCodeType_19; - /** - * see messages.properties - */ - public static String CharacterType_0; - /** - * see messages.properties - */ - public static String CurrencyCodeType_2; - /** - * see messages.properties - */ - public static String CurrencyCodeType_20; - /** - * see messages.properties - */ - public static String CurrencyCodeType_21; - /** - * see messages.properties - */ - public static String CurrencyCodeType_22; - /** - * see messages.properties - */ - public static String CurrencyCodeType_23; - /** - * see messages.properties - */ - public static String CurrencyCodeType_24; - /** - * see messages.properties - */ - public static String CurrencyCodeType_25; - /** - * see messages.properties - */ - public static String CurrencyCodeType_26; - /** - * see messages.properties - */ - public static String CurrencyCodeType_27; - /** - * see messages.properties - */ - public static String CurrencyCodeType_28; - /** - * see messages.properties - */ - public static String CurrencyCodeType_29; - /** - * see messages.properties - */ - public static String CurrencyCodeType_3; - /** - * see messages.properties - */ - public static String CurrencyCodeType_30; - /** - * see messages.properties - */ - public static String CurrencyCodeType_31; - /** - * see messages.properties - */ - public static String CurrencyCodeType_32; - /** - * see messages.properties - */ - public static String CurrencyCodeType_33; - /** - * see messages.properties - */ - public static String CurrencyCodeType_34; - /** - * see messages.properties - */ - public static String CurrencyCodeType_35; - /** - * see messages.properties - */ - public static String CurrencyCodeType_36; - /** - * see messages.properties - */ - public static String CurrencyCodeType_37; - /** - * see messages.properties - */ - public static String CurrencyCodeType_38; - /** - * see messages.properties - */ - public static String CurrencyCodeType_39; - /** - * see messages.properties - */ - public static String CurrencyCodeType_4; - /** - * see messages.properties - */ - public static String CurrencyCodeType_40; - /** - * see messages.properties - */ - public static String CurrencyCodeType_41; - /** - * see messages.properties - */ - public static String CurrencyCodeType_42; - /** - * see messages.properties - */ - public static String CurrencyCodeType_43; - /** - * see messages.properties - */ - public static String CurrencyCodeType_44; - /** - * see messages.properties - */ - public static String CurrencyCodeType_45; - /** - * see messages.properties - */ - public static String CurrencyCodeType_46; - /** - * see messages.properties - */ - public static String CurrencyCodeType_47; - /** - * see messages.properties - */ - public static String CurrencyCodeType_48; - /** - * see messages.properties - */ - public static String CurrencyCodeType_49; - /** - * see messages.properties - */ - public static String CurrencyCodeType_5; - /** - * see messages.properties - */ - public static String CurrencyCodeType_50; - /** - * see messages.properties - */ - public static String CurrencyCodeType_51; - /** - * see messages.properties - */ - public static String CurrencyCodeType_52; - /** - * see messages.properties - */ - public static String CurrencyCodeType_53; - /** - * see messages.properties - */ - public static String CurrencyCodeType_54; - /** - * see messages.properties - */ - public static String CurrencyCodeType_55; - /** - * see messages.properties - */ - public static String CurrencyCodeType_56; - /** - * see messages.properties - */ - public static String CurrencyCodeType_57; - /** - * see messages.properties - */ - public static String CurrencyCodeType_58; - /** - * see messages.properties - */ - public static String CurrencyCodeType_59; - /** - * see messages.properties - */ - public static String CurrencyCodeType_6; - /** - * see messages.properties - */ - public static String CurrencyCodeType_60; - /** - * see messages.properties - */ - public static String CurrencyCodeType_61; - /** - * see messages.properties - */ - public static String CurrencyCodeType_62; - /** - * see messages.properties - */ - public static String CurrencyCodeType_63; - /** - * see messages.properties - */ - public static String CurrencyCodeType_64; - /** - * see messages.properties - */ - public static String CurrencyCodeType_65; - /** - * see messages.properties - */ - public static String CurrencyCodeType_66; - /** - * see messages.properties - */ - public static String CurrencyCodeType_67; - /** - * see messages.properties - */ - public static String CurrencyCodeType_68; - /** - * see messages.properties - */ - public static String CurrencyCodeType_69; - /** - * see messages.properties - */ - public static String CurrencyCodeType_7; - /** - * see messages.properties - */ - public static String CurrencyCodeType_70; - /** - * see messages.properties - */ - public static String CurrencyCodeType_71; - /** - * see messages.properties - */ - public static String CurrencyCodeType_72; - /** - * see messages.properties - */ - public static String CurrencyCodeType_73; - /** - * see messages.properties - */ - public static String CurrencyCodeType_74; - /** - * see messages.properties - */ - public static String CurrencyCodeType_75; - /** - * see messages.properties - */ - public static String CurrencyCodeType_76; - /** - * see messages.properties - */ - public static String CurrencyCodeType_77; - /** - * see messages.properties - */ - public static String CurrencyCodeType_78; - /** - * see messages.properties - */ - public static String CurrencyCodeType_79; - /** - * see messages.properties - */ - public static String CurrencyCodeType_8; - /** - * see messages.properties - */ - public static String CurrencyCodeType_80; - /** - * see messages.properties - */ - public static String CurrencyCodeType_81; - /** - * see messages.properties - */ - public static String CurrencyCodeType_82; - /** - * see messages.properties - */ - public static String CurrencyCodeType_83; - /** - * see messages.properties - */ - public static String CurrencyCodeType_84; - /** - * see messages.properties - */ - public static String CurrencyCodeType_85; - /** - * see messages.properties - */ - public static String CurrencyCodeType_86; - /** - * see messages.properties - */ - public static String CurrencyCodeType_87; - /** - * see messages.properties - */ - public static String CurrencyCodeType_88; - /** - * see messages.properties - */ - public static String CurrencyCodeType_89; - /** - * see messages.properties - */ - public static String CurrencyCodeType_9; - /** - * see messages.properties - */ - public static String LanguageCodeType_0; - /** - * see messages.properties - */ - public static String LanguageCodeType_1; - /** - * see messages.properties - */ - public static String LanguageCodeType_7; - /** - * see messages.properties - */ - public static String LanguageCodeType_9; - /** - * see messages.properties - */ - public static String LinkType_16; - /** - * see messages.properties - */ - public static String LocaleType_1; - /** - * see messages.properties - */ - public static String WebPathType_1; - /** - * see messages.properties - */ - public static String WebPathType_2; - /** - * see messages.properties - */ - public static String LanguageCodeType_11; - /** - * see messages.properties - */ - public static String LanguageCodeType_13; - /** - * see messages.properties - */ - public static String LanguageCodeType_15; - /** - * see messages.properties - */ - public static String LanguageCodeType_17; - /** - * see messages.properties - */ - public static String LanguageCodeType_19; - /** - * see messages.properties - */ - public static String LanguageCodeType_21; - /** - * see messages.properties - */ - public static String LanguageCodeType_23; - /** - * see messages.properties - */ - public static String LanguageCodeType_25; - /** - * see messages.properties - */ - public static String LanguageCodeType_27; - /** - * see messages.properties - */ - public static String LanguageCodeType_29; - /** - * see messages.properties - */ - public static String LanguageCodeType_31; - /** - * see messages.properties - */ - public static String LanguageCodeType_33; - /** - * see messages.properties - */ - public static String LanguageCodeType_35; - /** - * see messages.properties - */ - public static String LanguageCodeType_37; - /** - * see messages.properties - */ - public static String LanguageCodeType_39; - /** - * see messages.properties - */ - public static String LanguageCodeType_41; - /** - * see messages.properties - */ - public static String LanguageCodeType_43; - /** - * see messages.properties - */ - public static String LanguageCodeType_45; - /** - * see messages.properties - */ - public static String LanguageCodeType_47; - /** - * see messages.properties - */ - public static String LanguageCodeType_49; - /** - * see messages.properties - */ - public static String LanguageCodeType_51; - /** - * see messages.properties - */ - public static String LanguageCodeType_53; - /** - * see messages.properties - */ - public static String LanguageCodeType_55; - /** - * see messages.properties - */ - public static String LanguageCodeType_57; - /** - * see messages.properties - */ - public static String LanguageCodeType_59; - /** - * see messages.properties - */ - public static String LanguageCodeType_61; - /** - * see messages.properties - */ - public static String LanguageCodeType_63; - /** - * see messages.properties - */ - public static String LanguageCodeType_65; - /** - * see messages.properties - */ - public static String LanguageCodeType_67; - /** - * see messages.properties - */ - public static String LanguageCodeType_69; - /** - * see messages.properties - */ - public static String LanguageCodeType_71; - /** - * see messages.properties - */ - public static String LanguageCodeType_73; - /** - * see messages.properties - */ - public static String LanguageCodeType_75; - /** - * see messages.properties - */ - public static String LanguageCodeType_77; - /** - * see messages.properties - */ - public static String LanguageCodeType_79; - /** - * see messages.properties - */ - public static String LanguageCodeType_81; - /** - * see messages.properties - */ - public static String LanguageCodeType_83; - /** - * see messages.properties - */ - public static String LanguageCodeType_85; - /** - * see messages.properties - */ - public static String LanguageCodeType_87; - /** - * see messages.properties - */ - public static String LanguageCodeType_89; - /** - * see messages.properties - */ - public static String LanguageCodeType_91; - /** - * see messages.properties - */ - public static String LanguageCodeType_93; - /** - * see messages.properties - */ - public static String LanguageCodeType_95; - /** - * see messages.properties - */ - public static String LanguageCodeType_97; - /** - * see messages.properties - */ - public static String LanguageCodeType_99; - /** - * see messages.properties - */ - public static String LanguageCodeType_101; - /** - * see messages.properties - */ - public static String LanguageCodeType_103; - /** - * see messages.properties - */ - public static String LanguageCodeType_105; - /** - * see messages.properties - */ - public static String LanguageCodeType_107; - /** - * see messages.properties - */ - public static String LanguageCodeType_109; - /** - * see messages.properties - */ - public static String LanguageCodeType_111; - /** - * see messages.properties - */ - public static String LanguageCodeType_113; - /** - * see messages.properties - */ - public static String LanguageCodeType_115; - /** - * see messages.properties - */ - public static String LanguageCodeType_117; - /** - * see messages.properties - */ - public static String LanguageCodeType_118; - /** - * see messages.properties - */ - public static String CurrencyCodeType_90; - /** - * see messages.properties - */ - public static String CurrencyCodeType_91; - /** - * see messages.properties - */ - public static String CurrencyCodeType_92; - /** - * see messages.properties - */ - public static String CurrencyCodeType_93; - /** - * see messages.properties - */ - public static String CurrencyCodeType_94; - /** - * see messages.properties - */ - public static String CurrencyCodeType_95; - /** - * see messages.properties - */ - public static String CurrencyCodeType_96; - /** - * see messages.properties - */ - public static String CurrencyCodeType_97; - /** - * see messages.properties - */ - public static String CurrencyCodeType_98; - /** - * see messages.properties - */ - public static String CurrencyCodeType_99; - /** - * see messages.properties - */ - public static String NumberType_max_val; - /** - * see messages.properties - */ - public static String NumberType_min_val; - /** - * see messages.properties - */ - public static String RelativePathType_0; - /** - * see messages.properties - */ - public static String StringType_invalid_value; - /** - * see messages.properties - */ - public static String ValueType_invalid_value; - /** - * see messages.properties - */ - public static String ValueType_invalid_value_without_setter; - /** - * see messages.properties - */ - public static String LengthType_invalid_integer; - /** - * see messages.properties - */ - public static String ColorType_invalid_color; - - /** - * see messages.properties - */ - public static String Bundle_not_found_rb; -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/MethodBindingType.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/MethodBindingType.java deleted file mode 100644 index 4c07e0e22..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/MethodBindingType.java +++ /dev/null @@ -1,78 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.taglibprocessing.attributevalues; - - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jdt.core.Signature; -import org.eclipse.jst.jsf.common.internal.types.CompositeType; -import org.eclipse.jst.jsf.common.internal.types.IAssignable; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.metadataprocessors.features.ELIsNotValidException; -import org.eclipse.jst.jsf.metadataprocessors.features.IValidELValues; -import org.eclipse.jst.jsf.metadataprocessors.features.IValidValues; -import org.eclipse.jst.jsf.metadataprocessors.features.IValidationMessage; -import org.eclipse.jst.jsf.metadataprocessors.features.ValidationMessage; - -/** - * Meta-data processing type representing an method-binding attribute value runtime type - * - * <p><b>Provisional API - subject to change</b></p> - * @author Gerry Kessler - Oracle - */ -public class MethodBindingType extends ExpressionBindingType implements IValidELValues, IValidValues{ - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.metadataprocessors.features.IValidELValues#getExpectedRuntimeType() - */ - public CompositeType getExpectedRuntimeType() throws ELIsNotValidException { - String[] params = getParams(); - - // need to "signaturize" each parameter - for (int param = 0; param < params.length; param++) - { - params[param] = Signature.createTypeSignature(params[param],true); - } - final String runtimeType = getReturnType(); - - String returnTypeSignature = null; - - if (runtimeType != null) - { - returnTypeSignature = Signature.createTypeSignature(runtimeType, true); - } - else - { - JSFCorePlugin.log(IStatus.INFO, "Missing metadata for trait "+RUNTIME_RETURN_TYPE+" for entity "+getMetaDataContext().getEntity()); - } - - if (returnTypeSignature == null) - { - return null; - } - - String methodSig = Signature.createMethodSignature(params, returnTypeSignature); - return new CompositeType(methodSig, IAssignable.ASSIGNMENT_TYPE_NONE); - } - - /** - * Non-EL values are invalid for method bound attribute values - * @see org.eclipse.jst.jsf.metadataprocessors.features.IValidValues#isValidValue(java.lang.String) - */ - public boolean isValidValue(String value) { - //if this is being called, we are being called in an non-EL context which is invalid. - IValidationMessage msg = new ValidationMessage(Messages.MethodBindingType_invalid_value); - getValidationMessages().add(msg); - return false; - } - - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/MultiSignatureEnumerationType.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/MultiSignatureEnumerationType.java deleted file mode 100644 index 5b84c4b03..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/MultiSignatureEnumerationType.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Vadim Dmitriev and others - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Vadim Dmitriev - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.taglibprocessing.attributevalues; - -import org.eclipse.jdt.core.Signature; -import org.eclipse.jst.jsf.common.internal.types.CompositeType; -import org.eclipse.jst.jsf.metadataprocessors.features.ELIsNotValidException; - -/** - * Abstract meta-data processing type representing an enumeration attribute value - * of multiple runtime types - * - * @author Vadim Dmitriev - */ -public abstract class MultiSignatureEnumerationType extends AbstractEnumerationType { - - /** - * @return return Java types as array of strings (i.e. - * new String[]{"boolean", "java.lang.String"}, etc.) - * Must not be null. - */ - protected abstract String[] getReturnTypes(); - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.metadataprocessors.features.IValidELValues#getExpectedRuntimeType() - */ - public CompositeType getExpectedRuntimeType() throws ELIsNotValidException { - String[] types = getReturnTypes(); - int len = types.length; - - String[] signaturedTypes = new String[ len ]; - for( int i = 0; i < len; i++ ) - { - signaturedTypes[ i ] = Signature.createTypeSignature(types[ i ], true); - } - return new CompositeType( signaturedTypes, getAssignmentType()); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/NumberPatternType.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/NumberPatternType.java deleted file mode 100644 index b5add42cb..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/NumberPatternType.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle Corporation., and others - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.taglibprocessing.attributevalues; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.jst.jsf.metadataprocessors.AbstractRootTypeDescriptor; -import org.eclipse.jst.jsf.metadataprocessors.features.IPossibleValues; -import org.eclipse.jst.jsf.metadataprocessors.features.PossibleValue; - -/** - * Meta-data processing type representing a numeric pattern type. - * - * <p><b>Provisional API - subject to change</b></p> - * - */ - -public class NumberPatternType extends AbstractRootTypeDescriptor implements IPossibleValues{ - //should we ever decide to validate the patterns, extend EnumerationType - final private static String[] PATTERNS = { - "0.00", //$NON-NLS-1$ - "#,##0", //$NON-NLS-1$ - "#,##0.00", //$NON-NLS-1$ - "#,##0;(#,##0)", //$NON-NLS-1$ - "#,##0.00;(#,##0.00)", //$NON-NLS-1$ - "0.##E0", //$NON-NLS-1$ - "0%", //$NON-NLS-1$ - "0.00%" //$NON-NLS-1$ - }; - - public List getPossibleValues() { - List ret = new ArrayList(); - for (int i=0;i<PATTERNS.length;i++){ - ret.add(new PossibleValue(PATTERNS[i])); - } - return ret; - } - - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/NumberType.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/NumberType.java deleted file mode 100644 index 4ee78b9c8..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/NumberType.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.taglibprocessing.attributevalues; - -import org.eclipse.jst.jsf.metadataprocessors.features.IValidValues; - -/** - * Abstract meta-data processing type representing a numeric attribute value runtime type - * - * <p><b>Provisional API - subject to change</b></p> - * @author Gerry Kessler - Oracle - */ -public abstract class NumberType extends EnumerationType{ - /** - * flag indicating max value metadata was found - */ - protected boolean maxFound = false; - /** - * flag indicating min value metadata was found - */ - protected boolean minFound = false; - - /** - * Validation message when value has exceeded maximum - */ - protected String EXCEEDS_MAX = Messages.NumberType_max_val; - /** - * Validation message when value is less than minimum - */ - protected String LESS_THAN_MIN = Messages.NumberType_min_val; - - /** - * @return maximum value from property named IValidValues.VALID_VALUES_MAX_PROP_NAME - */ - protected String getValidMaximumValue(){ - return getTraitValueAsString(IValidValues.VALID_VALUES_MAX_PROP_NAME); - } - - /** - * @return minimum value from property named IValidValues.VALID_VALUES_MIN_PROP_NAME - */ - protected String getValidMinimumValue(){ - return getTraitValueAsString(IValidValues.VALID_VALUES_MIN_PROP_NAME); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/ObjectType.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/ObjectType.java deleted file mode 100644 index 07120d4a6..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/ObjectType.java +++ /dev/null @@ -1,22 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.taglibprocessing.attributevalues; - -/** - * Abstract meta-data processing type representing an Object attribute value runtime type - * - * <p><b>Provisional API - subject to change</b></p> - * @author Gerry Kessler - Oracle - */ -public abstract class ObjectType extends DirectBindingType { - // TODO: ???? -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/PathType.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/PathType.java deleted file mode 100644 index 5f4f31142..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/PathType.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.taglibprocessing.attributevalues; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.jsf.context.resolver.structureddocument.IStructuredDocumentContextResolverFactory; -import org.eclipse.jst.jsf.context.resolver.structureddocument.IWorkspaceContextResolver; -import org.eclipse.jst.jsf.metadataprocessors.AbstractRootTypeDescriptor; -import org.eclipse.jst.jsf.metadataprocessors.features.IValidationMessage; - -/** - * EXPERIMENTAL - may change or dissappear - * - */ -public abstract class PathType extends AbstractRootTypeDescriptor { - - private IProject _project = null; - private final List<IValidationMessage> _validationMsgs = new ArrayList<IValidationMessage>(1); - - /** - * Constructor - */ - public PathType() { - super(); - } - - /** - * @return IProject - */ - protected IProject getProject() { - if( _project == null ) - { - final IWorkspaceContextResolver wkspaceResolver = - IStructuredDocumentContextResolverFactory.INSTANCE.getWorkspaceContextResolver( getStructuredDocumentContext() ); - _project = wkspaceResolver.getProject(); - } - - return _project; - } - - /** - * @return list of {@link IValidationMessage} - */ - public List<IValidationMessage> getValidationMessages() { - return _validationMsgs; - } - -}
\ No newline at end of file diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/RelativePathType.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/RelativePathType.java deleted file mode 100644 index 82dd38068..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/RelativePathType.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.taglibprocessing.attributevalues; - -import java.net.MalformedURLException; -import java.net.URL; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.Path; -import org.eclipse.jst.jsf.metadataprocessors.IMetaDataEnabledFeature; -import org.eclipse.jst.jsf.metadataprocessors.features.IValidValues; -import org.eclipse.jst.jsf.metadataprocessors.features.ValidationMessage; - -/** - * Path is relative to project - * <b>EXPERIMENTAL</b> - may change or dissappear - * - */ -public class RelativePathType extends PathType implements - IMetaDataEnabledFeature, IValidValues{ - - public boolean isValidValue(String value) { - //is this a relative path, or absolute url? - try { - new URL(value); - //not much else we what to do for now - return true; - } catch (MalformedURLException e) { - //is this a valid path relative to the - IProject project = getProject(); - IFile file= project.getFile(new Path(value)); - if (! file.exists()) - getValidationMessages().add(new ValidationMessage( value+Messages.RelativePathType_0)); - - return getValidationMessages().size() == 0; - } - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/ResourceBundleType.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/ResourceBundleType.java deleted file mode 100644 index 65f2fc973..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/ResourceBundleType.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Vadim Dmitriev - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.taglibprocessing.attributevalues; - -import java.text.MessageFormat; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IStorage; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jst.jsf.core.internal.tld.LoadBundleUtil; -import org.eclipse.jst.jsf.metadataprocessors.features.IValidValues; -import org.eclipse.jst.jsf.metadataprocessors.features.ValidationMessage; - -/** - * Meta-data processing type representing a path to resource bundle on classpath - * Patch by Vadim Dmitriev. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=203307. - * - * <p><b>Provisional API - subject to change</b></p> - * - * @author Vadim Dmitriev - * - * - */ -public class ResourceBundleType extends PathType implements IValidValues -{ - public boolean isValidValue( String value ) - { - try - { - IProject project = getProject(); - IStorage bundle = LoadBundleUtil.getLoadBundleResource( project , value ); - if( bundle != null ) - { - return true; - } - } - catch (CoreException e) - { - //error message is generated later - } - - final String message = - MessageFormat.format(Messages.Bundle_not_found_rb, value); - getValidationMessages().add(new ValidationMessage(message, "", IStatus.ERROR)); //$NON-NLS-1$ - return false; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/ScriptType.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/ScriptType.java deleted file mode 100644 index 9df83d411..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/ScriptType.java +++ /dev/null @@ -1,22 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.taglibprocessing.attributevalues; - -import org.eclipse.jst.jsf.metadataprocessors.AbstractRootTypeDescriptor; - -/** - * Represents script type - * <p><b>Provisional API - subject to change</b></p> - */ -public class ScriptType extends AbstractRootTypeDescriptor { -// -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/StringType.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/StringType.java deleted file mode 100644 index fa8f3af84..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/StringType.java +++ /dev/null @@ -1,83 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.taglibprocessing.attributevalues; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jst.jsf.metadataprocessors.features.IDefaultValue; -import org.eclipse.jst.jsf.metadataprocessors.features.IPossibleValues; -import org.eclipse.jst.jsf.metadataprocessors.features.IValidValues; -import org.eclipse.jst.jsf.metadataprocessors.features.PossibleValue; - -/** - * Meta-data processing type representing a String attribute value runtime type - * that implements IPossibleValues, IValidValues and IDefaultValues - * - * <p><b>Provisional API - subject to change</b></p> - * @author Gerry Kessler - Oracle - */ -public class StringType extends EnumerationType implements IValidValues, - IPossibleValues, IDefaultValue { - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.taglibprocessing.attributevalues.EnumerationType#getReturnType() - */ - protected String getReturnType(){ return "java.lang.String";} //$NON-NLS-1$ - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.metadataprocessors.features.IValidValues#isValidValue(java.lang.String) - */ - public boolean isValidValue(String value) { - List vals = getMDValidValues(); - if (vals.isEmpty()) - return true; - - //if the value is empty but there is a default value, consider it valid - if (getDefaultValue() != null && (value == null || value.trim().equals(""))) //$NON-NLS-1$ - return true; - - if(! vals.contains(value)){ - addNewValidationMessage(Messages.StringType_invalid_value); - } - return getValidationMessages().isEmpty(); - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.metadataprocessors.features.IPossibleValues#getPossibleValues() - */ - public List getPossibleValues() { - List pvs = getMDPossibleValues(); - if (pvs.isEmpty()) - return EMPTY_LIST; - - List pdvs = getMDPossibleValuesForDisplay(); - - //if there are no display vals or the meta-data list sizes are different, use the values list for display also - if (pdvs.isEmpty() || pvs.size() != pdvs.size()) - pdvs = pvs; - - ImageDescriptor icon = getImage(); - - String defaultValue = getDefaultValue(); - List ret = new ArrayList(pvs.size()); - for(int i=0;i<pvs.size();i++){ - PossibleValue pv = new PossibleValue((String)pvs.get(i), (String)pdvs.get(i)); - pv.setIcon(icon); - pv.setIsDefault(((String)pvs.get(i)).equals(defaultValue)); - ret.add(pv); - } - return ret; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/TimeZoneType.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/TimeZoneType.java deleted file mode 100644 index 56af13dc8..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/TimeZoneType.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle Corporation., and others - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.taglibprocessing.attributevalues; - -import java.util.ArrayList; -import java.util.List; -import java.util.TimeZone; - -import org.eclipse.jst.jsf.metadataprocessors.features.IPossibleValues; -import org.eclipse.jst.jsf.metadataprocessors.features.IValidValues; -import org.eclipse.jst.jsf.metadataprocessors.features.PossibleValue; - -/** - * Meta-data processing type representing a TimeZone Code type. - * - * <p><b>Provisional API - subject to change</b></p> - * - */ - -public class TimeZoneType extends EnumerationType implements IPossibleValues, IValidValues{ - private String[] _timezones; - - @Override - protected String getReturnType() { - return "java.lang.String"; //$NON-NLS-1$ - } - - public List getPossibleValues() { - List ret = new ArrayList(); - for(int i=0;i<getTimeZones().length;i++){ - PossibleValue pv = new PossibleValue(_timezones[i], _timezones[i]); - ret.add(pv); - } - return ret; - } - - private String[] getTimeZones() { - if (_timezones == null) - _timezones = TimeZone.getAvailableIDs(); - return _timezones; - } - - public boolean isValidValue(String value) { - for(int i=0;i<getTimeZones().length;i++){ - if (getTimeZones()[i].equals(value)) - return true; - } - return false; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/URIType.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/URIType.java deleted file mode 100644 index 889959be5..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/URIType.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.taglibprocessing.attributevalues; - -import org.eclipse.jst.jsf.metadataprocessors.IMetaDataEnabledFeature; - -/** - * URI Type: attribute values are Uniform Resource Identifiers (URIs), as defined in RFC 2396. - * URI attribute values may include full URIs such as http://www.foobar.com/ as well as relative URIs such as foo.html and ../foo/. - * EXPERIMENTAL - will change or dissappear - */ -public class URIType extends PathType implements IMetaDataEnabledFeature{ - //TODO: add validation... refactor or WebPath, RelativePath, etc. - - /** - * Constructor - */ - public URIType() { - // - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/ValueBindingType.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/ValueBindingType.java deleted file mode 100644 index ef9c45535..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/ValueBindingType.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.taglibprocessing.attributevalues; - -import org.eclipse.jdt.core.Signature; -import org.eclipse.jst.jsf.common.internal.types.CompositeType; -import org.eclipse.jst.jsf.common.internal.types.IAssignable; -import org.eclipse.jst.jsf.metadataprocessors.features.ELIsNotValidException; -import org.eclipse.jst.jsf.metadataprocessors.features.IValidELValues; - -/** - * Meta-data processing type representing a Value Bound attribute value runtime type - * that implements IValidValues - * - * <p><b>Provisional API - subject to change</b></p> - * @author Gerry Kessler - Oracle - */ -public class ValueBindingType extends ExpressionBindingType implements IValidELValues{ - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.metadataprocessors.features.IValidELValues#getExpectedRuntimeType() - */ - public CompositeType getExpectedRuntimeType() throws ELIsNotValidException { - String returnType = getReturnType(); - if (returnType == null) - return null; - - String methodSig = Signature.createTypeSignature(returnType, true); - return new CompositeType(methodSig, getAssignmentValue()); - } - - /** - * @return {@link IAssignable}.LHS or {@link IAssignable}.RHS - */ - protected int getAssignmentValue(){ - return (getIsSetValueRequired() ? IAssignable.ASSIGNMENT_TYPE_LHS : 0) | IAssignable.ASSIGNMENT_TYPE_RHS; - - } - - /** - * @return is runtime setter required? - */ - protected boolean getIsSetValueRequired(){ - String value = getTraitValueAsString(RUNTIME_SETTER_REQUIRED); - if (value == null || value.trim().length() == 0) - return false; - else if (value.trim().equals("true")) //$NON-NLS-1$ - return true; - else - return false; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/ValueType.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/ValueType.java deleted file mode 100644 index 7c03faef2..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/ValueType.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.taglibprocessing.attributevalues; - - -import org.eclipse.jst.jsf.metadataprocessors.features.IValidELValues; -import org.eclipse.jst.jsf.metadataprocessors.features.IValidValues; - -/** - * Meta-data processing type representing a "value" attribute - * that implements IValidValues and IValidELValues - * - * <p><b>Provisional API - subject to change</b></p> - * @author Gerry Kessler - Oracle - */ -public class ValueType extends ValueBindingType implements IValidValues, IValidELValues { - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.metadataprocessors.features.IValidValues#isValidValue(java.lang.String) - */ - public boolean isValidValue(String value){ - //value can be a string or a value binding expression - return true; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/WebPathType.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/WebPathType.java deleted file mode 100644 index c1c8c0dc4..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/WebPathType.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.taglibprocessing.attributevalues; - -import java.net.MalformedURLException; -import java.net.URL; - -import org.eclipse.core.runtime.Path; -import org.eclipse.jst.jsf.metadataprocessors.IMetaDataEnabledFeature; -import org.eclipse.jst.jsf.metadataprocessors.features.IValidValues; -import org.eclipse.jst.jsf.metadataprocessors.features.ValidationMessage; -import org.eclipse.wst.common.componentcore.ComponentCore; -import org.eclipse.wst.common.componentcore.resources.IVirtualContainer; -import org.eclipse.wst.common.componentcore.resources.IVirtualFile; - -/** - * Path relative to web root - * <b>EXPERIMENTAL</b> - may change or dissappear - * - */ -public class WebPathType extends PathType implements - IMetaDataEnabledFeature, IValidValues{ - - public boolean isValidValue(String value) { - //is this a relative path, or absolute url? - try { - URL url = new URL(value); - //if file protocol, see if it is valid? Otherwise assume ok. - if (url.getProtocol().equals("file")){ //$NON-NLS-1$ - validateFileRelativeToWebRoot(url.getPath()); - } - } catch (MalformedURLException e) { - //is this a valid path relative to the - validateFileRelativeToWebRoot(value); - } - return getValidationMessages().size() == 0; - - } - - private void validateFileRelativeToWebRoot(String value) { - IVirtualContainer webRoot = getWebRoot(); - if (! webRoot.exists()){ - getValidationMessages().add(new ValidationMessage( Messages.WebPathType_1)); - } - else { - IVirtualFile file = webRoot.getFile(new Path(value)); - if (!file.exists()) { - //was this a valid file path string, or bogus url? - getValidationMessages().add(new ValidationMessage(Messages.WebPathType_2)); - } - //we could also validate the expected file-extensions from meta data - } - - } - - private IVirtualContainer getWebRoot() - { - IVirtualContainer webRoot = - ComponentCore.createComponent(getProject()).getRootFolder(); - - return webRoot; - } -}
\ No newline at end of file diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/messages.properties b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/messages.properties deleted file mode 100644 index 22ddc87e5..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/messages.properties +++ /dev/null @@ -1,278 +0,0 @@ -############################################################################### -# Copyright (c) 2001, 2007 Oracle Corporation and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle Corporation - initial API and implementation -############################################################################### -IntegerType_invalid_integer=Value is not a valid integer. -IntegerType_invalid_member=Value is not a member of the provided valid values -LengthType_invalid_integer=Value is not a valid positive integer or positive integer percentage. -LongType_invalid_long=Value is not a valid Long. -LongType_invalid_member=Value is not a member of the provided valid values -BooleanType_invalid_values=Valid values are "true" or "false" -CurrencyCodeType_invalid=Invalid currency code -CurrencyCodeType_10=Aruba, Guilders (also called Florins) -CurrencyCodeType_100=Malta, Liri -CurrencyCodeType_101=Mauritius, Rupees -CurrencyCodeType_102=Maldives (Maldive Islands), Rufiyaa -CurrencyCodeType_103=Malawi, Kwachas -CurrencyCodeType_104=Mexico, Pesos -CurrencyCodeType_105=Malaysia, Ringgits -CurrencyCodeType_106=Mozambique, Meticais -CurrencyCodeType_107=Namibia, Dollars -CurrencyCodeType_108=Nigeria, Nairas -CurrencyCodeType_109=Nicaragua, Cordobas -CurrencyCodeType_11=Azerbaijan, Manats -CurrencyCodeType_110=Norway, Krone -CurrencyCodeType_111=Nepal, Nepal Rupees -CurrencyCodeType_112=New Zealand, Dollars -CurrencyCodeType_113=Oman, Rials -CurrencyCodeType_114=Panama, Balboa -CurrencyCodeType_115=Peru, Nuevos Soles -CurrencyCodeType_116=Papua New Guinea, Kina -CurrencyCodeType_117=Philippines, Pesos -CurrencyCodeType_118=Pakistan, Rupees -CurrencyCodeType_119=Poland, Zlotych -CurrencyCodeType_12=Bosnia and Herzegovina, Convertible Marka -CurrencyCodeType_120=Paraguay, Guarani -CurrencyCodeType_121=Qatar, Rials -CurrencyCodeType_122=Romania, Lei -CurrencyCodeType_123=Russia, Rubles -CurrencyCodeType_124=Rwanda, Rwanda Francs -CurrencyCodeType_125=Saudi Arabia, Riyals -CurrencyCodeType_126=Solomon Islands, Dollars -CurrencyCodeType_127=Seychelles, Rupees -CurrencyCodeType_128=Sudan, Dinars -CurrencyCodeType_129=Sweden, Kronor -CurrencyCodeType_13=Barbados, Dollars -CurrencyCodeType_130=Singapore, Dollars -CurrencyCodeType_131=Saint Helena, Pounds -CurrencyCodeType_132=Slovenia, Tolars -CurrencyCodeType_133=Slovakia, Koruny -CurrencyCodeType_134=Sierra Leone, Leones -CurrencyCodeType_135=Somalia, Shillings -CurrencyCodeType_136=Seborga, Luigini -CurrencyCodeType_137=Suriname, Dollars -CurrencyCodeType_138=Principe and S\u00E3o Tome, Dobras -CurrencyCodeType_139=El Salvador, Colones -CurrencyCodeType_14=Bangladesh, Taka -CurrencyCodeType_140=Syria, Pounds -CurrencyCodeType_141=Swaziland, Emalangeni -CurrencyCodeType_142=Thailand, Baht -CurrencyCodeType_143=Tajikistan, Somoni -CurrencyCodeType_144=Turkmenistan, Manats -CurrencyCodeType_145=Tunisia, Dinars -CurrencyCodeType_146=Tonga, Pa'anga -CurrencyCodeType_147=Turkey, Liras [being phased out] -CurrencyCodeType_148=Turkey, New Lira -CurrencyCodeType_149=Trinidad and Tobago, Dollars -CurrencyCodeType_15=Bulgaria, Leva -CurrencyCodeType_150=Tuvalu, Tuvalu Dollars -CurrencyCodeType_151=Taiwan, New Dollars -CurrencyCodeType_152=Tanzania, Shillings -CurrencyCodeType_153=Ukraine, Hryvnia -CurrencyCodeType_154=Uganda, Shillings -CurrencyCodeType_155=United States of America, Dollars -CurrencyCodeType_156=Uruguay, Pesos -CurrencyCodeType_157=Uzbekistan, Sums -CurrencyCodeType_158=Venezuela, Bolivares -CurrencyCodeType_159=Viet Nam, Dong -CurrencyCodeType_16=Bahrain, Dinars -CurrencyCodeType_160=Vanuatu, Vatu -CurrencyCodeType_161=Samoa, Tala -CurrencyCodeType_162=Communaut\u00E9 Financi\u00E8re Africaine BEAC Franc , Francs -CurrencyCodeType_163=Silver, Ounces -CurrencyCodeType_164=Gold, Ounces -CurrencyCodeType_165=East Caribbean Dollars -CurrencyCodeType_166=International Monetary Fund (IMF) Special Drawing Rights -CurrencyCodeType_167=Communaut\u00E9 Financi\u00E8re Africaine BCEAO, Francs -CurrencyCodeType_168=Palladium Ounces -CurrencyCodeType_169=Comptoirs Francais du Pacifique, Francs -CurrencyCodeType_17=Burundi, Francs -CurrencyCodeType_170=Platinum, Ounces -CurrencyCodeType_171=Yemen, Rials -CurrencyCodeType_172=South Africa, Rand -CurrencyCodeType_173=Zambia, Kwacha -CurrencyCodeType_174=Zimbabwe, Zimbabwe Dollars -CurrencyCodeType_18=Bermuda, Dollars -CurrencyCodeType_19=Brunei Darussalam, Dollars -CharacterType_0=Single unicode character is required -CurrencyCodeType_2=United Arab Emirates, Dirhams -CurrencyCodeType_20=Bolivia, Bolivianos -CurrencyCodeType_21=Brazil, Brazil Real -CurrencyCodeType_22=Bahamas, Dollars -CurrencyCodeType_23=Bhutan, Ngultrum -CurrencyCodeType_24=Botswana, Pulas -CurrencyCodeType_25=Belarus, Rubles -CurrencyCodeType_26=Belize, Dollars -CurrencyCodeType_27=Canada, Dollars -CurrencyCodeType_28=Congo/Kinshasa, Congolese Francs -CurrencyCodeType_29=Switzerland, Francs -CurrencyCodeType_3=Afghanistan, Afghanis -CurrencyCodeType_30=Chile, Pesos -CurrencyCodeType_31=China, Yuan Renminbi -CurrencyCodeType_32=Colombia, Pesos -CurrencyCodeType_33=Costa Rica, Colones -CurrencyCodeType_34=Serbia, Dinars -CurrencyCodeType_35=Cuba, Pesos -CurrencyCodeType_36=Cape Verde, Escudos -CurrencyCodeType_37=Cyprus, Pounds -CurrencyCodeType_38=Czech Republic, Koruny -CurrencyCodeType_39=Djibouti, Francs -CurrencyCodeType_4=Albania, Leke -CurrencyCodeType_40=Denmark, Kroner -CurrencyCodeType_41=Dominican Republic, Pesos -CurrencyCodeType_42=Algeria, Algeria Dinars -CurrencyCodeType_43=Estonia, Krooni -CurrencyCodeType_44=Egypt, Pounds -CurrencyCodeType_45=Eritrea, Nakfa -CurrencyCodeType_46=Ethiopia, Birr -CurrencyCodeType_47=Euro Member Countries, Euro -CurrencyCodeType_48=Fiji, Dollars -CurrencyCodeType_49=Falkland Islands (Malvinas), Pounds -CurrencyCodeType_5=Armenia, Drams -CurrencyCodeType_50=United Kingdom, Pounds -CurrencyCodeType_51=Georgia, Lari -CurrencyCodeType_52=Guernsey, Pounds -CurrencyCodeType_53=Ghana, Cedis -CurrencyCodeType_54=Gibraltar, Pounds -CurrencyCodeType_55=Gambia, Dalasi -CurrencyCodeType_56=Guinea, Francs -CurrencyCodeType_57=Guatemala, Quetzales -CurrencyCodeType_58=Guyana, Dollars -CurrencyCodeType_59=Hong Kong, Dollars -CurrencyCodeType_6=Netherlands Antilles, Guilders (also called Florins) -CurrencyCodeType_60=Honduras, Lempiras -CurrencyCodeType_61=Croatia, Kuna -CurrencyCodeType_62=Haiti, Gourdes -CurrencyCodeType_63=Hungary, Forint -CurrencyCodeType_64=Indonesia, Rupiahs -CurrencyCodeType_65=Israel, New Shekels -CurrencyCodeType_66=Isle of Man, Pounds -CurrencyCodeType_67=India, Rupees -CurrencyCodeType_68=Iraq, Dinars -CurrencyCodeType_69=Iran, Rials -CurrencyCodeType_7=Angola, Kwanza -CurrencyCodeType_70=Iceland, Kronur -CurrencyCodeType_71=Jersey, Pounds -CurrencyCodeType_72=Jamaica, Dollars -CurrencyCodeType_73=Jordan, Dinars -CurrencyCodeType_74=Japan, Yen -CurrencyCodeType_75=Kenya, Shillings -CurrencyCodeType_76=Kyrgyzstan, Soms -CurrencyCodeType_77=Cambodia, Riels -CurrencyCodeType_78=Comoros, Francs -CurrencyCodeType_79=Korea (North), Won -CurrencyCodeType_8=Argentina, Pesos -CurrencyCodeType_80=Korea (South), Won -CurrencyCodeType_81=Kuwait, Dinars -CurrencyCodeType_82=Cayman Islands, Dollars -CurrencyCodeType_83=Kazakhstan, Tenge -CurrencyCodeType_84=Laos, Kips -CurrencyCodeType_85=Lebanon, Pounds -CurrencyCodeType_86=Sri Lanka, Rupees -CurrencyCodeType_87=Liberia, Dollars -CurrencyCodeType_88=Lesotho, Maloti -CurrencyCodeType_89=Lithuania, Litai -CurrencyCodeType_9=Australia, Dollars -LanguageCodeType_0=ar Arabic (needs subtype) -LanguageCodeType_1=Invalid language code -LanguageCodeType_101=tr Turkish -LanguageCodeType_103=ts Tsonga -LanguageCodeType_105=uk Ukrainian -LanguageCodeType_107=ur Urdu -LanguageCodeType_109=vi Vietnamese -LanguageCodeType_11=br Breton -LanguageCodeType_111=xh Xhosa -LanguageCodeType_113=yi Yiddish -LanguageCodeType_115=zh Chinese (needs subtype) -LanguageCodeType_117=zu Zulu -LanguageCodeType_118=af Afrikaans -LanguageCodeType_13=ca Catalan -LanguageCodeType_15=cs Czech -LanguageCodeType_17=da Danish -LanguageCodeType_19=de German (Standard) -LanguageCodeType_21=el Greek -LanguageCodeType_23=en English -LanguageCodeType_25=es Spanish (Spain) -LanguageCodeType_27=et Estonian -LanguageCodeType_29=eu Basque -LanguageCodeType_31=fa Farsi -LanguageCodeType_33=fi Finnish -LanguageCodeType_35=fo Faeroese -LanguageCodeType_37=fr French (Standard) -LanguageCodeType_39=gd Gaelic (Scotland) -LanguageCodeType_41=he Hebrew -LanguageCodeType_43=hi Hindi -LanguageCodeType_45=hr Croatian -LanguageCodeType_47=hu Hungarian -LanguageCodeType_49=id Indonesian -LanguageCodeType_51=is Icelandic -LanguageCodeType_53=it Italian (Standard) -LanguageCodeType_55=ja Japanese -LanguageCodeType_57=ko Korean -LanguageCodeType_59=lt Lithuanian -LanguageCodeType_61=lv Latvian -LanguageCodeType_63=mk Macedonian -LanguageCodeType_65=ms Malaysian -LanguageCodeType_67=mt Maltese -LanguageCodeType_69=nl Dutch (Standard) -LanguageCodeType_7=be Belarusian -LanguageCodeType_71=no Norwegian (Bokmal/Nynorsk) -LanguageCodeType_73=pl Polish -LanguageCodeType_75=pt Portuguese (Standard) -LanguageCodeType_77=rm Rhaeto-Romanic -LanguageCodeType_79=ro Romanian -LanguageCodeType_81=ru Russian -LanguageCodeType_83=sk Slovak -LanguageCodeType_85=sl Slovenian -LanguageCodeType_87=sq Albanian -LanguageCodeType_89=sr Serbian (Cyrillic/Latin) -LanguageCodeType_9=bg Bulgarian -LinkType_16=Link type value must not be empty -LocaleType_1=Invalid locale value -WebPathType_1=Web root path not found -WebPathType_2=Invalid value -LanguageCodeType_91=sv Swedish -LanguageCodeType_93=sx Sutu -LanguageCodeType_95=sz Sami (Lappish) -LanguageCodeType_97=th Thai -LanguageCodeType_99=tn Setswana -CurrencyCodeType_90=Latvia, Lati -CurrencyCodeType_91=Libya, Dinars -CurrencyCodeType_92=Morocco, Dirhams -CurrencyCodeType_93=Moldova, Lei -CurrencyCodeType_94=Madagascar, Ariary -CurrencyCodeType_95=Macedonia, Denars -CurrencyCodeType_96=Myanmar (Burma), Kyats -CurrencyCodeType_97=Mongolia, Tugriks -CurrencyCodeType_98=Macau, Patacas -CurrencyCodeType_99=Mauritania, Ouguiyas -NumberType_max_val=Value exceeds maximum of {0} -NumberType_min_val=Value is less than minimum of {0} -RelativePathType_0=: path not found -DoubleType_invalid_double=Value is not a valid double. -DoubleType_invalid_member=Value is not a member of the provided valid values -StringType_invalid_value=Value is not valid. -FacesConfigIdentifierType_invalid_validator_id= {0} validator id is is not registered. -FacesConfigIdentifierType_invalid_converter_id= {0} converter id is not registered. -FacesConfigConverterIDFeatures_converterid_empty=Converter ids must not be null or empty. -FacesConfigValidatorIDFeatures_validatorid_empty=Validator ids must not be null or empty. -ValueType_invalid_value_without_setter=This 'value' attribute value must be a value binding expression that can take a value assignment. -ValueType_invalid_value=The 'value' attribute must be a non-zero length String or be a value binding expression. -ComponentBindingType_invalid_value=The 'binding' attribute requires an EL value binding reference to a UIComponent. -ComponentIDType_invalid_as_el='id' attributes must be Strings. Consider using 'binding' attribute instead. -ComponentIDType_invalid_value=The 'id' attribute must be a non-zero length String and be uniquely defined on the page. -ActionType_invalid_value=The action value does not match a navigation case outcome. -ActionType_invalid_empty_value=The action attribute must be a non-zero length String or a method binding matching a navigation case outcome. -ActionType_navcase_display={0}: goto {1} -ContentType_MIME_not_empty=Content (MIME) type must not be empty -MethodBindingType_invalid_value=MethodBinding attribute values must be EL expressions. -JavaClassType_invalid_type=Value for type attribute must be valid Java class and not empty. -JavaClassType_not_found=Java type not found, not instantiable, or does implement correct interfaces or extend correct superclass. -ColorType_invalid_color=Value is not a valid color. -Bundle_not_found_rb=Resource bundle {0} cannot be found on classpath diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/package-info.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/package-info.java deleted file mode 100644 index 468104b7d..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ - -/** - * Provides type system for tag attribute values so that the - * org.eclipse.jst.jsf.core.metadataprocessors.features can be applied. - * - * A type is added using the org.eclipse.jst.jsf.core.AttributeValueRuntimeTypes extension point. - * These types are referenced using the design-time metadata framework in org.eclipse.jst.jsf.common - * The org.eclipse.jst.jsf.metadataprocessors.features provides the interesting tooling services based upon the type. - * - * <p><b>Provisional API - subject to change</b></p> - */ -package org.eclipse.jst.jsf.taglibprocessing.attributevalues; diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/AbstractXMLViewValidationStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/AbstractXMLViewValidationStrategy.java deleted file mode 100644 index 5be7a8ad9..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/AbstractXMLViewValidationStrategy.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.validation.internal; - -import org.eclipse.jst.jsf.common.dom.DOMAdapter; -import org.eclipse.jst.jsf.common.internal.policy.IIdentifiable; - -/** - * A strategy that validates JSF views that are defined in XML format. - * - * @author cbateman - * - */ -public abstract class AbstractXMLViewValidationStrategy implements IIdentifiable<String> -{ - private final String _id; - private final String _displayName; - - /** - * @param id - * @param displayName - */ - public AbstractXMLViewValidationStrategy(final String id, final String displayName) - { - _id = id; - _displayName = displayName; - } - - /** - * @param domAdapter - */ - public abstract void validate(final DOMAdapter domAdapter); - - /** - * @param domAdapter - * @return true if this validator is interested in validating this node - */ - public abstract boolean isInteresting(final DOMAdapter domAdapter); - - public final String getId() - { - return _id; - } - - public String getDisplayName() - { - return _displayName; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/ELValidationPreferences.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/ELValidationPreferences.java deleted file mode 100644 index b96918d5e..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/ELValidationPreferences.java +++ /dev/null @@ -1,767 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.validation.internal; - -import org.eclipse.core.runtime.preferences.IScopeContext; -import org.eclipse.emf.common.util.Diagnostic; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jst.jsf.core.internal.IJSFPreferenceModel; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory; - -/** - * Model object for EL validation preferences - * - * @author cbateman - */ -public class ELValidationPreferences implements IJSFPreferenceModel -{ - private final static String KEY_ENABLE_BUILD_VALIDATION = - "org.eclipse.jst.jsf.ui.ValidateJSFELBuild"; - private final static boolean DEFAULT_ENABLE_BUILD_VALIDATION = true; - - private final static String KEY_ENABLE_INCREMENTAL_VALIDATION = - "org.eclipse.jst.jsf.ui.ValidateJSFELIncremental"; - private final static boolean DEFAULT_ENABLE_INCREMENTAL_VALIDATION = false; - - - private boolean _enableBuildValidation; - private boolean _enableIncrementalValidation; - private int[] _severities; - - /** - * Loads the object from the preference store provided - * - * @param prefStore - */ - public void load(IPreferenceStore prefStore) - { - if (!prefStore.contains(KEY_ENABLE_BUILD_VALIDATION)) - { - prefStore.setDefault(KEY_ENABLE_BUILD_VALIDATION, DEFAULT_ENABLE_BUILD_VALIDATION); - } - _enableBuildValidation = - prefStore.getBoolean(KEY_ENABLE_BUILD_VALIDATION); - - if (!prefStore.contains(KEY_ENABLE_INCREMENTAL_VALIDATION)) - { - prefStore.setDefault(KEY_ENABLE_INCREMENTAL_VALIDATION, DEFAULT_ENABLE_INCREMENTAL_VALIDATION); - } - _enableIncrementalValidation = - prefStore.getBoolean(KEY_ENABLE_INCREMENTAL_VALIDATION); - - loadSeverities(prefStore); - } - - private void loadSeverities(final IPreferenceStore prefStore) - { - final int severities[] = getSeverities(); - - for (int i = 0; i < DiagnosticFactory.NUM_IDS; i++) - { - final String key = getKeyById(i); - - if (!prefStore.contains(key)) - { - final int diagSeverity = getDefaultSeverity(i); - final Severity severity = mapDiagToSeverity(diagSeverity); - - prefStore.setDefault(key, severity.toString()); - } - final String storedSeverity = prefStore.getString(key); - severities[i] = mapSeverityToDiag(storedSeverity); - } - } - /** - * Copies the object into the preference store but DOES NOT SAVE IT - * - * @param prefStore - */ - public void commit(IPreferenceStore prefStore) - { - prefStore.setValue(KEY_ENABLE_BUILD_VALIDATION, _enableBuildValidation); - prefStore.setValue(KEY_ENABLE_INCREMENTAL_VALIDATION, - _enableIncrementalValidation); - commitSeverities(prefStore); - } - - private void commitSeverities(final IPreferenceStore prefStore) - { - final int severities[] = getSeverities(); - - for (int i = 0; i < severities.length; i++) - { - final String key = getKeyById(i); - prefStore.setValue(key - , mapDiagToSeverity(severities[i]).toString()); - } - } - - /** - * Reverts the model to it's defaults. Does not commit to pref store. - */ - public void setDefaults() - { - setEnableBuildValidation(DEFAULT_ENABLE_BUILD_VALIDATION); - setEnableIncrementalValidation(DEFAULT_ENABLE_INCREMENTAL_VALIDATION); - setProblemSeverityDefaults(); - } - - private void setProblemSeverityDefaults() - { - final int[] severities = getSeverities(); - - for (int i = 0; i < DiagnosticFactory.NUM_IDS; i++) - { - severities[i] = getDefaultSeverity(i); - } - } - - public Object getValueByKey(IScopeContext context, String key) { - // ignore context for now; will be used when we have project overrides - if (KEY_ENABLE_BUILD_VALIDATION.equals(key)) - { - return Boolean.valueOf(isEnableBuildValidation()); - } - else if (KEY_ENABLE_INCREMENTAL_VALIDATION.equals(key)) - { - return Boolean.valueOf(isEnableIncrementalValidation()); - } - else - { - try - { - final Severity severity = getSeverity(key); - return severity.toString(); - } - catch (IllegalArgumentException e) - { - // getIdByKey will throw this exception if key is not a valid - // severity key. Ignore the exception here and fall-through - } - } - - return null; // not found - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.core.internal.IJSFPreferenceModel#getStoredValueByKey(org.eclipse.core.runtime.preferences.IScopeContext, java.lang.String) - */ - public Object getStoredValueByKey(IScopeContext context, String key) { - // ignore context for now; will be used when we have project overrides - if (KEY_ENABLE_BUILD_VALIDATION.equals(key)) - { - return Boolean.valueOf(context.getNode("org.eclipse.jst.jsf.ui").getBoolean(key, true)); - } - else if (KEY_ENABLE_INCREMENTAL_VALIDATION.equals(key)) - { - return Boolean.valueOf(context.getNode("org.eclipse.jst.jsf.ui").getBoolean(key, false)); - } - else - { - try - { - return context.getNode("org.eclipse.jst.jsf.core").get(key, mapDiagToSeverity(getDefaultSeverity(getIdByKey(key))).toString()); - } - catch (IllegalArgumentException e) - { - // getIdByKey will throw this exception if key is not a valid - // severity key. Ignore the exception here and fall-through - } - } - - return null; // not found - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.core.internal.IJSFPreferenceModel#setValueByKey(org.eclipse.core.runtime.preferences.IScopeContext, java.lang.String, java.lang.Object) - */ - public Object setValueByKey(IScopeContext context, String key, Object value) - { - // ignore context for now; will be used when we have project overrides - if (KEY_ENABLE_BUILD_VALIDATION.equals(key)) - { - boolean oldValue = isEnableBuildValidation(); - boolean newValue = ((Boolean)value).booleanValue(); - setEnableBuildValidation(newValue); - return Boolean.valueOf(oldValue); - } - else if (KEY_ENABLE_INCREMENTAL_VALIDATION.equals(key)) - { - boolean oldValue = isEnableIncrementalValidation(); - boolean newValue = ((Boolean)value).booleanValue(); - setEnableIncrementalValidation(newValue); - return Boolean.valueOf(oldValue); - } - else - { - final Severity oldValue = getSeverity(key); - setSeverity(key, (Severity)value); - return oldValue; - } - } - - /** - * @return the build validation enablement - */ - public boolean isEnableBuildValidation() - { - return _enableBuildValidation; - } - - /** - * @return the incremental validation enablement - */ - public boolean isEnableIncrementalValidation() - { - return _enableIncrementalValidation; - } - - /** - * @param enableBuildValidation - */ - public void setEnableBuildValidation(boolean enableBuildValidation) { - _enableBuildValidation = enableBuildValidation; - } - - /** - * @param enableIncrementalValidation - */ - public void setEnableIncrementalValidation(boolean enableIncrementalValidation) { - _enableIncrementalValidation = enableIncrementalValidation; - } - - /** - * @param key - * @return the severity - */ - public Severity getSeverity(final String key) - { - final int severityDiag = _severities[getIdByKey(key)]; - final Severity severity = mapDiagToSeverity(severityDiag); - return severity; - } - - /** - * @param key - * @param severity - */ - public void setSeverity(final String key, final Severity severity) - { - final int newSeverityDiag = mapSeverityToDiag(severity.toString()); - final int diagId = getIdByKey(key); - _severities[diagId] = newSeverityDiag; - } - - /** - * @param diagnosticId - * @return the severity as configured for diagnosticId. The value - * is relative to the Diagnostic class severity scheme - */ - public final int getDiagnosticSeverity(final int diagnosticId) - { - return getSeverities()[diagnosticId]; - } - - private int[] getSeverities() - { - if (_severities == null) - { - _severities = new int[DiagnosticFactory.NUM_IDS]; - } - - return _severities; - } - - /** - * @param diagSeverity - * @return a Severity preference value for a diagnostic severity - */ - public static Severity mapDiagToSeverity(int diagSeverity) - { - switch(diagSeverity) - { - case Diagnostic.ERROR: - return Severity.ERROR; - case Diagnostic.WARNING: - return Severity.WARNING; - default: - return Severity.IGNORE; - } - } - - /** - * @param severity - * @return a Diagnostic severity level for a severity pref string - */ - public static int mapSeverityToDiag(String severity) - { - if ("error".equals(severity)) - { - return Diagnostic.ERROR; - } - else if ("warning".equals(severity)) - { - return Diagnostic.WARNING; - } - else if ("ignore".equals(severity)) - { - return Diagnostic.OK; - } - else - { - throw new IllegalArgumentException("Invalid enum name: "+severity); - } - } - - /** - * @param diagnosticId - * @return the default severity of a diagnostic - */ - public static int getDefaultSeverity(final int diagnosticId) - { - switch(diagnosticId) - { - case DiagnosticFactory.BINARY_OP_BOTH_OPERANDS_NULL_ID: - return Diagnostic.WARNING; - case DiagnosticFactory.BINARY_OP_POSSIBLE_DIVISION_BY_ZERO_ID: - return Diagnostic.ERROR; - case DiagnosticFactory.BINARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION_ID: - return Diagnostic.ERROR; - case DiagnosticFactory.BINARY_OP_CONSTANT_EXPRESSION_ALWAYS_EVAL_SAME_ID: - return Diagnostic.WARNING; - case DiagnosticFactory.BINARY_OP_EQUALITY_COMP_WITH_NULL_ALWAYS_EVAL_SAME_ID: - return Diagnostic.WARNING; - case DiagnosticFactory.BINARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN_ID: - return Diagnostic.ERROR; - case DiagnosticFactory.BINARY_OP_FIRST_ARGUMENT_SHORT_CIRCUITS_ID: - return Diagnostic.WARNING; - case DiagnosticFactory.BINARY_OP_SECOND_ARGUMENT_ALWAYS_EVAL_SAME_ID: - return Diagnostic.WARNING; - case DiagnosticFactory.BINARY_OP_NO_AVAILABLE_TYPE_COERCION_ID: - return Diagnostic.ERROR; - case DiagnosticFactory.BINARY_OP_COULD_NOT_COERCE_LITERALS_TO_NUMBERS_ID: - return Diagnostic.ERROR; - case DiagnosticFactory.UNARY_OP_CONSTANT_EXPRESSION_EVAL_SAME_ID: - return Diagnostic.WARNING; - case DiagnosticFactory.UNARY_OP_EMPTY_ALWAYS_FALSE_ON_TYPE_ID: - return Diagnostic.WARNING; - case DiagnosticFactory.UNARY_OP_MINUS_ON_NULL_ALWAYS_ZERO_ID: - return Diagnostic.WARNING; - case DiagnosticFactory.UNARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION_ID: - return Diagnostic.ERROR; - case DiagnosticFactory.UNARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN_ID: - return Diagnostic.ERROR; - case DiagnosticFactory.TERNARY_OP_CHOICE_IS_ALWAYS_SAME_ID: - return Diagnostic.WARNING; - case DiagnosticFactory.TERNARY_OP_CANNOT_COERCE_CHOICE_TO_BOOLEAN_ID: - return Diagnostic.ERROR; - case DiagnosticFactory.UNARY_OP_STRING_CONVERSION_NOT_GUARANTEED_ID: - return Diagnostic.WARNING; - case DiagnosticFactory.CANNOT_APPLY_OPERATOR_TO_METHOD_BINDING_ID: - return Diagnostic.ERROR; - case DiagnosticFactory.MEMBER_NOT_FOUND_ID: - return Diagnostic.WARNING; - case DiagnosticFactory.VARIABLE_NOT_FOUND_ID: - return Diagnostic.WARNING; - case DiagnosticFactory.MISSING_CLOSING_EXPR_BRACKET_ID: - return Diagnostic.ERROR; - case DiagnosticFactory.GENERAL_SYNTAX_ERROR_ID: - return Diagnostic.WARNING; - case DiagnosticFactory.EMPTY_EL_EXPRESSION_ID: - return Diagnostic.WARNING; - case DiagnosticFactory.BINARY_OP_DOT_WITH_VALUEB_NULL_ID: - return Diagnostic.WARNING; - case DiagnosticFactory.BINARY_OP_DOT_WITH_DOTTED_KEY_SHOULD_USE_ARRAY_ID: - return Diagnostic.WARNING; - case DiagnosticFactory.POSSIBLE_ARRAY_INDEX_OUT_OF_BOUNDS_ID: - return Diagnostic.WARNING; - case DiagnosticFactory.BINARY_COMPARISON_WITH_ENUM_ALWAYS_SAME_ID: - return Diagnostic.WARNING; - case DiagnosticFactory.BINARY_OP_COMPARISON_OF_ENUMS_INCOMPATIBLE_ID: - return Diagnostic.ERROR; - case DiagnosticFactory.MEMBER_IS_INTERMEDIATE_ID: - return Diagnostic.WARNING; - default: - throw new IllegalArgumentException("Diagnostic Id: "+ diagnosticId +" is out of range"); - } - } - - /** - * @param diagnosticId - * @return the preference key for the corresponding diagnosticId in the el DiagnosticFactory - */ - public static String getKeyById(final int diagnosticId) - { - switch(diagnosticId) - { - case DiagnosticFactory.BINARY_OP_BOTH_OPERANDS_NULL_ID: - return BINARY_OP_BOTH_OPERANDS_NULL; - case DiagnosticFactory.BINARY_OP_POSSIBLE_DIVISION_BY_ZERO_ID: - return BINARY_OP_POSSIBLE_DIVISION_BY_ZERO; - case DiagnosticFactory.BINARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION_ID: - return BINARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION; - case DiagnosticFactory.BINARY_OP_CONSTANT_EXPRESSION_ALWAYS_EVAL_SAME_ID: - return BINARY_OP_CONSTANT_EXPRESSION_ALWAYS_EVAL_SAME; - case DiagnosticFactory.BINARY_OP_EQUALITY_COMP_WITH_NULL_ALWAYS_EVAL_SAME_ID: - return BINARY_OP_EQUALITY_COMP_WITH_NULL_ALWAYS_EVAL_SAME; - case DiagnosticFactory.BINARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN_ID: - return BINARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN; - case DiagnosticFactory.BINARY_OP_FIRST_ARGUMENT_SHORT_CIRCUITS_ID: - return BINARY_OP_FIRST_ARGUMENT_SHORT_CIRCUITS; - case DiagnosticFactory.BINARY_OP_SECOND_ARGUMENT_ALWAYS_EVAL_SAME_ID: - return BINARY_OP_SECOND_ARGUMENT_ALWAYS_EVAL_SAME; - case DiagnosticFactory.BINARY_OP_NO_AVAILABLE_TYPE_COERCION_ID: - return BINARY_OP_NO_AVAILABLE_TYPE_COERCION; - case DiagnosticFactory.BINARY_OP_COULD_NOT_COERCE_LITERALS_TO_NUMBERS_ID: - return BINARY_OP_COULD_NOT_COERCE_LITERALS_TO_NUMBERS; - case DiagnosticFactory.UNARY_OP_CONSTANT_EXPRESSION_EVAL_SAME_ID: - return UNARY_OP_CONSTANT_EXPRESSION_EVAL_SAME; - case DiagnosticFactory.UNARY_OP_EMPTY_ALWAYS_FALSE_ON_TYPE_ID: - return UNARY_OP_EMPTY_ALWAYS_FALSE_ON_TYPE; - case DiagnosticFactory.UNARY_OP_MINUS_ON_NULL_ALWAYS_ZERO_ID: - return UNARY_OP_MINUS_ON_NULL_ALWAYS_ZERO; - case DiagnosticFactory.UNARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION_ID: - return UNARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION; - case DiagnosticFactory.UNARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN_ID: - return UNARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN; - case DiagnosticFactory.TERNARY_OP_CHOICE_IS_ALWAYS_SAME_ID: - return TERNARY_OP_CHOICE_IS_ALWAYS_SAME; - case DiagnosticFactory.TERNARY_OP_CANNOT_COERCE_CHOICE_TO_BOOLEAN_ID: - return TERNARY_OP_CANNOT_COERCE_CHOICE_TO_BOOLEAN; - case DiagnosticFactory.UNARY_OP_STRING_CONVERSION_NOT_GUARANTEED_ID: - return UNARY_OP_STRING_CONVERSION_NOT_GUARANTEED; - case DiagnosticFactory.CANNOT_APPLY_OPERATOR_TO_METHOD_BINDING_ID: - return CANNOT_APPLY_OPERATOR_TO_METHOD_BINDING; - case DiagnosticFactory.MEMBER_NOT_FOUND_ID: - return MEMBER_NOT_FOUND; - case DiagnosticFactory.VARIABLE_NOT_FOUND_ID: - return VARIABLE_NOT_FOUND; - case DiagnosticFactory.MISSING_CLOSING_EXPR_BRACKET_ID: - return MISSING_CLOSING_EXPR_BRACKET; - case DiagnosticFactory.GENERAL_SYNTAX_ERROR_ID: - return GENERAL_SYNTAX_ERROR; - case DiagnosticFactory.EMPTY_EL_EXPRESSION_ID: - return EMPTY_EL_EXPRESSION; - case DiagnosticFactory.BINARY_OP_DOT_WITH_VALUEB_NULL_ID: - return BINARY_OP_DOT_WITH_VALUEB_NULL; - case DiagnosticFactory.BINARY_OP_DOT_WITH_DOTTED_KEY_SHOULD_USE_ARRAY_ID: - return BINARY_OP_DOT_WITH_DOTTED_KEY_SHOULD_USE_ARRAY; - case DiagnosticFactory.POSSIBLE_ARRAY_INDEX_OUT_OF_BOUNDS_ID: - return POSSIBLE_ARRAY_INDEX_OUT_OF_BOUNDS; - case DiagnosticFactory.BINARY_COMPARISON_WITH_ENUM_ALWAYS_SAME_ID: - return BINARY_COMPARISON_WITH_ENUM_ALWAYS_SAME; - case DiagnosticFactory.BINARY_OP_COMPARISON_OF_ENUMS_INCOMPATIBLE_ID: - return BINARY_OP_COMPARISON_OF_ENUMS_INCOMPATIBLE; - case DiagnosticFactory.MEMBER_IS_INTERMEDIATE_ID: - return MEMBER_IS_INTERMEDIATE; - default: - throw new IllegalArgumentException("Diagnostic Id: "+ diagnosticId +" is out of range"); - } - } - - /** - * @param key - * @return the preference key for the corresponding diagnosticId in the el DiagnosticFactory - */ - public static int getIdByKey(final String key) - { - if (BINARY_OP_BOTH_OPERANDS_NULL.equals(key)) - { - return DiagnosticFactory.BINARY_OP_BOTH_OPERANDS_NULL_ID; - } - else if (BINARY_OP_POSSIBLE_DIVISION_BY_ZERO.equals(key)) - { - return DiagnosticFactory.BINARY_OP_POSSIBLE_DIVISION_BY_ZERO_ID; - } - else if (BINARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION.equals(key)) - { - return DiagnosticFactory.BINARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION_ID; - } - else if (BINARY_OP_CONSTANT_EXPRESSION_ALWAYS_EVAL_SAME.equals(key)) - { - return DiagnosticFactory.BINARY_OP_CONSTANT_EXPRESSION_ALWAYS_EVAL_SAME_ID; - } - else if (BINARY_OP_EQUALITY_COMP_WITH_NULL_ALWAYS_EVAL_SAME.equals(key)) - { - return DiagnosticFactory.BINARY_OP_EQUALITY_COMP_WITH_NULL_ALWAYS_EVAL_SAME_ID; - } - else if (BINARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN.equals(key)) - { - return DiagnosticFactory.BINARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN_ID; - } - else if (BINARY_OP_FIRST_ARGUMENT_SHORT_CIRCUITS.equals(key)) - { - return DiagnosticFactory.BINARY_OP_FIRST_ARGUMENT_SHORT_CIRCUITS_ID; - } - else if (BINARY_OP_SECOND_ARGUMENT_ALWAYS_EVAL_SAME.equals(key)) - { - return DiagnosticFactory.BINARY_OP_SECOND_ARGUMENT_ALWAYS_EVAL_SAME_ID; - } - else if (BINARY_OP_NO_AVAILABLE_TYPE_COERCION.equals(key)) - { - return DiagnosticFactory.BINARY_OP_NO_AVAILABLE_TYPE_COERCION_ID; - } - else if (BINARY_OP_COULD_NOT_COERCE_LITERALS_TO_NUMBERS.equals(key)) - { - return DiagnosticFactory.BINARY_OP_COULD_NOT_COERCE_LITERALS_TO_NUMBERS_ID; - } - else if (UNARY_OP_CONSTANT_EXPRESSION_EVAL_SAME.equals(key)) - { - return DiagnosticFactory.UNARY_OP_CONSTANT_EXPRESSION_EVAL_SAME_ID; - } - else if (UNARY_OP_EMPTY_ALWAYS_FALSE_ON_TYPE.equals(key)) - { - return DiagnosticFactory.UNARY_OP_EMPTY_ALWAYS_FALSE_ON_TYPE_ID; - } - else if (UNARY_OP_MINUS_ON_NULL_ALWAYS_ZERO.equals(key)) - { - return DiagnosticFactory.UNARY_OP_MINUS_ON_NULL_ALWAYS_ZERO_ID; - } - else if (UNARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION.equals(key)) - { - return DiagnosticFactory.UNARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION_ID; - } - else if (UNARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN.equals(key)) - { - return DiagnosticFactory.UNARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN_ID; - } - else if (TERNARY_OP_CHOICE_IS_ALWAYS_SAME.equals(key)) - { - return DiagnosticFactory.TERNARY_OP_CHOICE_IS_ALWAYS_SAME_ID; - } - else if (TERNARY_OP_CANNOT_COERCE_CHOICE_TO_BOOLEAN.equals(key)) - { - return DiagnosticFactory.TERNARY_OP_CANNOT_COERCE_CHOICE_TO_BOOLEAN_ID; - } - else if (UNARY_OP_STRING_CONVERSION_NOT_GUARANTEED.equals(key)) - { - return DiagnosticFactory.UNARY_OP_STRING_CONVERSION_NOT_GUARANTEED_ID; - } - else if (CANNOT_APPLY_OPERATOR_TO_METHOD_BINDING.equals(key)) - { - return DiagnosticFactory.CANNOT_APPLY_OPERATOR_TO_METHOD_BINDING_ID; - } - else if (MEMBER_NOT_FOUND.equals(key)) - { - return DiagnosticFactory.MEMBER_NOT_FOUND_ID; - } - else if (VARIABLE_NOT_FOUND.equals(key)) - { - return DiagnosticFactory.VARIABLE_NOT_FOUND_ID; - } - else if (MISSING_CLOSING_EXPR_BRACKET.equals(key)) - { - return DiagnosticFactory.MISSING_CLOSING_EXPR_BRACKET_ID; - } - else if (GENERAL_SYNTAX_ERROR.equals(key)) - { - return DiagnosticFactory.GENERAL_SYNTAX_ERROR_ID; - } - else if (EMPTY_EL_EXPRESSION.equals(key)) - { - return DiagnosticFactory.EMPTY_EL_EXPRESSION_ID; - } - else if (BINARY_OP_DOT_WITH_VALUEB_NULL.equals(key)) - { - return DiagnosticFactory.BINARY_OP_DOT_WITH_VALUEB_NULL_ID; - } - else if (BINARY_OP_DOT_WITH_DOTTED_KEY_SHOULD_USE_ARRAY.equals(key)) - { - return DiagnosticFactory.BINARY_OP_DOT_WITH_DOTTED_KEY_SHOULD_USE_ARRAY_ID; - } - else if (POSSIBLE_ARRAY_INDEX_OUT_OF_BOUNDS.equals(key)) - { - return DiagnosticFactory.POSSIBLE_ARRAY_INDEX_OUT_OF_BOUNDS_ID; - } - else if (BINARY_COMPARISON_WITH_ENUM_ALWAYS_SAME.equals(key)) - { - return DiagnosticFactory.BINARY_COMPARISON_WITH_ENUM_ALWAYS_SAME_ID; - } - else if (BINARY_OP_COMPARISON_OF_ENUMS_INCOMPATIBLE.equals(key)) - { - return DiagnosticFactory.BINARY_OP_COMPARISON_OF_ENUMS_INCOMPATIBLE_ID; - } - else if (MEMBER_IS_INTERMEDIATE.equals(key)) - { - return DiagnosticFactory.MEMBER_IS_INTERMEDIATE_ID; - } - else - { - throw new IllegalArgumentException("Severity Key: "+ key); - } - } - - /** - * e.g. createQualifiedKeyName("foo") -> org.eclipse.jst.jsf.core.foo - * @param baseName - * @return a plugin qualified key given the baseName - * - */ - private static String createQualifiedKeyName(final String baseName) - { - return JSFCorePlugin.PLUGIN_ID + "." + baseName; - } - - /** - * preference key. Match to DiagnosticFactory constants - */ - public final static String BINARY_OP_BOTH_OPERANDS_NULL = - createQualifiedKeyName("BINARY_OP_BOTH_OPERANDS_NULL"); - /** - * preference key. Match to DiagnosticFactory constants - */ - public final static String BINARY_OP_POSSIBLE_DIVISION_BY_ZERO = - createQualifiedKeyName("BINARY_OP_POSSIBLE_DIVISION_BY_ZERO"); - /** - * preference key. Match to DiagnosticFactory constants - */ - public final static String BINARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION = - createQualifiedKeyName("BINARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION"); - /** - * preference key. Match to DiagnosticFactory constants - */ - public final static String BINARY_OP_CONSTANT_EXPRESSION_ALWAYS_EVAL_SAME = - createQualifiedKeyName("BINARY_OP_CONSTANT_EXPRESSION_ALWAYS_EVAL_SAME"); - /** - * preference key. Match to DiagnosticFactory constants - */ - public final static String BINARY_OP_EQUALITY_COMP_WITH_NULL_ALWAYS_EVAL_SAME = - createQualifiedKeyName("BINARY_OP_EQUALITY_COMP_WITH_NULL_ALWAYS_EVAL_SAME"); - /** - * preference key. Match to DiagnosticFactory constants - */ - public final static String BINARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN = - createQualifiedKeyName("BINARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN"); - /** - * preference key. Match to DiagnosticFactory constants - */ - public final static String BINARY_OP_FIRST_ARGUMENT_SHORT_CIRCUITS = - createQualifiedKeyName("BINARY_OP_FIRST_ARGUMENT_SHORT_CIRCUITS"); - /** - * preference key. Match to DiagnosticFactory constants - */ - public final static String BINARY_OP_SECOND_ARGUMENT_ALWAYS_EVAL_SAME = - createQualifiedKeyName("BINARY_OP_SECOND_ARGUMENT_ALWAYS_EVAL_SAME"); - /** - * preference key. Match to DiagnosticFactory constants - */ - public final static String BINARY_OP_NO_AVAILABLE_TYPE_COERCION = - createQualifiedKeyName("BINARY_OP_NO_AVAILABLE_TYPE_COERCION"); - /** - * preference key. Match to DiagnosticFactory constants - */ - public final static String BINARY_OP_COULD_NOT_COERCE_LITERALS_TO_NUMBERS = - createQualifiedKeyName("BINARY_OP_COULD_NOT_COERCE_LITERALS_TO_NUMBERS"); - /** - * preference key. Match to DiagnosticFactory constants - */ - public final static String UNARY_OP_CONSTANT_EXPRESSION_EVAL_SAME = - createQualifiedKeyName("UNARY_OP_CONSTANT_EXPRESSION_EVAL_SAME"); - /** - * preference key. Match to DiagnosticFactory constants - */ - public final static String UNARY_OP_EMPTY_ALWAYS_FALSE_ON_TYPE = - createQualifiedKeyName("UNARY_OP_EMPTY_ALWAYS_FALSE_ON_TYPE"); - /** - * preference key. Match to DiagnosticFactory constants - */ - public final static String UNARY_OP_MINUS_ON_NULL_ALWAYS_ZERO = - createQualifiedKeyName("UNARY_OP_MINUS_ON_NULL_ALWAYS_ZERO"); - /** - * preference key. Match to DiagnosticFactory constants - */ - public final static String UNARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION = - createQualifiedKeyName("UNARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION"); - /** - * preference key. Match to DiagnosticFactory constants - */ - public final static String UNARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN = - createQualifiedKeyName("UNARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN"); - /** - * preference key. Match to DiagnosticFactory constants - */ - public final static String TERNARY_OP_CHOICE_IS_ALWAYS_SAME = - createQualifiedKeyName("TERNARY_OP_CHOICE_IS_ALWAYS_SAME"); - /** - * preference key. Match to DiagnosticFactory constants - */ - public final static String TERNARY_OP_CANNOT_COERCE_CHOICE_TO_BOOLEAN = - createQualifiedKeyName("TERNARY_OP_CANNOT_COERCE_CHOICE_TO_BOOLEAN"); - /** - * preference key. Match to DiagnosticFactory constants - */ - public final static String UNARY_OP_STRING_CONVERSION_NOT_GUARANTEED = - createQualifiedKeyName("UNARY_OP_STRING_CONVERSION_NOT_GUARANTEED"); - /** - * preference key. Match to DiagnosticFactory constants - */ - public final static String CANNOT_APPLY_OPERATOR_TO_METHOD_BINDING = - createQualifiedKeyName("CANNOT_APPLY_OPERATOR_TO_METHOD_BINDING"); - /** - * preference key. Match to DiagnosticFactory constants - */ - public final static String MEMBER_NOT_FOUND = - createQualifiedKeyName("MEMBER_NOT_FOUND"); - /** - * preference key. Match to DiagnosticFactory constants - */ - public final static String VARIABLE_NOT_FOUND = - createQualifiedKeyName("VARIABLE_NOT_FOUND"); - /** - * preference key. Match to DiagnosticFactory constants - */ - public final static String MISSING_CLOSING_EXPR_BRACKET = - createQualifiedKeyName("MISSING_CLOSING_EXPR_BRACKET"); - /** - * preference key. Match to DiagnosticFactory constants - */ - public final static String GENERAL_SYNTAX_ERROR = - createQualifiedKeyName("GENERAL_SYNTAX_ERROR"); - /** - * preference key. Match to DiagnosticFactory constants - */ - public final static String EMPTY_EL_EXPRESSION = - createQualifiedKeyName("EMPTY_EL_EXPRESSION"); - /** - * preference key. Match to DiagnosticFactory constants - */ - public final static String BINARY_OP_DOT_WITH_VALUEB_NULL = - createQualifiedKeyName("BINARY_OP_DOT_WITH_VALUEB_NULL"); - /** - * preference key. Match to DiagnosticFactory constants - */ - public final static String BINARY_OP_DOT_WITH_DOTTED_KEY_SHOULD_USE_ARRAY = - createQualifiedKeyName("BINARY_OP_DOT_WITH_DOTTED_KEY_SHOULD_USE_ARRAY"); - /** - * preference key. Match to DiagnosticFactory constants - */ - public final static String POSSIBLE_ARRAY_INDEX_OUT_OF_BOUNDS = - createQualifiedKeyName("POSSIBLE_ARRAY_INDEX_OUT_OF_BOUNDS"); - /** - * preference key. Match to DiagnosticFactory constants - */ - public final static String BINARY_COMPARISON_WITH_ENUM_ALWAYS_SAME = - createQualifiedKeyName("BINARY_COMPARISON_WITH_ENUM_ALWAYS_SAME"); - /** - * preference key. Match to DiagnosticFactory constants - */ - public final static String BINARY_OP_COMPARISON_OF_ENUMS_INCOMPATIBLE = - createQualifiedKeyName("BINARY_OP_COMPARISON_OF_ENUMS_INCOMPATIBLE"); - - /** - * preference key. Match to DiagnosticFactory constants - */ - public final static String MEMBER_IS_INTERMEDIATE = - createQualifiedKeyName("MEMBER_IS_INTERMEDIATE"); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/IJSFViewValidator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/IJSFViewValidator.java deleted file mode 100644 index a51c91433..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/IJSFViewValidator.java +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.validation.internal; - -import org.eclipse.core.resources.IFile; -import org.eclipse.emf.common.util.Diagnostic; -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -/** - * A validator for JSF views - * - * @author cbateman - * - */ -public interface IJSFViewValidator -{ - /** - * Validate the entire view file and report an problems using reporter. - * - * @param viewFile - * @param reporter - */ - void validateView(final IFile viewFile, final IValidationReporter reporter); - - /** - * Validate only those regions specified in the viewFile and report problems - * using reporter. - * - * @param viewFile - * @param regions - * @param reporter - */ - void validateView(final IFile viewFile, - final IStructuredDocumentRegion[] regions, - final IValidationReporter reporter); - - /** - * Implemented by callers of the view validator to receive notification - * of problems discovered during validation. - * - */ - public interface IValidationReporter - { - /** - * @param problem - * @param start - * @param length - */ - void report(final Diagnostic problem, final int start, final int length); - - /** - * @param message - * @deprecated internally by design - */ - void report(final IMessage message); - } - - /** - * An empty adapter implementation of IValidationReporter. All methods - * are noops. - * - * @author cbateman - * - */ - public class ReporterAdapter implements IValidationReporter - { - - public void report(Diagnostic problem, int start, int length) - { - // do nothing - } - - public void report(IMessage message) - { - // do nothing - } - - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/IJSPSemanticValidatorTest.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/IJSPSemanticValidatorTest.java deleted file mode 100644 index 454d31d9f..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/IJSPSemanticValidatorTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.validation.internal; - -import org.eclipse.core.resources.IFile; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext; -import org.eclipse.jst.jsf.core.internal.region.Region2ElementAdapter; -import org.eclipse.jst.jsf.validation.internal.IJSFViewValidator.IValidationReporter; - -/** - * Exposes certain private members for use by testing. - * - * NOT intended for use by production code. - * - * @author cbateman - * - */ -public interface IJSPSemanticValidatorTest -{ - /** - * Proxies the internal call to validate the containment of a particular - * tag. - * - * @param adapter - * @param node - * @param uri - * @param tagName - * @param reporter - * @param file - * @param context - */ - void validateContainment(Region2ElementAdapter adapter, IValidationReporter reporter, IFile file, IStructuredDocumentContext context); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/JSFTypeComparatorPreferences.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/JSFTypeComparatorPreferences.java deleted file mode 100644 index 9a6a537cd..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/JSFTypeComparatorPreferences.java +++ /dev/null @@ -1,339 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.validation.internal; - -import org.eclipse.core.runtime.preferences.IScopeContext; -import org.eclipse.emf.common.util.Diagnostic; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jst.jsf.common.internal.types.TypeComparatorDiagnosticFactory; -import org.eclipse.jst.jsf.common.internal.types.TypeComparatorPreferences; -import org.eclipse.jst.jsf.core.internal.IJSFPreferenceModel; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; - -/** - * Type comparator preferences for JSF. - * - * @author cbateman - * - */ -public class JSFTypeComparatorPreferences extends TypeComparatorPreferences - implements IJSFPreferenceModel -{ - - private int[] _severities; - - /** - * Loads the object from the preference store provided - * - * @param prefStore - */ - public void load(IPreferenceStore prefStore) - { - loadSeverities(prefStore); - } - - private void loadSeverities(final IPreferenceStore prefStore) - { - final int severities[] = getSeverities(); - - for (int i = 0; i < TypeComparatorDiagnosticFactory.NUM_IDS; i++) - { - final String key = getKeyById(i); - - if (!prefStore.contains(key)) - { - final int diagSeverity = getDefaultSeverity(i); - final Severity severity = mapDiagToSeverity(diagSeverity); - - prefStore.setDefault(key, severity.toString()); - } - final String storedSeverity = prefStore.getString(key); - severities[i] = mapSeverityToDiag(storedSeverity); - } - } - - /** - * Copies the object into the preference store but DOES NOT SAVE IT - * - * @param prefStore - */ - public void commit(IPreferenceStore prefStore) - { - commitSeverities(prefStore); - } - - private void commitSeverities(final IPreferenceStore prefStore) - { - final int severities[] = getSeverities(); - - for (int i = 0; i < severities.length; i++) - { - final String key = getKeyById(i); - prefStore - .setValue(key, mapDiagToSeverity(severities[i]).toString()); - } - } - - /** - * Reverts the model to it's defaults. Does not commit to pref store. - */ - public void setDefaults() - { - setProblemSeverityDefaults(); - } - - private void setProblemSeverityDefaults() - { - final int[] severities = getSeverities(); - - for (int i = 0; i < TypeComparatorDiagnosticFactory.NUM_IDS; i++) - { - severities[i] = getDefaultSeverity(i); - } - } - - public Object getValueByKey(IScopeContext context, String key) - { - try - { - final Severity severity = getSeverity(key); - return severity.toString(); - } - catch (IllegalArgumentException e) - { - // getIdByKey will throw this exception if key is not a valid - // severity key. Ignore the exception here and fall-through - } - - return null; // not found - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.jsf.core.internal.IJSFPreferenceModel#getStoredValueByKey(org.eclipse.core.runtime.preferences.IScopeContext, - * java.lang.String) - */ - public Object getStoredValueByKey(IScopeContext context, String key) - { - try - { - return context.getNode("org.eclipse.jst.jsf.core").get( - key, - mapDiagToSeverity(getDefaultSeverity(getIdByKey(key))) - .toString()); - } - catch (IllegalArgumentException e) - { - // getIdByKey will throw this exception if key is not a valid - // severity key. Ignore the exception here and fall-through - } - - return null; // not found - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.jsf.core.internal.IJSFPreferenceModel#setValueByKey(org.eclipse.core.runtime.preferences.IScopeContext, - * java.lang.String, java.lang.Object) - */ - public Object setValueByKey(IScopeContext context, String key, Object value) - { - final Severity oldValue = getSeverity(key); - setSeverity(key, (Severity) value); - return oldValue; - } - - /** - * @param key - * @return the severity - */ - public Severity getSeverity(final String key) - { - final int severityDiag = _severities[getIdByKey(key)]; - final Severity severity = mapDiagToSeverity(severityDiag); - return severity; - } - - /** - * @param key - * @param severity - */ - public void setSeverity(final String key, final Severity severity) - { - final int newSeverityDiag = mapSeverityToDiag(severity.toString()); - final int diagId = getIdByKey(key); - _severities[diagId] = newSeverityDiag; - } - - /** - * @param diagnosticId - * @return the severity as configured for diagnosticId. The value is - * relative to the Diagnostic class severity scheme - */ - public final int getDiagnosticSeverity(final int diagnosticId) - { - return getSeverities()[diagnosticId]; - } - - private int[] getSeverities() - { - if (_severities == null) - { - _severities = new int[TypeComparatorDiagnosticFactory.NUM_IDS]; - } - - return _severities; - } - - /** - * @param diagSeverity - * @return a Severity preference value for a diagnostic severity - */ - public static Severity mapDiagToSeverity(int diagSeverity) - { - switch (diagSeverity) - { - case Diagnostic.ERROR: - return Severity.ERROR; - case Diagnostic.WARNING: - return Severity.WARNING; - default: - return Severity.IGNORE; - } - } - - /** - * @param severity - * @return a Diagnostic severity level for a severity pref string - */ - public static int mapSeverityToDiag(String severity) - { - if ("error".equals(severity)) - { - return Diagnostic.ERROR; - } - else if ("warning".equals(severity)) - { - return Diagnostic.WARNING; - } - else if ("ignore".equals(severity)) - { - return Diagnostic.OK; - } - else - { - throw new IllegalArgumentException("Invalid enum name: " + severity); - } - } - - /** - * @param diagnosticId - * @return the preference key for the corresponding diagnosticId in the el - * DiagnosticFactory - */ - public static String getKeyById(final int diagnosticId) - { - switch (diagnosticId) - { - case TypeComparatorDiagnosticFactory.INCOMPATIBLE_METHOD_TYPES_ID: - return INCOMPATIBLE_METHOD_TYPES; - case TypeComparatorDiagnosticFactory.INCOMPATIBLE_TYPES_ID: - return INCOMPATIBLE_TYPES; - case TypeComparatorDiagnosticFactory.METHOD_EXPRESSION_EXPECTED_ID: - return METHOD_EXPRESSION_EXPECTED; - case TypeComparatorDiagnosticFactory.PROPERTY_NOT_READABLE_ID: - return PROPERTY_NOT_READABLE; - case TypeComparatorDiagnosticFactory.PROPERTY_NOT_WRITABLE_ID: - return PROPERTY_NOT_WRITABLE; - case TypeComparatorDiagnosticFactory.VALUE_EXPRESSION_EXPECTED_ID: - return VALUE_EXPRESSION_EXPECTED; - default: - throw new IllegalArgumentException("Diagnostic Id: " - + diagnosticId + " is out of range"); - } - } - - /** - * @param key - * @return the preference key for the corresponding diagnosticId in the el - * DiagnosticFactory - */ - public static int getIdByKey(final String key) - { - if (INCOMPATIBLE_METHOD_TYPES.equals(key)) - { - return TypeComparatorDiagnosticFactory.INCOMPATIBLE_METHOD_TYPES_ID; - } - else if (INCOMPATIBLE_TYPES.equals(key)) - { - return TypeComparatorDiagnosticFactory.INCOMPATIBLE_TYPES_ID; - } - else if (METHOD_EXPRESSION_EXPECTED.equals(key)) - { - return TypeComparatorDiagnosticFactory.METHOD_EXPRESSION_EXPECTED_ID; - } - else if (PROPERTY_NOT_READABLE.equals(key)) - { - return TypeComparatorDiagnosticFactory.PROPERTY_NOT_READABLE_ID; - } - else if (PROPERTY_NOT_WRITABLE.equals(key)) - { - return TypeComparatorDiagnosticFactory.PROPERTY_NOT_WRITABLE_ID; - } - else if (VALUE_EXPRESSION_EXPECTED.equals(key)) - { - return TypeComparatorDiagnosticFactory.VALUE_EXPRESSION_EXPECTED_ID; - } - else - { - throw new IllegalArgumentException("Severity Key: " + key); - } - } - - /** - * e.g. createQualifiedKeyName("foo") -> org.eclipse.jst.jsf.core.foo - * - * @param baseName - * @return a plugin qualified key given the baseName - * - */ - private static String createQualifiedKeyName(final String baseName) - { - return JSFCorePlugin.PLUGIN_ID + "." + baseName; - } - - /** - * preference key. Match to DiagnosticFactory constants - */ - public final static String INCOMPATIBLE_METHOD_TYPES = createQualifiedKeyName("INCOMPATIBLE_METHOD_TYPES"); - /** - * preference key. Match to DiagnosticFactory constants - */ - public final static String INCOMPATIBLE_TYPES = createQualifiedKeyName("INCOMPATIBLE_TYPES"); - /** - * preference key. Match to DiagnosticFactory constants - */ - public final static String METHOD_EXPRESSION_EXPECTED = createQualifiedKeyName("METHOD_EXPRESSION_EXPECTED"); - /** - * preference key. Match to DiagnosticFactory constants - */ - public final static String PROPERTY_NOT_READABLE = createQualifiedKeyName("PROPERTY_NOT_READABLE"); - /** - * preference key. Match to DiagnosticFactory constants - */ - public final static String PROPERTY_NOT_WRITABLE = createQualifiedKeyName("PROPERTY_NOT_WRITABLE"); - /** - * preference key. Match to DiagnosticFactory constants - */ - public final static String VALUE_EXPRESSION_EXPECTED = createQualifiedKeyName("VALUE_EXPRESSION_EXPECTED"); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/JSFValidationContext.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/JSFValidationContext.java deleted file mode 100644 index 0901a0e74..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/JSFValidationContext.java +++ /dev/null @@ -1,136 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.validation.internal; - -import org.eclipse.core.resources.IFile; -import org.eclipse.jst.jsf.designtime.internal.view.IDTViewHandler; -import org.eclipse.jst.jsf.designtime.resolver.IStructuredDocumentSymbolResolverFactory; -import org.eclipse.jst.jsf.validation.internal.IJSFViewValidator.IValidationReporter; -import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory; - -/** - * A context object used pass JSF validation information around. Not related to - * the model context framework. - * - * @author cbateman - * - */ -public final class JSFValidationContext -{ - private final ValidationPreferences _prefs; - private final boolean _isIncremental; - private final IDTViewHandler _adapter; - private final DiagnosticFactory _diagnosticFactory; - private final IFile _file; - private final IValidationReporter _reporter; - private final IStructuredDocumentSymbolResolverFactory _symbolResolverFactory; - - /** - * @param isIncremental -- - * true if this is "as-you-type" validation, false if this is - * "Build" or "Run Validation" validation * - * @param prefs - * @param adapter - * @param diagnosticFactory - * @param file - * @param reporter - * @param symbolResolveFactory - */ - public JSFValidationContext(final boolean isIncremental, - final ValidationPreferences prefs, - final IDTViewHandler adapter, - final DiagnosticFactory diagnosticFactory, final IFile file, - final IValidationReporter reporter, final IStructuredDocumentSymbolResolverFactory symbolResolveFactory) - { - super(); - _isIncremental = isIncremental; - _prefs = prefs; - _adapter = adapter; - _diagnosticFactory = diagnosticFactory; - _file = file; - _reporter = reporter; - _symbolResolverFactory = symbolResolveFactory; - } - - /** - * - * @return true if user preferences say we should do EL validation, false - * otherwise - */ - public final boolean shouldValidateEL() - { - _prefs.load(); - if (_isIncremental) - { - return _prefs.getElPrefs().isEnableIncrementalValidation(); - } - - return _prefs.getElPrefs().isEnableBuildValidation(); - } - - - /** - * @return the view handler - */ - public IDTViewHandler getAdapter() - { - return _adapter; - } - - /** - * @return the validator - */ -// public IValidator getValidator() -// { -// return _validator; -// } - - /** - * @return validation preferences - */ - public ValidationPreferences getPrefs() - { - return _prefs; - } - - /** - * @return diagnostic factory - */ - public DiagnosticFactory getDiagnosticFactory() - { - return _diagnosticFactory; - } - - /** - * @return the file - */ - public IFile getFile() - { - return _file; - } - - /** - * @return the reporter. - */ - public IValidationReporter getReporter() - { - return _reporter; - } - - /** - * @return the symbol resolver factory for this context - */ - public IStructuredDocumentSymbolResolverFactory getSymbolResolverFactory() - { - return _symbolResolverFactory; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/JSFValidatorFactory.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/JSFValidatorFactory.java deleted file mode 100644 index 06ee772e2..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/JSFValidatorFactory.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.validation.internal; - -/** - * A factory that is to construct JSF validators - * - * @author cbateman - * - */ -public class JSFValidatorFactory -{ - /** - * @return a default validator for XML-defined views. - */ - public static IJSFViewValidator createDefaultXMLValidator() - { - return new XMLViewDefnValidator(); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/LocalizedMessage.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/LocalizedMessage.java deleted file mode 100644 index 11151c210..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/LocalizedMessage.java +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -/** - * - */ -package org.eclipse.jst.jsf.validation.internal; - -import java.util.Locale; - -import org.eclipse.core.resources.IResource; -import org.eclipse.wst.validation.internal.core.Message; - -/** - * Localized version of the message. - * - * @author cbateman - * - */ -public class LocalizedMessage extends Message { - - private String _message = null; - - /** - * @param severity - * @param messageText - */ - public LocalizedMessage(int severity, String messageText) { - this(severity, messageText, null); - } - - /** - * @param severity - * @param messageText - * @param targetObject - */ - public LocalizedMessage(int severity, String messageText, IResource targetObject) { - this(severity, messageText, (Object) targetObject); - } - - /** - * @param severity - * @param messageText - * @param targetObject - */ - public LocalizedMessage(int severity, String messageText, Object targetObject) { - super(null, severity, null); - setLocalizedMessage(messageText); - setTargetObject(targetObject); - } - - /** - * @param message - */ - public void setLocalizedMessage(String message) { - _message = message; - } - - /** - * @return the message - */ - public String getLocalizedMessage() { - return _message; - } - - public String getText() { - return getLocalizedMessage(); - } - - public String getText(ClassLoader cl) { - return getLocalizedMessage(); - } - - public String getText(Locale l) { - return getLocalizedMessage(); - } - - public String getText(Locale l, ClassLoader cl) { - return getLocalizedMessage(); - } -}
\ No newline at end of file diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/Severity.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/Severity.java deleted file mode 100644 index 06265b060..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/Severity.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.validation.internal; - -/** - * Severity levels of problems - */ -public enum Severity -{ - /** - * Indicates a problem severity of Error - */ - ERROR - { - public java.lang.String toString() { - return "error"; - } - } - , - /** - * Indicates a problem severity of Warning - */ - WARNING - { - public java.lang.String toString() { - return "warning"; - } - } - , - /** - * Indicates no problem should be shown - */ - IGNORE - { - public java.lang.String toString() { - return "ignore"; - } - }; - - /** - * @param value - * @return the enum based on the toString mappings - */ - public static Severity valueOfString(String value) - { - if ("error".equals(value)) - { - return ERROR; - } - else if ("warning".equals(value)) - { - return WARNING; - } - else - { - return IGNORE; - } - } - }
\ No newline at end of file diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/ValidationPreferences.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/ValidationPreferences.java deleted file mode 100644 index d61f4c027..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/ValidationPreferences.java +++ /dev/null @@ -1,90 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.validation.internal; - -import org.eclipse.jface.preference.IPreferenceStore; - -/** - * @author cbateman - * - */ -public class ValidationPreferences -{ - private final IPreferenceStore _prefStore; - private final ELValidationPreferences _elPrefs; - private final JSFTypeComparatorPreferences _typeComparatorPrefs; - /** - * Constructor - * @param prefStore - */ - public ValidationPreferences(IPreferenceStore prefStore) - { - _prefStore = prefStore; - _elPrefs = new ELValidationPreferences(); - _typeComparatorPrefs = new JSFTypeComparatorPreferences(); - } - - /** - * @return the el preferences - */ - public ELValidationPreferences getElPrefs() - { - return _elPrefs; - } - - /** - * @return the type comparator preferences. - */ - public JSFTypeComparatorPreferences getTypeComparatorPrefs() - { - return _typeComparatorPrefs; - } - - /**IPreferenceStore - * The default preference loader - */ - public void load() - { - load(_prefStore); - } - - /** - * Loads preferences from prefStore - * - * @param prefStore - */ - private void load(IPreferenceStore prefStore) - { - _elPrefs.load(prefStore); - _typeComparatorPrefs.load(prefStore); - } - - /** - * Commits but does not store the preferences - * - * @param prefStore - */ - public void commit(IPreferenceStore prefStore) - { - _elPrefs.commit(prefStore); - _typeComparatorPrefs.commit(prefStore); - } - - /** - * Reverts the model to it's defaults. Does not commit to pref store. - */ - public void setDefaults() - { - _elPrefs.setDefaults(); - _typeComparatorPrefs.setDefaults(); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/XMLViewDefnValidator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/XMLViewDefnValidator.java deleted file mode 100644 index da1f97d70..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/XMLViewDefnValidator.java +++ /dev/null @@ -1,203 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.validation.internal; - -import java.io.IOException; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.core.internal.region.Region2AttrAdapter; -import org.eclipse.jst.jsf.core.internal.region.Region2ElementAdapter; -import org.eclipse.jst.jsf.core.internal.region.Region2ElementAdapter.NoElementException; -import org.eclipse.jst.jsf.designtime.DTAppManagerUtil; -import org.eclipse.jst.jsf.designtime.internal.view.IDTViewHandler; -import org.eclipse.jst.jsf.designtime.resolver.IStructuredDocumentSymbolResolverFactory; -import org.eclipse.jst.jsf.designtime.resolver.StructuredDocumentSymbolResolverFactory; -import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory; -import org.eclipse.jst.jsf.validation.internal.strategy.AttributeValidatingStrategy; -import org.eclipse.jst.jsf.validation.internal.strategy.ContainmentValidatingStrategy; -import org.eclipse.wst.sse.core.StructuredModelManager; -import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument; -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion; -import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext; - -/** - * Validator for JSF view definitions that are structured in XML format - * - * @author cbateman - * - */ -public class XMLViewDefnValidator implements IJSFViewValidator -{ - // TODO: should the source validator be a separate class in jsp.ui? - // problem with simple split off is that preference must also be split off - static final boolean DEBUG; - static - { - final String value = Platform - .getDebugOption("org.eclipse.jst.jsf.core/validation"); //$NON-NLS-1$ - DEBUG = value != null && value.equalsIgnoreCase("true"); //$NON-NLS-1$ - } - - // default. Overridable by calling setSymbolResolverFactory - private IStructuredDocumentSymbolResolverFactory _symbolResolverFactory = - StructuredDocumentSymbolResolverFactory.getInstance(); - - /** - * Validates a JSP tag. - * - * Currently only attribute values with supplied annotation meta-data is - * being validated. Also, only JSF EL is being validated and not JSP EL. - * - * This method may be extended in the future to validate tag semantics an - * other cross attribute validations. - * - * @param container - * @param jsfValidationContext - * - */ - private void validateTag(final IStructuredDocumentRegion container, - final JSFValidationContext jsfValidationContext, - final ContainmentValidatingStrategy containmentStrategy) - { - // TODO: later when we move to composite strategy, run in SafeRunner - // to protect against exceptions generated in external code. - try - { - final Region2ElementAdapter regionAdapter = new Region2ElementAdapter( - container); - -// final IStructuredDocumentContext elementContext = -// IStructuredDocumentContextFactory.INSTANCE -// .getContext(container.getParentDocument(), container -// .getStartOffset()); - - if (containmentStrategy.isInteresting(regionAdapter)) - { - containmentStrategy.validate(regionAdapter); - } - - final AttributeValidatingStrategy strategy = - new AttributeValidatingStrategy(jsfValidationContext); - - for (final Region2AttrAdapter attrAdapter : regionAdapter - .getAttributes().values()) - { - if (strategy.isInteresting(attrAdapter)) - { - strategy.validate(attrAdapter); - } - } - } - catch (NoElementException ne) - { - // XXX: - } - } - - public void validateView(final IFile viewFile, final IValidationReporter reporter) - { - IStructuredModel model = null; - if (DEBUG) - { - System.out.println("executing JSPSemanticsValidator.validateFile"); - } - - try - { - final JSFValidationContext jsfValidationContext = - createValidationContext(false, viewFile, reporter); - - if (jsfValidationContext == null) - { - return; - } - - model = StructuredModelManager.getModelManager().getModelForRead( - viewFile); - - final IStructuredDocument structuredDoc = - model.getStructuredDocument(); - final IStructuredDocumentRegion[] regions = - structuredDoc.getStructuredDocumentRegions(); - validateRegions(regions, jsfValidationContext, - new ContainmentValidatingStrategy(jsfValidationContext)); - } - catch (final CoreException e) - { - JSFCorePlugin.log("Error validating JSF", e); - } - catch (final IOException e) - { - JSFCorePlugin.log("Error validating JSF", e); - } - finally - { - if (null != model) - { - model.releaseFromRead(); - } - } - } - - public void validateView(IFile viewFile, - IStructuredDocumentRegion[] regions, IValidationReporter reporter) - { - final JSFValidationContext jsfValidationContext = - createValidationContext(true, viewFile, reporter); - - if (jsfValidationContext == null) - { - return; - } - - validateRegions(regions, jsfValidationContext, - new ContainmentValidatingStrategy(jsfValidationContext)); - } - - private void validateRegions(final IStructuredDocumentRegion[] regions, - final JSFValidationContext context, - final ContainmentValidatingStrategy containmentValidator) - { - for (final IStructuredDocumentRegion curNode : regions) - { - if (curNode.getFirstRegion().getType() == DOMRegionContext.XML_TAG_OPEN) - { - validateTag(curNode, context, containmentValidator); - } - } - } - - private JSFValidationContext createValidationContext( - final boolean isIncremental, final IFile file, - final IValidationReporter reporter) - { - final ValidationPreferences prefs = new ValidationPreferences( - JSFCorePlugin.getDefault().getPreferenceStore()); - prefs.load(); - final DiagnosticFactory diagnosticFactory = new DiagnosticFactory(); - - final IDTViewHandler viewHandler = DTAppManagerUtil.getViewHandler(file - .getProject()); - - // only validate files that our designtime supports - if (viewHandler == null || !viewHandler.supportsViewDefinition(file)) - { - return null; - } - - return new JSFValidationContext(isIncremental, prefs, viewHandler, - diagnosticFactory, file, reporter, _symbolResolverFactory); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/AppConfigValidationUtil.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/AppConfigValidationUtil.java deleted file mode 100644 index 11b980c94..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/AppConfigValidationUtil.java +++ /dev/null @@ -1,444 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.validation.internal.appconfig; - -import java.io.StringReader; -import java.util.Iterator; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jdt.core.Flags; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.ITypeHierarchy; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jdt.core.Signature; -import org.eclipse.jst.jsf.common.internal.types.TypeConstants; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.facesconfig.emf.ListEntriesType; -import org.eclipse.jst.jsf.facesconfig.emf.ManagedBeanScopeType; -import org.eclipse.jst.jsf.facesconfig.emf.MapEntriesType; -import org.eclipse.jst.jsp.core.internal.java.jspel.JSPELParser; -import org.eclipse.jst.jsp.core.internal.java.jspel.ParseException; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.xml.core.internal.emf2xml.EMF2DOMSSEAdapter; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode; -import org.w3c.dom.Node; - -/** - * Common functions for app config validation - * - * @author cbateman - * - */ -public final class AppConfigValidationUtil -{ - /** - * Per the fully-qualified-classType in the Faces 1.2 schema and - * the ClassName entity in the 1.1 DTD - * - * @param fullyQualifiedName - * @param instanceOf - * @param mustBeAClass - * @param project - * @return null if no problems or a Message if problem found - */ - public static IMessage validateClassName(final String fullyQualifiedName, - final String instanceOf, - final boolean mustBeAClass, - final IProject project) - { - try - { - IType type = getType(project, fullyQualifiedName); - if (type == null || !type.exists()) - { - return DiagnosticFactory - .create_CANNOT_FIND_CLASS_NAME(fullyQualifiedName); - } - - // must be a class, not an interface or enum - if (mustBeAClass && !type.isClass()) - { - return DiagnosticFactory - .create_FULLY_QUALIFIED_NAME_MUST_BE_A_CLASS - (fullyQualifiedName); - } - - // must not be abstract since it must instantiable - if (Flags.isAbstract(type.getFlags())) - { - return DiagnosticFactory - .create_CLASS_MUST_BE_CONCRETE(fullyQualifiedName); - } - - if (instanceOf != null) - { - if (!isInstanceOf(type, instanceOf)) - { - // if we get to here, we haven't found the expected - // the super type so error - return DiagnosticFactory.create_CLASS_MUST_BE_INSTANCE_OF - (fullyQualifiedName, Messages.AppConfigValidationUtil_0, instanceOf); - } - } - } - catch(JavaModelException jme) - { - // fall-through, not found - JSFCorePlugin.log(jme, - "Error resolving fully qualified class name: "+fullyQualifiedName); //$NON-NLS-1$ - } - - // either found the class or had an exception so don't report error - return null; - } - - private static IType getType(final IProject project, - final String fullyQualifiedName) throws JavaModelException - { - final IJavaProject javaProject = JavaCore.create(project); - return javaProject.findType(fullyQualifiedName); - } - - /** - * Per the faces-config-el-expressionType in the Faces 1.2 schema and - * the Action entity in the 1.1 DTD - * - * @param textContent - * @return an validation diagnostic or null if the textContent - * represent an expected EL expression - */ - public static IMessage validateELExpression(final String textContent) - { - final ELResultWrapper result = extractELExpression(textContent); - - if (result.elText != null) - { - JSPELParser parser = new JSPELParser(new StringReader(result.elText)); - - try { - parser.Expression(); - } catch (ParseException e) { - // syntax error - return DiagnosticFactory.create_SYNTAX_ERROR_IN_EL(); - } - - return null; - } - - return result.message; - } - - /** - * @param textContent - * @return the result of trying to extract an EL expression from the - * textContent string. The content is expected to be of the form - * #{elText}. elText in the return value will be set to this value - * from within the braces. If a syntax error occurs in this extraction - * message property of the result object will contain a validation message - * and elText will be set to null. - * TODO: move this somewhere more generic and shared. - */ - public static ELResultWrapper extractELExpression(final String textContent) - { - final String elRegex = "#\\{(.*)\\}"; //$NON-NLS-1$ - Pattern pattern = Pattern.compile(elRegex); - Matcher matcher = pattern.matcher(textContent.trim()); - if (matcher.matches()) - { - final String elText = matcher.group(1).trim(); - - if ("".equals(elText) || elText == null) //$NON-NLS-1$ - { - return new ELResultWrapper(DiagnosticFactory.create_SYNTAX_ERROR_IN_EL(), null); - } - return new ELResultWrapper(null, elText); - } - return new ELResultWrapper(DiagnosticFactory.create_EL_EXPR_MUST_BE_IN_HASH_BRACES(), null); - } - - /** - * Value object that wraps the result of trying - * to extract an EL expression from an arbitrary String - */ - public static class ELResultWrapper - { - private final IMessage message; - private final String elText; - - ELResultWrapper(IMessage message, String elText) { - super(); - this.message = message; - this.elText = elText; - } - - /** - * @return a message indicating a problem encountered - * trying to extract, or null if no problem was encountered - */ - public IMessage getMessage() { - return message; - } - - /** - * @return the el expression string raw, stripped of any - * sorrounding #{} syntax or null if could not be extracted - */ - public String getElText() { - return elText; - } - } - - /** - * @param eObj - * @return the offset character offset in to the XML document of the - * XML node that eObj was constructed from or -1 if not - * computable - */ - public static int getStartOffset(EObject eObj) - { - IDOMNode node = getDomNode(eObj); - - if (node != null) - { - return node.getStartStructuredDocumentRegion().getStartOffset(); - } - - return -1; - } - - /** - * @param eObj - * @return the length in characters of the XML node that - * eObj was constructed from or -1 if no computable - */ - public static int getLength(EObject eObj) - { - IDOMNode node = getDomNode(eObj); - - if (node != null) - { - return node.getEndStructuredDocumentRegion().getEndOffset() - - node.getStartStructuredDocumentRegion().getStartOffset(); - } - - return -1; - } - - /** - * @param eObj - * @return the DOM node that eObj was constructed from or - * null if not computable - */ - public static IDOMNode getDomNode(EObject eObj) - { - for (Iterator it = eObj.eAdapters().iterator(); it.hasNext();) - { - Adapter adapter = (Adapter) it.next(); - - if (adapter instanceof EMF2DOMSSEAdapter) - { - final EMF2DOMSSEAdapter sseAdapter = (EMF2DOMSSEAdapter) adapter; - final Node node = sseAdapter.getNode(); - if (node instanceof IDOMNode) - { - return (IDOMNode) node; - } - } - } - - return null; - } - - /** - * @param scope - * @return an error message if scope does not match a valid - * scope enum. - */ - public static IMessage validateManagedBeanScope(ManagedBeanScopeType scope) - { - // scope must be one of a few enums - if (!"request".equals(scope.getTextContent()) //$NON-NLS-1$ - && !"session".equals(scope.getTextContent()) //$NON-NLS-1$ - && !"application".equals(scope.getTextContent()) //$NON-NLS-1$ - && !"none".equals(scope.getTextContent())) //$NON-NLS-1$ - { - return DiagnosticFactory.create_BEAN_SCOPE_NOT_VALID(); - } - - return null; - } - - /** - * @param targetName - * @param targetType the type of the object that mapEntries will be assigned to - * @param mapEntries - * @param project - * @return null if okay or an error message if the mapEntries type is - * invalid in some way - * Note: when Java 1.5 support is added we can validate against the template types - */ - public static IMessage validateMapEntries(String targetName, String targetType, MapEntriesType mapEntries, IProject project) - { - if (mapEntries == null || targetType == null || project == null) - { - throw new AssertionError("Arguments to validateMapEntries can't be null"); //$NON-NLS-1$ - } - - try - { - // TODO: do a bean look-up for targetName to verify that it a) matches the type - // and b) exists on the bean - IType type = getType(project, targetType); - - if (type != null && - !(isInstanceOf(type, Signature.toString(TypeConstants.TYPE_MAP)))) - { - return DiagnosticFactory - .create_MAP_ENTRIES_CAN_ONLY_BE_SET_ON_MAP_TYPE(targetName); - } - // TODO: validate the the map entries - // TODO: validate the types of the map entries against the values present - // TODO: validate the map key and value types against the template - } - catch (JavaModelException jme) - { - JSFCorePlugin.log(new Exception(jme), "Exception while validating mapEntries"); //$NON-NLS-1$ - } - // if we get to here, we have not found anything meaningful to report - return null; - } - - /** - * @param targetName - * @param targetType the type of the object that mapEntries will be assigned to - * @param listEntries - * @param project - * @return null if okay or an error message if the listEntries type is - * invalid in some way - * Note: when Java 1.5 support is added we can validate against the template types - */ - public static IMessage validateListEntries(String targetName, String targetType, ListEntriesType listEntries, IProject project) - { - if (listEntries == null || targetType == null || project == null) - { - throw new AssertionError("Arguments to validateMapEntries can't be null"); //$NON-NLS-1$ - } - - try - { - IType type = getType(project, targetType); - // TODO: do a bean look-up for targetName to verify that it a) matches the type - // and b) exists on the bean - if (type != null && - !(isInstanceOf(type, Signature.toString(TypeConstants.TYPE_LIST)))) - { - return DiagnosticFactory - .create_LIST_ENTRIES_CAN_ONLY_BE_SET_ON_LIST_TYPE(targetName); - } - // TODO: validate the the list entries - // TODO: validate the types of the list entries against the values present - // TODO: validate the value types against the template - } - catch (JavaModelException jme) - { - JSFCorePlugin.log(new Exception(jme), "Exception while validating mapEntries"); //$NON-NLS-1$ - } - // if we get to here, we have not found anything meaningful to report - return null; - } - - /** - * @param localeType - * @return a diagnostic if 'localeType' does not match the - * expected format or null if all is clear - */ - public static IMessage validateLocaleType(final String localeType) - { - // based on the localeType in the Faces 1.2 schema. This is safe - // to apply to 1.1 since it expects the same pattern even though - // the DTD cannot validate it - final String localeTypePattern = "[a-z]{2}(_|-)?([\\p{L}\\-\\p{Nd}]{2})?"; //$NON-NLS-1$ - final Matcher matcher = Pattern.compile(localeTypePattern).matcher(localeType); - - if (!matcher.matches()) - { - return DiagnosticFactory.create_LOCALE_FORMAT_NOT_VALID(); - } - - return null; - } - - /** - * @param type - * @param instanceOf - * @return true if type instanceof instanceOf is true - * - * @throws JavaModelException - */ - public static boolean isInstanceOf(final IType type, final String instanceOf) throws JavaModelException - { - if (instanceOf != null) - { - // must have either a no-arg constructor or an adapter constructor - // that is of the type of instanceOf -// IType constructorParam = getType(project, instanceOf); -// if (constructorParam != null) -// { -// final String constructorMethodName = -// type.getElementName(); -// final IMethod defaultConstructor = -// type.getMethod(constructorMethodName, new String[0]); -// final IMethod adapterConstructor = -// type.getMethod(constructorMethodName, new String[]{instanceOf}); -// final boolean isDefaultConstructor = -// defaultConstructor != null && defaultConstructor.isConstructor(); -// final boolean isAdapterConstructor = -// adapterConstructor != null && adapterConstructor.isConstructor(); -// if (!isDefaultConstructor && !isAdapterConstructor) -// { - // TODO: no constructor == default constructor... -// } -// } - - // if the type is an exact match - if (instanceOf.equals(type.getFullyQualifiedName())) - { - return true; - } - - final ITypeHierarchy typeHierarchy = - type.newSupertypeHierarchy(new NullProgressMonitor()); - - final IType[] supers = typeHierarchy.getAllSupertypes(type); - for (int i = 0; i < supers.length; i++) - { - if (instanceOf.equals(supers[i].getFullyQualifiedName())) - { - return true; - } - } - } - return false; - } - - private AppConfigValidationUtil() - { - // no external construction - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/AppConfigValidator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/AppConfigValidator.java deleted file mode 100644 index 6f5161705..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/AppConfigValidator.java +++ /dev/null @@ -1,390 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.validation.internal.appconfig; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Set; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IWorkspaceRoot; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.jobs.ISchedulingRule; -import org.eclipse.jst.jsf.core.IJSFCoreConstants; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.core.jsfappconfig.JSFAppConfigUtils; -import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigType; -import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit; -import org.eclipse.jst.jsp.core.internal.Logger; -import org.eclipse.wst.common.project.facet.core.IFacetedProject; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; -import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager; -import org.eclipse.wst.validation.AbstractValidator; -import org.eclipse.wst.validation.ValidationResult; -import org.eclipse.wst.validation.ValidationState; -import org.eclipse.wst.validation.internal.core.ValidationException; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; -import org.eclipse.wst.validation.internal.provisional.core.IValidationContext; -import org.eclipse.wst.validation.internal.provisional.core.IValidator; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel; -import org.w3c.dom.DocumentType; -import org.w3c.dom.NamedNodeMap; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - -/** - * General build-time validator for the JSF application configuration file (faces-config.xml)b - * - * @author cbateman - * - */ -public class AppConfigValidator extends AbstractValidator implements IValidator { - - @Override - public ValidationResult validate(final IResource resource, final int kind, - final ValidationState state, final IProgressMonitor monitor) { - final ValidationResult vr = new ValidationResult(); - if (resource == null || !(resource instanceof IFile)) { - return vr; - } - final IReporter reporter = vr.getReporter(monitor); - validateFile((IFile) resource, reporter); - return vr; - } - - /** - * @param helper - * @return the scheduling rull for this validator - */ - public ISchedulingRule getSchedulingRule(final IValidationContext helper) { - // no scheduling rule - return null; - } - - /** - * @param helper - * @param reporter - * @return the result of running validation - * @throws ValidationException - */ - public IStatus validateInJob(final IValidationContext helper, final IReporter reporter) - throws ValidationException { - IStatus status = Status.OK_STATUS; - try { - validate(helper, reporter); - } - catch (final ValidationException e) { - Logger.logException(e); - status = new Status(IStatus.ERROR, JSFCorePlugin.getDefault().getPluginID(), IStatus.ERROR, e.getLocalizedMessage(), e); - } - return status; - } - - public void cleanup(final IReporter reporter) { - // no cleanup - - } - - public void validate(final IValidationContext helper, final IReporter reporter) - throws ValidationException - { - final String[] uris = helper.getURIs(); - final IWorkspaceRoot wsRoot = ResourcesPlugin.getWorkspace().getRoot(); - if (uris.length > 0) { - IFile currentFile = null; - - for (int i = 0; i < uris.length && !reporter.isCancelled(); i++) { - currentFile = wsRoot.getFile(new Path(uris[i])); - if (currentFile != null && currentFile.exists()) { -// if (shouldValidate(currentFile) && fragmentCheck(currentFile)) { - -// int percent = (i * 100) / uris.length + 1; -//Message message = new LocalizedMessage(IMessage.LOW_SEVERITY, percent + "% " + uris[i]); - // reporter.displaySubtask(this, message); - - validateFile(currentFile, reporter); - } - } - } - - // copied from JSPValidator TODO: perhaps just use app config locator? -// else { -// -// // if uris[] length 0 -> validate() gets called for each project -// if (helper instanceof IWorkbenchContext) { -// -// IProject project = ((IWorkbenchContext) helper).getProject(); -// JSPFileVisitor visitor = new JSPFileVisitor(reporter); -// try { -// // collect all jsp files for the project -// project.accept(visitor, IResource.DEPTH_INFINITE); -// } -// catch (CoreException e) { -// if (DEBUG) -// e.printStackTrace(); -// } -// IFile[] files = visitor.getFiles(); -// for (int i = 0; i < files.length && !reporter.isCancelled(); i++) { -// if (shouldValidate(files[i]) && fragmentCheck(files[i])) { -// int percent = (i * 100) / files.length + 1; -// Message message = new LocalizedMessage(IMessage.LOW_SEVERITY, percent + "% " + files[i].getFullPath().toString()); -// reporter.displaySubtask(this, message); -// -// validateFile(files[i], reporter); -// } -// if (DEBUG) -// System.out.println("validating: [" + files[i] + "]"); //$NON-NLS-1$ //$NON-NLS-2$ -// } -// } -// } - } - - private void validateFile(final IFile file, final IReporter reporter) - { - FacesConfigArtifactEdit facesConfigEdit = null; - - try - { - final IPath path = JSFAppConfigUtils.getWebContentFolderRelativePath(file); - facesConfigEdit = FacesConfigArtifactEdit. - getFacesConfigArtifactEditForRead(file.getProject(), path.toString()); - - if (facesConfigEdit != null - && facesConfigEdit.getFacesConfig()!=null) - { - final String version = validateVersioning(file, facesConfigEdit, reporter); - validateModel(file, facesConfigEdit,reporter, version); - } - } - finally - { - if (facesConfigEdit != null) - { - facesConfigEdit.dispose(); - } - } - } - - /** - * Ensure that the expected project version (facet) jives with what is in - * the faces-config. Generally this means: - * - * if (version == 1.1) then no 1.2 artifacts (error) - * if (version == 1.2) then warn if using old artifacts (warning) - */ - private String validateVersioning(final IFile file, final FacesConfigArtifactEdit facesConfigEdit, final IReporter reporter) - { - final String appConfigFileVersion = getAppConfigFileVersion(facesConfigEdit); - - if (appConfigFileVersion != null) - { - final String projectVersion = getJSFVersion(file.getProject()); - - if (IJSFCoreConstants.FACET_VERSION_1_1.equals(projectVersion) - || IJSFCoreConstants.FACET_VERSION_1_0.equals(projectVersion)) - { - if (IJSFCoreConstants.FACET_VERSION_1_2.equals(appConfigFileVersion)) - { - reporter.addMessage(this, - DiagnosticFactory - .create_APP_CONFIG_IS_NEWER_THAN_JSF_VERSION(file)); - } - } - else if (IJSFCoreConstants.FACET_VERSION_1_2.equals(projectVersion)) - { - if (IJSFCoreConstants.FACET_VERSION_1_1.equals(appConfigFileVersion) - || IJSFCoreConstants.FACET_VERSION_1_0.equals(appConfigFileVersion)) - { - reporter.addMessage(this, - DiagnosticFactory - .create_APP_CONFIG_IS_OLDER_THAN_JSF_VERSION(file - , appConfigFileVersion, projectVersion)); - } - } - // if no exact match, don't make any assumptions - } - return appConfigFileVersion; - } - - /** - * @param facesConfigEdit - * @return the version of the app config file or null if not determinant - */ - private String getAppConfigFileVersion(final FacesConfigArtifactEdit facesConfigEdit) - { - String appConfigVersion = null; - - final IDOMModel domModel = facesConfigEdit.getIDOMModel(); - final IDOMDocument document = domModel.getDocument(); - if (document == null) {return null;} - - final DocumentType docType = domModel.getDocument().getDoctype(); - - // if we have DTD doctype then we're looking at 1.1 or before - if (docType != null) - { - appConfigVersion = extractVersionFromPublicId(docType); - // if not found in the public id, try the system id - if (appConfigVersion == null) - { - appConfigVersion = extractVersionFromSystemId(docType); - } - } - else - { - final NodeList rootNodes = domModel.getDocument().getChildNodes(); - - for (int i = 0; i < rootNodes.getLength(); i++) - { - final Node node = rootNodes.item(i); - if (node.getNodeType() == Node.ELEMENT_NODE - && "faces-config".equals(node.getLocalName())) - { - final NamedNodeMap map = node.getAttributes(); - // the most accurate thing is the version - final Node versionAttrib = map.getNamedItem("version"); - - if (versionAttrib != null) - { - appConfigVersion = versionAttrib.getNodeValue(); - break; - } - - // TODO: add additional heuristic to parse out - // the schema - } - } - } - - return appConfigVersion; - } - - - - private void validateModel(final IFile file, - final FacesConfigArtifactEdit facesConfigEdit, - final IReporter reporter, - final String version) - { - final FacesConfigType facesConfigType = facesConfigEdit.getFacesConfig(); - final FacesConfigValidator validator = new FacesConfigValidator(version); - final List messages = new ArrayList(); - validator.validate(facesConfigType, messages, file); - - for (final Iterator it = messages.iterator(); it.hasNext();) - { - final IMessage message = (IMessage) it.next(); - reporter.addMessage(this, message); - } - } - - /** - * @param project - * @return the version string for the JSF facet on project - * or null if not found - */ - private String getJSFVersion(final IProject project) - { - try - { - final IFacetedProject facetedProject = ProjectFacetsManager.create(project); - final Set facets = facetedProject.getProjectFacets(); - - for (final Iterator it = facets.iterator(); it.hasNext();) - { - final IProjectFacetVersion facetVersion = - (IProjectFacetVersion) it.next(); - - if (IJSFCoreConstants.JSF_CORE_FACET_ID.equals(facetVersion.getProjectFacet().getId())) - { - return facetVersion.getVersionString(); - } - } - } - catch (final CoreException ce) - { - JSFCorePlugin.log(ce, "Problem loading faceted project"); - // fall-through and return null - } - return null; - } - - private String extractVersionFromPublicId(final DocumentType docType) - { - final String publicId = docType.getPublicId(); - final String publicIdRegex = "-\\/\\/(.*)\\/\\/(.*)\\/\\/.*"; - - if (publicId != null) - { - final Pattern pattern = Pattern.compile(publicIdRegex); - final Matcher matcher = pattern.matcher(publicId); - - if (matcher.matches()) - { - final String classTypeString = matcher.group(2); - final String[] classTypes = classTypeString.split("\\s+"); - - // verify that the class type is a DTD - if (classTypes.length > 0 - && "DTD".equals(classTypes[0])) - { - // either 1.0 or 1.1; be most conservative - String appConfigVersion = IJSFCoreConstants.JSF_VERSION_1_0; - - // see if the version is in the public id - if (IJSFCoreConstants.JSF_VERSION_1_1.equals(classTypes[classTypes.length-1])) - { - appConfigVersion = IJSFCoreConstants.FACET_VERSION_1_1; - } - - return appConfigVersion; - } - } - } - - return null; - } - - private String extractVersionFromSystemId(final DocumentType docType) - { - final String systemId = docType.getSystemId(); - final String systemIdRegEx = "http:\\/\\/java.sun.com\\/dtd\\/web-facesconfig_(.*)\\.dtd"; - if (systemId != null) - { - final Pattern pattern = Pattern.compile(systemIdRegEx); - final Matcher matcher = pattern.matcher(systemId); - - if (matcher.matches()) - { - final String version = matcher.group(1); - if ("1_1".equals(version)||"1_0".equals(version)) - { - return version.replaceAll("_", "."); - } - } - } - return null; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/ApplicationValidationVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/ApplicationValidationVisitor.java deleted file mode 100644 index 1dc04c966..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/ApplicationValidationVisitor.java +++ /dev/null @@ -1,299 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.validation.internal.appconfig; - -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.jst.jsf.core.IJSFCoreConstants; -import org.eclipse.jst.jsf.facesconfig.emf.DefaultLocaleType; -import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage; -import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigType; -import org.eclipse.jst.jsf.facesconfig.emf.LocaleConfigType; -import org.eclipse.jst.jsf.facesconfig.emf.SupportedLocaleType; - -/** - * Validator the <application> node of the app config model - * @author cbateman - * - */ -public class ApplicationValidationVisitor extends EObjectValidationVisitor -{ - - /** - * Default constructure - * @param version - */ - public ApplicationValidationVisitor(String version) - { - super(FacesConfigPackage.eINSTANCE.getFacesConfigType_Application(), version); - } - - protected void doValidate(EObject object, List messages, IFile file) { - // nothing to validate - } - - protected EObjectValidationVisitor[] getChildNodeValidators() { - return new EObjectValidationVisitor[] - { - // TODO: validate message and resource bundles - // TODO: validate default render kit id - new ActionListenerValidationVisitor(getVersion()), - new NavigationHandlerValidationVisitor(getVersion()), - new ViewHandlerValidationVisitor(getVersion()), - new StateManagerValidationVisitior(getVersion()), - new PropertyResolverValidationVisitor(getVersion()), - new VariableResolverValidationVisitor(getVersion()), - new ELResolverValidationVisitor(getVersion()), - new LocaleConfigValidationVisitor(getVersion()) - }; - } - - /** - * @param facesConfig - * @param messages - * @param file - */ - protected void validateManagedBeanNames(FacesConfigType facesConfig, List messages, IFile file) - { -// final Map foundBeans = new HashMap(); -// final List firstCollisionInstance = new ArrayList(); -// -// for (final Iterator it = facesConfig.getManagedBean().iterator(); it.hasNext();) -// { -// final ManagedBeanType managedBean = (ManagedBeanType) it.next(); -// -// if (managedBean.getManagedBeanName() == null -// || managedBean.getManagedBeanName().getTextContent() == null -// || "".equals(managedBean.getManagedBeanName().getTextContent())) -// { -// -// } - -// if (!foundBeans.containsKey(managedBean.getManagedBeanName())) -// } - } - - private static class LocaleConfigValidationVisitor extends EObjectValidationVisitor - { - /** - * @param version - */ - public LocaleConfigValidationVisitor(String version) - { - super(FacesConfigPackage.eINSTANCE.getApplicationType_LocaleConfig() - , version); - } - - protected void doValidate(EObject object, List messages, IFile file) - { - final LocaleConfigType localeConfig = (LocaleConfigType) object; - - DefaultLocaleType defaultLocale = localeConfig.getDefaultLocale(); - - if (defaultLocale != null) - { - addMessageInfo( - messages, - AppConfigValidationUtil - .validateLocaleType(defaultLocale.getTextContent()) - , defaultLocale, file); - } - - for (final Iterator it = localeConfig.getSupportedLocale().iterator(); it.hasNext();) - { - final SupportedLocaleType supportedLocale = - (SupportedLocaleType) it.next(); - addMessageInfo( - messages, - AppConfigValidationUtil - .validateLocaleType(supportedLocale.getTextContent()) - , supportedLocale, file); - } - - } - - protected EObjectValidationVisitor[] getChildNodeValidators() { - // there are children, but we're going to validate in doValidate - return NO_CHILDREN; - } - - } - - private static class ActionListenerValidationVisitor extends ApplicationClassNameBasedValidationVisitor - { - /** - * @param version - */ - public ActionListenerValidationVisitor(final String version) { - super(FacesConfigPackage.eINSTANCE.getApplicationType_ActionListener(), - version,"javax.faces.event.ActionListener", true); - } - } - - private static class NavigationHandlerValidationVisitor extends ApplicationClassNameBasedValidationVisitor - { - /** - * @param version - */ - public NavigationHandlerValidationVisitor(final String version) { - super(FacesConfigPackage.eINSTANCE.getApplicationType_NavigationHandler(), - version,"javax.faces.application.NavigationHandler", true); - } - } - - private static class ViewHandlerValidationVisitor extends ApplicationClassNameBasedValidationVisitor - { - ViewHandlerValidationVisitor(final String version) - { - super(FacesConfigPackage.eINSTANCE.getApplicationType_ViewHandler(), - version,"javax.faces.application.ViewHandler", true); - } - } - - private static class StateManagerValidationVisitior extends ApplicationClassNameBasedValidationVisitor - { - StateManagerValidationVisitior(final String version) - { - // must a concrete class with a zero arg constructor: - // JSF1.1_3.2.3.2 and JSF1.2_3.2.4.2 - super(FacesConfigPackage.eINSTANCE.getApplicationType_StateManager(), - version,"javax.faces.application.StateManager", true); - } - } - - private static class PropertyResolverValidationVisitor extends ApplicationClassNameBasedValidationVisitor - { - PropertyResolverValidationVisitor(final String version) - { - super(FacesConfigPackage.eINSTANCE.getApplicationType_PropertyResolver(), - version,"javax.faces.el.PropertyResolver", true); - } - - protected void doValidate(EObject object, List messages, IFile file) { - super.doValidate(object, messages, file); - - // if this version greater than 1.1 then property resolvers are - // deprecated in favour of el-resolvers - final String version = getVersion(); - if (!IJSFCoreConstants.FACET_VERSION_1_0.equals(version) && !IJSFCoreConstants.FACET_VERSION_1_1.equals(version)) - { - addMessageInfo(messages, - DiagnosticFactory.create_API_DEPRECATED_AFTER_VERSION_ID - ("property-resolver", IJSFCoreConstants.FACET_VERSION_1_1, "el-resolver") - , object, file); - } - } - } - - private static class VariableResolverValidationVisitor extends ApplicationClassNameBasedValidationVisitor - { - VariableResolverValidationVisitor(final String version) - { - super(FacesConfigPackage.eINSTANCE.getApplicationType_VariableResolver(), - version, "javax.faces.el.VariableResolver", true); - } - - protected void doValidate(EObject object, List messages, IFile file) { - super.doValidate(object, messages, file); - // if this version greater than 1.1 then property resolvers are - // deprecated in favour of el-resolvers - final String version = getVersion(); - if (!IJSFCoreConstants.JSF_VERSION_1_0.equals(version) && !IJSFCoreConstants.JSF_VERSION_1_1.equals(version)) - { - addMessageInfo(messages, - DiagnosticFactory.create_API_DEPRECATED_AFTER_VERSION_ID - ("variable-resolver", IJSFCoreConstants.JSF_VERSION_1_1, "el-resolver") - , object, file); - } - - } - } - - private static class ELResolverValidationVisitor extends ApplicationClassNameBasedValidationVisitor - { - ELResolverValidationVisitor(final String version) - { - // must be a class and have zero-arg constructor - // JSF1.2_5.6.1.4 - super(FacesConfigPackage.eINSTANCE.getApplicationType_ELResolver(), - version, "javax.el.ELResolver", true); - } - - protected void doValidate(EObject object, List messages, IFile file) { - // if this version less than 1.2 then property resolvers are - // deprecated in favour of el-resolvers - final String version = getVersion(); - if (IJSFCoreConstants.JSF_VERSION_1_0.equals(version) || IJSFCoreConstants.JSF_VERSION_1_1.equals(version)) - { - addMessageInfo(messages, - DiagnosticFactory.create_API_NOT_AVAILABLE_BEFORE_VERSION - ("el-resolver", IJSFCoreConstants.JSF_VERSION_1_2, "variable-resolver or property-resolver") - , object, file); - } - else - { - super.doValidate(object, messages, file); - } - } - } - - private abstract static class ApplicationClassNameBasedValidationVisitor extends ClassNameEObjectValidationVisitor - { - private final String _instanceOf; - private final boolean _mustBeClass; - - /** - * @param feature - * @param version - * @param instanceOf - * @param mustBeClass - */ - protected ApplicationClassNameBasedValidationVisitor(EStructuralFeature feature, - final String version, final String instanceOf, final boolean mustBeClass) - { - super(feature, version); - _instanceOf = instanceOf; - _mustBeClass = mustBeClass; - } - - protected String getFullyQualifiedName(EObject eobj) - { - EStructuralFeature feature = eobj.eClass().getEStructuralFeature("textContent"); - - if (feature != null) - { - return (String)eobj.eGet(feature); - } - - return null; - } - - @Override - protected boolean mustBeClass() { - return _mustBeClass; - } - - protected EObjectValidationVisitor[] getChildNodeValidators() { - // no children - return NO_CHILDREN; - } - - protected String getInstanceOf() { - return _instanceOf; - } - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/AttributeValidationVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/AttributeValidationVisitor.java deleted file mode 100644 index 2ddd7e824..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/AttributeValidationVisitor.java +++ /dev/null @@ -1,83 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.validation.internal.appconfig; - -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.jst.jsf.facesconfig.emf.AttributeClassType; -import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage; - -/** - * Validates the <attribute> element of components, converters etc. - * - * @author cbateman - * - */ -public class AttributeValidationVisitor extends EObjectValidationVisitor { - - /** - * @param feature - * @param version - */ - public AttributeValidationVisitor(EStructuralFeature feature, String version) { - // this validator can be attached to numerous parents so it - // cannot hard-code its feature - super(feature,version); - } - - protected void doValidate(EObject object, List messages, IFile file) { - // nothing to do - } - - protected EObjectValidationVisitor[] getChildNodeValidators() { - return new EObjectValidationVisitor[] - { - new AttributeClassValidationVisitor(getVersion()) - }; - } - - private static class AttributeClassValidationVisitor extends ClassNameEObjectValidationVisitor - { - /** - * @param version - */ - public AttributeClassValidationVisitor( - String version) { - super(FacesConfigPackage.eINSTANCE.getAttributeType_AttributeClass() - , version); - } - - protected String getFullyQualifiedName(EObject eobj) { - return ((AttributeClassType)eobj).getTextContent(); - } - - protected String getInstanceOf() { - // null since there is no instance of enforcement here - return null; - } - - protected EObjectValidationVisitor[] getChildNodeValidators() { - return NO_CHILDREN; - } - - @Override - protected boolean mustBeClass() - { - // attribute could be a class or an enum - return false; - } - - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/ClassNameEObjectValidationVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/ClassNameEObjectValidationVisitor.java deleted file mode 100644 index 6ef8fa34f..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/ClassNameEObjectValidationVisitor.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.validation.internal.appconfig; - -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; - -/** - * Abstract validation visitor for classname based eobjects - * - * @author cbateman - * - */ -public abstract class ClassNameEObjectValidationVisitor extends - EObjectValidationVisitor -{ - /** - * @param structuralFeature - * @param version - */ - public ClassNameEObjectValidationVisitor( - EStructuralFeature structuralFeature, String version) { - super(structuralFeature, version); - } - - protected void doValidate(EObject object, List messages, IFile file) - { - String fullyQualifiedName = getFullyQualifiedName(object); - // protect against null - fullyQualifiedName = fullyQualifiedName == null ? "" : fullyQualifiedName; - addMessageInfo(messages, - AppConfigValidationUtil - .validateClassName(fullyQualifiedName, getInstanceOf() - , false, file.getProject()),object, file); - } - - /** - * @param eobj - * @return the fully qualified name from the eobject - */ - protected abstract String getFullyQualifiedName(EObject eobj); - - /** - * @return a fully-qualified - */ - protected abstract String getInstanceOf(); - - /** - * @return true if the class being named must be a class - * and may not be an enum or interface - */ - protected abstract boolean mustBeClass(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/ComponentValidatorVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/ComponentValidatorVisitor.java deleted file mode 100644 index 5ec0f3e97..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/ComponentValidatorVisitor.java +++ /dev/null @@ -1,151 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.validation.internal.appconfig; - -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jst.jsf.facesconfig.emf.ComponentClassType; -import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage; -import org.eclipse.jst.jsf.facesconfig.emf.FacetNameType; - -/** - * Validator for a <component> - * - * @author cbateman - * - */ -public class ComponentValidatorVisitor extends EObjectValidationVisitor -{ - /** - * @param version - */ - public ComponentValidatorVisitor(final String version) - { - super(FacesConfigPackage.eINSTANCE.getFacesConfigType_Component(), - version); - } - - protected void doValidate(EObject object, List messages, IFile file) { - // nothing in the tag to validate - } - - protected EObjectValidationVisitor[] getChildNodeValidators() { - return new EObjectValidationVisitor[] - { - new ComponentClassValidationVisitor(getVersion()), - new AttributeValidationVisitor(FacesConfigPackage.eINSTANCE.getComponentType_Attribute(), getVersion()), - new PropertyValidationVisitor - (FacesConfigPackage.eINSTANCE.getComponentType_Property() - ,FacesConfigPackage.eINSTANCE.getComponentType_ComponentClass() - ,getVersion()), - new ComponentFacetValidationVisitor(getVersion()) - }; - } - - private static class ComponentClassValidationVisitor extends ClassNameEObjectValidationVisitor - { - ComponentClassValidationVisitor(final String version) - { - super(FacesConfigPackage.eINSTANCE.getComponentType_ComponentClass(), - version); - } - - protected String getFullyQualifiedName(EObject eobj) - { - return ((ComponentClassType)eobj).getTextContent(); - } - - protected String getInstanceOf() { - return "javax.faces.component.UIComponent"; - } - - protected EObjectValidationVisitor[] getChildNodeValidators() { - return NO_CHILDREN; - } - - @Override - protected boolean mustBeClass() { - // must a class - return true; - } - } - - private static class ComponentFacetValidationVisitor extends EObjectValidationVisitor - { - /** - * @param version - */ - public ComponentFacetValidationVisitor(String version) - { - super(FacesConfigPackage.eINSTANCE.getComponentType_Facet(), version); - } - - protected void doValidate(EObject object, List messages, IFile file) { - // do nothing - } - - protected EObjectValidationVisitor[] getChildNodeValidators() { - return new EObjectValidationVisitor[] - { - new FacetNameValidationVisitor(getVersion()) - }; - } - - private static class FacetNameValidationVisitor extends EObjectValidationVisitor - { - /** - * @param version - */ - public FacetNameValidationVisitor(String version) { - super(FacesConfigPackage.eINSTANCE.getFacetType_FacetName(), - version); - } - - protected void doValidate(EObject object, List messages, IFile file) { - FacetNameType name = (FacetNameType) object; - boolean isValid = false; - - if (name.getTextContent() != null - || "".equals(name.getTextContent().trim())) - { - String nameValue = name.getTextContent().trim(); - - // TODO: isJavaIdentifierStart seems broken... - if (Character.isJavaIdentifierStart(nameValue.charAt(0))) - { - isValid = true; - for (int i = 1; i < nameValue.length(); i++) - { - if (!Character.isJavaIdentifierPart(nameValue.charAt(i))) - { - isValid = false; - } - } - } - } - - if (!isValid) - { - addMessageInfo(messages, - DiagnosticFactory.create_MUST_BE_A_VALID_JAVA_IDENT("Facet name") - , object, file); - } - } - - protected EObjectValidationVisitor[] getChildNodeValidators() { - return NO_CHILDREN; - } - - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/ConverterValidationVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/ConverterValidationVisitor.java deleted file mode 100644 index 5fba0bcfd..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/ConverterValidationVisitor.java +++ /dev/null @@ -1,110 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.validation.internal.appconfig; - -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jst.jsf.facesconfig.emf.ConverterClassType; -import org.eclipse.jst.jsf.facesconfig.emf.ConverterForClassType; -import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage; - -/** - * Validates the converter - */ -public class ConverterValidationVisitor extends EObjectValidationVisitor -{ - - /** - * @param version - */ - public ConverterValidationVisitor(final String version) - { - super(FacesConfigPackage.eINSTANCE.getFacesConfigType_Converter(), - version); - } - - protected void doValidate(EObject object, List messages, IFile file) { - // nothing in the tag to validate - } - - protected EObjectValidationVisitor[] getChildNodeValidators() { - return new EObjectValidationVisitor[] - { - new ConverterClassValidationVisitor(getVersion()) - , new AttributeValidationVisitor(FacesConfigPackage.eINSTANCE.getConverterType_Attribute(), getVersion()) - , new PropertyValidationVisitor - (FacesConfigPackage.eINSTANCE.getConverterType_Property() - ,FacesConfigPackage.eINSTANCE.getConverterType_ConverterClass() - ,getVersion()) - , new ConverterForClassValidationVisitor(getVersion()) - }; - } - - private static class ConverterClassValidationVisitor extends ClassNameEObjectValidationVisitor - { - ConverterClassValidationVisitor(final String version) - { - super(FacesConfigPackage.eINSTANCE.getConverterType_ConverterClass(), - version); - } - - protected String getFullyQualifiedName(EObject eobj) - { - return ((ConverterClassType)eobj).getTextContent(); - } - - protected String getInstanceOf() { - return "javax.faces.convert.Converter"; - } - - protected EObjectValidationVisitor[] getChildNodeValidators() { - return NO_CHILDREN; - } - - @Override - protected boolean mustBeClass() { - // can't be an enum - return true; - } - } - - private static class ConverterForClassValidationVisitor extends ClassNameEObjectValidationVisitor - { - ConverterForClassValidationVisitor(final String version) - { - super(FacesConfigPackage.eINSTANCE.getConverterType_ConverterForClass(), - version); - } - - protected String getFullyQualifiedName(EObject eobj) - { - return ((ConverterForClassType)eobj).getTextContent(); - } - - protected String getInstanceOf() { - // no instanceof enforcement - return null; - } - - protected EObjectValidationVisitor[] getChildNodeValidators() { - return NO_CHILDREN; - } - - @Override - protected boolean mustBeClass() { - // could be a converter for all instances of an enum type - return false; - } - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/DiagnosticFactory.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/DiagnosticFactory.java deleted file mode 100644 index 219bd5976..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/DiagnosticFactory.java +++ /dev/null @@ -1,412 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.validation.internal.appconfig; - -import java.text.MessageFormat; -import java.util.Locale; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IResource; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.wst.validation.internal.core.Message; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -/** - * Factory for constructing diagnostic objects for AppConfig file validation - * - * @author cbateman - * - */ -public final class DiagnosticFactory -{ - /** - * Problem id - */ - public final static int EL_EXPR_MUST_BE_IN_HASH_BRACES_ID = 0; - - /** - * Problem id - */ - public final static int SYNTAX_ERROR_IN_EL_ID = 1; - - /** - * Problem id - */ - public final static int CANNOT_FIND_CLASS_NAME_ID = 2; - - /** - * Problem id - */ - public final static int FULLY_QUALIFIED_NAME_MUST_BE_A_CLASS_ID = 3; - - /** - * Problem id - */ - public final static int CLASS_MUST_BE_INSTANCE_OF_ID = 4; - - /** - * Problem id - */ - public final static int CLASS_MUST_BE_CONCRETE_ID = 5; - - /** - * TODO: - */ - public final static int CLASS_MUST_HAVE_DEFAULT_OR_ADAPTER_CONSTRUCTOR_ID = 6; - - /** - * Problem id - */ - public final static int API_DEPRECATED_AFTER_VERSION_ID = 7; - - /** - * Problem id - */ - public final static int BEAN_PROPERTY_NOT_FOUND_ID = 8; - - /** - * Problem id - */ - public final static int MUST_BE_A_VALID_JAVA_IDENT_ID = 9; - - /** - * Problem id - */ - public final static int BEAN_SCOPE_NOT_VALID_ID = 10; - - /** - * Problem id - */ - public final static int MAP_ENTRIES_CAN_ONLY_BE_SET_ON_MAP_TYPE_ID = 11; - - /** - * Problem id - */ - public final static int LIST_ENTRIES_CAN_ONLY_BE_SET_ON_LIST_TYPE_ID = 12; - - /** - * Problem id - */ - public final static int API_NOT_AVAILABLE_BEFORE_VERSION_ID = 13; - - /** - * Problem id - */ - public final static int APP_CONFIG_IS_NEWER_THAN_JSF_VERSION_ID = 14; - /** - * Problem id - */ - public final static int APP_CONFIG_IS_OLDER_THAN_JSF_VERSION_ID = 15; - - /** - * Problem id - */ - public final static int LOCALE_FORMAT_NOT_VALID_ID = 16; - - /** - * @return message indicating text that should be EL was - * not found sorrounded in #{} values - */ - public static IMessage create_EL_EXPR_MUST_BE_IN_HASH_BRACES() - { - return new MyLocalizedMessage(IMessage.NORMAL_SEVERITY, - Messages.EL_EXPR_MUST_BE_IN_HASH_BRACES_ID, - null, EL_EXPR_MUST_BE_IN_HASH_BRACES_ID); - } - - /** - * @return message indicating that EL was found that - * was empty or did not parse - */ - public static IMessage create_SYNTAX_ERROR_IN_EL() - { - return new MyLocalizedMessage(IMessage.NORMAL_SEVERITY, - Messages.SYNTAX_ERROR_IN_EL_ID, - null, SYNTAX_ERROR_IN_EL_ID); - } - - /** - * @param className - * @return message indicating that className can't be found as - * a valid fully qualified class name - */ - public static IMessage create_CANNOT_FIND_CLASS_NAME(final String className) - { - return new MyLocalizedMessage(IMessage.NORMAL_SEVERITY, - MessageFormat.format(Messages.CANNOT_FIND_CLASS_NAME_ID,new Object[]{className}), - null, CANNOT_FIND_CLASS_NAME_ID); - } - - /** - * @param fullyQualifiedName - * @return the error message for a fullyQualifiedName that resolves to a type - * that is not a class (i.e. an interface or enum) but is expected to be - */ - public static IMessage create_FULLY_QUALIFIED_NAME_MUST_BE_A_CLASS(final String fullyQualifiedName) - { - return new MyLocalizedMessage(IMessage.NORMAL_SEVERITY, - MessageFormat.format(Messages.FULLY_QUALIFIED_NAME_MUST_BE_A_CLASS_ID - ,new Object[]{fullyQualifiedName}) - ,null, FULLY_QUALIFIED_NAME_MUST_BE_A_CLASS_ID); - } - - /** - * @param className - * @param extensionType - * @param expectedSuper - * @return an error when a class name must be of type expectedSuper - */ - public static IMessage create_CLASS_MUST_BE_INSTANCE_OF(final String className, - final String extensionType, - final String expectedSuper) - { - return new MyLocalizedMessage(IMessage.NORMAL_SEVERITY, - MessageFormat.format(Messages.CLASS_MUST_BE_INSTANCE_OF_ID - ,new Object[]{className, extensionType, expectedSuper}) - ,null, CLASS_MUST_BE_INSTANCE_OF_ID); - } - - - /** - * @param className - * @return error indicating that className must specify a class - * that is concrete - */ - public static IMessage create_CLASS_MUST_BE_CONCRETE(final String className) - { - return new MyLocalizedMessage(IMessage.NORMAL_SEVERITY, - MessageFormat.format(Messages.CLASS_MUST_BE_CONCRETE_ID - ,new Object[]{className}) - ,null, CLASS_MUST_BE_CONCRETE_ID); - } - - /** - * @param apiName -- name of deprecated API - * @param afterVersion -- version after which deprecation is effective - * @param useInstead -- name of API to use instead - * @return an error indicating the use of a deprecated API - */ - public static IMessage create_API_DEPRECATED_AFTER_VERSION_ID(final String apiName, final String afterVersion, final String useInstead) - { - return new MyLocalizedMessage(IMessage.NORMAL_SEVERITY, - MessageFormat.format(Messages.API_DEPRECATED_AFTER_VERSION_ID - ,new Object[]{apiName, afterVersion, useInstead}) - ,null, API_DEPRECATED_AFTER_VERSION_ID); - } - - /** - * @param propertyName - * @param beanClassName - * @return an error indicating that the propertyName was not - * found on beanClassName - */ - public static IMessage create_BEAN_PROPERTY_NOT_FOUND(final String propertyName, final String beanClassName) - { - return new MyLocalizedMessage(IMessage.NORMAL_SEVERITY, - MessageFormat.format(Messages.BEAN_PROPERTY_NOT_FOUND_ID - ,new Object[]{propertyName, beanClassName}) - ,null, BEAN_PROPERTY_NOT_FOUND_ID); - - } - - - /** - * @param nameOfId - * @return an error indicating that some id must be a valid - * Java identifier - */ - public static IMessage create_MUST_BE_A_VALID_JAVA_IDENT(final String nameOfId) - { - return new MyLocalizedMessage(IMessage.NORMAL_SEVERITY, - MessageFormat.format(Messages.MUST_BE_A_VALID_JAVA_IDENT_ID - ,new Object[]{nameOfId}) - ,null, MUST_BE_A_VALID_JAVA_IDENT_ID); - } - - /** - * @return an error indicating an invalid bean scope enum value - */ - public static IMessage create_BEAN_SCOPE_NOT_VALID() - { - return new MyLocalizedMessage(IMessage.NORMAL_SEVERITY, - Messages.BEAN_SCOPE_NOT_VALID_ID - , null, BEAN_SCOPE_NOT_VALID_ID); - } - - /** - * @param targetName - * @return an error indicating that a map entry is being set on a target - * object that is not a java.util.Map - */ - public static IMessage create_MAP_ENTRIES_CAN_ONLY_BE_SET_ON_MAP_TYPE(String targetName) - { - return new MyLocalizedMessage(IMessage.NORMAL_SEVERITY, - MessageFormat.format(Messages.MAP_ENTRIES_CAN_ONLY_BE_SET_ON_MAP_TYPE_ID, - new Object[]{targetName}), - null, MAP_ENTRIES_CAN_ONLY_BE_SET_ON_MAP_TYPE_ID); - } - - /** - * @param targetName - * @return an error indicating that a list entry is being set on a target - * object that is not a java.util.List - */ - public static IMessage create_LIST_ENTRIES_CAN_ONLY_BE_SET_ON_LIST_TYPE(String targetName) - { - return new MyLocalizedMessage(IMessage.NORMAL_SEVERITY, - MessageFormat.format(Messages.LIST_ENTRIES_CAN_ONLY_BE_SET_ON_LIST_TYPE_ID, - new Object[]{targetName}), - null, LIST_ENTRIES_CAN_ONLY_BE_SET_ON_LIST_TYPE_ID); - } - - /** - * @param apiName - * @param beforeVersion - * @param useInstead - * @return a diagnostic indicating that an API is being used that is not yet - * available in the current JSF version. - */ - public static IMessage create_API_NOT_AVAILABLE_BEFORE_VERSION(final String apiName, final String beforeVersion, final String useInstead) - { - return new MyLocalizedMessage(IMessage.NORMAL_SEVERITY, - MessageFormat.format(Messages.API_NOT_AVAILABLE_BEFORE_VERSION_ID - ,new Object[]{apiName, beforeVersion, useInstead}) - ,null, API_NOT_AVAILABLE_BEFORE_VERSION_ID); - } - - /** - * @param file - * @return a diagnostic indicating that the app config model in use is too - * new for the selected JSF runtime version. - */ - public static IMessage create_APP_CONFIG_IS_NEWER_THAN_JSF_VERSION(IFile file) - { - final IMessage message = new MyLocalizedMessage(IMessage.HIGH_SEVERITY, - Messages.APP_CONFIG_IS_NEWER_THAN_JSF_VERSION_ID - ,null, APP_CONFIG_IS_NEWER_THAN_JSF_VERSION_ID); - message.setTargetObject(file); - return message; - } - - /** - * @param file - * @param appConfigVersion - * @param projectVersion - * @return a diagnostic indicating that the app config model in use is older - * than the selected JSF runtime version. - */ - public static IMessage create_APP_CONFIG_IS_OLDER_THAN_JSF_VERSION(IFile file, String appConfigVersion, String projectVersion) - { - final IMessage message = new MyLocalizedMessage(IMessage.NORMAL_SEVERITY, - MessageFormat.format( - Messages.APP_CONFIG_IS_OLDER_THAN_JSF_VERSION_ID, - new Object[] {appConfigVersion, projectVersion}) - ,null, APP_CONFIG_IS_OLDER_THAN_JSF_VERSION_ID); - message.setTargetObject(file); - return message; - } - - /** - * @return a diagnostic indicating that the locale format does - * not match what is expected - */ - public static IMessage create_LOCALE_FORMAT_NOT_VALID() - { - IMessage message = new MyLocalizedMessage(IMessage.NORMAL_SEVERITY, - Messages.LOCALE_FORMAT_NOT_VALID_ID - ,null, LOCALE_FORMAT_NOT_VALID_ID); - return message; - } - - /** - * Customized localizable message for app config validation - * @author cbateman - * - */ - static class MyLocalizedMessage extends Message implements ILocalizedMessage - { - private final String _message; - private final int _errorCode; - - /** - * @param severity - * @param messageText - * @param targetObject - * @param errorCode - */ - public MyLocalizedMessage(int severity, String messageText, IResource targetObject, int errorCode) { - this(severity, messageText, (Object) targetObject, errorCode); - } - - /** - * @param severity - * @param messageText - * @param targetObject - * @param errorCode - */ - private MyLocalizedMessage(int severity, String messageText, Object targetObject, int errorCode) { - super(JSFCorePlugin.getDefault().getBundle().getSymbolicName(), severity, - messageText); - _message = messageText; - setTargetObject(targetObject); - _errorCode = errorCode; - } - - /** - * @return the localized message - */ - public String getLocalizedMessage() { - return _message; - } - - /** - * @see org.eclipse.wst.validation.internal.core.Message#getText() - */ - public String getText() { - return getLocalizedMessage(); - } - - /** - * @see org.eclipse.wst.validation.internal.core.Message#getText(java.lang.ClassLoader) - */ - public String getText(ClassLoader cl) { - return getLocalizedMessage(); - } - - /** - * @see org.eclipse.wst.validation.internal.core.Message#getText(java.util.Locale) - */ - public String getText(Locale l) { - return getLocalizedMessage(); - } - - public String getText(Locale l, ClassLoader cl) { - return getLocalizedMessage(); - } - - /** - * @return the error code related to this message - */ - public int getErrorCode() { - return _errorCode; - } - - - /** - * @param offset - * @return true if this message applies to document offset - */ - public boolean appliesTo(int offset) - { - return (offset >= getOffset() && offset < getOffset()+getLength()); - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/EObjectValidationVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/EObjectValidationVisitor.java deleted file mode 100644 index a3b7909d5..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/EObjectValidationVisitor.java +++ /dev/null @@ -1,165 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.validation.internal.appconfig; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.resources.IFile; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -/** - * - * @author cbateman - */ -public abstract class EObjectValidationVisitor -{ - private EStructuralFeature _structuralFeature; - private Map _childFeatures; // == null; lazy initialized in validate - private final String _version; - - /** - * Used to indicate no child nodes - */ - protected final static EObjectValidationVisitor[] NO_CHILDREN = - new EObjectValidationVisitor[0]; - - /** - * @param version - * - */ - public EObjectValidationVisitor(String version) - { - _version = version; - } - - private EObjectValidationVisitor getVisitorForFeature(EStructuralFeature feature) - { - if (_childFeatures == null) - { - _childFeatures = new HashMap(); - - EObjectValidationVisitor[] children = getChildNodeValidators(); - - for (int i = 0; i < children.length; i++) - { - final EObjectValidationVisitor child = children[i]; - _childFeatures.put(child.getStructuralFeature(), child); - } - } - - return (EObjectValidationVisitor) _childFeatures.get(feature); - } - - /** - * @param structuralFeature - * @param version - */ - public EObjectValidationVisitor(EStructuralFeature structuralFeature, String version) - { - this(version); - _structuralFeature = structuralFeature; - } - - /** - * @param eObject - * @param messages - * @param file - */ - public final void validate(EObject eObject, List messages, IFile file) - { - doValidate(eObject, messages, file); - - List features = eObject.eClass().getEAllStructuralFeatures(); - - for (final Iterator it = features.iterator(); it.hasNext();) - { - final EStructuralFeature feature = (EStructuralFeature) it.next(); - final EObjectValidationVisitor visitor = - getVisitorForFeature(feature); - - if (visitor != null) - { - final Object obj = eObject.eGet(feature); - - if (obj instanceof List - && feature.isMany()) - { - for (final Iterator childIt = ((List)obj).iterator(); - childIt.hasNext();) - { - Object child = childIt.next(); - if (child instanceof EObject) - { - visitor.validate((EObject)child, messages, file); - } - } - } - else if (obj instanceof EObject) - { - visitor.validate((EObject)obj , messages, file); - } - } - } - } - - /** - * Do the validation for this visitor on this node. Add any Message's to - * the messages list - * - * @param eObject - * @param messages - * @param file - */ - protected abstract void doValidate(EObject eObject, List messages, IFile file); - - /** - * @return an array of visitors that validate children of the current node - */ - protected abstract EObjectValidationVisitor[] getChildNodeValidators(); - - /** - * @return the structural feature - */ - protected final EStructuralFeature getStructuralFeature() - { - return _structuralFeature; - } - - /** - * @return the version of the runtime - */ - protected final String getVersion() - { - return _version; - } - - /** - * @param messages - * @param message - * @param eObj - * @param file - */ - protected static void addMessageInfo(List messages, IMessage message, EObject eObj, IFile file) - { - if (message != null) - { - message.setOffset(AppConfigValidationUtil.getStartOffset(eObj)); - message.setLength(AppConfigValidationUtil.getLength(eObj)); - message.setTargetObject(file); - messages.add(message); - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/FacesConfigValidator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/FacesConfigValidator.java deleted file mode 100644 index 66c2c2848..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/FacesConfigValidator.java +++ /dev/null @@ -1,102 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.validation.internal.appconfig; - -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage; -import org.eclipse.jst.jsf.facesconfig.emf.PhaseListenerType; - -/** - * Top-level validator for the faces-config model - * - * @author cbateman - * - */ -public class FacesConfigValidator extends EObjectValidationVisitor -{ - /** - * constructor - * @param version - */ - public FacesConfigValidator(String version) - { - super(version); - } - - protected EObjectValidationVisitor[] getChildNodeValidators() - { - return new EObjectValidationVisitor[] - { - new NavigationRuleValidator(getVersion()) - , new ApplicationValidationVisitor(getVersion()) - , new LifecycleValidationVisitor(getVersion()) - , new FactoryValidationVisitor(getVersion()) - , new ComponentValidatorVisitor(getVersion()) - , new ValidatorTypeValidationVisitor(getVersion()) - , new ConverterValidationVisitor(getVersion()) - , new ManagedBeanValidationVisitor(getVersion()) - , new RenderKitValidationVisitor(getVersion()) - }; - } - - protected void doValidate(EObject object, List messages, IFile file) - { - // nothing to do - } - - private static class LifecycleValidationVisitor extends EObjectValidationVisitor - { - LifecycleValidationVisitor(final String version) - { - super(FacesConfigPackage.eINSTANCE.getFacesConfigType_Lifecycle(), - version); - } - - protected void doValidate(EObject object, List messages, IFile file) { - // nothing to validate except in children - } - - protected EObjectValidationVisitor[] getChildNodeValidators() { - return new EObjectValidationVisitor[] { - new PhaseListenerValidation(getVersion()) - }; - } - - private static class PhaseListenerValidation extends ClassNameEObjectValidationVisitor - { - PhaseListenerValidation(final String version) - { - super(FacesConfigPackage.eINSTANCE.getLifecycleType_PhaseListener(), - version); - } - protected String getFullyQualifiedName(EObject eobj) { - return ((PhaseListenerType)eobj).getTextContent(); - } - - protected String getInstanceOf() { - return "javax.faces.event.PhaseListener"; - } - - protected EObjectValidationVisitor[] getChildNodeValidators() { - // no children - return NO_CHILDREN; - } - @Override - protected boolean mustBeClass() { - // must be a class - return true; - } - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/FactoryValidationVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/FactoryValidationVisitor.java deleted file mode 100644 index 7ea53741d..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/FactoryValidationVisitor.java +++ /dev/null @@ -1,170 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.validation.internal.appconfig; - -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jst.jsf.facesconfig.emf.ApplicationFactoryType; -import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage; -import org.eclipse.jst.jsf.facesconfig.emf.FacesContextFactoryType; -import org.eclipse.jst.jsf.facesconfig.emf.LifecycleFactoryType; -import org.eclipse.jst.jsf.facesconfig.emf.RenderKitFactoryType; - -/** - * @author cbateman - * - */ -public class FactoryValidationVisitor extends EObjectValidationVisitor -{ - /** - * @param version - */ - public FactoryValidationVisitor(String version) { - super(FacesConfigPackage.eINSTANCE.getFacesConfigType_Factory() - ,version); - } - - protected void doValidate(EObject object, List messages, IFile file) { - // nothing to do except vaildate children - } - - protected EObjectValidationVisitor[] getChildNodeValidators() - { - return new EObjectValidationVisitor[] - { - new ApplicationFactoryValidationVisitor(getVersion()) - , new FacesContextFactoryValidationVisitor(getVersion()) - , new LifecycleFactoryValidationVisitor(getVersion()) - , new RenderkitFactoryValidationVisitor(getVersion()) - }; - } - - private static class ApplicationFactoryValidationVisitor extends ClassNameEObjectValidationVisitor - { - ApplicationFactoryValidationVisitor(final String version) - { - super(FacesConfigPackage.eINSTANCE.getFactoryType_ApplicationFactory(), - version); - } - - protected String getFullyQualifiedName(EObject eobj) - { - return ((ApplicationFactoryType)eobj).getTextContent(); - } - - protected String getInstanceOf() { - return "javax.faces.application.ApplicationFactory"; - } - - @Override - protected boolean mustBeClass() { - return true; - } - - protected EObjectValidationVisitor[] getChildNodeValidators() { - // none - return NO_CHILDREN; - } - - } - - private static class FacesContextFactoryValidationVisitor extends ClassNameEObjectValidationVisitor - { - FacesContextFactoryValidationVisitor(final String version) - { - super(FacesConfigPackage.eINSTANCE.getFactoryType_FacesContextFactory(), - version); - } - - protected String getFullyQualifiedName(EObject eobj) - { - return ((FacesContextFactoryType)eobj).getTextContent(); - } - - protected String getInstanceOf() { - return "javax.faces.context.FacesContextFactory"; - } - - protected EObjectValidationVisitor[] getChildNodeValidators() { - // none - return NO_CHILDREN; - } - - @Override - protected boolean mustBeClass() - { - // must be a class - return true; - } - - } - - private static class LifecycleFactoryValidationVisitor extends ClassNameEObjectValidationVisitor - { - LifecycleFactoryValidationVisitor(final String version) - { - super(FacesConfigPackage.eINSTANCE.getFactoryType_LifecycleFactory(), - version); - } - - protected String getFullyQualifiedName(EObject eobj) - { - return ((LifecycleFactoryType)eobj).getTextContent(); - } - - protected String getInstanceOf() { - return "javax.faces.lifecycle.LifecycleFactory"; - } - - protected EObjectValidationVisitor[] getChildNodeValidators() { - // none - return NO_CHILDREN; - } - - @Override - protected boolean mustBeClass() { - // must be a class - return true; - } - - } - - private static class RenderkitFactoryValidationVisitor extends ClassNameEObjectValidationVisitor - { - RenderkitFactoryValidationVisitor(final String version) - { - super(FacesConfigPackage.eINSTANCE.getFactoryType_RenderKitFactory(), - version); - } - - protected String getFullyQualifiedName(EObject eobj) - { - return ((RenderKitFactoryType)eobj).getTextContent(); - } - - protected String getInstanceOf() { - return "javax.faces.render.RenderKitFactory"; - } - - protected EObjectValidationVisitor[] getChildNodeValidators() { - // none - return NO_CHILDREN; - } - - @Override - protected boolean mustBeClass() { - // must be a class - return true; - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/ILocalizedMessage.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/ILocalizedMessage.java deleted file mode 100644 index 33240d7aa..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/ILocalizedMessage.java +++ /dev/null @@ -1,23 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.validation.internal.appconfig; - -/** - * Used to expose internal message data to unit tests. Should not be used by clients - * @author cbateman - * - */ -public interface ILocalizedMessage { - /** - * @return the error code - */ - public int getErrorCode(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/ManagedBeanValidationVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/ManagedBeanValidationVisitor.java deleted file mode 100644 index 4f4d47c16..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/ManagedBeanValidationVisitor.java +++ /dev/null @@ -1,131 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.validation.internal.appconfig; - -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage; -import org.eclipse.jst.jsf.facesconfig.emf.ListEntriesType; -import org.eclipse.jst.jsf.facesconfig.emf.ManagedBeanClassType; -import org.eclipse.jst.jsf.facesconfig.emf.ManagedBeanScopeType; -import org.eclipse.jst.jsf.facesconfig.emf.ManagedBeanType; -import org.eclipse.jst.jsf.facesconfig.emf.MapEntriesType; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -/** - * Managed bean validator - * - * @author cbateman - * - */ -public class ManagedBeanValidationVisitor extends EObjectValidationVisitor -{ - /** - * @param version - */ - public ManagedBeanValidationVisitor(final String version) - { - super(FacesConfigPackage.eINSTANCE.getFacesConfigType_ManagedBean() - ,version); - } - - protected void doValidate(EObject object, List messages, IFile file) - { - final ManagedBeanType managedBean = (ManagedBeanType) object; - - // TODO: validate managedBeanName is a valid Java id -// final String managedBeanName = -// managedBean.getManagedBeanName().getTextContent(); - validateScope(managedBean.getManagedBeanScope(), messages, file); - validateClass(managedBean.getManagedBeanClass(), messages, file); - validateEntryTypes(managedBean, messages, file); - } - - private void validateScope(ManagedBeanScopeType scope, List messages, IFile file) - { - if (scope != null && scope.getTextContent() != null) - { - addMessageInfo(messages - , AppConfigValidationUtil.validateManagedBeanScope(scope) - , scope, file); - } - } - - private void validateClass(ManagedBeanClassType classType, List messages, IFile file) - { - if (classType != null) - { - String classTypeValue = classType.getTextContent(); - addMessageInfo(messages - , AppConfigValidationUtil.validateClassName - (classTypeValue == null ? "" : classTypeValue - , null, true, // a managed bean must be a class - file.getProject()) - , classType, file); - } - } - - private void validateEntryTypes(ManagedBeanType managedBeanType, List messages, IFile file) - { - // TODO: do a bean look-up for targetName to verify that it a) matches the type - // and b) exists on the bean - if (managedBeanType.getManagedBeanName()!= null - && managedBeanType.getManagedBeanClass() != null) - { - final String propertyName = - managedBeanType.getManagedBeanName().getTextContent(); - final String propertyClass = - managedBeanType.getManagedBeanClass().getTextContent(); - - if (propertyName == null || propertyClass == null - || "".equals(propertyName.trim()) - || "".equals(propertyClass.trim())) - { - return; - } - - IMessage message = null; - EObject eObj = null; - if (managedBeanType.getMapEntries() != null) - { - eObj = managedBeanType.getMapEntries(); - message = - AppConfigValidationUtil - .validateMapEntries - (propertyName - , propertyClass - , (MapEntriesType) eObj - , file.getProject()); - } - else if (managedBeanType.getListEntries() != null) - { - eObj = managedBeanType.getListEntries(); - message = - AppConfigValidationUtil - .validateListEntries( - propertyName - , propertyClass - , (ListEntriesType) eObj - , file.getProject()); - } - addMessageInfo(messages, message, eObj, file); - } - } - - protected EObjectValidationVisitor[] getChildNodeValidators() { - return new EObjectValidationVisitor[] - { - new ManagedPropertyValidationVisitor(getVersion()) - }; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/ManagedPropertyValidationVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/ManagedPropertyValidationVisitor.java deleted file mode 100644 index 27dd66c60..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/ManagedPropertyValidationVisitor.java +++ /dev/null @@ -1,98 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.validation.internal.appconfig; - -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage; -import org.eclipse.jst.jsf.facesconfig.emf.ListEntriesType; -import org.eclipse.jst.jsf.facesconfig.emf.ManagedPropertyType; -import org.eclipse.jst.jsf.facesconfig.emf.MapEntriesType; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -/** - * Validates managed bean properties - * - */ -public class ManagedPropertyValidationVisitor extends EObjectValidationVisitor -{ - /** - * @param version - */ - public ManagedPropertyValidationVisitor(String version) { - super(FacesConfigPackage.eINSTANCE.getManagedBeanType_ManagedProperty() - ,version); - } - - protected void doValidate(final EObject object, final List messages, final IFile file) - { - // TODO: do a bean look-up for propertyName to verify that it a) matches the type - // and b) exists on the bean - final ManagedPropertyType managedPropertyType = - (ManagedPropertyType) object; - - if (managedPropertyType.getPropertyName() == null - || managedPropertyType.getPropertyClass() == null) - { - // don't bother if the basics aren't correct - return; - } - - final String propertyName = - managedPropertyType.getPropertyName().getTextContent(); - final String propertyClass = - managedPropertyType.getPropertyClass().getTextContent(); - - if (propertyName == null || propertyClass == null - || "".equals(propertyName.trim()) - || "".equals(propertyClass.trim())) - { - return; - } - - IMessage message = null; - EObject eObj = null; - if (managedPropertyType.getMapEntries() != null) - { - eObj = managedPropertyType.getMapEntries(); - message = - AppConfigValidationUtil - .validateMapEntries - (propertyName - , propertyClass - , (MapEntriesType) eObj - , file.getProject()); - } - else if (managedPropertyType.getListEntries() != null) - { - eObj = managedPropertyType.getListEntries(); - message = - AppConfigValidationUtil - .validateListEntries( - propertyName - , propertyClass - , (ListEntriesType) eObj - , file.getProject()); - } - - addMessageInfo(messages, message, eObj, file); - } - - protected EObjectValidationVisitor[] getChildNodeValidators() { - return new EObjectValidationVisitor[] - { - new PropertyNameValidationVisitor(FacesConfigPackage.eINSTANCE.getManagedPropertyType_PropertyName(), - FacesConfigPackage.eINSTANCE.getManagedBeanType_ManagedBeanClass(), getVersion()) - }; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/Messages.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/Messages.java deleted file mode 100644 index fb62b62d3..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/Messages.java +++ /dev/null @@ -1,110 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.validation.internal.appconfig; - -import org.eclipse.osgi.util.NLS; - -class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.jst.jsf.validation.internal.appconfig.messages"; //$NON-NLS-1$ - - - - - static { - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } - - /** - * see messages.properties - */ - public static String AppConfigValidationUtil_0; - - /** - * see messages.properties - */ - public static String EL_EXPR_MUST_BE_IN_HASH_BRACES_ID; - - /** - * see messages.properties - */ - public static String SYNTAX_ERROR_IN_EL_ID; - - /** - * see messages.properties - */ - public static String CANNOT_FIND_CLASS_NAME_ID; - - /** - * see messages.properties - */ - public static String FULLY_QUALIFIED_NAME_MUST_BE_A_CLASS_ID; - - /** - * see messages.properties - */ - public static String CLASS_MUST_BE_INSTANCE_OF_ID; - - /** - * see messages.properties - */ - public static String CLASS_MUST_BE_CONCRETE_ID; - - /** - * see messages.properties - */ - public static String API_DEPRECATED_AFTER_VERSION_ID; - - /** - * see messages.properties - */ - public static String BEAN_PROPERTY_NOT_FOUND_ID; - - /** - * see messages.properties - */ - public static String MUST_BE_A_VALID_JAVA_IDENT_ID; - - /** - * see messages.properties - */ - public static String BEAN_SCOPE_NOT_VALID_ID; - - /** - * see messages.properties - */ - public static String MAP_ENTRIES_CAN_ONLY_BE_SET_ON_MAP_TYPE_ID; - - /** - * see messages.properties - */ - public static String LIST_ENTRIES_CAN_ONLY_BE_SET_ON_LIST_TYPE_ID; - - /** - * see messages.properties - */ - public static String API_NOT_AVAILABLE_BEFORE_VERSION_ID; - - /** - * see messages.properties - */ - public static String APP_CONFIG_IS_NEWER_THAN_JSF_VERSION_ID; - - /** - * see messages.properties - */ - public static String APP_CONFIG_IS_OLDER_THAN_JSF_VERSION_ID; - - /** - * see messages.properties - */ - public static String LOCALE_FORMAT_NOT_VALID_ID; -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/NavigationCaseValidationVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/NavigationCaseValidationVisitor.java deleted file mode 100644 index 9c2c51656..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/NavigationCaseValidationVisitor.java +++ /dev/null @@ -1,79 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.validation.internal.appconfig; - -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage; -import org.eclipse.jst.jsf.facesconfig.emf.FromActionType; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -/** - * NavigationCase validation visitor. - * - * @author cbateman - * - */ -public class NavigationCaseValidationVisitor extends EObjectValidationVisitor -{ - /** - * @param version - * - */ - public NavigationCaseValidationVisitor(final String version) - { - super(FacesConfigPackage.eINSTANCE.getNavigationRuleType_NavigationCase() - , version); - } - - protected void doValidate(EObject object, List messages, IFile file) - { - // nothing to do - } - - protected EObjectValidationVisitor[] getChildNodeValidators() - { - return new EObjectValidationVisitor[] - { - new FromActionValidationVisitor(getVersion()) - }; - } - - private static class FromActionValidationVisitor extends EObjectValidationVisitor - { - /** - * @param version - * - */ - public FromActionValidationVisitor(String version) { - super(FacesConfigPackage.eINSTANCE.getNavigationCaseType_FromAction(), - version); - } - - protected void doValidate(EObject object, List messages, IFile file) - { - if (object instanceof FromActionType) - { - final FromActionType actionType = (FromActionType) object; - IMessage message = AppConfigValidationUtil.validateELExpression - (actionType.getTextContent()); - addMessageInfo(messages, message, actionType, file); - } - } - - protected EObjectValidationVisitor[] getChildNodeValidators() - { - return NO_CHILDREN; - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/NavigationRuleValidator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/NavigationRuleValidator.java deleted file mode 100644 index 97b9df029..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/NavigationRuleValidator.java +++ /dev/null @@ -1,91 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.validation.internal.appconfig; - -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage; - -/** - * Recursive validator for navigation-rule - * - * @author cbateman - * - */ -public class NavigationRuleValidator extends EObjectValidationVisitor -{ - /** - * Constructor - * @param version - */ - public NavigationRuleValidator(final String version) - { - super(FacesConfigPackage.eINSTANCE.getFacesConfigType_NavigationRule() - , version); - } - - protected void doValidate(EObject eobj, List messages, IFile file) - { - // nothing to do - } - - protected EObjectValidationVisitor[] getChildNodeValidators() - { - return new EObjectValidationVisitor[] - { - new NavigationCaseValidationVisitor(getVersion()) - }; - } -// private static class FromViewIdValidator extends ViewIdValidator -// { -// FromViewIdValidator() -// { -// super(Node.ELEMENT_NODE, "from-view-id"); -// } -// -// protected void doValidate(Node node, List messages, IFile file) -// { -// // only validate if a custom navigation handler is not set -// // since we can only validate against what the default navigation -// // handler will expect -// if (!hasCustomNavigationHandler(file)) -// { -// final String textContent = node.getTextContent(); -// final IProject project = file.getProject(); -// -// -// } -// } -// -// private boolean hasCustomNavigationHandler(IFile file) -// { -// JSFAppConfigManager configManager = -// JSFAppConfigManager.getInstance(file.getProject()); -// -// for (final Iterator appIt = configManager.getApplications().iterator(); appIt.hasNext();) -// { -// ApplicationType appType = (ApplicationType) appIt.next(); -// if (appType.getNavigationHandler().size() > 0) -// { -// return true; -// } -// } -// -// return false; -// } -// -// protected NodeValidationVisitor[] getChildNodeValidators() { -// return EMPTY_CHILDREN; -// } -// } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/NodeValidationVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/NodeValidationVisitor.java deleted file mode 100644 index aa2f78117..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/NodeValidationVisitor.java +++ /dev/null @@ -1,134 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.validation.internal.appconfig; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.resources.IFile; -import org.w3c.dom.NamedNodeMap; -import org.w3c.dom.Node; - -/** - * Visits an app config DOM tree and calls validators based on the - * configured validator tree - * - * @author cbateman - * - */ -public abstract class NodeValidationVisitor -{ - private final short _nodeType; - private final String _nodeName; - private final Map _attributeVisitors; - private final Map _elementVisitors; - - /** - * Used to indicate no child nodes - */ - protected final static NodeValidationVisitor[] EMPTY_CHILDREN = new NodeValidationVisitor[0]; - - /** - * @param nodeType - * @param nodeName - */ - public NodeValidationVisitor(short nodeType, String nodeName) - { - _nodeType = nodeType; - _nodeName = nodeName; - _attributeVisitors = new HashMap(); - _elementVisitors = new HashMap(); - - NodeValidationVisitor[] childVisitors = getChildNodeValidators(); - - for (int i = 0; i < childVisitors.length; i++) - { - final NodeValidationVisitor visitor = childVisitors[i]; - - switch(visitor.getNodeType()) - { - case Node.ATTRIBUTE_NODE: - _attributeVisitors.put(visitor.getNodeName(), visitor); - break; - - case Node.ELEMENT_NODE: - _elementVisitors.put(visitor.getNodeName(), visitor); - break; - } - } - } - - /** - * @param node - * @param messages - * @param file - */ - public final void validate(Node node, List messages, IFile file) - { - doValidate(node, messages, file); - - final NamedNodeMap attributes = node.getAttributes(); - - for (int i = 0; attributes != null && i < attributes.getLength(); i++) - { - final Node attr = attributes.item(i); - final NodeValidationVisitor visitor = - (NodeValidationVisitor) _attributeVisitors.get(attr.getNodeName()); - if (visitor != null) - { - visitor.validate(attr, messages, file); - } - } - - for (int i = 0; i < node.getChildNodes().getLength(); i++) - { - final Node child = node.getChildNodes().item(i); - final NodeValidationVisitor visitor = - (NodeValidationVisitor) _elementVisitors.get(child.getNodeName()); - if (visitor != null) - { - visitor.validate(child, messages, file); - } - } - } - - /** - * Do the validation for this visitor on this node. Add any Message's to - * the messages list - * - * @param node - * @param messages - * @param file - */ - protected abstract void doValidate(Node node, List messages, IFile file); - - /** - * @return an array of visitors that validate children of the current node - */ - protected abstract NodeValidationVisitor[] getChildNodeValidators(); - - /** - * @return the node type for this validator - */ - protected short getNodeType() - { - return _nodeType; - } - - /** - * @return the node name for this validator - */ - protected String getNodeName() - { - return _nodeName; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/PropertyNameValidationVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/PropertyNameValidationVisitor.java deleted file mode 100644 index f58804dc5..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/PropertyNameValidationVisitor.java +++ /dev/null @@ -1,101 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.validation.internal.appconfig; - -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.jst.jsf.facesconfig.emf.PropertyNameType; - -/** - * Validate the validation property name - * - * @author cbateman - */ -class PropertyNameValidationVisitor extends EObjectValidationVisitor -{ - private final EStructuralFeature _parentClassNameFeature; - - /** - * @param feature - * @param parentClassNameFeature - * @param version - */ - public PropertyNameValidationVisitor(EStructuralFeature feature, - EStructuralFeature parentClassNameFeature, String version) - { - super(feature, version); - _parentClassNameFeature = parentClassNameFeature; - } - - protected EObjectValidationVisitor[] getChildNodeValidators() - { - return PropertyValidationVisitor.NO_CHILDREN; - } - - protected void doValidate(EObject object, List messages, IFile file) - { - final String parentClassType = getParentClassType(object); - - if (parentClassType != null) - { - String typeSig = - PropertyValidationVisitor.validateProperty((PropertyNameType)object - , file.getProject(), parentClassType); - final String propertyName = - ((PropertyNameType)object).getTextContent(); - - if (typeSig == null) - { - PropertyValidationVisitor.addMessageInfo(messages, - DiagnosticFactory - .create_BEAN_PROPERTY_NOT_FOUND - (propertyName, parentClassType) - , object, file); - } - } - } - - private String getParentClassType(EObject object) - { - String parentClassType = null; - - // need to derive the parent's type - final EObject property = object.eContainer(); - if (property != null) - { - EObject owningObject = property.eContainer(); - - if (owningObject != null) - { - final EObject parentClassTypeObject = - (EObject) owningObject.eGet(_parentClassNameFeature); - - if (parentClassTypeObject != null) - { - final EStructuralFeature feature = - parentClassTypeObject.eClass() - .getEStructuralFeature("textContent"); - - if (feature != null) - { - parentClassType = (String) - parentClassTypeObject.eGet(feature); - } - } - } - } - - return parentClassType; - } -}
\ No newline at end of file diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/PropertyValidationVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/PropertyValidationVisitor.java deleted file mode 100644 index be9f5ec4d..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/PropertyValidationVisitor.java +++ /dev/null @@ -1,110 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.validation.internal.appconfig; - -import java.util.List; -import java.util.Map; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jst.jsf.common.util.JDTBeanIntrospector; -import org.eclipse.jst.jsf.common.util.JDTBeanProperty; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage; -import org.eclipse.jst.jsf.facesconfig.emf.PropertyNameType; - -/** - * Validates property's - * - */ -public class PropertyValidationVisitor extends EObjectValidationVisitor -{ - private final EStructuralFeature _parentClassName; - - /** - * @param feature - * @param parentClassName - * @param version - */ - public PropertyValidationVisitor(EStructuralFeature feature, EStructuralFeature parentClassName, String version) { - // this validator can be attached to numerous parents so it - // cannot hard-code its feature - super(feature,version); - _parentClassName = parentClassName; - } - - protected void doValidate(EObject object, List messages, IFile file) { - // validate the class type here because we need knowledge - // of the property name to do it - //TODO: -// final PropertyType property = (PropertyType) object; -// final String propertyClass = -// property.getPropertyClass().getTextContent(); -// final String propertySignature = -// validateProperty(property.getPropertyName() -// , file.getProject(), _parentClassType); -// -// if (propertySignature != null -// && Signature.) -// { -// Signature.create -// } - } - - protected EObjectValidationVisitor[] getChildNodeValidators() { - return new EObjectValidationVisitor[] - { - new PropertyNameValidationVisitor(FacesConfigPackage.eINSTANCE.getPropertyType_PropertyName(), - _parentClassName, getVersion()) - }; - } - - static String validateProperty(PropertyNameType object, IProject project, String parentClassType) - { - String signatureBeanProperty = null; - try - { - IJavaProject javaProject = JavaCore.create(project); - IType type = javaProject.findType(parentClassType); - - if (type != null) - { - final JDTBeanIntrospector introspector = - new JDTBeanIntrospector(type); - - final Map properties = introspector.getProperties(); - - final String propertyName = object.getTextContent(); - if (properties.containsKey(propertyName)) - { - final JDTBeanProperty beanProperty = - (JDTBeanProperty) properties.get(propertyName); - signatureBeanProperty = - beanProperty.getTypeSignature(); - } - } - } - catch(JavaModelException jme) - { - JSFCorePlugin - .log(new Exception(jme), - "Problem validating on parent: "+parentClassType); - } - - return signatureBeanProperty; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/RenderKitValidationVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/RenderKitValidationVisitor.java deleted file mode 100644 index a7b474b05..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/RenderKitValidationVisitor.java +++ /dev/null @@ -1,79 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.validation.internal.appconfig; - -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage; -import org.eclipse.jst.jsf.facesconfig.emf.RenderKitClassType; - -/** - * Validates the renderkit - */ -public class RenderKitValidationVisitor extends EObjectValidationVisitor -{ - - /** - * @param version - */ - public RenderKitValidationVisitor(String version) - { - super(FacesConfigPackage.eINSTANCE.getFacesConfigType_RenderKit() - ,version); - } - - protected void doValidate(EObject object, List messages, IFile file) - { - // nothing to do - } - - protected EObjectValidationVisitor[] getChildNodeValidators() - { - return new EObjectValidationVisitor[] - { - new RenderKitClassValidationVisitor(getVersion()), - new RendererValidationVisitor(getVersion()) - }; - } - - private static class RenderKitClassValidationVisitor extends ClassNameEObjectValidationVisitor - { - /** - * @param version - */ - public RenderKitClassValidationVisitor(String version) - { - super(FacesConfigPackage.eINSTANCE.getRenderKitType_RenderKitClass() - , version); - } - - protected String getFullyQualifiedName(EObject eobj) - { - return ((RenderKitClassType)eobj).getTextContent(); - } - - protected String getInstanceOf() { - return "javax.faces.render.RenderKit"; - } - - protected EObjectValidationVisitor[] getChildNodeValidators() { - return NO_CHILDREN; - } - - @Override - protected boolean mustBeClass() { - // must be a class - return true; - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/RendererValidationVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/RendererValidationVisitor.java deleted file mode 100644 index d92fabdea..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/RendererValidationVisitor.java +++ /dev/null @@ -1,79 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.validation.internal.appconfig; - -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage; -import org.eclipse.jst.jsf.facesconfig.emf.RendererClassType; - -/** - * Renderer validation - * - */ -public class RendererValidationVisitor extends EObjectValidationVisitor { - - /** - * @param version - */ - public RendererValidationVisitor(String version) - { - super(FacesConfigPackage.eINSTANCE.getRenderKitType_Renderer(), - version); - } - - protected void doValidate(EObject object, List messages, IFile file) { - // nothing to do - } - - protected EObjectValidationVisitor[] getChildNodeValidators() { - return new EObjectValidationVisitor[] - { - new RendererClassValidationVisitor(getVersion()) - , new AttributeValidationVisitor - (FacesConfigPackage.eINSTANCE.getRendererType_Attribute() - , getVersion()) - }; - } - - private static class RendererClassValidationVisitor extends ClassNameEObjectValidationVisitor - { - /** - * @param version - */ - public RendererClassValidationVisitor(String version) - { - super(FacesConfigPackage.eINSTANCE.getRendererType_RendererClass() - , version); - } - - protected String getFullyQualifiedName(EObject eobj) - { - return ((RendererClassType)eobj).getTextContent(); - } - - protected String getInstanceOf() { - return "javax.faces.render.Renderer"; - } - - protected EObjectValidationVisitor[] getChildNodeValidators() { - return NO_CHILDREN; - } - - @Override - protected boolean mustBeClass() { - // must be a class - return true; - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/ValidatorTypeValidationVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/ValidatorTypeValidationVisitor.java deleted file mode 100644 index 512e3c7e8..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/ValidatorTypeValidationVisitor.java +++ /dev/null @@ -1,79 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.validation.internal.appconfig; - -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage; -import org.eclipse.jst.jsf.facesconfig.emf.ValidatorClassType; - -/** - * Validation visitor for the Validator faces config model sub-type - * @author cbateman - * - */ -public class ValidatorTypeValidationVisitor extends EObjectValidationVisitor { - - /** - * @param version - */ - public ValidatorTypeValidationVisitor(final String version) - { - super(FacesConfigPackage.eINSTANCE.getFacesConfigType_Validator(), - version); - } - - protected void doValidate(EObject object, List messages, IFile file) { - // nothing in the tag to validate - } - - protected EObjectValidationVisitor[] getChildNodeValidators() { - return new EObjectValidationVisitor[] - { - new ValidatorClassValidationVisitor(getVersion()), - new AttributeValidationVisitor(FacesConfigPackage.eINSTANCE.getValidatorType_Attribute(), getVersion()), - new PropertyValidationVisitor - (FacesConfigPackage.eINSTANCE.getValidatorType_Property() - ,FacesConfigPackage.eINSTANCE.getValidatorType_ValidatorClass() - ,getVersion()), - }; - } - - private static class ValidatorClassValidationVisitor extends ClassNameEObjectValidationVisitor - { - ValidatorClassValidationVisitor(final String version) - { - super(FacesConfigPackage.eINSTANCE.getValidatorType_ValidatorClass(), - version); - } - - protected String getFullyQualifiedName(EObject eobj) - { - return ((ValidatorClassType)eobj).getTextContent(); - } - - protected String getInstanceOf() { - return "javax.faces.validator.Validator"; - } - - protected EObjectValidationVisitor[] getChildNodeValidators() { - return NO_CHILDREN; - } - - @Override - protected boolean mustBeClass() { - // must be a class - return true; - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/ViewIdValidator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/ViewIdValidator.java deleted file mode 100644 index 6c2a06734..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/ViewIdValidator.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.validation.internal.appconfig; - - -/** - * @author cbateman - * - */ -public abstract class ViewIdValidator extends NodeValidationVisitor -{ - /** - * @param nodeType - * @param nodeName - */ - protected ViewIdValidator(final short nodeType, final String nodeName) - { - super(nodeType, nodeName); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/messages.properties b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/messages.properties deleted file mode 100644 index 37da6845f..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/messages.properties +++ /dev/null @@ -1,27 +0,0 @@ -############################################################################### -# Copyright (c) 2001, 2007 Oracle Corporation and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle Corporation - initial API and implementation -############################################################################### -EL_EXPR_MUST_BE_IN_HASH_BRACES_ID=EL expression must be of the form #{expression} -SYNTAX_ERROR_IN_EL_ID=Syntax error in EL -CANNOT_FIND_CLASS_NAME_ID=Cannot find fully qualified class: {0} -FULLY_QUALIFIED_NAME_MUST_BE_A_CLASS_ID=Fully qualified name must be a class: {0} -CLASS_MUST_BE_INSTANCE_OF_ID=Class {0} must {1} the type {2} -CLASS_MUST_BE_CONCRETE_ID=Class {0} must be concrete (not abstract) -API_DEPRECATED_AFTER_VERSION_ID=API {0} is deprecated after JSF {1}. Use {2} instead. -BEAN_PROPERTY_NOT_FOUND_ID=Bean property {0} not found on parent class {1} -MUST_BE_A_VALID_JAVA_IDENT_ID={0} must be a valid Java identifier -BEAN_SCOPE_NOT_VALID_ID=Managed bean scope must be one of: request, session, application, none -MAP_ENTRIES_CAN_ONLY_BE_SET_ON_MAP_TYPE_ID=Map entries can only be set on objects of type Map. {0} is not an instance of type java.util.Map -LIST_ENTRIES_CAN_ONLY_BE_SET_ON_LIST_TYPE_ID=List entries can only be set on objects of type List. {0} is not an instance of type java.util.List -API_NOT_AVAILABLE_BEFORE_VERSION_ID=API {0} is not avaiable before JSF {1}. Use {2} instead. -APP_CONFIG_IS_NEWER_THAN_JSF_VERSION_ID=Faces 1.2 application configuration cannot be used in projects for Faces 1.1 or before -APP_CONFIG_IS_OLDER_THAN_JSF_VERSION_ID=Faces {0} application configuration being used in Faces {1} project. Not all Faces {1} features will be available" -LOCALE_FORMAT_NOT_VALID_ID=Locale format must be of the form lang_[_country[_variant]] like en or en_US or ja_JP_SJIS -AppConfigValidationUtil_0=extend diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/ConstraintsFactory.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/ConstraintsFactory.java deleted file mode 100644 index 0df2966b4..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/ConstraintsFactory.java +++ /dev/null @@ -1,64 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: ConstraintsFactory.java,v 1.1 2007/02/28 21:16:02 cbateman Exp $ - */ -package org.eclipse.jst.jsf.validation.internal.constraints; - -import org.eclipse.emf.ecore.EFactory; - -/** - * <!-- begin-user-doc --> - * The <b>Factory</b> for the model. - * It provides a create method for each non-abstract class of the model. - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.validation.internal.constraints.ConstraintsPackage - * @generated - */ -public interface ConstraintsFactory extends EFactory { - /** - * The singleton instance of the factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - ConstraintsFactory eINSTANCE = org.eclipse.jst.jsf.validation.internal.constraints.impl.ConstraintsFactoryImpl.init(); - - /** - * Returns a new object of class '<em>Tag Id</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Tag Id</em>'. - * @generated - */ - TagId createTagId(); - - /** - * Returns a new object of class '<em>Tag Set</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Tag Set</em>'. - * @generated - */ - TagSet createTagSet(); - - /** - * Returns a new object of class '<em>Contains Tag Constraint</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Contains Tag Constraint</em>'. - * @generated - */ - ContainsTagConstraint createContainsTagConstraint(); - - /** - * Returns the package supported by this factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the package supported by this factory. - * @generated - */ - ConstraintsPackage getConstraintsPackage(); - -} //ConstraintsFactory diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/ConstraintsPackage.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/ConstraintsPackage.java deleted file mode 100644 index 5e140ea18..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/ConstraintsPackage.java +++ /dev/null @@ -1,353 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: ConstraintsPackage.java,v 1.4 2008/02/01 21:52:24 gkessler Exp $ - */ -package org.eclipse.jst.jsf.validation.internal.constraints; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; - -/** - * <!-- begin-user-doc --> - * The <b>Package</b> for the model. - * It contains accessors for the meta objects to represent - * <ul> - * <li>each class,</li> - * <li>each feature of each class,</li> - * <li>each enum,</li> - * <li>and each data type</li> - * </ul> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.validation.internal.constraints.ConstraintsFactory - * @model kind="package" - * @generated - */ -@SuppressWarnings("hiding") -public interface ConstraintsPackage extends EPackage { - /** - * The package name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNAME = "constraints"; - - /** - * The package namespace URI. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNS_URI = "http://org.eclipse.jst.jsf.core/constraints.ecore"; - - /** - * The package namespace name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNS_PREFIX = "cnst"; - - /** - * The singleton instance of the package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - ConstraintsPackage eINSTANCE = org.eclipse.jst.jsf.validation.internal.constraints.impl.ConstraintsPackageImpl.init(); - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.validation.internal.constraints.impl.TagIdImpl <em>Tag Id</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.validation.internal.constraints.impl.TagIdImpl - * @see org.eclipse.jst.jsf.validation.internal.constraints.impl.ConstraintsPackageImpl#getTagId() - * @generated - */ - int TAG_ID = 0; - - /** - * The feature id for the '<em><b>Uri</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int TAG_ID__URI = 0; - - /** - * The feature id for the '<em><b>Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int TAG_ID__NAME = 1; - - /** - * The number of structural features of the '<em>Tag Id</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int TAG_ID_FEATURE_COUNT = 2; - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.validation.internal.constraints.impl.TagSetImpl <em>Tag Set</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.validation.internal.constraints.impl.TagSetImpl - * @see org.eclipse.jst.jsf.validation.internal.constraints.impl.ConstraintsPackageImpl#getTagSet() - * @generated - */ - int TAG_SET = 1; - - /** - * The feature id for the '<em><b>Tags</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int TAG_SET__TAGS = 0; - - /** - * The number of structural features of the '<em>Tag Set</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int TAG_SET_FEATURE_COUNT = 1; - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.validation.internal.constraints.impl.ContainsTagConstraintImpl <em>Contains Tag Constraint</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.validation.internal.constraints.impl.ContainsTagConstraintImpl - * @see org.eclipse.jst.jsf.validation.internal.constraints.impl.ConstraintsPackageImpl#getContainsTagConstraint() - * @generated - */ - int CONTAINS_TAG_CONSTRAINT = 2; - - /** - * The feature id for the '<em><b>Set Generator</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int CONTAINS_TAG_CONSTRAINT__SET_GENERATOR = 0; - - /** - * The feature id for the '<em><b>Satisfies Set</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int CONTAINS_TAG_CONSTRAINT__SATISFIES_SET = 1; - - /** - * The number of structural features of the '<em>Contains Tag Constraint</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int CONTAINS_TAG_CONSTRAINT_FEATURE_COUNT = 2; - - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.validation.internal.constraints.TagId <em>Tag Id</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Tag Id</em>'. - * @see org.eclipse.jst.jsf.validation.internal.constraints.TagId - * @generated - */ - EClass getTagId(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.validation.internal.constraints.TagId#getUri <em>Uri</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Uri</em>'. - * @see org.eclipse.jst.jsf.validation.internal.constraints.TagId#getUri() - * @see #getTagId() - * @generated - */ - EAttribute getTagId_Uri(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.validation.internal.constraints.TagId#getName <em>Name</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Name</em>'. - * @see org.eclipse.jst.jsf.validation.internal.constraints.TagId#getName() - * @see #getTagId() - * @generated - */ - EAttribute getTagId_Name(); - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.validation.internal.constraints.TagSet <em>Tag Set</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Tag Set</em>'. - * @see org.eclipse.jst.jsf.validation.internal.constraints.TagSet - * @generated - */ - EClass getTagSet(); - - /** - * Returns the meta object for the reference list '{@link org.eclipse.jst.jsf.validation.internal.constraints.TagSet#getTags <em>Tags</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the reference list '<em>Tags</em>'. - * @see org.eclipse.jst.jsf.validation.internal.constraints.TagSet#getTags() - * @see #getTagSet() - * @generated - */ - EReference getTagSet_Tags(); - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.validation.internal.constraints.ContainsTagConstraint <em>Contains Tag Constraint</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Contains Tag Constraint</em>'. - * @see org.eclipse.jst.jsf.validation.internal.constraints.ContainsTagConstraint - * @generated - */ - EClass getContainsTagConstraint(); - - /** - * Returns the meta object for the reference '{@link org.eclipse.jst.jsf.validation.internal.constraints.ContainsTagConstraint#getSetGenerator <em>Set Generator</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the reference '<em>Set Generator</em>'. - * @see org.eclipse.jst.jsf.validation.internal.constraints.ContainsTagConstraint#getSetGenerator() - * @see #getContainsTagConstraint() - * @generated - */ - EReference getContainsTagConstraint_SetGenerator(); - - /** - * Returns the meta object for the reference '{@link org.eclipse.jst.jsf.validation.internal.constraints.ContainsTagConstraint#getSatisfiesSet <em>Satisfies Set</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the reference '<em>Satisfies Set</em>'. - * @see org.eclipse.jst.jsf.validation.internal.constraints.ContainsTagConstraint#getSatisfiesSet() - * @see #getContainsTagConstraint() - * @generated - */ - EReference getContainsTagConstraint_SatisfiesSet(); - - /** - * Returns the factory that creates the instances of the model. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the factory that creates the instances of the model. - * @generated - */ - ConstraintsFactory getConstraintsFactory(); - - /** - * <!-- begin-user-doc --> - * Defines literals for the meta objects that represent - * <ul> - * <li>each class,</li> - * <li>each feature of each class,</li> - * <li>each enum,</li> - * <li>and each data type</li> - * </ul> - * <!-- end-user-doc --> - * @generated - */ - interface Literals { - /** - * The meta object literal for the '{@link org.eclipse.jst.jsf.validation.internal.constraints.impl.TagIdImpl <em>Tag Id</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.validation.internal.constraints.impl.TagIdImpl - * @see org.eclipse.jst.jsf.validation.internal.constraints.impl.ConstraintsPackageImpl#getTagId() - * @generated - */ - // @SuppressWarnings("hiding") - EClass TAG_ID = eINSTANCE.getTagId(); - - /** - * The meta object literal for the '<em><b>Uri</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - // @SuppressWarnings("hiding") - EAttribute TAG_ID__URI = eINSTANCE.getTagId_Uri(); - - /** - * The meta object literal for the '<em><b>Name</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - // @SuppressWarnings("hiding") - EAttribute TAG_ID__NAME = eINSTANCE.getTagId_Name(); - - /** - * The meta object literal for the '{@link org.eclipse.jst.jsf.validation.internal.constraints.impl.TagSetImpl <em>Tag Set</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.validation.internal.constraints.impl.TagSetImpl - * @see org.eclipse.jst.jsf.validation.internal.constraints.impl.ConstraintsPackageImpl#getTagSet() - * @generated - */ - // @SuppressWarnings("hiding") - EClass TAG_SET = eINSTANCE.getTagSet(); - - /** - * The meta object literal for the '<em><b>Tags</b></em>' reference list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - // @SuppressWarnings("hiding") - EReference TAG_SET__TAGS = eINSTANCE.getTagSet_Tags(); - - /** - * The meta object literal for the '{@link org.eclipse.jst.jsf.validation.internal.constraints.impl.ContainsTagConstraintImpl <em>Contains Tag Constraint</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.validation.internal.constraints.impl.ContainsTagConstraintImpl - * @see org.eclipse.jst.jsf.validation.internal.constraints.impl.ConstraintsPackageImpl#getContainsTagConstraint() - * @generated - */ - // @SuppressWarnings("hiding") - EClass CONTAINS_TAG_CONSTRAINT = eINSTANCE.getContainsTagConstraint(); - - /** - * The meta object literal for the '<em><b>Set Generator</b></em>' reference feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - // @SuppressWarnings("hiding") - EReference CONTAINS_TAG_CONSTRAINT__SET_GENERATOR = eINSTANCE.getContainsTagConstraint_SetGenerator(); - - /** - * The meta object literal for the '<em><b>Satisfies Set</b></em>' reference feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - // @SuppressWarnings("hiding") - EReference CONTAINS_TAG_CONSTRAINT__SATISFIES_SET = eINSTANCE.getContainsTagConstraint_SatisfiesSet(); - - } - -} //ConstraintsPackage diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/ContainsTagConstraint.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/ContainsTagConstraint.java deleted file mode 100644 index d91e5c064..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/ContainsTagConstraint.java +++ /dev/null @@ -1,83 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: ContainsTagConstraint.java,v 1.2 2007/04/16 19:53:29 itrimble Exp $ - */ -package org.eclipse.jst.jsf.validation.internal.constraints; - -import org.eclipse.emf.ecore.EObject; - -import org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.SetGenerator; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Contains Tag Constraint</b></em>'. - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.jst.jsf.validation.internal.constraints.ContainsTagConstraint#getSetGenerator <em>Set Generator</em>}</li> - * <li>{@link org.eclipse.jst.jsf.validation.internal.constraints.ContainsTagConstraint#getSatisfiesSet <em>Satisfies Set</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.jst.jsf.validation.internal.constraints.ConstraintsPackage#getContainsTagConstraint() - * @model - * @generated - */ -public interface ContainsTagConstraint extends EObject { - /** - * Returns the value of the '<em><b>Set Generator</b></em>' reference. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Set Generator</em>' reference isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Set Generator</em>' reference. - * @see #setSetGenerator(SetGenerator) - * @see org.eclipse.jst.jsf.validation.internal.constraints.ConstraintsPackage#getContainsTagConstraint_SetGenerator() - * @model extendedMetaData="kind='element' name='set-generator'" - * @generated - */ - SetGenerator getSetGenerator(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.validation.internal.constraints.ContainsTagConstraint#getSetGenerator <em>Set Generator</em>}' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Set Generator</em>' reference. - * @see #getSetGenerator() - * @generated - */ - void setSetGenerator(SetGenerator value); - - /** - * Returns the value of the '<em><b>Satisfies Set</b></em>' reference. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Satisfies Set</em>' reference isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Satisfies Set</em>' reference. - * @see #setSatisfiesSet(TagSet) - * @see org.eclipse.jst.jsf.validation.internal.constraints.ConstraintsPackage#getContainsTagConstraint_SatisfiesSet() - * @model extendedMetaData="kind='element' name='satisfies-set'" - * @generated - */ - TagSet getSatisfiesSet(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.validation.internal.constraints.ContainsTagConstraint#getSatisfiesSet <em>Satisfies Set</em>}' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Satisfies Set</em>' reference. - * @see #getSatisfiesSet() - * @generated - */ - void setSatisfiesSet(TagSet value); - -} // ContainsTagConstraint diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/TagId.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/TagId.java deleted file mode 100644 index 5c5ebb12b..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/TagId.java +++ /dev/null @@ -1,81 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: TagId.java,v 1.1 2007/02/28 21:16:02 cbateman Exp $ - */ -package org.eclipse.jst.jsf.validation.internal.constraints; - -import org.eclipse.emf.ecore.EObject; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Tag Id</b></em>'. - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.jst.jsf.validation.internal.constraints.TagId#getUri <em>Uri</em>}</li> - * <li>{@link org.eclipse.jst.jsf.validation.internal.constraints.TagId#getName <em>Name</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.jst.jsf.validation.internal.constraints.ConstraintsPackage#getTagId() - * @model - * @generated - */ -public interface TagId extends EObject { - /** - * Returns the value of the '<em><b>Uri</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Uri</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Uri</em>' attribute. - * @see #setUri(String) - * @see org.eclipse.jst.jsf.validation.internal.constraints.ConstraintsPackage#getTagId_Uri() - * @model extendedMetaData="kind='element'" - * @generated - */ - String getUri(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.validation.internal.constraints.TagId#getUri <em>Uri</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Uri</em>' attribute. - * @see #getUri() - * @generated - */ - void setUri(String value); - - /** - * Returns the value of the '<em><b>Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Name</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Name</em>' attribute. - * @see #setName(String) - * @see org.eclipse.jst.jsf.validation.internal.constraints.ConstraintsPackage#getTagId_Name() - * @model extendedMetaData="kind='element'" - * @generated - */ - String getName(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.validation.internal.constraints.TagId#getName <em>Name</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Name</em>' attribute. - * @see #getName() - * @generated - */ - void setName(String value); - -} // TagId diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/TagSet.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/TagSet.java deleted file mode 100644 index 5c60d5ddb..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/TagSet.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: TagSet.java,v 1.1 2007/02/28 21:16:02 cbateman Exp $ - */ -package org.eclipse.jst.jsf.validation.internal.constraints; - -import org.eclipse.emf.common.util.EList; - -import org.eclipse.emf.ecore.EObject; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Tag Set</b></em>'. - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.jst.jsf.validation.internal.constraints.TagSet#getTags <em>Tags</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.jst.jsf.validation.internal.constraints.ConstraintsPackage#getTagSet() - * @model - * @generated - */ -public interface TagSet extends EObject { - /** - * Returns the value of the '<em><b>Tags</b></em>' reference list. - * The list contents are of type {@link org.eclipse.jst.jsf.validation.internal.constraints.TagId}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Tags</em>' reference list isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Tags</em>' reference list. - * @see org.eclipse.jst.jsf.validation.internal.constraints.ConstraintsPackage#getTagSet_Tags() - * @model type="org.eclipse.jst.jsf.validation.internal.constraints.TagId" - * @generated - */ - EList getTags(); - -} // TagSet diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/impl/ConstraintsFactoryImpl.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/impl/ConstraintsFactoryImpl.java deleted file mode 100644 index f83091de0..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/impl/ConstraintsFactoryImpl.java +++ /dev/null @@ -1,127 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: ConstraintsFactoryImpl.java,v 1.2 2007/03/22 23:56:16 cbateman Exp $ - */ -package org.eclipse.jst.jsf.validation.internal.constraints.impl; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; - -import org.eclipse.emf.ecore.impl.EFactoryImpl; - -import org.eclipse.emf.ecore.plugin.EcorePlugin; - -import org.eclipse.jst.jsf.validation.internal.constraints.*; - -/** - * <!-- begin-user-doc --> - * An implementation of the model <b>Factory</b>. - * <!-- end-user-doc --> - * @generated - */ -public class ConstraintsFactoryImpl extends EFactoryImpl implements ConstraintsFactory { - /** - * Creates the default factory implementation. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the constraints factory - * @generated - */ - public static ConstraintsFactory init() { - try { - ConstraintsFactory theConstraintsFactory = (ConstraintsFactory)EPackage.Registry.INSTANCE.getEFactory("http://org.eclipse.jst.jsf.core/constraints.ecore"); - if (theConstraintsFactory != null) { - return theConstraintsFactory; - } - } - catch (Exception exception) { - EcorePlugin.INSTANCE.log(exception); - } - return new ConstraintsFactoryImpl(); - } - - /** - * Creates an instance of the factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ConstraintsFactoryImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param eClass - * @return the eobject for the class - * @generated - */ - public EObject create(EClass eClass) { - switch (eClass.getClassifierID()) { - case ConstraintsPackage.TAG_ID: return createTagId(); - case ConstraintsPackage.TAG_SET: return createTagSet(); - case ConstraintsPackage.CONTAINS_TAG_CONSTRAINT: return createContainsTagConstraint(); - default: - throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new tag id - * @generated - */ - public TagId createTagId() { - TagIdImpl tagId = new TagIdImpl(); - return tagId; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new tag set - * @generated - */ - public TagSet createTagSet() { - TagSetImpl tagSet = new TagSetImpl(); - return tagSet; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new Contains Tag Constraint - * @generated - */ - public ContainsTagConstraint createContainsTagConstraint() { - ContainsTagConstraintImpl containsTagConstraint = new ContainsTagConstraintImpl(); - return containsTagConstraint; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the constraints package - * @generated - */ - public ConstraintsPackage getConstraintsPackage() { - return (ConstraintsPackage)getEPackage(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the package - * @deprecated - * @generated - */ - public static ConstraintsPackage getPackage() { - return ConstraintsPackage.eINSTANCE; - } - -} //ConstraintsFactoryImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/impl/ConstraintsPackageImpl.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/impl/ConstraintsPackageImpl.java deleted file mode 100644 index fc60ec767..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/impl/ConstraintsPackageImpl.java +++ /dev/null @@ -1,329 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: ConstraintsPackageImpl.java,v 1.3 2007/04/16 19:53:19 itrimble Exp $ - */ -package org.eclipse.jst.jsf.validation.internal.constraints.impl; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; - -import org.eclipse.emf.ecore.impl.EPackageImpl; - -import org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.TraitTypesPackage; - -import org.eclipse.jst.jsf.validation.internal.constraints.ConstraintsFactory; -import org.eclipse.jst.jsf.validation.internal.constraints.ConstraintsPackage; -import org.eclipse.jst.jsf.validation.internal.constraints.ContainsTagConstraint; -import org.eclipse.jst.jsf.validation.internal.constraints.TagId; -import org.eclipse.jst.jsf.validation.internal.constraints.TagSet; - -/** - * <!-- begin-user-doc --> - * An implementation of the model <b>Package</b>. - * <!-- end-user-doc --> - * @generated - */ -public class ConstraintsPackageImpl extends EPackageImpl implements ConstraintsPackage { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass tagIdEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass tagSetEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass containsTagConstraintEClass = null; - - /** - * Creates an instance of the model <b>Package</b>, registered with - * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package - * package URI value. - * <p>Note: the correct way to create the package is via the static - * factory method {@link #init init()}, which also performs - * initialization of the package, or returns the registered package, - * if one already exists. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.ecore.EPackage.Registry - * @see org.eclipse.jst.jsf.validation.internal.constraints.ConstraintsPackage#eNS_URI - * @see #init() - * @generated - */ - private ConstraintsPackageImpl() { - super(eNS_URI, ConstraintsFactory.eINSTANCE); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private static boolean isInited = false; - - /** - * Creates, registers, and initializes the <b>Package</b> for this - * model, and for any others upon which it depends. Simple - * dependencies are satisfied by calling this method on all - * dependent packages before doing anything else. This method drives - * initialization for interdependent packages directly, in parallel - * with this package, itself. - * <p>Of this package and its interdependencies, all packages which - * have not yet been registered by their URI values are first created - * and registered. The packages are then initialized in two steps: - * meta-model objects for all of the packages are created before any - * are initialized, since one package's meta-model objects may refer to - * those of another. - * <p>Invocation of this method will not affect any packages that have - * already been initialized. - * <!-- begin-user-doc --> - * @return the initialized package - * <!-- end-user-doc --> - * @see #eNS_URI - * @see #createPackageContents() - * @see #initializePackageContents() - * @generated - */ - public static ConstraintsPackage init() { - if (isInited) return (ConstraintsPackage)EPackage.Registry.INSTANCE.getEPackage(ConstraintsPackage.eNS_URI); - - // Obtain or create and register package - ConstraintsPackageImpl theConstraintsPackage = (ConstraintsPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(eNS_URI) instanceof ConstraintsPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(eNS_URI) : new ConstraintsPackageImpl()); - - isInited = true; - - // Initialize simple dependencies - TraitTypesPackage.eINSTANCE.eClass(); - - // Create package meta-data objects - theConstraintsPackage.createPackageContents(); - - // Initialize created meta-data - theConstraintsPackage.initializePackageContents(); - - // Mark meta-data to indicate it can't be changed - theConstraintsPackage.freeze(); - - return theConstraintsPackage; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getTagId() { - return tagIdEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getTagId_Uri() { - return (EAttribute)tagIdEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getTagId_Name() { - return (EAttribute)tagIdEClass.getEStructuralFeatures().get(1); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getTagSet() { - return tagSetEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getTagSet_Tags() { - return (EReference)tagSetEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getContainsTagConstraint() { - return containsTagConstraintEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getContainsTagConstraint_SetGenerator() { - return (EReference)containsTagConstraintEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getContainsTagConstraint_SatisfiesSet() { - return (EReference)containsTagConstraintEClass.getEStructuralFeatures().get(1); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ConstraintsFactory getConstraintsFactory() { - return (ConstraintsFactory)getEFactoryInstance(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private boolean isCreated = false; - - /** - * Creates the meta-model objects for the package. This method is - * guarded to have no affect on any invocation but its first. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void createPackageContents() { - if (isCreated) return; - isCreated = true; - - // Create classes and their features - tagIdEClass = createEClass(TAG_ID); - createEAttribute(tagIdEClass, TAG_ID__URI); - createEAttribute(tagIdEClass, TAG_ID__NAME); - - tagSetEClass = createEClass(TAG_SET); - createEReference(tagSetEClass, TAG_SET__TAGS); - - containsTagConstraintEClass = createEClass(CONTAINS_TAG_CONSTRAINT); - createEReference(containsTagConstraintEClass, CONTAINS_TAG_CONSTRAINT__SET_GENERATOR); - createEReference(containsTagConstraintEClass, CONTAINS_TAG_CONSTRAINT__SATISFIES_SET); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private boolean isInitialized = false; - - /** - * Complete the initialization of the package and its meta-model. This - * method is guarded to have no affect on any invocation but its first. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void initializePackageContents() { - if (isInitialized) return; - isInitialized = true; - - // Initialize package - setName(eNAME); - setNsPrefix(eNS_PREFIX); - setNsURI(eNS_URI); - - // Obtain other dependent packages - TraitTypesPackage theTraitTypesPackage = (TraitTypesPackage)EPackage.Registry.INSTANCE.getEPackage(TraitTypesPackage.eNS_URI); - - // Add supertypes to classes - - // Initialize classes and features; add operations and parameters - initEClass(tagIdEClass, TagId.class, "TagId", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEAttribute(getTagId_Uri(), ecorePackage.getEString(), "uri", null, 0, 1, TagId.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getTagId_Name(), ecorePackage.getEString(), "name", null, 0, 1, TagId.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - - initEClass(tagSetEClass, TagSet.class, "TagSet", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEReference(getTagSet_Tags(), this.getTagId(), null, "tags", null, 0, -1, TagSet.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - - initEClass(containsTagConstraintEClass, ContainsTagConstraint.class, "ContainsTagConstraint", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEReference(getContainsTagConstraint_SetGenerator(), theTraitTypesPackage.getSetGenerator(), null, "setGenerator", null, 0, 1, ContainsTagConstraint.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEReference(getContainsTagConstraint_SatisfiesSet(), this.getTagSet(), null, "satisfiesSet", null, 0, 1, ContainsTagConstraint.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - - // Create resource - createResource(eNS_URI); - - // Create annotations - // http:///org/eclipse/emf/ecore/util/ExtendedMetaData - createExtendedMetaDataAnnotations(); - } - - /** - * Initializes the annotations for <b>http:///org/eclipse/emf/ecore/util/ExtendedMetaData</b>. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void createExtendedMetaDataAnnotations() { - String source = "http:///org/eclipse/emf/ecore/util/ExtendedMetaData"; - addAnnotation - (getTagId_Uri(), - source, - new String[] { - "kind", "element", - "name", "uri" - }); - addAnnotation - (getTagId_Name(), - source, - new String[] { - "kind", "element", - "name", "name" - }); - addAnnotation - (getTagSet_Tags(), - source, - new String[] { - "kind", "element", - "name", "tagId" - }); - addAnnotation - (getContainsTagConstraint_SetGenerator(), - source, - new String[] { - "kind", "element", - "name", "set-generator" - }); - addAnnotation - (getContainsTagConstraint_SatisfiesSet(), - source, - new String[] { - "kind", "element", - "name", "satisfies-set" - }); - } - -} //ConstraintsPackageImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/impl/ContainsTagConstraintImpl.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/impl/ContainsTagConstraintImpl.java deleted file mode 100644 index d3fad7129..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/impl/ContainsTagConstraintImpl.java +++ /dev/null @@ -1,220 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: ContainsTagConstraintImpl.java,v 1.3 2007/04/16 19:53:19 itrimble Exp $ - */ -package org.eclipse.jst.jsf.validation.internal.constraints.impl; - -import org.eclipse.emf.common.notify.Notification; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.InternalEObject; - -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.impl.EObjectImpl; - -import org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.SetGenerator; - -import org.eclipse.jst.jsf.validation.internal.constraints.ConstraintsPackage; -import org.eclipse.jst.jsf.validation.internal.constraints.ContainsTagConstraint; -import org.eclipse.jst.jsf.validation.internal.constraints.TagSet; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Contains Tag Constraint</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.jst.jsf.validation.internal.constraints.impl.ContainsTagConstraintImpl#getSetGenerator <em>Set Generator</em>}</li> - * <li>{@link org.eclipse.jst.jsf.validation.internal.constraints.impl.ContainsTagConstraintImpl#getSatisfiesSet <em>Satisfies Set</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class ContainsTagConstraintImpl extends EObjectImpl implements ContainsTagConstraint { - /** - * The cached value of the '{@link #getSetGenerator() <em>Set Generator</em>}' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getSetGenerator() - * @generated - * @ordered - */ - protected SetGenerator setGenerator = null; - - /** - * The cached value of the '{@link #getSatisfiesSet() <em>Satisfies Set</em>}' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getSatisfiesSet() - * @generated - * @ordered - */ - protected TagSet satisfiesSet = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ContainsTagConstraintImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EClass eStaticClass() { - return ConstraintsPackage.Literals.CONTAINS_TAG_CONSTRAINT; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public SetGenerator getSetGenerator() { - if (setGenerator != null && setGenerator.eIsProxy()) { - InternalEObject oldSetGenerator = (InternalEObject)setGenerator; - setGenerator = (SetGenerator)eResolveProxy(oldSetGenerator); - if (setGenerator != oldSetGenerator) { - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.RESOLVE, ConstraintsPackage.CONTAINS_TAG_CONSTRAINT__SET_GENERATOR, oldSetGenerator, setGenerator)); - } - } - return setGenerator; - } - - /** - * <!-- begin-user-doc --> - * @return the set generator - * <!-- end-user-doc --> - * @generated - */ - public SetGenerator basicGetSetGenerator() { - return setGenerator; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setSetGenerator(SetGenerator newSetGenerator) { - SetGenerator oldSetGenerator = setGenerator; - setGenerator = newSetGenerator; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, ConstraintsPackage.CONTAINS_TAG_CONSTRAINT__SET_GENERATOR, oldSetGenerator, setGenerator)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public TagSet getSatisfiesSet() { - if (satisfiesSet != null && satisfiesSet.eIsProxy()) { - InternalEObject oldSatisfiesSet = (InternalEObject)satisfiesSet; - satisfiesSet = (TagSet)eResolveProxy(oldSatisfiesSet); - if (satisfiesSet != oldSatisfiesSet) { - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.RESOLVE, ConstraintsPackage.CONTAINS_TAG_CONSTRAINT__SATISFIES_SET, oldSatisfiesSet, satisfiesSet)); - } - } - return satisfiesSet; - } - - /** - * <!-- begin-user-doc --> - * @return the tag set that must be satisfied - * <!-- end-user-doc --> - * @generated - */ - public TagSet basicGetSatisfiesSet() { - return satisfiesSet; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setSatisfiesSet(TagSet newSatisfiesSet) { - TagSet oldSatisfiesSet = satisfiesSet; - satisfiesSet = newSatisfiesSet; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, ConstraintsPackage.CONTAINS_TAG_CONSTRAINT__SATISFIES_SET, oldSatisfiesSet, satisfiesSet)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case ConstraintsPackage.CONTAINS_TAG_CONSTRAINT__SET_GENERATOR: - if (resolve) return getSetGenerator(); - return basicGetSetGenerator(); - case ConstraintsPackage.CONTAINS_TAG_CONSTRAINT__SATISFIES_SET: - if (resolve) return getSatisfiesSet(); - return basicGetSatisfiesSet(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case ConstraintsPackage.CONTAINS_TAG_CONSTRAINT__SET_GENERATOR: - setSetGenerator((SetGenerator)newValue); - return; - case ConstraintsPackage.CONTAINS_TAG_CONSTRAINT__SATISFIES_SET: - setSatisfiesSet((TagSet)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eUnset(int featureID) { - switch (featureID) { - case ConstraintsPackage.CONTAINS_TAG_CONSTRAINT__SET_GENERATOR: - setSetGenerator((SetGenerator)null); - return; - case ConstraintsPackage.CONTAINS_TAG_CONSTRAINT__SATISFIES_SET: - setSatisfiesSet((TagSet)null); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean eIsSet(int featureID) { - switch (featureID) { - case ConstraintsPackage.CONTAINS_TAG_CONSTRAINT__SET_GENERATOR: - return setGenerator != null; - case ConstraintsPackage.CONTAINS_TAG_CONSTRAINT__SATISFIES_SET: - return satisfiesSet != null; - } - return super.eIsSet(featureID); - } - -} //ContainsTagConstraintImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/impl/TagIdImpl.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/impl/TagIdImpl.java deleted file mode 100644 index a4f9985e2..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/impl/TagIdImpl.java +++ /dev/null @@ -1,215 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: TagIdImpl.java,v 1.1 2007/02/28 21:16:02 cbateman Exp $ - */ -package org.eclipse.jst.jsf.validation.internal.constraints.impl; - -import org.eclipse.emf.common.notify.Notification; - -import org.eclipse.emf.ecore.EClass; - -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.impl.EObjectImpl; - -import org.eclipse.jst.jsf.validation.internal.constraints.ConstraintsPackage; -import org.eclipse.jst.jsf.validation.internal.constraints.TagId; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Tag Id</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.jst.jsf.validation.internal.constraints.impl.TagIdImpl#getUri <em>Uri</em>}</li> - * <li>{@link org.eclipse.jst.jsf.validation.internal.constraints.impl.TagIdImpl#getName <em>Name</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class TagIdImpl extends EObjectImpl implements TagId { - /** - * The default value of the '{@link #getUri() <em>Uri</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getUri() - * @generated - * @ordered - */ - protected static final String URI_EDEFAULT = null; - - /** - * The cached value of the '{@link #getUri() <em>Uri</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getUri() - * @generated - * @ordered - */ - protected String uri = URI_EDEFAULT; - - /** - * The default value of the '{@link #getName() <em>Name</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getName() - * @generated - * @ordered - */ - protected static final String NAME_EDEFAULT = null; - - /** - * The cached value of the '{@link #getName() <em>Name</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getName() - * @generated - * @ordered - */ - protected String name = NAME_EDEFAULT; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TagIdImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EClass eStaticClass() { - return ConstraintsPackage.Literals.TAG_ID; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getUri() { - return uri; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setUri(String newUri) { - String oldUri = uri; - uri = newUri; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, ConstraintsPackage.TAG_ID__URI, oldUri, uri)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getName() { - return name; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setName(String newName) { - String oldName = name; - name = newName; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, ConstraintsPackage.TAG_ID__NAME, oldName, name)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case ConstraintsPackage.TAG_ID__URI: - return getUri(); - case ConstraintsPackage.TAG_ID__NAME: - return getName(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case ConstraintsPackage.TAG_ID__URI: - setUri((String)newValue); - return; - case ConstraintsPackage.TAG_ID__NAME: - setName((String)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eUnset(int featureID) { - switch (featureID) { - case ConstraintsPackage.TAG_ID__URI: - setUri(URI_EDEFAULT); - return; - case ConstraintsPackage.TAG_ID__NAME: - setName(NAME_EDEFAULT); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean eIsSet(int featureID) { - switch (featureID) { - case ConstraintsPackage.TAG_ID__URI: - return URI_EDEFAULT == null ? uri != null : !URI_EDEFAULT.equals(uri); - case ConstraintsPackage.TAG_ID__NAME: - return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String toString() { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (uri: "); - result.append(uri); - result.append(", name: "); - result.append(name); - result.append(')'); - return result.toString(); - } - -} //TagIdImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/impl/TagSetImpl.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/impl/TagSetImpl.java deleted file mode 100644 index f3899144a..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/impl/TagSetImpl.java +++ /dev/null @@ -1,132 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: TagSetImpl.java,v 1.1 2007/02/28 21:16:02 cbateman Exp $ - */ -package org.eclipse.jst.jsf.validation.internal.constraints.impl; - -import java.util.Collection; - -import org.eclipse.emf.common.util.EList; - -import org.eclipse.emf.ecore.EClass; - -import org.eclipse.emf.ecore.impl.EObjectImpl; - -import org.eclipse.emf.ecore.util.EObjectResolvingEList; - -import org.eclipse.jst.jsf.validation.internal.constraints.ConstraintsPackage; -import org.eclipse.jst.jsf.validation.internal.constraints.TagId; -import org.eclipse.jst.jsf.validation.internal.constraints.TagSet; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Tag Set</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.jst.jsf.validation.internal.constraints.impl.TagSetImpl#getTags <em>Tags</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class TagSetImpl extends EObjectImpl implements TagSet { - /** - * The cached value of the '{@link #getTags() <em>Tags</em>}' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getTags() - * @generated - * @ordered - */ - protected EList tags = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TagSetImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EClass eStaticClass() { - return ConstraintsPackage.Literals.TAG_SET; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EList getTags() { - if (tags == null) { - tags = new EObjectResolvingEList(TagId.class, this, ConstraintsPackage.TAG_SET__TAGS); - } - return tags; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case ConstraintsPackage.TAG_SET__TAGS: - return getTags(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case ConstraintsPackage.TAG_SET__TAGS: - getTags().clear(); - getTags().addAll((Collection)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eUnset(int featureID) { - switch (featureID) { - case ConstraintsPackage.TAG_SET__TAGS: - getTags().clear(); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean eIsSet(int featureID) { - switch (featureID) { - case ConstraintsPackage.TAG_SET__TAGS: - return tags != null && !tags.isEmpty(); - } - return super.eIsSet(featureID); - } - -} //TagSetImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/util/ConstraintsAdapterFactory.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/util/ConstraintsAdapterFactory.java deleted file mode 100644 index ff1de0e99..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/util/ConstraintsAdapterFactory.java +++ /dev/null @@ -1,154 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: ConstraintsAdapterFactory.java,v 1.1 2007/02/28 21:16:02 cbateman Exp $ - */ -package org.eclipse.jst.jsf.validation.internal.constraints.util; - -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.common.notify.Notifier; - -import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; - -import org.eclipse.emf.ecore.EObject; - -import org.eclipse.jst.jsf.validation.internal.constraints.*; - -/** - * <!-- begin-user-doc --> - * The <b>Adapter Factory</b> for the model. - * It provides an adapter <code>createXXX</code> method for each class of the model. - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.validation.internal.constraints.ConstraintsPackage - * @generated - */ -public class ConstraintsAdapterFactory extends AdapterFactoryImpl { - /** - * The cached model package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected static ConstraintsPackage modelPackage; - - /** - * Creates an instance of the adapter factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ConstraintsAdapterFactory() { - if (modelPackage == null) { - modelPackage = ConstraintsPackage.eINSTANCE; - } - } - - /** - * Returns whether this factory is applicable for the type of the object. - * <!-- begin-user-doc --> - * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model. - * <!-- end-user-doc --> - * @return whether this factory is applicable for the type of the object. - * @generated - */ - public boolean isFactoryForType(Object object) { - if (object == modelPackage) { - return true; - } - if (object instanceof EObject) { - return ((EObject)object).eClass().getEPackage() == modelPackage; - } - return false; - } - - /** - * The switch the delegates to the <code>createXXX</code> methods. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ConstraintsSwitch modelSwitch = - new ConstraintsSwitch() { - public Object caseTagId(TagId object) { - return createTagIdAdapter(); - } - public Object caseTagSet(TagSet object) { - return createTagSetAdapter(); - } - public Object caseContainsTagConstraint(ContainsTagConstraint object) { - return createContainsTagConstraintAdapter(); - } - public Object defaultCase(EObject object) { - return createEObjectAdapter(); - } - }; - - /** - * Creates an adapter for the <code>target</code>. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param target the object to adapt. - * @return the adapter for the <code>target</code>. - * @generated - */ - public Adapter createAdapter(Notifier target) { - return (Adapter)modelSwitch.doSwitch((EObject)target); - } - - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.validation.internal.constraints.TagId <em>Tag Id</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.jst.jsf.validation.internal.constraints.TagId - * @generated - */ - public Adapter createTagIdAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.validation.internal.constraints.TagSet <em>Tag Set</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.jst.jsf.validation.internal.constraints.TagSet - * @generated - */ - public Adapter createTagSetAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.validation.internal.constraints.ContainsTagConstraint <em>Contains Tag Constraint</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.jst.jsf.validation.internal.constraints.ContainsTagConstraint - * @generated - */ - public Adapter createContainsTagConstraintAdapter() { - return null; - } - - /** - * Creates a new adapter for the default case. - * <!-- begin-user-doc --> - * This default implementation returns null. - * <!-- end-user-doc --> - * @return the new adapter. - * @generated - */ - public Adapter createEObjectAdapter() { - return null; - } - -} //ConstraintsAdapterFactory diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/util/ConstraintsResourceFactoryImpl.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/util/ConstraintsResourceFactoryImpl.java deleted file mode 100644 index e0da2ca89..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/util/ConstraintsResourceFactoryImpl.java +++ /dev/null @@ -1,55 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: ConstraintsResourceFactoryImpl.java,v 1.1 2007/02/28 21:16:02 cbateman Exp $ - */ -package org.eclipse.jst.jsf.validation.internal.constraints.util; - -import org.eclipse.emf.common.util.URI; - -import org.eclipse.emf.ecore.resource.Resource; - -import org.eclipse.emf.ecore.resource.impl.ResourceFactoryImpl; - -import org.eclipse.emf.ecore.xmi.XMLResource; - -/** - * <!-- begin-user-doc --> - * The <b>Resource Factory</b> associated with the package. - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.validation.internal.constraints.util.ConstraintsResourceImpl - * @generated - */ -public class ConstraintsResourceFactoryImpl extends ResourceFactoryImpl { - /** - * Creates an instance of the resource factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ConstraintsResourceFactoryImpl() { - super(); - } - - /** - * Creates an instance of the resource. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Resource createResource(URI uri) { - XMLResource result = new ConstraintsResourceImpl(uri); - result.getDefaultSaveOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE); - result.getDefaultLoadOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE); - - result.getDefaultSaveOptions().put(XMLResource.OPTION_SCHEMA_LOCATION, Boolean.TRUE); - - result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, Boolean.TRUE); - result.getDefaultSaveOptions().put(XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, Boolean.TRUE); - - result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_LEXICAL_HANDLER, Boolean.TRUE); - return result; - } - -} //ConstraintsResourceFactoryImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/util/ConstraintsResourceImpl.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/util/ConstraintsResourceImpl.java deleted file mode 100644 index c397df097..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/util/ConstraintsResourceImpl.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: ConstraintsResourceImpl.java,v 1.1 2007/02/28 21:16:02 cbateman Exp $ - */ -package org.eclipse.jst.jsf.validation.internal.constraints.util; - -import org.eclipse.emf.common.util.URI; - -import org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl; - -/** - * <!-- begin-user-doc --> - * The <b>Resource </b> associated with the package. - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.validation.internal.constraints.util.ConstraintsResourceFactoryImpl - * @generated - */ -public class ConstraintsResourceImpl extends XMLResourceImpl { - /** - * Creates an instance of the resource. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param uri the URI of the new resource. - * @generated - */ - public ConstraintsResourceImpl(URI uri) { - super(uri); - } - -} //ConstraintsResourceImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/util/ConstraintsSwitch.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/util/ConstraintsSwitch.java deleted file mode 100644 index 9628616c4..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/util/ConstraintsSwitch.java +++ /dev/null @@ -1,175 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: ConstraintsSwitch.java,v 1.2 2007/04/09 02:40:07 cbateman Exp $ - */ -package org.eclipse.jst.jsf.validation.internal.constraints.util; - -import java.util.List; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; - -import org.eclipse.jst.jsf.validation.internal.constraints.*; - -/** - * <!-- begin-user-doc --> - * The <b>Switch</b> for the model's inheritance hierarchy. - * It supports the call {@link #doSwitch(EObject) doSwitch(object)} - * to invoke the <code>caseXXX</code> method for each class of the model, - * starting with the actual class of the object - * and proceeding up the inheritance hierarchy - * until a non-null result is returned, - * which is the result of the switch. - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.validation.internal.constraints.ConstraintsPackage - * @generated - */ -public class ConstraintsSwitch { - /** - * The cached model package - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected static ConstraintsPackage modelPackage; - - /** - * Creates an instance of the switch. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ConstraintsSwitch() { - if (modelPackage == null) { - modelPackage = ConstraintsPackage.eINSTANCE; - } - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * @param theEObject - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - public Object doSwitch(EObject theEObject) { - return doSwitch(theEObject.eClass(), theEObject); - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * @param theEClass - * @param theEObject - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - protected Object doSwitch(EClass theEClass, EObject theEObject) { - if (theEClass.eContainer() == modelPackage) { - return doSwitch(theEClass.getClassifierID(), theEObject); - } - List eSuperTypes = theEClass.getESuperTypes(); - return - eSuperTypes.isEmpty() ? - defaultCase(theEObject) : - doSwitch((EClass)eSuperTypes.get(0), theEObject); - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * @param classifierID - * @param theEObject - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - protected Object doSwitch(int classifierID, EObject theEObject) { - switch (classifierID) { - case ConstraintsPackage.TAG_ID: { - TagId tagId = (TagId)theEObject; - Object result = caseTagId(tagId); - if (result == null) result = defaultCase(theEObject); - return result; - } - case ConstraintsPackage.TAG_SET: { - TagSet tagSet = (TagSet)theEObject; - Object result = caseTagSet(tagSet); - if (result == null) result = defaultCase(theEObject); - return result; - } - case ConstraintsPackage.CONTAINS_TAG_CONSTRAINT: { - ContainsTagConstraint containsTagConstraint = (ContainsTagConstraint)theEObject; - Object result = caseContainsTagConstraint(containsTagConstraint); - if (result == null) result = defaultCase(theEObject); - return result; - } - default: return defaultCase(theEObject); - } - } - - /** - * Returns the result of interpretting the object as an instance of '<em>Tag Id</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpretting the object as an instance of '<em>Tag Id</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object caseTagId(TagId object) { - return null; - } - - /** - * Returns the result of interpretting the object as an instance of '<em>Tag Set</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpretting the object as an instance of '<em>Tag Set</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object caseTagSet(TagSet object) { - return null; - } - - /** - * Returns the result of interpretting the object as an instance of '<em>Contains Tag Constraint</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpretting the object as an instance of '<em>Contains Tag Constraint</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object caseContainsTagConstraint(ContainsTagConstraint object) { - return null; - } - - /** - * Returns the result of interpretting the object as an instance of '<em>EObject</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch, but this is the last case anyway. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpretting the object as an instance of '<em>EObject</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) - * @generated - */ - public Object defaultCase(EObject object) { - return null; - } - -} //ConstraintsSwitch diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/util/ConstraintsXMLProcessor.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/util/ConstraintsXMLProcessor.java deleted file mode 100644 index 3d80420bb..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/util/ConstraintsXMLProcessor.java +++ /dev/null @@ -1,50 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: ConstraintsXMLProcessor.java,v 1.1 2007/02/28 21:16:02 cbateman Exp $ - */ -package org.eclipse.jst.jsf.validation.internal.constraints.util; - -import java.util.Map; - -import org.eclipse.emf.ecore.EPackage; - -import org.eclipse.emf.ecore.xmi.util.XMLProcessor; - -import org.eclipse.jst.jsf.validation.internal.constraints.ConstraintsPackage; - -/** - * This class contains helper methods to serialize and deserialize XML documents - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -public class ConstraintsXMLProcessor extends XMLProcessor { - /** - * Public constructor to instantiate the helper. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ConstraintsXMLProcessor() { - super((EPackage.Registry.INSTANCE)); - ConstraintsPackage.eINSTANCE.eClass(); - } - - /** - * Register for "*" and "xml" file extensions the ConstraintsResourceFactoryImpl factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Map getRegistrations() { - if (registrations == null) { - super.getRegistrations(); - registrations.put(XML_EXTENSION, new ConstraintsResourceFactoryImpl()); - registrations.put(STAR_EXTENSION, new ConstraintsResourceFactoryImpl()); - } - return registrations; - } - -} //ConstraintsXMLProcessor diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/ASTSemanticValidator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/ASTSemanticValidator.java deleted file mode 100644 index e8b2ba910..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/ASTSemanticValidator.java +++ /dev/null @@ -1,612 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.validation.internal.el; - -import java.io.IOException; - -import org.eclipse.core.resources.IFile; -import org.eclipse.emf.common.util.Diagnostic; -import org.eclipse.jst.jsf.common.internal.types.BooleanLiteralType; -import org.eclipse.jst.jsf.common.internal.types.FloatLiteralType; -import org.eclipse.jst.jsf.common.internal.types.IntegerLiteralType; -import org.eclipse.jst.jsf.common.internal.types.LiteralType; -import org.eclipse.jst.jsf.common.internal.types.MethodType; -import org.eclipse.jst.jsf.common.internal.types.NullLiteralType; -import org.eclipse.jst.jsf.common.internal.types.SignatureBasedType; -import org.eclipse.jst.jsf.common.internal.types.StringLiteralType; -import org.eclipse.jst.jsf.common.internal.types.ValueType; -import org.eclipse.jst.jsf.context.resolver.structureddocument.IStructuredDocumentContextResolverFactory; -import org.eclipse.jst.jsf.context.resolver.structureddocument.IWorkspaceContextResolver; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext; -import org.eclipse.jst.jsf.context.symbol.IInstanceSymbol; -import org.eclipse.jst.jsf.context.symbol.IPropertySymbol; -import org.eclipse.jst.jsf.context.symbol.ISymbol; -import org.eclipse.jst.jsf.context.symbol.internal.util.IObjectSymbolBasedValueType; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.designtime.resolver.IStructuredDocumentSymbolResolverFactory; -import org.eclipse.jst.jsf.designtime.resolver.ISymbolContextResolver; -import org.eclipse.jst.jsf.validation.internal.IJSFViewValidator.IValidationReporter; -import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory; -import org.eclipse.jst.jsf.validation.internal.el.operators.BinaryOperator; -import org.eclipse.jst.jsf.validation.internal.el.operators.BracketOperator; -import org.eclipse.jst.jsf.validation.internal.el.operators.DotOperator; -import org.eclipse.jst.jsf.validation.internal.el.operators.TernaryChoiceOperator; -import org.eclipse.jst.jsf.validation.internal.el.operators.UnaryOperator; -import org.eclipse.jst.jsp.core.internal.java.jspel.ASTAddExpression; -import org.eclipse.jst.jsp.core.internal.java.jspel.ASTAndExpression; -import org.eclipse.jst.jsp.core.internal.java.jspel.ASTChoiceExpression; -import org.eclipse.jst.jsp.core.internal.java.jspel.ASTEqualityExpression; -import org.eclipse.jst.jsp.core.internal.java.jspel.ASTExpression; -import org.eclipse.jst.jsp.core.internal.java.jspel.ASTFunctionInvocation; -import org.eclipse.jst.jsp.core.internal.java.jspel.ASTLiteral; -import org.eclipse.jst.jsp.core.internal.java.jspel.ASTMultiplyExpression; -import org.eclipse.jst.jsp.core.internal.java.jspel.ASTOperatorExpression; -import org.eclipse.jst.jsp.core.internal.java.jspel.ASTOrExpression; -import org.eclipse.jst.jsp.core.internal.java.jspel.ASTRelationalExpression; -import org.eclipse.jst.jsp.core.internal.java.jspel.ASTUnaryExpression; -import org.eclipse.jst.jsp.core.internal.java.jspel.ASTValue; -import org.eclipse.jst.jsp.core.internal.java.jspel.ASTValuePrefix; -import org.eclipse.jst.jsp.core.internal.java.jspel.ASTValueSuffix; -import org.eclipse.jst.jsp.core.internal.java.jspel.JSPELParser; -import org.eclipse.jst.jsp.core.internal.java.jspel.JSPELParserConstants; -import org.eclipse.jst.jsp.core.internal.java.jspel.JSPELParserVisitor; -import org.eclipse.jst.jsp.core.internal.java.jspel.ParseException; -import org.eclipse.jst.jsp.core.internal.java.jspel.SimpleNode; -import org.eclipse.jst.jsp.core.internal.java.jspel.Token; - - -class ASTSemanticValidator implements JSPELParserVisitor, IExpressionSemanticValidator -{ - private final IFile _targetFile; - private final ASTExpression _expr; - private final IStructuredDocumentContext _context; - private final ISymbolContextResolver _symbolResolver; -// private final List<IMessage> _messages; - private final EvaluationTracker _tracker; - private final DiagnosticFactory _diagnosticFactory; - private final IValidationReporter _reporter; - - ASTSemanticValidator(final ASTExpression expr, - final IStructuredDocumentContext context, - final IStructuredDocumentSymbolResolverFactory symbolResolverFactory, - final IValidationReporter reporter) - { - final IWorkspaceContextResolver resolver = IStructuredDocumentContextResolverFactory.INSTANCE - .getWorkspaceContextResolver(context); - - if (resolver != null) - { - _targetFile = (IFile) resolver.getResource(); - } - else - { - _targetFile = null; - } - - _expr = expr; - _context = context; - _symbolResolver = symbolResolverFactory.getSymbolContextResolver(context); - _tracker = new EvaluationTracker(); - _diagnosticFactory = new DiagnosticFactory(); - _reporter = reporter; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.validation.internal.el.IExpressionSemanticValidator#validate() - */ - public void validate() - { - _expr.jjtAccept(this, _tracker); - } - - public Object visit(final ASTAddExpression node, final Object data) - { - performBinaryEvaluation(node, (EvaluationTracker)data); - return data; - } - - public Object visit(final ASTAndExpression node, final Object data) - { - performBinaryEvaluation(node, (EvaluationTracker)data); - return data; - } - - public Object visit(final ASTChoiceExpression node, final Object data) - { - if (node.jjtGetNumChildren() != 3) - { - throw new AssertionError("Binary operators should always have two sub-expressions"); - } - - // evaluate choice argument - node.jjtGetChild(0).jjtAccept(this, data); - final ValueType choiceArg = ((EvaluationTracker)data).getValueType(); - // evaluate when true argument - node.jjtGetChild(1).jjtAccept(this, data); - final ValueType whenTrueArg = ((EvaluationTracker)data).getValueType(); - //evaluate when false argument - node.jjtGetChild(2).jjtAccept(this, data); - final ValueType whenFalseArg = ((EvaluationTracker)data).getValueType(); - - - if (choiceArg != null && whenTrueArg != null && whenFalseArg != null) - { - final TernaryChoiceOperator operator = - new TernaryChoiceOperator(_diagnosticFactory); - - final Diagnostic diagnostic = - operator.validate(choiceArg/* whenTrueArg, whenFalseArg*/); - - if (diagnostic.getSeverity() != Diagnostic.OK) - { - final Token firstToken = node.getFirstToken(); - final int offset = _context.getDocumentPosition() + firstToken.beginColumn - 1; - final int length = node.getLastToken().endColumn - firstToken.beginColumn+1; - _reporter.report(diagnostic, offset, length); - } - - ((EvaluationTracker)data).setType(operator.perform(choiceArg, whenTrueArg, whenFalseArg)); - } - else - { - ((EvaluationTracker)data).setType(null); - } - - return data; - } - - public Object visit(final ASTEqualityExpression node, final Object data) - { - performBinaryEvaluation(node, (EvaluationTracker)data); - return data; - } - - public Object visit(final ASTExpression node, final Object data) { - return node.childrenAccept(this, data); - } - - public Object visit(final ASTFunctionInvocation node, final Object data) - { - // when we see a function invocation, null the type - // we do not validate function invocations currently - final Object retVal = node.childrenAccept(this, data); - ((EvaluationTracker)data).setType(null); - return retVal; - } - - public Object visit(final ASTLiteral node, final Object data) - { - // note, there is an implicit assumption here that literals - // are all terminals (leafs in the tree) - if (node.jjtGetNumChildren() > 0) - { - throw new AssertionError("Literals should be terminal"); - } - - LiteralType type = null; - - final Token literalToken = node.getFirstToken(); - - switch (literalToken.kind) - { - case JSPELParserConstants.STRING_LITERAL: - type = new StringLiteralType(stripQuotes(literalToken.image)); - break; - - case JSPELParserConstants.INTEGER_LITERAL: - type = new IntegerLiteralType(Long.parseLong(literalToken.image)); - break; - - case JSPELParserConstants.FLOATING_POINT_LITERAL: - type = new FloatLiteralType(Double.parseDouble(literalToken.image)); - break; - - case JSPELParserConstants.FALSE: - type = BooleanLiteralType.FALSE; - break; - - case JSPELParserConstants.TRUE: - type = BooleanLiteralType.TRUE; - break; - - case JSPELParserConstants.NULL: - type = NullLiteralType.SINGLETON; - break; - - default: - JSFCorePlugin.log("Unknown EL literal: " +literalToken.toString(), new Throwable("This throwable simply used to mark a stack trace")); - } - - ((EvaluationTracker)data).setType(type); - return data; - } - - private String stripQuotes(final String stringLiteral) - { - if (stringLiteral.startsWith("'") - || stringLiteral.startsWith("\"")) - - { - if (stringLiteral.length() > 2) - { - // take 'literal' -> literal - return stringLiteral.substring(1, stringLiteral.length()-1); - } - // if only two characters, then the empty string - return ""; - } - - return stringLiteral; - } - - public Object visit(final ASTMultiplyExpression node, final Object data) - { - performBinaryEvaluation(node, (EvaluationTracker)data); - return data; - } - - public Object visit(final ASTOrExpression node, final Object data) - { - performBinaryEvaluation(node, (EvaluationTracker)data); - return data; - } - - public Object visit(final ASTRelationalExpression node, final Object data) - { - performBinaryEvaluation(node, (EvaluationTracker)data); - return data; - } - - public Object visit(final ASTUnaryExpression node, final Object data) - { - // assertion here is that this expression decomposes: - // UnaryExpr -> Value - // UnaryExpr -> UnaryOp UnaryExpression - // since UnaryOp is a terminal (-,!,not,empty) node will - // always have exactly one child - node.childrenAccept(this, data); - final SignatureBasedType type = ((EvaluationTracker)data).getType(); - - if (type != null) - { - final Token firstToken = node.getFirstToken(); - if (UnaryOperator.isUnaryOperator(firstToken)) - { - if (type instanceof ValueType) - { - final UnaryOperator unaryOp = UnaryOperator.createUnaryOperator(firstToken, _diagnosticFactory); - final Diagnostic diagnostic = unaryOp.validate((ValueType)type); - - if (diagnostic.getSeverity() != Diagnostic.OK) - { - final int offset = _context.getDocumentPosition() + firstToken.beginColumn - 1; - final int length = node.getLastToken().endColumn - firstToken.beginColumn+1; - _reporter.report(diagnostic, offset, length); - } - - ((EvaluationTracker)data). - setType(unaryOp.performOperation ((ValueType)type)); - } - // cannot apply operations to method bindings - else - { - final int offset = _context.getDocumentPosition() + - firstToken.beginColumn - 1; - final int length = node.getLastToken().endColumn - - firstToken.beginColumn+1; - - Diagnostic diagnostic = - _diagnosticFactory.create_CANNOT_APPLY_OPERATOR_TO_METHOD_BINDING(); - - _reporter.report(diagnostic, offset, length); - } - } - } - - return data; - } - - public Object visit(final ASTValue node, final Object data) { - final ValueExpressionTracker tracker = new ValueExpressionTracker(); - - ((EvaluationTracker)data).setValueTracker(tracker); - - node.childrenAccept(this, data); - - final SignatureBasedType type = ((EvaluationTracker)data).getType(); - - // now check the tracker. If the last property in the expression - // is non-null (i.e. the value has one or more suffices) then we - // to very the leaf node (i.e. 'z' in #{x.y.z}) is more than just - // an intermediate value used to get to other properties - if (type instanceof IObjectSymbolBasedValueType - && ((IObjectSymbolBasedValueType)type).getSymbol() instanceof IPropertySymbol - && ((IPropertySymbol)((IObjectSymbolBasedValueType)type).getSymbol()).isIntermediate()) - { - final int offset = tracker.getCurPropertySymbolOffset(); - final int length = tracker.getCurPropertySymbolLength(); - final Diagnostic diagnostic = - _diagnosticFactory.create_MEMBER_IS_INTERMEDIATE( - ((IPropertySymbol)((IObjectSymbolBasedValueType)type).getSymbol()).getName()); - _reporter.report(diagnostic, offset, length); - } - - return data; - } - - public Object visit(final ASTValuePrefix node, final Object data) - { - if (node.jjtGetNumChildren() == 0) - { - final Token token = node.getFirstToken(); - final String image = token.image; - - final ISymbol symbol = _symbolResolver.getVariable(image); - - if (symbol == null) - { - final int offset = - _context.getDocumentPosition() + token.beginColumn - 1; - final int length = token.endColumn - token.beginColumn + 1; - - final Diagnostic diagnostic = - _diagnosticFactory.create_VARIABLE_NOT_FOUND(image); - - if (diagnostic.getSeverity() != Diagnostic.OK) - { - _reporter.report(diagnostic, offset, length); - } - } - else if (symbol instanceof IInstanceSymbol) - { - final IObjectSymbolBasedValueType symbolType = - IObjectSymbolBasedValueType.getInstance(symbol); - ((EvaluationTracker) data).setType(symbolType); - } - } - - return node.childrenAccept(this, data); - } - - public Object visit(final ASTValueSuffix node, final Object data) - { - final ValueExpressionTracker tracker = ((EvaluationTracker) data).getValueTracker(); - final SignatureBasedType type = ((EvaluationTracker) data).getType(); - - if (type instanceof IObjectSymbolBasedValueType) - { - final IObjectSymbolBasedValueType symbolType = - (IObjectSymbolBasedValueType) type; - final Token firstToken = node.getFirstToken(); - - if (node.jjtGetNumChildren() == 0 - && firstToken.kind == JSPELParserConstants.DOT) - { - final Token dotId = node.getLastToken(); - - final int offset = - _context.getDocumentPosition() + dotId.beginColumn - 1; - final int length = dotId.endColumn - dotId.beginColumn + 1; - - final DotOperator dotOp = new DotOperator(_diagnosticFactory, _targetFile); - - final StringLiteralType suffixLiteral = new StringLiteralType(dotId.image); - final Diagnostic diagnostic = - dotOp.validate(symbolType, - suffixLiteral); - - if (diagnostic.getSeverity() != Diagnostic.OK) - { - _reporter.report(diagnostic, offset, length); - ((EvaluationTracker) data).setType(null); - } - else - { - // // if the base (value-a) is a map, then using the bracket value-a['y'] type - // // syntax is recommended. Note that we do this here instead of - // // DotOperator so that we don't tie the default property resolver - // // behaviour to that operator class. If someone changes the rules - // // of how the prop resolver interprets the base, then they may want to - // // write their own validator that doesn't do this - // if (symbolType.getSymbol().supportsCoercion(TypeConstants.TYPE_MAP)) - // { - // _messages.add(ValidationMessageFactory.createFromDiagnostic( - // DiagnosticFactory.create_BINARY_OP_DOT_WITH_VALUEA_MAP_SHOULD_USE_ARRAY - // (symbolType.getSymbol().getName(), dotId.image), - // startOffset, length, _targetFile)); - // } - - ((EvaluationTracker) data).setType(dotOp.performOperation(symbolType, - suffixLiteral)); - tracker.setCurMemberSymbol(offset, length); - } - - // we finished with the single dot suffix here - return data; - } - else if (firstToken.kind == JSPELParserConstants.LBRACKET) - { - final EvaluationTracker subExprTracker = new EvaluationTracker(); - node.childrenAccept(this, subExprTracker); - - final SignatureBasedType subExprType = subExprTracker.getType(); - - if (subExprType instanceof ValueType) - { - final Token lastToken = node.getLastToken(); - final int offset = - _context.getDocumentPosition() + firstToken.beginColumn - 1; - final int length = lastToken.endColumn - firstToken.beginColumn + 1; - - final BracketOperator bracketOperator = new BracketOperator(_diagnosticFactory, _targetFile); - - final Diagnostic diagnostic = - bracketOperator.validate(symbolType, - (ValueType)subExprType); - - if (diagnostic.getSeverity() != Diagnostic.OK) - { - _reporter.report(diagnostic, offset, length); - ((EvaluationTracker) data).setType(null); - } - else - { - ((EvaluationTracker) data).setType(bracketOperator.performOperation(symbolType, - (ValueType)subExprType)); - tracker.setCurMemberSymbol(offset, length); - } - } - // we are finished with the bracketed suffix at this point. - return data; - } - } - - // don't bother to accept children, since if we haven't done - // something above, there's not much sensible we can do with it - // clear the type first though - ((EvaluationTracker) data).setType(null); - return data; //node.childrenAccept(this, data); - } - - public Object visit(final SimpleNode node, final Object data) { - return node.childrenAccept(this, data); - } - - /** - * Copies stored messages into the validation reporter - * @param validator - * @param reporter - */ -// public void reportFindings(final IValidator validator, final IReporter reporter) -// { -// for (final IMessage message : _messages) -// { -// // don't report messages that have no severity. -// if ((message.getSeverity() & IMessage.ALL_MESSAGES) != 0) -// { -// reporter.addMessage(validator, message); -// } -// } -// } - - private void performBinaryEvaluation(final ASTOperatorExpression node, final EvaluationTracker tracker) - { - if (node.jjtGetNumChildren() < 2) - { - throw new AssertionError("Binary operators should always have at least two sub-expressions"); - } - else if (node.getOperatorTokens().size() != node.jjtGetNumChildren()-1) - { - throw new AssertionError("Binary operators should always have one operator token less than number of sub-expressions"); - } - - // evaluate left-most argument - node.jjtGetChild(0).jjtAccept(this, tracker); - - ValueType curType = getValueTypeForBinaryOperation(tracker.getType(), (SimpleNode) node.jjtGetChild(0)); - - for (int child = 1; child < node.jjtGetNumChildren(); child++) - { - // evaluate next argument running left-to-right - node.jjtGetChild(child).jjtAccept(this, tracker); - final ValueType secondType = - getValueTypeForBinaryOperation(tracker.getType(), (SimpleNode) node.jjtGetChild(child)); - - if (curType != null && secondType != null) - { - final BinaryOperator operator = - BinaryOperator.getBinaryOperator((Token)node.getOperatorTokens().get(child-1), _diagnosticFactory, _context); - - final Diagnostic diagnostic = operator.validate(curType, secondType); - - if (diagnostic.getSeverity() != Diagnostic.OK) - { - final Token firstToken = node.getFirstToken(); - final int offset = _context.getDocumentPosition() + firstToken.beginColumn - 1; - final int length = node.getLastToken().endColumn - firstToken.beginColumn+1; - _reporter.report(diagnostic, offset, length); - } - - curType = operator.performOperation(curType, secondType); - } - } - - tracker.setType(curType); - } - - private ValueType getValueTypeForBinaryOperation(final SignatureBasedType type, final SimpleNode node) - { - if (type instanceof ValueType) - { - return (ValueType) type; - } - else if (type instanceof MethodType) - { - final int offset = _context.getDocumentPosition() + node.getFirstToken().beginColumn - 1; - final int length = node.getLastToken().endColumn - node.getFirstToken().beginColumn+1; - final Diagnostic diagnostic = _diagnosticFactory.create_CANNOT_APPLY_OPERATOR_TO_METHOD_BINDING(); - _reporter.report(diagnostic, offset, length); - } - - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.validation.internal.el.IExpressionSemanticValidator#getMessages() - */ -// public List getMessages() -// { -// if (!_validatorHasBeenCalled) -// { -// throw new AssertionError("Should not call getMessages before validate has been called"); -// } -// return _messages; -// } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.validation.internal.el.IExpressionSemanticValidator#getExpressionType() - */ - public SignatureBasedType getExpressionType() - { - return _tracker.getType(); - } - - /** - * @param args - * @throws IOException - * @throws ParseException - */ - public static void main(final String[] args) throws IOException, ParseException - { - String elText = ""; - int nextCharacter; - - while(((nextCharacter = System.in.read()) != -1)) - { - final char nextChar = (char) nextCharacter; - - if (nextChar == '\n') - { - final JSPELParser parser = JSPELParser.createParser(elText); - final ASTExpression expr = parser.Expression(); - expr.dump(""); - - elText = ""; - } - else - { - elText += nextChar; - } - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/ELExpressionValidator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/ELExpressionValidator.java deleted file mode 100644 index 71ccead6b..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/ELExpressionValidator.java +++ /dev/null @@ -1,158 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.validation.internal.el; - -import org.eclipse.emf.common.util.Diagnostic; -import org.eclipse.jst.jsf.common.internal.types.CompositeType; -import org.eclipse.jst.jsf.common.internal.types.SignatureBasedType; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext; -import org.eclipse.jst.jsf.designtime.resolver.IStructuredDocumentSymbolResolverFactory; -import org.eclipse.jst.jsf.validation.internal.IJSFViewValidator.IValidationReporter; -import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory; -import org.eclipse.jst.jsp.core.internal.java.jspel.ASTExpression; -import org.eclipse.jst.jsp.core.internal.java.jspel.JSPELParser; -import org.eclipse.jst.jsp.core.internal.java.jspel.ParseException; -import org.eclipse.jst.jsp.core.internal.java.jspel.Token; -import org.eclipse.jst.jsp.core.internal.java.jspel.TokenMgrError; - -/** - * Validates a single expression string - * - * @author cbateman - * - */ -public class ELExpressionValidator -{ - private final IStructuredDocumentContext _context; - private final String _elText; - private final DiagnosticFactory _diagnosticFactory; - - private ASTSemanticValidator _semanticValidator; - private final IStructuredDocumentSymbolResolverFactory _symbolResolverFactory; - private final IValidationReporter _reporter; - - /** - * @param context - * @param elText - * @param symbolResolverFactory - * @param reporter - */ - public ELExpressionValidator(final IStructuredDocumentContext context, - final String elText, - final IStructuredDocumentSymbolResolverFactory symbolResolverFactory, - final IValidationReporter reporter) - { - _context = context; - _elText = elText; - _diagnosticFactory = new DiagnosticFactory(); - _symbolResolverFactory = symbolResolverFactory; - _reporter = reporter; - } - - /** - * Validates a single EL expression in an XML attribute value - * @return an ASTExpression for the node - */ - public ASTExpression validateXMLNode() - { - JSPELParser elParser = JSPELParser.createParser(_elText); - // = - try { - //final long startParsing = System.currentTimeMillis(); - final ASTExpression expr = elParser.Expression(); - //final long endParsing = System.currentTimeMillis(); - //final long startSemantics = System.currentTimeMillis(); - validateSemantics(expr, _context); - //final long endSemantics = System.currentTimeMillis(); - - //System.out.println("Time to parse '"+elText+"' = "+(endParsing-startParsing)); - //System.out.println("Time to semantic checking '"+elText+"' = "+(endSemantics-startSemantics)); - - // if the parser bailed before parsing the whole - // expression, raise a warning that there is probably - // some syntatical issue - if (expr.getLastToken().endColumn < _elText.trim().length()-1) - { - final int offset = _context.getDocumentPosition() + expr.getLastToken().endColumn; - final int length = _elText.trim().length() - expr.getLastToken().endColumn; - final Diagnostic diagnostic = - _diagnosticFactory.create_GENERAL_SYNTAX_ERROR(); - - _reporter.report(diagnostic, offset, length); - } - - return expr; - } - catch (ParseException e) { - Token curTok = e.currentToken; - int offset = _context.getDocumentPosition() + curTok.beginColumn; - int length = curTok.endColumn - curTok.beginColumn + 1; - final Diagnostic diagnostic = _diagnosticFactory.create_GENERAL_SYNTAX_ERROR(); - _reporter.report(diagnostic, offset, length); - return null; - } - catch (TokenMgrError te) { - final int offset = _context.getDocumentPosition(); - final int length = _elText.length(); - final Diagnostic diagnostic = - _diagnosticFactory.create_GENERAL_SYNTAX_ERROR(); - _reporter.report(diagnostic, offset, length); - return null; - } - } - - /** - * @return the type of the expression or null if - * the type could not be evaluated - */ - public CompositeType getExpressionType() - { - if (_semanticValidator != null) - { - final SignatureBasedType type = - _semanticValidator.getExpressionType(); - - if (type != null) - { - return type.toCompositeType(); - } - } - - return null; - } - - - /** - * @return the EL semantic validator for this expression validitor or - * null if one has not yet been constructor. One will only be construct - * if validate is called and the expression does not have any syntax errors. - */ - public IExpressionSemanticValidator getSemanticValidator() - { - return _semanticValidator; - } - - /** - * Validates the context-specific data for one EL expressino - * - * @param expr - * @param file - * @param reporter - * @param context - */ - private void validateSemantics(ASTExpression expr,IStructuredDocumentContext context) - { - _semanticValidator = new ASTSemanticValidator(expr, context, _symbolResolverFactory, _reporter); - _semanticValidator.validate(); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/EvaluationTracker.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/EvaluationTracker.java deleted file mode 100644 index aec1b214d..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/EvaluationTracker.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.validation.internal.el; - -import org.eclipse.jst.jsf.common.internal.types.SignatureBasedType; -import org.eclipse.jst.jsf.common.internal.types.ValueType; - -/** - * Used to track the evaulation of an EL expression AST - * - * @author cbateman - * - */ -class EvaluationTracker -{ - private ValueExpressionTracker _valueTracker; - private SignatureBasedType _type; - - /** - * @return the current value expression tracker or null if not set - */ - public ValueExpressionTracker getValueTracker() { - return _valueTracker; - } - - /** - * @param valueTracker - */ - public void setValueTracker(ValueExpressionTracker valueTracker) { - _valueTracker = valueTracker; - } - - /** - * @return the currently resolved type or null if not yet resolved - * or not able to resolve - */ - public SignatureBasedType getType() { - return _type; - } - - /** - * @param type - */ - public void setType(SignatureBasedType type) { - _type = type; - } - - /** - * @return if getType() is a ValueType, returns it otherwise null - */ - public ValueType getValueType() - { - if (_type instanceof ValueType) - { - return (ValueType) _type; - } - - return null; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/IExpressionSemanticValidator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/IExpressionSemanticValidator.java deleted file mode 100644 index 636fffe33..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/IExpressionSemanticValidator.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.validation.internal.el; - -import org.eclipse.jst.jsf.common.internal.types.SignatureBasedType; - -/** - * Exposes certain parts of the ASTSemanticValidator without exposing the whole class - * Primarily this was done for JUnit testing - * - * @author cbateman - * - */ -public interface IExpressionSemanticValidator { - - /** - * Performs the semantic validatino - */ - public abstract void validate(); - - /** - * @return the value type of fully resolved expression - * or null if not resolved (or could not be resolved) - */ - public abstract SignatureBasedType getExpressionType(); - -}
\ No newline at end of file diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/QuickFixAssistant.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/QuickFixAssistant.java deleted file mode 100644 index 89ff50f04..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/QuickFixAssistant.java +++ /dev/null @@ -1,149 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.validation.internal.el; - - -/** - * @author cbateman - * - */ -public class QuickFixAssistant //extends CorrectionAssistantProvider -{ -/* public IContentAssistant getCorrectionAssistant(ISourceViewer sourceViewer) { - IContentAssistant ca = null; - - if (sourceViewer != null) { - ContentAssistant assistant = new ContentAssistant(); - - if (sourceViewer != null) { - IContentAssistProcessor correctionProcessor = new CorrectionProcessorXML(sourceViewer); - assistant.setContentAssistProcessor(correctionProcessor, IJSPPartitions.JSP_DEFAULT_EL2); - } - ca = assistant; - } - - return ca; - - } - - private class CorrectionProcessorXML extends StructuredCorrectionProcessor { - /** - * quick assist processor - */ -/* protected IQuickAssistProcessor fQuickAssistProcessor; - /** - * quick fix processor - */ -/* protected IQuickFixProcessor fQuickFixProcessor; - - /** - * @param sourceViewer - */ -/* public CorrectionProcessorXML(ISourceViewer sourceViewer) { - super(sourceViewer); - } - - protected IQuickAssistProcessor getQuickAssistProcessor() { - if (fQuickAssistProcessor == null) - fQuickAssistProcessor = new IQuickAssistProcessor() - { - public boolean canAssist(StructuredTextViewer viewer, int offset) - { - return true; - } - - /** - * Collects proposals for assistant at the given offset. - */ -/* public ICompletionProposal[] getProposals(StructuredTextViewer viewer, int offset) throws CoreException - { - final IStructuredDocumentContext context = IStructuredDocumentContextFactory.INSTANCE.getContext(viewer, offset); - final ITextRegionContextResolver resolver = IStructuredDocumentContextResolverFactory.INSTANCE.getTextRegionResolver(context); - - if (resolver == null) - { - return new ICompletionProposal[0]; - } - - final String regionType = resolver.getRegionType(); - final List proposals = new ArrayList(); - - if (DOMJSPRegionContexts.JSP_VBL_CONTENT.equals(regionType)) - { - final String elText = resolver.getRegionText(); - final StringReader reader = new StringReader(elText); - final JSPELParser parser = new JSPELParser(reader); - - try - { - final ASTExpression expr = parser.Expression(); - final IExpressionSemanticValidator validator = new ASTSemanticValidator(expr, context); - validator.validate(); - -// for (final Iterator it = validator.getMessages().iterator(); it.hasNext();) -// { -// // TODO:MyLocalizedMessage message = (MyLocalizedMessage) it.next(); -// -// if (message.appliesTo(offset)) -// { - throw new UnsupportedOperationException("TODO:"); -// switch(message.getErrorCode()) -// { - //TODO: -// case Messages.ERROR_CODE_BEANNAME_NOT_FOUND: -// { -// final String beanName = -// (String) message.getAttribute("name"); -// proposals.add(new ELContentAssistProposal(beanName, ((IFile)message.getTargetObject()).getProject())); -// } -// break; -// } -// } -// } - } - catch (ParseException pe) - { - // left empty on purpose - } - } - - return (ICompletionProposal[]) proposals.toArray(new ICompletionProposal[0]); - } - }; - - return fQuickAssistProcessor; - } - - protected IQuickFixProcessor getQuickFixProcessor() { - if (fQuickFixProcessor == null) - { - // TODO: should use the approach where possible, but the Annotation doesn't pass - // enough info - fQuickFixProcessor = new QuickFixProcessorXML() - { - public boolean canFix(Annotation annnotation) - { - return true; - } - - public ICompletionProposal[] getProposals(Annotation annnotation) throws CoreException - { - return new ICompletionProposal[0]; - } - }; - } - - return fQuickFixProcessor; - } - }*/ -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/ValueExpressionTracker.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/ValueExpressionTracker.java deleted file mode 100644 index 702f997a6..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/ValueExpressionTracker.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.validation.internal.el; - - -class ValueExpressionTracker -{ - private int _curPropertySymbolOffset; - private int _curPropertySymbolLength; - - /** - * @param offset - * @param length - */ - public void setCurMemberSymbol(int offset, int length) - { - _curPropertySymbolOffset = offset; - _curPropertySymbolLength = length; - } - - /** - * @return the offset of the current property symbol or 0 if no current property symbol - */ - public int getCurPropertySymbolOffset() - { - return _curPropertySymbolOffset; - } - - /** - * @return the length of the current property symbol or 0 if no current property symbol - */ - public int getCurPropertySymbolLength() - { - return _curPropertySymbolLength; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/diagnostics/DiagnosticFactory.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/diagnostics/DiagnosticFactory.java deleted file mode 100644 index 64e8381d4..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/diagnostics/DiagnosticFactory.java +++ /dev/null @@ -1,561 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation7 - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.validation.internal.el.diagnostics; - -import java.text.MessageFormat; - -import org.eclipse.emf.common.util.BasicDiagnostic; -import org.eclipse.emf.common.util.Diagnostic; -import org.eclipse.jst.jsf.validation.internal.ELValidationPreferences; -import org.eclipse.osgi.util.NLS; - -/** - * Factory for all operator diagnostics. Class should - * not be implemented, instantiated or sub-classed. - * - * @author cbateman - * - */ -public final class DiagnosticFactory -{ - /** - * The id used in the source field of all Diagnostic's created by this factory - * to uniquely identify EL validation as their source type. - */ - public final static String SOURCE_ID = "org.eclipse.jst.jsf.validation.el.Diagnostics";//$NON-NLS-1$ - - /** - * Problem id - */ - public final static int BINARY_OP_BOTH_OPERANDS_NULL_ID = 0; - /** - * Problem id - */ - public final static int BINARY_OP_POSSIBLE_DIVISION_BY_ZERO_ID = 1; - /** - * Problem id - */ - public final static int BINARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION_ID = 2; - /** - * Problem id - */ - public final static int BINARY_OP_CONSTANT_EXPRESSION_ALWAYS_EVAL_SAME_ID = 3; - /** - * Problem id - */ - public final static int BINARY_OP_EQUALITY_COMP_WITH_NULL_ALWAYS_EVAL_SAME_ID = 4; - /** - * Problem id - */ - public final static int BINARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN_ID = 5; - /** - * Problem id - */ - public final static int BINARY_OP_FIRST_ARGUMENT_SHORT_CIRCUITS_ID = 6; - /** - * Problem id - */ - public final static int BINARY_OP_SECOND_ARGUMENT_ALWAYS_EVAL_SAME_ID = 7; - /** - * Problem id - */ - public final static int BINARY_OP_NO_AVAILABLE_TYPE_COERCION_ID = 8; - /** - * Problem id - */ - public final static int BINARY_OP_COULD_NOT_COERCE_LITERALS_TO_NUMBERS_ID = 9; - /** - * Problem id - */ - public final static int UNARY_OP_CONSTANT_EXPRESSION_EVAL_SAME_ID = 10; - /** - * Problem id - */ - public final static int UNARY_OP_EMPTY_ALWAYS_FALSE_ON_TYPE_ID = 11; - /** - * Problem id - */ - public final static int UNARY_OP_MINUS_ON_NULL_ALWAYS_ZERO_ID = 12; - /** - * Problem id - */ - public final static int UNARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION_ID = 13; - /** - * Problem id - */ - public final static int UNARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN_ID = 14; - /** - * Problem id - */ - public final static int TERNARY_OP_CHOICE_IS_ALWAYS_SAME_ID = 15; - /** - * Problem id - */ - public final static int TERNARY_OP_CANNOT_COERCE_CHOICE_TO_BOOLEAN_ID = 16; - /** - * Problem id - */ - public final static int UNARY_OP_STRING_CONVERSION_NOT_GUARANTEED_ID = 17; - /** - * Problem id - */ - public final static int CANNOT_APPLY_OPERATOR_TO_METHOD_BINDING_ID = 18; - /** - * Problem id - */ - public final static int MEMBER_NOT_FOUND_ID = 19; - /** - * Problem id - */ - public final static int VARIABLE_NOT_FOUND_ID = 20; - /** - * Problem id - */ - public final static int MISSING_CLOSING_EXPR_BRACKET_ID = 21; - /** - * Problem id - */ - public final static int GENERAL_SYNTAX_ERROR_ID = 22; - /** - * Problem id - */ - public final static int EMPTY_EL_EXPRESSION_ID = 23; - - /** - * - */ - public final static int BINARY_OP_DOT_WITH_VALUEB_NULL_ID = 24; - - /** - * Identifies a problem where we have x.y and x is a map. In this case - * the recommend syntax is x['y'] - */ - public final static int BINARY_OP_DOT_WITH_DOTTED_KEY_SHOULD_USE_ARRAY_ID = 25; - - /** - * Indicates that a numeric array accessor is being used with a value - * which is either < 0 or may be greater than the assumed size of the array - */ - public final static int POSSIBLE_ARRAY_INDEX_OUT_OF_BOUNDS_ID = 26; - - /** - * Identifies the problem where an expr like bean.enumProp == 'blah' - * but 'blah' does not match any of the possible enum constants, meaning - * that the operation will always resolve to a constant value (in this case false) - */ - public final static int BINARY_COMPARISON_WITH_ENUM_ALWAYS_SAME_ID = 27; - - /** - * Identifies a problem where two enum variables are compared but the enums are - * not compatible. i.e. bean.enum1 < bean.enum2. Enum.compareTo() may throw - * an exception in this case (CCE). - */ - public final static int BINARY_OP_COMPARISON_OF_ENUMS_INCOMPATIBLE_ID = 28; - - /** - * Indicates a situation such as x.y where x is a bundle and - * 'x.y.z' exists, but x.y while partially valid, does not have a value - * associated. - */ - public final static int MEMBER_IS_INTERMEDIATE_ID = 29; - - /** - * Count of ids - */ - public final static int NUM_IDS = 30; - - /** - * @param operatorName - * @return a configured diagnostic - */ - public Diagnostic create_BINARY_OP_BOTH_OPERANDS_NULL(final String operatorName) - { - final String message = NLS.bind( - Messages.BINARY_OP_BOTH_OPERANDS_NULL, operatorName); - return create(BINARY_OP_BOTH_OPERANDS_NULL_ID, message); - } - - private static Diagnostic DIAGNOSTIC_POSSIBLE_DIV_BY_ZERO; - - /** - * @return a configured diagnostic - */ - public Diagnostic create_BINARY_OP_POSSIBLE_DIVISION_BY_ZERO() - { - if (DIAGNOSTIC_POSSIBLE_DIV_BY_ZERO == null) - { - final String message = Messages.POSSIBLE_DIV_BY_ZERO; - DIAGNOSTIC_POSSIBLE_DIV_BY_ZERO = - create(BINARY_OP_POSSIBLE_DIVISION_BY_ZERO_ID, message); - } - return DIAGNOSTIC_POSSIBLE_DIV_BY_ZERO; - } - - /** - * @param operatorName - * @return a configured diagnostic - */ - public Diagnostic create_BINARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION(final String operatorName) - { - final String message = - NLS.bind(Messages.BINARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION, operatorName); - return create(BINARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION_ID, message); - } - - /** - * @param operatorName - * @param value - * @return a configured diagnostic - */ - public Diagnostic create_BINARY_OP_CONSTANT_EXPRESSION_ALWAYS_EVAL_SAME(final String operatorName, final String value) - { - final String message = - NLS.bind(Messages.BINARY_OP_CONSTANT_EXPRESSION_ALWAYS_EVAL_SAME,operatorName, value); - return create(BINARY_OP_CONSTANT_EXPRESSION_ALWAYS_EVAL_SAME_ID, message); - } - - /** - * @param value - * @return a configured diagnostic - */ - public Diagnostic create_BINARY_OP_EQUALITY_COMP_WITH_NULL_ALWAYS_EVAL_SAME(final String value) - { - final String message = - NLS.bind(Messages.BINARY_OP_EQUALITY_COMP_WITH_NULL_ALWAYS_EVAL_SAME, value); - return create(BINARY_OP_EQUALITY_COMP_WITH_NULL_ALWAYS_EVAL_SAME_ID, message); - } - - /** - * @param whichArgument - * @return a configured diagnostic - */ - public Diagnostic create_BINARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN(final String whichArgument) - { - final String message = - NLS.bind(Messages.BINARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN, whichArgument); - return create(BINARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN_ID, message); - } - - /** - * @param shortCircuitValue - * @param operatorName - * @return a configured diagnostic - */ - public Diagnostic create_BINARY_OP_FIRST_ARGUMENT_SHORT_CIRCUITS(boolean shortCircuitValue, String operatorName) - { - final String message = - NLS.bind(Messages.BINARY_OP_FIRST_ARGUMENT_SHORT_CIRCUITS, - Boolean.valueOf(shortCircuitValue), operatorName); - return create(BINARY_OP_FIRST_ARGUMENT_SHORT_CIRCUITS_ID, message); - } - - /** - * @param shortCircuitValue - * @param operatorName - * @return a configured diagnostic - */ - public Diagnostic create_BINARY_OP_SECOND_ARGUMENT_ALWAYS_EVAL_SAME(final boolean shortCircuitValue, final String operatorName) - { - final String message = - NLS.bind(Messages.BINARY_OP_SECOND_ARGUMENT_ALWAYS_EVAL_SAME, - Boolean.valueOf(shortCircuitValue), operatorName); - - return create(BINARY_OP_SECOND_ARGUMENT_ALWAYS_EVAL_SAME_ID, message); - } - - private static Diagnostic DIAGNOSTIC_NO_AVAILABLE_TYPE_COERCION; - - /** - * @return a configured diagnostic - */ - public Diagnostic create_BINARY_OP_NO_AVAILABLE_TYPE_COERCION() - { - if (DIAGNOSTIC_NO_AVAILABLE_TYPE_COERCION == null) - { - DIAGNOSTIC_NO_AVAILABLE_TYPE_COERCION = - create(BINARY_OP_NO_AVAILABLE_TYPE_COERCION_ID, - Messages.BINARY_OP_NO_AVAILABLE_TYPE_COERCION); - } - - return DIAGNOSTIC_NO_AVAILABLE_TYPE_COERCION; - } - - private static Diagnostic DIAGNOSTIC_COULD_NOT_COERCE_LITERALS; - - /** - * @return a configured diagnostic - */ - public Diagnostic create_BINARY_OP_COULD_NOT_COERCE_LITERALS_TO_NUMBERS() - { - if (DIAGNOSTIC_COULD_NOT_COERCE_LITERALS == null) - { - DIAGNOSTIC_COULD_NOT_COERCE_LITERALS = - create(BINARY_OP_COULD_NOT_COERCE_LITERALS_TO_NUMBERS_ID, - Messages.BINARY_OP_COULD_NOT_COERCE_LITERALS_TO_NUMBERS); - } - - return DIAGNOSTIC_COULD_NOT_COERCE_LITERALS; - } - - /** - * @param operatorName - * @param value - * @return a configured diagnostic - */ - public Diagnostic create_UNARY_OP_CONSTANT_EXPRESSION_EVAL_SAME_ID(final String operatorName, final String value) - { - final String message = - NLS.bind(Messages.UNARY_OP_CONSTANT_EXPRESSION_EVAL_SAME, - operatorName, value); - return create(UNARY_OP_CONSTANT_EXPRESSION_EVAL_SAME_ID, message); - } - - /** - * @return a configured diagnostic - */ - public Diagnostic create_UNARY_OP_EMPTY_ALWAYS_FALSE_ON_TYPE() - { - return create(UNARY_OP_EMPTY_ALWAYS_FALSE_ON_TYPE_ID, - Messages.UNARY_OP_EMPTY_ALWAYS_FALSE_ON_TYPE); - } - - /** - * @return a configured diagnostic - */ - public Diagnostic create_UNARY_OP_MINUS_ON_NULL_ALWAYS_ZERO() - { - return create(UNARY_OP_MINUS_ON_NULL_ALWAYS_ZERO_ID, - Messages.UNARY_OP_MINUS_ON_NULL_ALWAYS_ZERO); - } - - /** - * @param operatorName - * @return a configured diagnostic - */ - public Diagnostic create_UNARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION(final String operatorName) - { - final String message = - NLS.bind(Messages.UNARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION, - operatorName); - return create(UNARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION_ID, message); - } - - /** - * @param operatorName - * @return a configured diagnostic - */ - public Diagnostic create_UNARY_OP_STRING_CONVERSION_NOT_GUARANTEED(final String operatorName) - { - final String message = - NLS.bind(Messages.UNARY_OP_STRING_CONVERSION_NOT_GUARANTEED, - operatorName); - return create(UNARY_OP_STRING_CONVERSION_NOT_GUARANTEED_ID, message); - } - - /** - * @return a configured diagnostic - */ - public Diagnostic create_UNARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN() - { - return create(UNARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN_ID, - Messages.UNARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN); - } - - /** - * @param result - * @param whichSelected - * @return a configured diagnostic - */ - public Diagnostic create_TERNARY_OP_CHOICE_IS_ALWAYS_SAME(boolean result, String whichSelected) - { - final String message = - NLS.bind(Messages.TERNARY_OP_CHOICE_IS_ALWAYS_SAME, - Boolean.valueOf(result), whichSelected); - return create(TERNARY_OP_CHOICE_IS_ALWAYS_SAME_ID, message); - } - - /** - * @return a configured diagnostic - */ - public Diagnostic create_TERNARY_OP_CANNOT_COERCE_CHOICE_TO_BOOLEAN() - { - return create(TERNARY_OP_CANNOT_COERCE_CHOICE_TO_BOOLEAN_ID, - Messages.TERNARY_OP_CANNOT_COERCE_CHOICE_TO_BOOLEAN_ID); - } - - /** - * Method bindings cannot participate in expressions involving operators - * Per JSP 1.1 spec section 5.2.1 - * - * @return a configured message - */ - public Diagnostic create_CANNOT_APPLY_OPERATOR_TO_METHOD_BINDING() - { - return create(CANNOT_APPLY_OPERATOR_TO_METHOD_BINDING_ID, - Messages.CANNOT_APPLY_OPERATORS_TO_MB); - } - - /** - * @param curMemberSymbol - * @param owningMember - * @return a configured message - */ - public Diagnostic create_MEMBER_NOT_FOUND(String curMemberSymbol, String owningMember) - { - return create(MEMBER_NOT_FOUND_ID, - NLS.bind(Messages.VM_PROP_NAME_NOT_FOUND, curMemberSymbol, owningMember)); - } - - /** - * @param variableName - * @return a configured message - */ - public Diagnostic create_VARIABLE_NOT_FOUND(String variableName) - { - return create(VARIABLE_NOT_FOUND_ID - , NLS.bind(Messages.VM_ROOT_NAME_NOT_FOUND, variableName)); - } - - /** - * @return a configured message - */ - public Diagnostic create_MISSING_CLOSING_EXPR_BRACKET() - { - return create(MISSING_CLOSING_EXPR_BRACKET_ID - , Messages.MISSING_CLOSING_EXPR_BRACKET); - } - - /** - * @return a configured message - */ - public Diagnostic create_GENERAL_SYNTAX_ERROR() - { - return create(GENERAL_SYNTAX_ERROR_ID, Messages.GENERAL_SYNTAX_ERROR); - } - - /** - * @return a configured message - */ - public Diagnostic create_EMPTY_EL_EXPRESSION() - { - return create(EMPTY_EL_EXPRESSION_ID, Messages.EMPTY_EL_EXPRESSION); - } - - /** - * @param operatorName - * @return a configured diagnostic - */ - public Diagnostic create_BINARY_OP_DOT_WITH_VALUEB_NULL(final String operatorName) - { - return create(BINARY_OP_DOT_WITH_VALUEB_NULL_ID - , Messages.bind(Messages.BINARY_OP_DOT_WITH_VALUEB_NULL, operatorName)); - } - - /** - * @param valAName - * @param valueBName - * @return a configured diagnostic - */ - public Diagnostic create_BINARY_OP_DOT_WITH_VALUEA_MAP_SHOULD_USE_ARRAY(final String valAName, final String valueBName) - { - final Object[] formatArgs = new Object[] {valAName, valueBName}; - return create(BINARY_OP_DOT_WITH_DOTTED_KEY_SHOULD_USE_ARRAY_ID, - MessageFormat.format(Messages.BINARY_OP_DOT_WITH_DOTTED_KEY_SHOULD_USE_ARRAY,formatArgs)); - } - - /** - * @param value - * @return an array index out of bounds diagnostic - */ - public Diagnostic create_POSSIBLE_ARRAY_INDEX_OUT_OF_BOUNDS(final Integer value) - { - final Object[] formatArgs = new Object[] {value}; - - return create(POSSIBLE_ARRAY_INDEX_OUT_OF_BOUNDS_ID - , MessageFormat.format(Messages.POSSIBLE_ARRAY_INDEX_OUT_OF_BOUNDS,formatArgs)); - } - - /** - * @param operatorName - * @param invariantResult - * @param enumName - * @param fieldName - * @return a diagnostic - */ - public Diagnostic create_BINARY_COMPARISON_WITH_ENUM_AND_CONST_ALWAYS_SAME(final String operatorName, final boolean invariantResult, final String enumName, final String fieldName) - { - return create(BINARY_COMPARISON_WITH_ENUM_ALWAYS_SAME_ID - , MessageFormat.format(Messages.BINARY_COMPARISON_WITH_ENUM_AND_CONST_ALWAYS_SAME - , new Object[] {operatorName - , Boolean.valueOf(invariantResult), enumName, fieldName})); - } - - /** - * @param operatorName - * @param invariantResult - * @param enumName1 - * @param enumName2 - * @return a diagnostic - */ - public Diagnostic create_BINARY_COMPARISON_WITH_TWO_ENUMS_ALWAYS_SAME(final String operatorName, final boolean invariantResult, final String enumName1, final String enumName2) - { - return create(BINARY_COMPARISON_WITH_ENUM_ALWAYS_SAME_ID - , MessageFormat.format(Messages.BINARY_COMPARISON_WITH_TWO_ENUMS_ALWAYS_SAME - , new Object[] {operatorName - , Boolean.valueOf(invariantResult), enumName1, enumName2})); - } - - /** - * @param operatorName - * @param invariantResult - * @param enumName - * @param nonEnum - * @return a diagnostic - */ - public Diagnostic create_BINARY_COMPARISON_WITH_ENUM_AND_UNCOERCABLE_NONCONST_ALWAYS_SAME(final String operatorName, final boolean invariantResult, final String enumName, final String nonEnum) - { - return create(BINARY_COMPARISON_WITH_ENUM_ALWAYS_SAME_ID - , MessageFormat.format(Messages.BINARY_COMPARISON_WITH_ENUM_AND_UNCOERCABLE_NONCONST_ALWAYS_SAME - , new Object[] {operatorName - , Boolean.valueOf(invariantResult), enumName, nonEnum})); - } - - /** - * @return a diagnostic - */ - public Diagnostic create_BINARY_OP_COMPARISON_OF_ENUMS_INCOMPATIBLE() - { - return create(BINARY_OP_COMPARISON_OF_ENUMS_INCOMPATIBLE_ID - , Messages.BINARY_OP_COMPARISON_OF_ENUMS_INCOMPATIBLE); - } - - /** - * @param intermediateMemberName - * @return a diagnostic - */ - public Diagnostic create_MEMBER_IS_INTERMEDIATE(final String intermediateMemberName) - { - return create(MEMBER_IS_INTERMEDIATE_ID - , NLS.bind(Messages.MEMBER_IS_INTERMEDIATE - , intermediateMemberName)); - } - - private BasicDiagnostic create(int diagnosticId, String message) - { - final int severity = ELValidationPreferences.getDefaultSeverity(diagnosticId); - return new BasicDiagnostic(severity, SOURCE_ID - , diagnosticId - , message - , null); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/diagnostics/Messages.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/diagnostics/Messages.java deleted file mode 100644 index c14a8513d..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/diagnostics/Messages.java +++ /dev/null @@ -1,159 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.validation.internal.el.diagnostics; - -import org.eclipse.osgi.util.NLS; - -class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.jst.jsf.validation.internal.el.diagnostics.messages"; //$NON-NLS-1$ - - - static { - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } - - /** - * see messages.properties - */ - public static String POSSIBLE_DIV_BY_ZERO; - /** - * see messages.properties - */ - public static String UNARY_OP_EMPTY_ALWAYS_FALSE_ON_TYPE; - /** - * see messages.properties - */ - public static String UNARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN; - /** - * see messages.properties - */ - public static String TERNARY_OP_CANNOT_COERCE_CHOICE_TO_BOOLEAN_ID; - /** - * see messages.properties - */ - public static String BINARY_OP_BOTH_OPERANDS_NULL; - /** - * see messages.properties - */ - public static String BINARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION; - /** - * see messages.properties - */ - public static String BINARY_OP_CONSTANT_EXPRESSION_ALWAYS_EVAL_SAME; - /** - * see messages.properties - */ - public static String BINARY_OP_EQUALITY_COMP_WITH_NULL_ALWAYS_EVAL_SAME; - /** - * see messages.properties - */ - public static String BINARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN; - /** - * see messages.properties - */ - public static String BINARY_OP_FIRST_ARGUMENT_SHORT_CIRCUITS; - /** - * see messages.properties - */ - public static String BINARY_OP_SECOND_ARGUMENT_ALWAYS_EVAL_SAME; - /** - * see messages.properties - */ - public static String BINARY_OP_NO_AVAILABLE_TYPE_COERCION; - /** - * see messages.properties - */ - public static String BINARY_OP_COULD_NOT_COERCE_LITERALS_TO_NUMBERS; - /** - * see messages.properties - */ - public static String UNARY_OP_CONSTANT_EXPRESSION_EVAL_SAME; - /** - * see messages.properties - */ - public static String UNARY_OP_MINUS_ON_NULL_ALWAYS_ZERO; - /** - * see messages.properties - */ - public static String UNARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION; - /** - * see messages.properties - */ - public static String UNARY_OP_STRING_CONVERSION_NOT_GUARANTEED; - /** - * see messages.properties - */ - public static String TERNARY_OP_CHOICE_IS_ALWAYS_SAME; - /** - * see messages.properties - */ - public static String VM_PROP_NAME_NOT_FOUND; - /** - * see messages.properties - */ - public static String VM_ROOT_NAME_NOT_FOUND; - /** - * see messages.properties - */ - public static String CANNOT_APPLY_OPERATORS_TO_MB; - /** - * see messages.properties - */ - public static String MISSING_CLOSING_EXPR_BRACKET; - /** - * see messages.properties - */ - public static String GENERAL_SYNTAX_ERROR; - /** - * see messages.properties - */ - public static String EMPTY_EL_EXPRESSION; - /** - * see messages.properties - */ - public static String BINARY_OP_DOT_WITH_VALUEB_NULL; - /** - * see messages.properties - */ - public static String BINARY_OP_DOT_WITH_DOTTED_KEY_SHOULD_USE_ARRAY; - - /** - * see messages.properties - */ - public static String POSSIBLE_ARRAY_INDEX_OUT_OF_BOUNDS; - /** - * see messages.properties - */ - public static String BINARY_COMPARISON_WITH_ENUM_AND_CONST_ALWAYS_SAME; - /** - * see messages.properties - */ - public static String BINARY_COMPARISON_WITH_TWO_ENUMS_ALWAYS_SAME; - /** - * see messages.properties - */ - public static String BINARY_OP_COMPARISON_OF_ENUMS_INCOMPATIBLE; - - /** - * see messages.properties - */ - public static String BINARY_COMPARISON_WITH_ENUM_AND_UNCOERCABLE_NONCONST_ALWAYS_SAME; - /** - * see messages.properties - */ - public static String MEMBER_IS_INTERMEDIATE; - - private Messages() { - // do nothing; no external instantiation - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/diagnostics/messages.properties b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/diagnostics/messages.properties deleted file mode 100644 index 8f78e7c78..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/diagnostics/messages.properties +++ /dev/null @@ -1,44 +0,0 @@ -############################################################################### -# Copyright (c) 2001, 2008 Oracle Corporation and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle Corporation - initial API and implementation -############################################################################### -GENERAL_SYNTAX_ERROR=Syntax error in EL -EMPTY_EL_EXPRESSION=Empty EL expression - -VM_ROOT_NAME_NOT_FOUND = {0} cannot be resolved -VM_PROP_NAME_NOT_FOUND = {0} cannot be resolved as a member of {1} -CANNOT_APPLY_OPERATORS_TO_MB=Cannot apply expression operators to method bindings -MISSING_CLOSING_EXPR_BRACKET=Missing closing bracket on expression - -POSSIBLE_DIV_BY_ZERO=Possible division by zero -UNARY_OP_EMPTY_ALWAYS_FALSE_ON_TYPE=This empty expression always evaluates to false. Only string, maps, arrays and collection have meaningful values for the empty operator -UNARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN=Not operator does not support type coercion. -TERNARY_OP_CANNOT_COERCE_CHOICE_TO_BOOLEAN_ID=Could not coerce choice argument to boolean -BINARY_OP_BOTH_OPERANDS_NULL={0} with operand ''null'' is always zero -BINARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION=Could not make numeric conversion for {0} operation -BINARY_OP_CONSTANT_EXPRESSION_ALWAYS_EVAL_SAME=This {0} will always result a value of {1} -BINARY_OP_EQUALITY_COMP_WITH_NULL_ALWAYS_EVAL_SAME=Comparisons with null always evaluates to {0} -BINARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN=Cannot coerce {0} argument to boolean -BINARY_OP_FIRST_ARGUMENT_SHORT_CIRCUITS=The first boolean argument is always {0}. The second argument will never be evaluated and the {1} will always evaluate to {0}. -BINARY_OP_SECOND_ARGUMENT_ALWAYS_EVAL_SAME=The second boolean argument is always {0}. The {1} will always evaluate to {0} -BINARY_OP_NO_AVAILABLE_TYPE_COERCION=Cannot coerce arguments for this operator -BINARY_OP_COULD_NOT_COERCE_LITERALS_TO_NUMBERS=Could not coerce literals to numbers -UNARY_OP_CONSTANT_EXPRESSION_EVAL_SAME=This {0} will always result a value of {1} -UNARY_OP_MINUS_ON_NULL_ALWAYS_ZERO=Unary minus applied to null is always zero -UNARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION=Could not make numeric conversion for {0} operation -UNARY_OP_STRING_CONVERSION_NOT_GUARANTEED=Type coercion for {0} operator not guaranteed for possible runtime types: {1} -TERNARY_OP_CHOICE_IS_ALWAYS_SAME=Choice argument is always {0}. {1} argument is always returned -BINARY_OP_DOT_WITH_VALUEB_NULL=Applying the {0} operator with null second argument always results in null -BINARY_OP_DOT_WITH_DOTTED_KEY_SHOULD_USE_ARRAY=Array syntax is preferred when accessing Map properties with keys containing dots (i.e. {0}[''{1}'']) -POSSIBLE_ARRAY_INDEX_OUT_OF_BOUNDS=Possible array index out of bound on list/array access with value: {0} -BINARY_COMPARISON_WITH_ENUM_AND_CONST_ALWAYS_SAME=Comparison using {0} will always evaluate to {1}. Enumeration type {2} does not have a constant named {3} -BINARY_OP_COMPARISON_OF_ENUMS_INCOMPATIBLE=Comparison of incompatible enumeration vales may cause a ClassCastException. -BINARY_COMPARISON_WITH_TWO_ENUMS_ALWAYS_SAME=Comparison using {0} will always evaulate to {1}. Enumeration type {2} is not equality comparable with {3} -BINARY_COMPARISON_WITH_ENUM_AND_UNCOERCABLE_NONCONST_ALWAYS_SAME=Comparison using {0} will always evaulate to {1}. Enumeration type {2} is not equality comparable with non-enumeration type {3} -MEMBER_IS_INTERMEDIATE={0} is an intermediate property which does not have its own value associated with it.
\ No newline at end of file diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/AddArithmeticBinaryOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/AddArithmeticBinaryOperator.java deleted file mode 100644 index e1975f0a0..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/AddArithmeticBinaryOperator.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.validation.internal.el.operators; - -import java.math.BigDecimal; - -import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory; - -/** - * Represents the arithmetic + operator in EL - * - * @author cbateman - * - */ -/*package*/ class AddArithmeticBinaryOperator extends NoDivArithmeticBinaryOperator { - - private static final String ADDITION = "addition"; - - AddArithmeticBinaryOperator(DiagnosticFactory diagnosticFactory) { - super(diagnosticFactory); - } - - protected Long doRealOperation(Long firstArg, Long secondArg) - { - return Long.valueOf(firstArg.longValue() + secondArg.longValue()); - } - - protected Double doRealOperation(Double firstArg, Double secondArg) { - return Double.valueOf(firstArg.doubleValue() + secondArg.doubleValue()); - } - - protected BigDecimal doRealOperation(BigDecimal firstArg, - BigDecimal secondArg) - { - return firstArg.add(secondArg); - } - - protected String getOperatorName() { - return ADDITION; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/AndBinaryOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/AndBinaryOperator.java deleted file mode 100644 index 2ce58ce6d..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/AndBinaryOperator.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.validation.internal.el.operators; - -import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory; - - -/** - * Encapsulates the 'and'/'&&' boolean-AND operator - * Based on JSP.2.3.6.1 - * - * @author cbateman - * - */ -/*package*/class AndBinaryOperator extends LogicalBinaryOperator -{ - - AndBinaryOperator(DiagnosticFactory diagnosticFactory) { - super(diagnosticFactory); - } - - protected boolean doRealOperation(Boolean firstArg, Boolean secondArg) - { - return (firstArg.booleanValue() && secondArg.booleanValue()); - } - - protected String readableOperatorName() - { - return "logical-AND"; - } - - protected boolean shortCircuitValue() { - // AND short-circuits on false - return false; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/ArithmeticBinaryOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/ArithmeticBinaryOperator.java deleted file mode 100644 index 3f7000046..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/ArithmeticBinaryOperator.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.validation.internal.el.operators; - -import java.math.BigDecimal; - -import org.eclipse.emf.common.util.Diagnostic; -import org.eclipse.jst.jsf.common.internal.types.ValueType; -import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory; - -/** - * Super for all arithmetic binary operators -- +, -, *,/,% - * - * @author cbateman - * - */ -/*package*/ abstract class ArithmeticBinaryOperator extends BinaryOperator -{ - ArithmeticBinaryOperator(DiagnosticFactory diagnosticFactory) - { - super(diagnosticFactory); - } - - public abstract ValueType performOperation(ValueType firstArg, ValueType secondArg); - public abstract Diagnostic validate(ValueType firstArg, ValueType secondArg); - - /** - * @param firstArg - * @param secondArg - * @return the result of firstArg op secondArg - */ - protected abstract Long doRealOperation(Long firstArg, Long secondArg); - - /** - * @param firstArg - * @param secondArg - * @return the result of firstArg op secondArg - */ - protected abstract Double doRealOperation(Double firstArg, Double secondArg); - - /** - * @param firstArg - * @param secondArg - * @return the result of firstArg op secondArg - */ - protected abstract BigDecimal doRealOperation(BigDecimal firstArg, BigDecimal secondArg); - - /** - * @return human-readable name of the operator - */ - protected abstract String getOperatorName(); - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/BinaryOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/BinaryOperator.java deleted file mode 100644 index 58661da4e..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/BinaryOperator.java +++ /dev/null @@ -1,163 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.validation.internal.el.operators; - -import org.eclipse.core.resources.IProject; -import org.eclipse.emf.common.util.Diagnostic; -import org.eclipse.jst.jsf.common.internal.types.ValueType; -import org.eclipse.jst.jsf.context.resolver.structureddocument.IStructuredDocumentContextResolverFactory; -import org.eclipse.jst.jsf.context.resolver.structureddocument.IWorkspaceContextResolver; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext; -import org.eclipse.jst.jsf.core.jsfappconfig.JSFAppConfigUtils; -import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory; -import org.eclipse.jst.jsp.core.internal.java.jspel.JSPELParserConstants; -import org.eclipse.jst.jsp.core.internal.java.jspel.Token; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; - -/** - * Represents an abstract EL binary operator that always - * takes arguments and produces a single results - * - * @author cbateman - * - */ -public abstract class BinaryOperator -{ - /** - * the factory used to construct diagnostics - */ - protected final DiagnosticFactory _diagnosticFactory; - - /** - * @param operatorToken - * @param diagnosticFactory - * @param context -- the current EL document context; must not be null - * @return a binary operator based on the provided token - * @throws IllegalArgumentException if the token is not a recognized - * EL binary operator token or if context is null - */ - public static BinaryOperator getBinaryOperator(Token operatorToken, DiagnosticFactory diagnosticFactory, IStructuredDocumentContext context) - { - if (context == null) - { - throw new IllegalArgumentException("Context must not be null"); //$NON-NLS-1$ - } - final String facetVersion = determineJSFVersion(context); - - switch (operatorToken.kind) - { - case JSPELParserConstants.AND1: - case JSPELParserConstants.AND2: - return new AndBinaryOperator(diagnosticFactory); - - case JSPELParserConstants.OR1: - case JSPELParserConstants.OR2: - return new OrBinaryOperator(diagnosticFactory); - - case JSPELParserConstants.EQ1: - case JSPELParserConstants.EQ2: - return new EqualsBinaryRelationalOperator(diagnosticFactory,facetVersion); - - case JSPELParserConstants.NEQ1: - case JSPELParserConstants.NEQ2: - return new NotEqualsBinaryRelationalOperator(diagnosticFactory,facetVersion); - - case JSPELParserConstants.GT1: - case JSPELParserConstants.GT2: - return new GreaterThanRelationalBinaryOperator(diagnosticFactory,facetVersion); - - case JSPELParserConstants.GE1: - case JSPELParserConstants.GE2: - return new GreaterThanEqRelationalBinaryOperator(diagnosticFactory,facetVersion); - - case JSPELParserConstants.LT1: - case JSPELParserConstants.LT2: - return new LessThanRelationalBinaryOperator(diagnosticFactory,facetVersion); - - case JSPELParserConstants.LE1: - case JSPELParserConstants.LE2: - return new LessThanEqRelationalBinaryOperator(diagnosticFactory,facetVersion); - - case JSPELParserConstants.PLUS: - return new AddArithmeticBinaryOperator(diagnosticFactory); - - case JSPELParserConstants.MINUS: - return new SubtractArithmeticBinaryOperator(diagnosticFactory); - - case JSPELParserConstants.MULTIPLY: - return new MultiplyArithmeticBinaryOperator(diagnosticFactory); - - case JSPELParserConstants.DIVIDE1: - case JSPELParserConstants.DIVIDE2: - return new DivArithmeticBinaryOperator(diagnosticFactory); - - case JSPELParserConstants.MODULUS1: - case JSPELParserConstants.MODULUS2: - return new ModArithmeticBinaryOperator(diagnosticFactory); - } - - throw new IllegalArgumentException("Unknown binary operator: "+operatorToken.image); //$NON-NLS-1$ - } - - /** - * - * Constructor - */ - BinaryOperator(DiagnosticFactory diagnosticFactory) - { - /* no construction or sub-classing outside package*/ - _diagnosticFactory = diagnosticFactory; - } - - /** - * If both arguments are literals and the operation can be performed, then - * the return must be a new LiteralType transformed using this operator. - * - * If one or both of the arg is not a literal and the operaton can be performed, then - * the return is a new ValueType transformed per the rules of the operator - * - * If the operation cannot be performed on ValueType, return null - * - * @param firstArg - * @param secondArg - * @return a new value type after the operation is performed - */ - public abstract ValueType performOperation(ValueType firstArg, ValueType secondArg); - - - /** - * @param firstArg - * @param secondArg - * @return a Diagnostic interpreting whether it is valid to perform the - * operation on the two arguments - */ - public abstract Diagnostic validate(ValueType firstArg, ValueType secondArg); - - private static String determineJSFVersion(IStructuredDocumentContext context) - { - final IWorkspaceContextResolver wkResolver = - IStructuredDocumentContextResolverFactory. - INSTANCE.getWorkspaceContextResolver(context); - - IProject project = wkResolver.getProject(); - - IProjectFacetVersion projectVersion = JSFAppConfigUtils.getProjectFacet(project); - - if (projectVersion != null) - { - return projectVersion.getVersionString(); - } - - return null; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/BracketOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/BracketOperator.java deleted file mode 100644 index 4cfc74ebb..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/BracketOperator.java +++ /dev/null @@ -1,165 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.validation.internal.el.operators; - -import org.eclipse.core.resources.IFile; -import org.eclipse.emf.common.util.Diagnostic; -import org.eclipse.jdt.core.Signature; -import org.eclipse.jst.jsf.common.internal.types.LiteralType; -import org.eclipse.jst.jsf.common.internal.types.SignatureBasedType; -import org.eclipse.jst.jsf.common.internal.types.TypeCoercer; -import org.eclipse.jst.jsf.common.internal.types.TypeCoercionException; -import org.eclipse.jst.jsf.common.internal.types.TypeConstants; -import org.eclipse.jst.jsf.common.internal.types.TypeTransformer; -import org.eclipse.jst.jsf.common.internal.types.ValueType; -import org.eclipse.jst.jsf.context.symbol.IObjectSymbol; -import org.eclipse.jst.jsf.context.symbol.ISymbol; -import org.eclipse.jst.jsf.context.symbol.internal.util.IObjectSymbolBasedValueType; -import org.eclipse.jst.jsf.designtime.el.AbstractDTPropertyResolver; -import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory; - -/** - * Handles the operator 'bracket' where bracket(expr-a, id-b) == 'expr-a[id-b]' in EL syntax - * - * @author cbateman - * - */ -public class BracketOperator extends MemberAccessorOperator -{ - private static final String OPERATOR_NAME_ARRAY_ACCESSOR = "array ('[]') accessor"; - - /** - * @param diagnosticFactory - * @param file - */ - public BracketOperator(final DiagnosticFactory diagnosticFactory, final IFile file) - { - super(file, diagnosticFactory); - } - - protected SignatureBasedType handlePerformObjectSymbolValue( - IObjectSymbolBasedValueType firstArg, ValueType secondArg) - { - // per JSP.2.3.4 step 5.2, if value-a is a list or array access - if (firstArg.isInstanceOf(TypeConstants.TYPE_LIST) - || Signature.getArrayCount(firstArg.getSignature()) > 0) - { - return handlePerformNumericPropertyAccessorBase(firstArg, secondArg); - } - - // per JSP.2.3.4 step 5, if value-a is a map or if it is not - // a list or array (and therefore a bean), treat it as named property accessed object - // if firstArg is a map then we must treat the access like a map.get(secondArg) - - // if we don't have a literal value with which to derive value-b, then - // we can't get a property - if (secondArg instanceof LiteralType) - { - return handlePerformNamedPropertyAccessorBase(firstArg, (LiteralType)secondArg); - } - - return null; - } - - protected Diagnostic validateObjectSymbolValue(IObjectSymbolBasedValueType firstArg, - ValueType secondArg) - { - // per JSP.2.3.4 step 5.2, if value-a is a list or array access - if (firstArg.isInstanceOf(TypeConstants.TYPE_LIST) - || firstArg.getSymbol().getTypeDescriptor().isArray()) - { - return validateNumericPropertyAccessorBase(firstArg, secondArg); - } - - // per JSP.2.3.4 step 5, if value-a is a map or if it is not - // a list or array (and therefore a bean), treat it as named property accessed object - // if firstArg is a map then we must treat the access like a map.get(secondArg) - if (secondArg instanceof LiteralType) - { - return validateNamedPropertyAccessorBase(firstArg, (LiteralType) secondArg); - } - // otherwise, there's nothing we can guarantee - return Diagnostic.OK_INSTANCE; - } - - private Diagnostic validateNumericPropertyAccessorBase(IObjectSymbolBasedValueType firstArg, - ValueType secondArg) - { - try - { - // secondArg must successfully coerce to integer - TypeCoercer.coerceToNumber(TypeTransformer.transformBoxPrimitives(secondArg.getSignature())); - - if (secondArg instanceof LiteralType) - { - // this will throw a TypeCoercionExceptino if it won't - // coerce - Integer integerValue = - (Integer) ((LiteralType)secondArg).coerceToNumber(Integer.class); - - if (integerValue.intValue() < 0) - { - return _diagnosticFactory.create_POSSIBLE_ARRAY_INDEX_OUT_OF_BOUNDS(integerValue); - } - } - else - { - // if the argument is a non-literal string, we can't verify - // that the coercion to integer won't throw an exception - // at runtime - if (TypeCoercer.typeIsString(secondArg.getSignature())) - { - return _diagnosticFactory.create_UNARY_OP_STRING_CONVERSION_NOT_GUARANTEED(OPERATOR_NAME_ARRAY_ACCESSOR); - } - } - - // TODO: attempt to detect ArrayIndexOutOfBoundsException - return Diagnostic.OK_INSTANCE; - } - catch (TypeCoercionException e) - { - return _diagnosticFactory.create_BINARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION(OPERATOR_NAME_ARRAY_ACCESSOR); - } - } - - private SignatureBasedType handlePerformNumericPropertyAccessorBase(IObjectSymbolBasedValueType firstArg, - ValueType secondArg) - { - AbstractDTPropertyResolver propResolver = getPropertyResolver(); - int index = 0; - if (secondArg instanceof LiteralType) - { - try { - index = ((LiteralType)secondArg).coerceToNumber(Integer.class).intValue(); - } catch (TypeCoercionException e) { - // suppress, just use index = 0 - // this maybe should be an assertion... - } - } - - final ISymbol symbol = - propResolver.getProperty(firstArg.getSymbol(), index); - - if (symbol instanceof IObjectSymbol) - { - return IObjectSymbolBasedValueType.getInstance(symbol); - } - - // if can't be resolved, return null - return null; - } - - @Override - protected String getOperatorName() - { - return Messages.getString("BracketOperator.Name"); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/DivArithmeticBinaryOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/DivArithmeticBinaryOperator.java deleted file mode 100644 index b1d3059df..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/DivArithmeticBinaryOperator.java +++ /dev/null @@ -1,261 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.validation.internal.el.operators; - -import java.math.BigDecimal; - -import org.eclipse.emf.common.util.Diagnostic; -import org.eclipse.jdt.core.Signature; -import org.eclipse.jst.jsf.common.internal.types.FloatLiteralType; -import org.eclipse.jst.jsf.common.internal.types.IAssignable; -import org.eclipse.jst.jsf.common.internal.types.IntegerLiteralType; -import org.eclipse.jst.jsf.common.internal.types.LiteralType; -import org.eclipse.jst.jsf.common.internal.types.TypeCoercer; -import org.eclipse.jst.jsf.common.internal.types.TypeCoercionException; -import org.eclipse.jst.jsf.common.internal.types.TypeConstants; -import org.eclipse.jst.jsf.common.internal.types.TypeTransformer; -import org.eclipse.jst.jsf.common.internal.types.ValueType; -import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory; - -/** - * Represents dividing EL binary operators: div and / (same operator) - * Based on JSP.2.3.5.2 - * - * @author cbateman - * - */ -/*package*/ class DivArithmeticBinaryOperator extends ArithmeticBinaryOperator -{ - - private static final String DIVISION = "division"; - - DivArithmeticBinaryOperator(DiagnosticFactory diagnosticFactory) { - super(diagnosticFactory); - // TODO Auto-generated constructor stub - } - - public ValueType performOperation(ValueType firstArg, ValueType secondArg) - { - // JSP.2.3.5.2, step one: if both null then always 0 - if (TypeCoercer.typeIsNull(firstArg.getSignature()) - && TypeCoercer.typeIsNull(secondArg.getSignature())) - { - return new IntegerLiteralType(0); - } - - final String boxedFirstArg = TypeTransformer.transformBoxPrimitives(firstArg.getSignature()); - final String boxedSecondArg = TypeTransformer.transformBoxPrimitives(secondArg.getSignature()); - - // JSP.2.3.5.2, step 2: if one arg is BigInteger or BigDecimal - // then coerce to BigDecimal and do div - if (TypeConstants.TYPE_BIG_DOUBLE.equals(boxedFirstArg) - || TypeConstants.TYPE_BIG_DOUBLE.equals(boxedSecondArg) - || TypeConstants.TYPE_BIG_INTEGER.equals(boxedFirstArg) - || TypeConstants.TYPE_BIG_INTEGER.equals(boxedSecondArg)) - { - return performBigDecimal(firstArg, secondArg); - } - - return performDouble(firstArg, secondArg); - } - - public Diagnostic validate(ValueType firstArg, ValueType secondArg) { - // JSP.2.3.5.2, step one: if both null then always 0 - if (TypeCoercer.typeIsNull(firstArg.getSignature()) - && TypeCoercer.typeIsNull(secondArg.getSignature())) - { - return _diagnosticFactory.create_BINARY_OP_BOTH_OPERANDS_NULL(DIVISION); - } - - final String boxedFirstArg = TypeTransformer.transformBoxPrimitives(firstArg.getSignature()); - final String boxedSecondArg = TypeTransformer.transformBoxPrimitives(secondArg.getSignature()); - - // JSP.2.3.5.2, step 2: if one arg is BigInteger or BigDecimal - // then coerce to BigDecimal and do div - if (TypeConstants.TYPE_BIG_DOUBLE.equals(boxedFirstArg) - || TypeConstants.TYPE_BIG_DOUBLE.equals(boxedSecondArg) - || TypeConstants.TYPE_BIG_INTEGER.equals(boxedFirstArg) - || TypeConstants.TYPE_BIG_INTEGER.equals(boxedSecondArg)) - { - return validateBigDecimal(firstArg, secondArg); - } - - return validateDouble(firstArg, secondArg); - } - - private ValueType performBigDecimal(ValueType firstArg, ValueType secondArg) - { - // since one or the other args must be either big decimal or big int, - // we don't have two literals, so it is sufficient to ensure that we can - // coerce both to numbers and check for div by zero and div of zero - try - { - TypeCoercer.coerceToNumber(TypeTransformer.transformBoxPrimitives(firstArg.getSignature())); - TypeCoercer.coerceToNumber(TypeTransformer.transformBoxPrimitives(secondArg.getSignature())); - - // if we get to here, the result is always BigDecimal unless we have - // a div by zero - if (secondArg instanceof LiteralType) - { - final Number coercedValue = ((LiteralType)secondArg).coerceToNumber(BigDecimal.class); - if (((BigDecimal)coercedValue).equals(new BigDecimal(0))) - { - return null; - } - } - - return new ValueType(TypeConstants.TYPE_BIG_DOUBLE, IAssignable.ASSIGNMENT_TYPE_RHS); - } - catch (TypeCoercionException ce) - { - return null; - } - } - - private ValueType performDouble(ValueType firstArg, ValueType secondArg) - { - try - { - TypeCoercer.coerceToNumber(TypeTransformer.transformBoxPrimitives(firstArg.getSignature())); - TypeCoercer.coerceToNumber(TypeTransformer.transformBoxPrimitives(secondArg.getSignature())); - - Number secondValue = null; - if (secondArg instanceof LiteralType) - { - secondValue = ((LiteralType)secondArg).coerceToNumber(Double.class); - // if the second value is definitely 0, then return null since - // we have a div by zero - if (secondValue.doubleValue() == 0.0) - { - return null; - } - } - - Number firstValue = null; - - if (firstArg instanceof LiteralType) - { - firstValue = ((LiteralType)firstArg).coerceToNumber(Double.class); - } - - if (firstValue != null && secondValue != null) - { - return new FloatLiteralType( - doRealOperation(new Double(firstValue.doubleValue()) - , new Double(secondValue.doubleValue())).doubleValue()); - } - - // if not both literals and could coerce, then the type is double - return new ValueType(Signature.SIG_DOUBLE, IAssignable.ASSIGNMENT_TYPE_RHS); - } - catch (TypeCoercionException ce) - { - // could not coerce for the operation - return null; - } - } - - private Diagnostic validateBigDecimal(ValueType firstArg, ValueType secondArg) - { - // since one or the other args must be either big decimal or big int, - // we don't have two literals, so it is sufficient to ensure that we can - // coerce both to numbers and check for div by zero and div of zero - try - { - TypeCoercer.coerceToNumber(TypeTransformer.transformBoxPrimitives(firstArg.getSignature())); - TypeCoercer.coerceToNumber(TypeTransformer.transformBoxPrimitives(secondArg.getSignature())); - - // if we get to here, the result is always BigDecimal unless we have - // a div by zero - if (secondArg instanceof LiteralType) - { - final Number coercedValue = ((LiteralType)secondArg).coerceToNumber(BigDecimal.class); - if (((BigDecimal)coercedValue).equals(new BigDecimal(0))) - { - return _diagnosticFactory.create_BINARY_OP_POSSIBLE_DIVISION_BY_ZERO(); - } - } - - // everything's okay if we get here - return Diagnostic.OK_INSTANCE; - } - catch (TypeCoercionException ce) - { - return _diagnosticFactory.create_BINARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION(DIVISION); - } - } - - private Diagnostic validateDouble(ValueType firstArg, ValueType secondArg) - { - try - { - TypeCoercer.coerceToNumber(TypeTransformer.transformBoxPrimitives(firstArg.getSignature())); - TypeCoercer.coerceToNumber(TypeTransformer.transformBoxPrimitives(secondArg.getSignature())); - - Number secondValue = null; - if (secondArg instanceof LiteralType) - { - secondValue = ((LiteralType)secondArg).coerceToNumber(Double.class); - // if the second value is definitely 0, then return null since - // we have a div by zero - if (secondValue.doubleValue() == 0.0) - { - return _diagnosticFactory.create_BINARY_OP_POSSIBLE_DIVISION_BY_ZERO(); - } - } - - Number firstValue = null; - - if (firstArg instanceof LiteralType) - { - firstValue = ((LiteralType)firstArg).coerceToNumber(Double.class); - } - - if (firstValue != null && secondValue != null) - { - String result - = Double.toString( - doRealOperation(new Double(firstValue.doubleValue()), - new Double(secondValue.doubleValue())).doubleValue()); - - return _diagnosticFactory.create_BINARY_OP_CONSTANT_EXPRESSION_ALWAYS_EVAL_SAME(DIVISION, result); - } - - // if not both literals and could coerce, then the type is double - return Diagnostic.OK_INSTANCE; - } - catch (TypeCoercionException ce) - { - // could not coerce for the operation - return _diagnosticFactory.create_BINARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION(DIVISION); - } - } - - protected BigDecimal doRealOperation(BigDecimal firstArg, BigDecimal secondArg) { - // per JSP.2.3.5.2, step 2 - return firstArg.divide(secondArg, BigDecimal.ROUND_HALF_UP); - } - - protected Double doRealOperation(Double firstArg, Double secondArg) - { - return new Double(firstArg.doubleValue() / secondArg.doubleValue()); - } - - protected Long doRealOperation(Long firstArg, Long secondArg) { - return Long.valueOf(firstArg.longValue() / secondArg.longValue()); - } - - protected String getOperatorName() { - return DIVISION; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/DotOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/DotOperator.java deleted file mode 100644 index 72720ce3c..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/DotOperator.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.validation.internal.el.operators; - -import org.eclipse.core.resources.IFile; -import org.eclipse.emf.common.util.Diagnostic; -import org.eclipse.jst.jsf.common.internal.types.LiteralType; -import org.eclipse.jst.jsf.common.internal.types.SignatureBasedType; -import org.eclipse.jst.jsf.common.internal.types.ValueType; -import org.eclipse.jst.jsf.context.symbol.internal.util.IObjectSymbolBasedValueType; -import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory; - -/** - * Handles the operator 'dot' where dot(expr-a, id-b) == 'expr-a.id-b' in EL syntax - * - * @author cbateman - * - */ -public class DotOperator extends MemberAccessorOperator -{ - /** - * @param diagnosticFactory - * @param file - */ - public DotOperator(final DiagnosticFactory diagnosticFactory, final IFile file) - { - super(file, diagnosticFactory); - } - - protected SignatureBasedType handlePerformObjectSymbolValue( - IObjectSymbolBasedValueType firstArg, ValueType secondArg) - { - // the dot operator (unlike the bracket) can only treat firstArg as - // a named property accessor object - // if we don't have a literal value with which to derive value-b, then - // we can't get a property - if (secondArg instanceof LiteralType) - { - return handlePerformNamedPropertyAccessorBase(firstArg, (LiteralType)secondArg); - } - return null; - } - - public Diagnostic validateObjectSymbolValue(IObjectSymbolBasedValueType firstArg, - ValueType secondArg) - { - Diagnostic diag = Diagnostic.OK_INSTANCE; - - if (secondArg instanceof LiteralType) - { - diag = validateNamedPropertyAccessorBase(firstArg, (LiteralType) secondArg); - } - - return diag; - } - - @Override - protected String getOperatorName() - { - return Messages.getString("DotOperator.Name"); - } -}
\ No newline at end of file diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/EmptyUnaryOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/EmptyUnaryOperator.java deleted file mode 100644 index 812d1cb00..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/EmptyUnaryOperator.java +++ /dev/null @@ -1,122 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.validation.internal.el.operators; - -import org.eclipse.emf.common.util.Diagnostic; -import org.eclipse.jdt.core.Signature; -import org.eclipse.jst.jsf.common.internal.types.BooleanLiteralType; -import org.eclipse.jst.jsf.common.internal.types.NullLiteralType; -import org.eclipse.jst.jsf.common.internal.types.StringLiteralType; -import org.eclipse.jst.jsf.common.internal.types.TypeConstants; -import org.eclipse.jst.jsf.common.internal.types.ValueType; -import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory; - -/** - * Represents the EL unary operator '-' on a ValueType - * as described by JSP.2.3.7 - * - * @author cbateman - * - */ -/*package*/ class EmptyUnaryOperator extends UnaryOperator -{ - private static final String EMPTY = "empty"; - - EmptyUnaryOperator(DiagnosticFactory diagnosticFactory) - { - super(diagnosticFactory); - } - - public ValueType performOperation(ValueType type) - { - if (type instanceof StringLiteralType) - { - if ("".equals(((StringLiteralType)type).getLiteralValue())) - { - // if the string is empty, operator always returns true - return BooleanLiteralType.TRUE; - } - - // if the string is empty, operator always returns true - return BooleanLiteralType.FALSE; - } - - // empty(null) is always true - if (type instanceof NullLiteralType) - { - return BooleanLiteralType.TRUE; - } - - // if the type is not string, array, Map, or Collection - // then empty is always false - String testSig = type.getSignature(); - - if (!TypeConstants.TYPE_STRING.equals(testSig) - && !type.isInstanceOf(TypeConstants.TYPE_COLLECTION) - && !type.isInstanceOf(TypeConstants.TYPE_MAP) - && Signature.getTypeSignatureKind(testSig) != Signature.ARRAY_TYPE_SIGNATURE) - { - return BooleanLiteralType.FALSE; - } - - // otherwise, return a generic boolean type - return new ValueType(TypeConstants.TYPE_BOOLEAN, type.getAssignability()); - } - - public Diagnostic validate(ValueType type) - { - // empty always validates to false unless: - // the value is an empty string, array, map or collection - // one thing we do is see if the thing is a literal. If it is - // we can warn that the value could be folded - if (type instanceof StringLiteralType) - { - String condition; - - if ("".equals(((StringLiteralType)type).getLiteralValue())) - { - condition = "true"; - } - else - { - condition = "false"; - } - - return _diagnosticFactory. - create_UNARY_OP_CONSTANT_EXPRESSION_EVAL_SAME_ID - (EMPTY,condition); - } - - // empty(null) is always true - if (type instanceof NullLiteralType) - { - return _diagnosticFactory. - create_UNARY_OP_CONSTANT_EXPRESSION_EVAL_SAME_ID - (EMPTY,"true"); - } - - // if the type is not string, array, Map, or Collection warn that - // this may be always false - String testSig = type.getSignature(); - - if (!TypeConstants.TYPE_STRING.equals(testSig) - && !type.isInstanceOf(TypeConstants.TYPE_COLLECTION) - && !type.isInstanceOf(TypeConstants.TYPE_MAP) - && Signature.getTypeSignatureKind(testSig) != Signature.ARRAY_TYPE_SIGNATURE) - { - return _diagnosticFactory.create_UNARY_OP_EMPTY_ALWAYS_FALSE_ON_TYPE(); - } - - return Diagnostic.OK_INSTANCE; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/EqualityRelationalBinaryOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/EqualityRelationalBinaryOperator.java deleted file mode 100644 index fcfca0379..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/EqualityRelationalBinaryOperator.java +++ /dev/null @@ -1,539 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.validation.internal.el.operators; - -import java.math.BigDecimal; -import java.math.BigInteger; - -import org.eclipse.emf.common.util.Diagnostic; -import org.eclipse.jdt.core.IType; -import org.eclipse.jst.jsf.common.internal.types.BooleanLiteralType; -import org.eclipse.jst.jsf.common.internal.types.IAssignable; -import org.eclipse.jst.jsf.common.internal.types.LiteralType; -import org.eclipse.jst.jsf.common.internal.types.StringLiteralType; -import org.eclipse.jst.jsf.common.internal.types.TypeCoercer; -import org.eclipse.jst.jsf.common.internal.types.TypeCoercionException; -import org.eclipse.jst.jsf.common.internal.types.TypeConstants; -import org.eclipse.jst.jsf.common.internal.types.TypeTransformer; -import org.eclipse.jst.jsf.common.internal.types.ValueType; -import org.eclipse.jst.jsf.common.util.TypeUtil; -import org.eclipse.jst.jsf.context.symbol.internal.util.IObjectSymbolBasedValueType; -import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory; - -/** - * A relational binary operator for equality: "==" or "!=" - * - * @author cbateman - * - */ -/*package*/ abstract class EqualityRelationalBinaryOperator extends RelationalBinaryOperator -{ - EqualityRelationalBinaryOperator(final DiagnosticFactory diagnosticFactory, String jsfVersion) - { - super(diagnosticFactory, jsfVersion); - } - - /** - * @param firstArg - * @param secondArg - * @return the result of the operation - */ - protected abstract boolean doRealOperation(Boolean firstArg, Boolean secondArg); - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.validation.internal.el.operators.BinaryOperator#performOperation(org.eclipse.jst.jsf.core.internal.types.ValueType, org.eclipse.jst.jsf.core.internal.types.ValueType) - */ - public ValueType performOperation(ValueType firstArg, ValueType secondArg) - { - // JSP.2.3.5.7 step 2 if either operand is null, then not equal - if (TypeCoercer.typeIsNull(firstArg.getSignature()) - || TypeCoercer.typeIsNull(secondArg.getSignature())) - { - return BooleanLiteralType.FALSE; - } - - String boxedFirstType = TypeTransformer.transformBoxPrimitives(firstArg.getSignature()); - String boxedSecondType = TypeTransformer.transformBoxPrimitives(secondArg.getSignature()); - - // JSP.2.3.5.7 step 3, if either is BigDecimal, promote both and compare - if (TypeConstants.TYPE_BIG_DOUBLE.equals(boxedFirstType) - || TypeConstants.TYPE_BIG_DOUBLE.equals(boxedSecondType)) - { - return handleNumericComparison(firstArg, secondArg, BigDecimal.class); - } - - // JSP.2.3.5.7, step 4 if either is a float or double, promote both to - // double and compare - if (TypeConstants.TYPE_BOXED_DOUBLE.equals(boxedFirstType) - || TypeConstants.TYPE_BOXED_FLOAT.equals(boxedFirstType) - || TypeConstants.TYPE_BOXED_DOUBLE.equals(boxedSecondType) - || TypeConstants.TYPE_BOXED_FLOAT.equals(boxedSecondType)) - { - return handleNumericComparison(firstArg, secondArg, Double.class); - } - - // JSP.2.3.5.7, step 5 if either is a big integer, promote and compare - if (TypeConstants.TYPE_BIG_INTEGER.equals(boxedFirstType) - || TypeConstants.TYPE_BIG_INTEGER.equals(boxedSecondType)) - { - return handleNumericComparison(firstArg, secondArg, BigInteger.class); - } - - // JSP.2.3.5.7, step 6 if either is Long or smaller, coerce both to Long - if (TypeConstants.TYPE_BOXED_LONG.equals(boxedFirstType) - || TypeConstants.TYPE_BOXED_LONG.equals(boxedSecondType) - || TypeConstants.TYPE_BOXED_INTEGER.equals(boxedFirstType) - || TypeConstants.TYPE_BOXED_INTEGER.equals(boxedSecondType) - || TypeConstants.TYPE_BOXED_SHORT.equals(boxedFirstType) - || TypeConstants.TYPE_BOXED_SHORT.equals(boxedSecondType) - || TypeConstants.TYPE_BOXED_BYTE.equals(boxedFirstType) - || TypeConstants.TYPE_BOXED_BYTE.equals(boxedSecondType) - || TypeConstants.SIGNATURE_BOXED_CHARACTER.equals(boxedFirstType) - || TypeConstants.SIGNATURE_BOXED_CHARACTER.equals(boxedSecondType)) - { - return handleNumericComparison(firstArg, secondArg, Long.class); - } - - // JSP.2.3.5.7, step 7 if either is a boolean, coerce to boolean - if (TypeConstants.TYPE_BOXED_BOOLEAN.equals(boxedFirstType) - || TypeConstants.TYPE_BOXED_BOOLEAN.equals(boxedSecondType)) - { - return handleBooleanComparison(firstArg, secondArg); - } - - // Unified EL 1.8.2, step 8 if either is a enum, then coerce both to enum - // NOTE: we handle the JSF 1.1 case also where enums are treated as non-coercable - // Object's - if (firstArg.isEnumType() || secondArg.isEnumType()) - { - return handleEnumComparison(firstArg, secondArg); - } - - // JSP.2.3.5.7, step 8 if either is a string, coerce to string and - // compare lexically - if (TypeConstants.TYPE_STRING.equals(boxedFirstType) - || TypeConstants.TYPE_STRING.equals(boxedSecondType)) - { - return handleStringComparison(firstArg, secondArg); - } - - // otherwise, an equal compare will be done A.equals(B). Since - return new ValueType(TypeConstants.TYPE_BOOLEAN, IAssignable.ASSIGNMENT_TYPE_RHS); - } - - private ValueType handleEnumComparison(ValueType firstArg, - ValueType secondArg) - { - assert firstArg.isEnumType() || secondArg.isEnumType(); - - // if the first is not an enum, then we have non-Enum == Enum case - if (!firstArg.isEnumType()) - { - return handleComparsionOfEnumAndNonEnum(secondArg, firstArg); - } - - // if the second is not an enum, then we have Enum == non-Enum case - if (!secondArg.isEnumType()) - { - return handleComparsionOfEnumAndNonEnum(firstArg, secondArg); - } - - // only other case is they are both enums. Check if they are directly - // comparable. - if (TypeUtil.canNeverBeEqual(firstArg.getSignature(), secondArg.getSignature())) - { - boolean result = doRealOperation("foo", "notFoo"); // just simulate the operation where the operands are not equal //$NON-NLS-1$ //$NON-NLS-2$ - - return BooleanLiteralType.valueOf(result); - } - - // otherwise, all we know is that it's a boolean - return new ValueType(TypeConstants.TYPE_BOOLEAN, IAssignable.ASSIGNMENT_TYPE_RHS); - } - - private ValueType handleComparsionOfEnumAndNonEnum(ValueType enumType, - ValueType nonEnumType) - { - // the only literal value that could have got us here is a - // StringLiteralValue since the others a filtered out before this is - // called - if (nonEnumType instanceof LiteralType) - { - assert nonEnumType instanceof StringLiteralType; - - Diagnostic result = validateIfEnumToStringComparison(((StringLiteralType)nonEnumType).getLiteralValue(), enumType); - - if (result != null) - { - // compare two things that aren't equal - return BooleanLiteralType.valueOf(doRealOperation("foo", "foo_")); //$NON-NLS-1$ //$NON-NLS-2$ - } - return new ValueType(TypeConstants.TYPE_BOOLEAN, IAssignable.ASSIGNMENT_TYPE_RHS); - } - - // if the arg is a String, then we can't prove anything before runtime - if (nonEnumType.isInstanceOf(TypeConstants.TYPE_STRING)) - { - return new ValueType(TypeConstants.TYPE_BOOLEAN, IAssignable.ASSIGNMENT_TYPE_RHS); - } - // otherwise, we know it will result in a problem since one is an enum - // and the other isn't so simply do a comparison on two things that aren't equals - return BooleanLiteralType.valueOf(doRealOperation("foo", "foo_")); //$NON-NLS-1$ //$NON-NLS-2$ - } - - public Diagnostic validate(ValueType firstArg, ValueType secondArg) { - - // JSP.2.3.5.7 step 2 if either operand is null, then not equal - if (TypeCoercer.typeIsNull(firstArg.getSignature()) - || TypeCoercer.typeIsNull(secondArg.getSignature())) - { - // TODO: this is a strange thing to do... - final boolean result = doRealOperation(Integer.valueOf(4), null); - return _diagnosticFactory.create_BINARY_OP_EQUALITY_COMP_WITH_NULL_ALWAYS_EVAL_SAME(Boolean.toString(result)); - } - - final String boxedFirstType = - TypeTransformer.transformBoxPrimitives(firstArg.getSignature()); - final String boxedSecondType = - TypeTransformer.transformBoxPrimitives(secondArg.getSignature()); - - // JSP.2.3.5.7 step 3, if either is BigDecimal, promote both and compare - if (TypeConstants.TYPE_BIG_DOUBLE.equals(boxedFirstType) - || TypeConstants.TYPE_BIG_DOUBLE.equals(boxedSecondType)) - { - return validateNumericComparison(firstArg, secondArg, BigDecimal.class); - } - - // JSP.2.3.5.7, step 4 if either is a float or double, promote both to - // double and compare - if (TypeConstants.TYPE_BOXED_DOUBLE.equals(boxedFirstType) - || TypeConstants.TYPE_BOXED_FLOAT.equals(boxedFirstType) - || TypeConstants.TYPE_BOXED_DOUBLE.equals(boxedSecondType) - || TypeConstants.TYPE_BOXED_FLOAT.equals(boxedSecondType)) - { - return validateNumericComparison(firstArg, secondArg, Double.class); - } - - // JSP.2.3.5.7, step 5 if either is a big integer, promote and compare - if (TypeConstants.TYPE_BIG_INTEGER.equals(boxedFirstType) - || TypeConstants.TYPE_BIG_INTEGER.equals(boxedSecondType)) - { - return validateNumericComparison(firstArg, secondArg, BigInteger.class); - } - - // JSP.2.3.5.7, step 6 if either is Long or smaller, coerce both to Long - if (TypeConstants.TYPE_BOXED_LONG.equals(boxedFirstType) - || TypeConstants.TYPE_BOXED_LONG.equals(boxedSecondType) - || TypeConstants.TYPE_BOXED_INTEGER.equals(boxedFirstType) - || TypeConstants.TYPE_BOXED_INTEGER.equals(boxedSecondType) - || TypeConstants.TYPE_BOXED_SHORT.equals(boxedFirstType) - || TypeConstants.TYPE_BOXED_SHORT.equals(boxedSecondType) - || TypeConstants.TYPE_BOXED_BYTE.equals(boxedFirstType) - || TypeConstants.TYPE_BOXED_BYTE.equals(boxedSecondType) - || TypeConstants.SIGNATURE_BOXED_CHARACTER.equals(boxedFirstType) - || TypeConstants.SIGNATURE_BOXED_CHARACTER.equals(boxedSecondType)) - { - return validateNumericComparison(firstArg, secondArg, Long.class); - } - - // JSP.2.3.5.7, step 7 if either is a boolean, coerce to boolean - if (TypeConstants.TYPE_BOXED_BOOLEAN.equals(boxedFirstType) - || TypeConstants.TYPE_BOXED_BOOLEAN.equals(boxedSecondType)) - { - return validateBooleanComparison(firstArg, secondArg); - } - - // Unified EL 1.8.2, step 8 if either is a enum, then coerce both to enum - // NOTE: we handle the JSF 1.1 case also where enums are treated as non-coercable - // Object's - if (firstArg.isEnumType() || secondArg.isEnumType()) - { - return validateEnumComparison(firstArg, secondArg); - } - - // JSP.2.3.5.7, step 8 if either is a string, coerce to string and - // compare lexically - if (TypeConstants.TYPE_STRING.equals(boxedFirstType) - || TypeConstants.TYPE_STRING.equals(boxedSecondType)) - { - return validateStringComparison(firstArg, secondArg); - } - - // otherwise, an equal compare will be done A.equals(B). Since - return Diagnostic.OK_INSTANCE; - } - - - /** - * Both types are coerced to boolean before comparison - * - * @param firstArg - * @param secondArg - * @return the result of the comparison - */ - private ValueType handleBooleanComparison(ValueType firstArg, ValueType secondArg) - { - boolean canCoerceFirstArg = - TypeCoercer.canCoerceToBoolean(TypeTransformer.transformBoxPrimitives(firstArg.getSignature())); - boolean canCoerceSecondArg = TypeCoercer.canCoerceToBoolean(TypeTransformer.transformBoxPrimitives(secondArg.getSignature())); - - if (! (canCoerceFirstArg && canCoerceSecondArg)) - { - return null; - } - - if (firstArg instanceof LiteralType && secondArg instanceof LiteralType) - { - try - { - Boolean firstValue = ((LiteralType)firstArg).coerceToBoolean(); - Boolean secondValue = ((LiteralType)secondArg).coerceToBoolean(); - - if (firstValue != null && secondValue != null) - { - boolean result = doRealOperation(firstValue, secondValue); - return result ? - BooleanLiteralType.TRUE : - BooleanLiteralType.FALSE; - } - } - catch (TypeCoercionException tce) - { - throw new AssertionError("should never get here; have already checked coercability above"); //$NON-NLS-1$ - } - } - - // otherwise, we have a valid comparison that results in boolean - return new ValueType(TypeConstants.TYPE_BOOLEAN, IAssignable.ASSIGNMENT_TYPE_RHS); - } - - private Diagnostic validateBooleanComparison(ValueType firstType, ValueType secondType) - { - boolean canCoerceFirstArg = - TypeCoercer.canCoerceToBoolean(TypeTransformer.transformBoxPrimitives(firstType.getSignature())); - boolean canCoerceSecondArg = TypeCoercer.canCoerceToBoolean(TypeTransformer.transformBoxPrimitives(secondType.getSignature())); - - if (!canCoerceFirstArg) - { - return _diagnosticFactory.create_BINARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN(Messages.getString("EqualityRelationalBinaryOperator.FirstArgument")); //$NON-NLS-1$ - } - - if (!canCoerceSecondArg) - { - return _diagnosticFactory.create_BINARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN(Messages.getString("EqualityRelationalBinaryOperator.SecondArgument")); //$NON-NLS-1$ - } - - if (firstType instanceof LiteralType && secondType instanceof LiteralType) - { - try - { - Boolean firstValue = ((LiteralType)firstType).coerceToBoolean(); - Boolean secondValue = ((LiteralType)secondType).coerceToBoolean(); - - if (firstValue != null && secondValue != null) - { - final boolean result = - doRealOperation(firstValue, secondValue); - return _diagnosticFactory. - create_BINARY_OP_CONSTANT_EXPRESSION_ALWAYS_EVAL_SAME(getOperationName(), Boolean.toString(result)); - } - } - catch (TypeCoercionException tce) - { - throw new AssertionError("should never get here; have already checked coercability above"); //$NON-NLS-1$ - } - } - - // otherwise, we have a valid comparison - return Diagnostic.OK_INSTANCE; - } - - @Override - protected Diagnostic validateStringComparison(ValueType firstType, - ValueType secondType) - { - String firstValue = null; - - if (firstType instanceof LiteralType) - { - firstValue = ((LiteralType)firstType).getLiteralValue(); - } - - String secondValue = null; - if (secondType instanceof LiteralType) - { - secondValue = ((LiteralType)secondType).getLiteralValue(); - } - - if (firstValue != null) - { - Diagnostic result = validateIfEnumToStringComparison(firstValue, secondType); - - if (result != null) - { - return result; - } - } - - if (secondValue != null) - { - Diagnostic result = validateIfEnumToStringComparison(secondValue, firstType); - - if (result != null) - { - return result; - } - } - - // if it's a string to enum compare, do the default parent thing - return super.validateStringComparison(firstType, secondType); - } - - - @Override - protected ValueType handleStringComparison(ValueType firstType, - ValueType secondType) - { - String firstValue = null; - - if (firstType instanceof LiteralType) - { - firstValue = ((LiteralType)firstType).getLiteralValue(); - } - - String secondValue = null; - if (secondType instanceof LiteralType) - { - secondValue = ((LiteralType)secondType).getLiteralValue(); - } - - if (firstValue != null) - { - Diagnostic result = validateIfEnumToStringComparison(firstValue, secondType); - - if (result != null) - { - return handleIfEnumToNonMemberStringComparison(firstValue, secondType); - } - } - - if (secondValue != null) - { - Diagnostic result = validateIfEnumToStringComparison(secondValue, firstType); - - if (result != null) - { - return handleIfEnumToNonMemberStringComparison(secondValue, firstType); - } - } - - // otherwise, do the super thing - return super.handleStringComparison(firstType, secondType); - } - - private Diagnostic validateEnumComparison(final ValueType firstArg, final ValueType secondArg) - { - assert firstArg.isEnumType() || secondArg.isEnumType(); - - // if the first is not an enum, then we have non-Enum == Enum case - if (!firstArg.isEnumType()) - { - return validateComparsionOfEnumAndNonEnum(firstArg, secondArg); - } - - // if the second is not an enum, then we have Enum == non-Enum case - if (!secondArg.isEnumType()) - { - return validateComparsionOfEnumAndNonEnum(secondArg, firstArg); - } - - // only other case is they are both enums. Check if they are directly - // comparable. - if (TypeUtil.canNeverBeEqual(firstArg.getSignature(), secondArg.getSignature())) - { - return _diagnosticFactory. - create_BINARY_COMPARISON_WITH_TWO_ENUMS_ALWAYS_SAME - (getOperationName() - , doRealOperation("foo", "notFoo") // just simulate the operation where the operands are not equal //$NON-NLS-1$ //$NON-NLS-2$ - , TypeUtil.getFullyQualifiedName(firstArg.getSignature()) - , TypeUtil.getFullyQualifiedName(secondArg.getSignature())); - } - - // otherwise, it's all good - return Diagnostic.OK_INSTANCE; - } - - private Diagnostic validateComparsionOfEnumAndNonEnum(final ValueType nonEnumType, final ValueType enumType) - { - // the only literal value that could have got us here is a - // StringLiteralValue since the others a filtered out before this is - // called - if (nonEnumType instanceof LiteralType) - { - assert nonEnumType instanceof StringLiteralType; - - Diagnostic result = validateIfEnumToStringComparison(((StringLiteralType)nonEnumType).getLiteralValue(), enumType); - - if (result != null) - { - return result; - } - return Diagnostic.OK_INSTANCE; - } - - // if the arg is a String, then we can't prove anything before runtime - if (nonEnumType.isInstanceOf(TypeConstants.TYPE_STRING)) - { - return Diagnostic.OK_INSTANCE; - } - // otherwise, we know it will result in a problem since one is an enum - // and the other isn't - return _diagnosticFactory. - create_BINARY_COMPARISON_WITH_ENUM_AND_UNCOERCABLE_NONCONST_ALWAYS_SAME - (getOperationName() - , doRealOperation("foo", "notFoo") // just simulate the operation where the operands are not equal //$NON-NLS-1$ //$NON-NLS-2$ - , TypeUtil.getFullyQualifiedName(enumType.getSignature()) - , TypeUtil.getFullyQualifiedName(nonEnumType.getSignature())); - } - - private Diagnostic validateIfEnumToStringComparison(final String literalValue, final ValueType validateIfEnum) - { - if (validateIfEnum.isEnumType() - && validateIfEnum instanceof IObjectSymbolBasedValueType) - { - final IObjectSymbolBasedValueType symbolValueType = - (IObjectSymbolBasedValueType) validateIfEnum; - - IType type = symbolValueType.getSymbol().getTypeDescriptor().resolveType(symbolValueType.getSymbol().getTypeDescriptor().getTypeSignature()); - - if (type != null && !TypeUtil.isEnumMember(type, literalValue)) - { - return _diagnosticFactory. - create_BINARY_COMPARISON_WITH_ENUM_AND_CONST_ALWAYS_SAME - (getOperationName() - , doRealOperation(literalValue, literalValue+"_") // just simulate the operation where the operands are not equal //$NON-NLS-1$ - , TypeUtil.getFullyQualifiedName(validateIfEnum.getSignature()) - , literalValue); - } - } - - return null; - } - - private ValueType handleIfEnumToNonMemberStringComparison(final String literalValue, final ValueType enumValueType) - { - // we need to apply the real operation to literalValue and any string that !equals(literalValue) - // since it's not a member of the enum - return BooleanLiteralType.valueOf(doRealOperation(literalValue, literalValue+"_")); //$NON-NLS-1$ - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/EqualsBinaryRelationalOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/EqualsBinaryRelationalOperator.java deleted file mode 100644 index 3fa99f472..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/EqualsBinaryRelationalOperator.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.validation.internal.el.operators; - -import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory; - -/** - * Represents the equals -- ==/eq EL binary operator - * - * @author cbateman - * - */ -/*package*/ class EqualsBinaryRelationalOperator extends - EqualityRelationalBinaryOperator -{ - - EqualsBinaryRelationalOperator(final DiagnosticFactory diagnosticFactory, String jsfVersion) { - super(diagnosticFactory, jsfVersion); - } - - /** - * @param firstArg - * @param secondArg - * @return the result of the operation - */ - protected boolean doRealOperation(Number firstArg, Number secondArg) - { - return firstArg.equals(secondArg); - } - - /** - * @param firstArg - * @param secondArg - * @return the result of the operation - */ - protected boolean doRealOperation(Boolean firstArg, Boolean secondArg) - { - return firstArg.equals(secondArg); - } - - /** - * @param firstArg - * @param secondArg - * @return the result of the operation - */ - protected boolean doRealOperation(String firstArg, String secondArg) - { - return firstArg.equals(secondArg); - } - - protected String getOperationName() - { - return Messages.getString("EqualsBinaryRelationalOperator.OperationName"); //$NON-NLS-1$ - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/GreaterThanEqRelationalBinaryOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/GreaterThanEqRelationalBinaryOperator.java deleted file mode 100644 index edab570f8..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/GreaterThanEqRelationalBinaryOperator.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.validation.internal.el.operators; - -import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory; - -/** - * Encapsulates the EL greater-than-eq operator -- ">="/ge - * - * @author cbateman - * - */ -/*package*/ class GreaterThanEqRelationalBinaryOperator extends - LtGtRelationalBinaryOperator -{ - GreaterThanEqRelationalBinaryOperator(final DiagnosticFactory diagnosticFactory, String jsfVersion) { - super(diagnosticFactory, jsfVersion); - } - - protected boolean doRealOperation(Number firstArg, Number secondArg) - { - return ((Comparable)firstArg).compareTo(secondArg) >= 0; - } - - protected boolean doRealOperation(String firstArg, String secondArg) - { - return firstArg.compareTo(secondArg) >= 0; - } - - protected String getOperationName() - { - return Messages.getString("GreaterThanEqRelationalBinaryOperator.OperationName"); //$NON-NLS-1$ - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/GreaterThanRelationalBinaryOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/GreaterThanRelationalBinaryOperator.java deleted file mode 100644 index 78a62a7a6..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/GreaterThanRelationalBinaryOperator.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.validation.internal.el.operators; - -import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory; - -/** - * Represents the EL greater than operator -- ">"/gt - * @author cbateman - * - */ -/*package*/ class GreaterThanRelationalBinaryOperator extends - LtGtRelationalBinaryOperator { - - GreaterThanRelationalBinaryOperator(final DiagnosticFactory diagnosticFactory, String jsfVersion) - { - super(diagnosticFactory, jsfVersion); - } - - protected boolean doRealOperation(Number firstArg, Number secondArg) - { - return ((Comparable)firstArg).compareTo(secondArg) > 0; - } - - protected boolean doRealOperation(String firstArg, String secondArg) - { - return firstArg.compareTo(secondArg) > 0; - } - - protected String getOperationName() - { - return Messages.getString("GreaterThanRelationalBinaryOperator.OperationName"); //$NON-NLS-1$ - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/LessThanEqRelationalBinaryOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/LessThanEqRelationalBinaryOperator.java deleted file mode 100644 index 24dc5e2a5..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/LessThanEqRelationalBinaryOperator.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.validation.internal.el.operators; - -import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory; - - -/** - * Encapsulates the EL less-than-equal operator -- "<="/le - * - * @author cbateman - * - */ -/*package*/ class LessThanEqRelationalBinaryOperator extends - LtGtRelationalBinaryOperator -{ - LessThanEqRelationalBinaryOperator(final DiagnosticFactory diagnosticFactory, String jsfVersion) { - super(diagnosticFactory, jsfVersion); - } - - protected boolean doRealOperation(Number firstArg, Number secondArg) - { - return ((Comparable)firstArg).compareTo(secondArg) <= 0; - } - - protected boolean doRealOperation(String firstArg, String secondArg) - { - return firstArg.compareTo(secondArg) <= 0; - } - - protected String getOperationName() - { - return Messages.getString("LessThanEqRelationalBinaryOperator.OperationName"); //$NON-NLS-1$ - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/LessThanRelationalBinaryOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/LessThanRelationalBinaryOperator.java deleted file mode 100644 index 7b8e7ea7b..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/LessThanRelationalBinaryOperator.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.validation.internal.el.operators; - -import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory; - -/** - * The "<"/"lt" less-than EL operator - * - * @author cbateman - * - */ -/*package*/ class LessThanRelationalBinaryOperator extends - LtGtRelationalBinaryOperator -{ - LessThanRelationalBinaryOperator(final DiagnosticFactory diagnosticFactory, String jsfVersion) - { - super(diagnosticFactory, jsfVersion); - } - - protected boolean doRealOperation(Number firstArg, Number secondArg) - { - return ((Comparable)firstArg).compareTo(secondArg) < 0; - } - - protected boolean doRealOperation(String firstArg, String secondArg) - { - return firstArg.compareTo(secondArg) < 0; - } - - protected String getOperationName() - { - return Messages.getString("LessThanRelationalBinaryOperator.OperationName"); //$NON-NLS-1$ - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/LogicalBinaryOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/LogicalBinaryOperator.java deleted file mode 100644 index 41b897fea..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/LogicalBinaryOperator.java +++ /dev/null @@ -1,178 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.validation.internal.el.operators; - -import org.eclipse.emf.common.util.Diagnostic; -import org.eclipse.jst.jsf.common.internal.types.BooleanLiteralType; -import org.eclipse.jst.jsf.common.internal.types.IAssignable; -import org.eclipse.jst.jsf.common.internal.types.LiteralType; -import org.eclipse.jst.jsf.common.internal.types.TypeCoercer; -import org.eclipse.jst.jsf.common.internal.types.TypeCoercionException; -import org.eclipse.jst.jsf.common.internal.types.TypeConstants; -import org.eclipse.jst.jsf.common.internal.types.TypeTransformer; -import org.eclipse.jst.jsf.common.internal.types.ValueType; -import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory; - -/** - * Represents a logical binary operator per JSP.2.3.6.1 (logical and/or) - * - * @author cbateman - * - */ -/*package*/abstract class LogicalBinaryOperator extends BinaryOperator -{ - LogicalBinaryOperator(DiagnosticFactory diagnosticFactory) { - super(diagnosticFactory); - } - - public ValueType performOperation(ValueType firstArg, ValueType secondArg) - { - final boolean canCoerceFirstArg = - TypeCoercer.canCoerceToBoolean(TypeTransformer.transformBoxPrimitives(firstArg.getSignature())); - final boolean canCoerceSecondArg = - TypeCoercer.canCoerceToBoolean(TypeTransformer.transformBoxPrimitives(secondArg.getSignature())); - - // if can't perform, must return null - if (! (canCoerceFirstArg && canCoerceSecondArg)) - { - return null; - } - - Boolean firstArgResolvedValue = null; - - if (firstArg instanceof LiteralType) - { - try - { - firstArgResolvedValue = ((LiteralType)firstArg).coerceToBoolean(); - } - catch (TypeCoercionException tce) - { - // should never be throw due to already checking if can coerce - throw new AssertionError("coercion already checked; this should never be reached"); - } - } - - Boolean secondArgResolvedValue = null; - if (secondArg instanceof LiteralType) - { - try - { - secondArgResolvedValue = ((LiteralType)secondArg).coerceToBoolean(); - } - catch (TypeCoercionException tce) - { - // should never be throw due to already checking if can coerce - throw new AssertionError("coercion already checked; this should never be reached"); - } - } - - if (firstArgResolvedValue != null && secondArgResolvedValue != null) - { - boolean result = - doRealOperation(firstArgResolvedValue, secondArgResolvedValue); - - return result ? BooleanLiteralType.TRUE : BooleanLiteralType.FALSE; - - } - - // otherwise, just return a boolean - // result can only be an rvalue - return new ValueType(TypeConstants.TYPE_BOOLEAN, IAssignable.ASSIGNMENT_TYPE_RHS); - } - - public Diagnostic validate(ValueType firstArg, ValueType secondArg) - { - final boolean canCoerceFirstArg = - TypeCoercer.canCoerceToBoolean(TypeTransformer.transformBoxPrimitives(firstArg.getSignature())); - final boolean canCoerceSecondArg = - TypeCoercer.canCoerceToBoolean(TypeTransformer.transformBoxPrimitives(secondArg.getSignature())); - - if (!canCoerceFirstArg) - { - return _diagnosticFactory. - create_BINARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN("first"); - //return new BasicDiagnostic(Diagnostic.ERROR, "", 0, "Cannot coerce first argument of "+readableOperatorName()+" to boolean", null); - } - - if (!canCoerceSecondArg) - { - return _diagnosticFactory. - create_BINARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN("first"); - - //return new BasicDiagnostic(Diagnostic.ERROR, "", 0, "Cannot coerce second argument of "+readableOperatorName()+" to boolean", null); - } - - if (firstArg instanceof LiteralType) - { - try - { - final Boolean boolValue = - ((LiteralType)firstArg).coerceToBoolean(); - - if (boolValue.booleanValue() == shortCircuitValue()) - { - return _diagnosticFactory. - create_BINARY_OP_FIRST_ARGUMENT_SHORT_CIRCUITS - (shortCircuitValue(), readableOperatorName()); - } - } - catch (TypeCoercionException tce) - { - // should never be throw due to already checking if can coerce - throw new AssertionError("coercion already checked; this should never be reached"); - } - } - - if (secondArg instanceof LiteralType) - { - try - { - final Boolean boolValue = - ((LiteralType)secondArg).coerceToBoolean(); - - if (boolValue.booleanValue() == shortCircuitValue()) - { - return _diagnosticFactory. - create_BINARY_OP_SECOND_ARGUMENT_ALWAYS_EVAL_SAME - (shortCircuitValue(), readableOperatorName()); - } - } - catch (TypeCoercionException tce) - { - // should never be throw due to already checking if can coerce - throw new AssertionError("coercion already checked; this should never be reached"); - } - } - - // otherwise, nothing to report - return Diagnostic.OK_INSTANCE; - } - - /** - * @return a human readable name for the operator - */ - protected abstract String readableOperatorName(); - - /** - * @return the boolean value on which the operator short-circuits - */ - protected abstract boolean shortCircuitValue(); - - /** - * @param firstArg - * @param secondArg - * @return the result of performing the operator to two actual values - */ - protected abstract boolean doRealOperation(Boolean firstArg, Boolean secondArg); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/LtGtRelationalBinaryOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/LtGtRelationalBinaryOperator.java deleted file mode 100644 index e4695ac88..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/LtGtRelationalBinaryOperator.java +++ /dev/null @@ -1,225 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.validation.internal.el.operators; - -import java.math.BigDecimal; -import java.math.BigInteger; - -import org.eclipse.emf.common.util.Diagnostic; -import org.eclipse.jdt.core.Signature; -import org.eclipse.jst.jsf.common.internal.types.BooleanLiteralType; -import org.eclipse.jst.jsf.common.internal.types.IAssignable; -import org.eclipse.jst.jsf.common.internal.types.TypeCoercer; -import org.eclipse.jst.jsf.common.internal.types.TypeConstants; -import org.eclipse.jst.jsf.common.internal.types.TypeTransformer; -import org.eclipse.jst.jsf.common.internal.types.ValueType; -import org.eclipse.jst.jsf.common.util.TypeUtil; -import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory; - -/** - * Encapsulates the EL binary operators "<", ">", "<=", ">=" - * - * @author cbateman - * - */ -/*package*/ abstract class LtGtRelationalBinaryOperator extends RelationalBinaryOperator -{ - LtGtRelationalBinaryOperator(final DiagnosticFactory diagnosticFactory, String jsfVersion) - { - super(diagnosticFactory, jsfVersion); - } - - protected abstract boolean doRealOperation(Number firstArg, Number secondArg); - - protected abstract boolean doRealOperation(String firstArg, String secondArg); - - public ValueType performOperation(ValueType firstArg, ValueType secondArg) - { - // JSP.2.3.5.6 step 2 if either operand is null, then always false - if (TypeCoercer.typeIsNull(firstArg.getSignature()) - || TypeCoercer.typeIsNull(secondArg.getSignature())) - { - return BooleanLiteralType.FALSE; - } - - String boxedFirstType = TypeTransformer.transformBoxPrimitives(firstArg.getSignature()); - String boxedSecondType = TypeTransformer.transformBoxPrimitives(secondArg.getSignature()); - - // JSP.2.3.5.6 step 3, if either is BigDecimal, promote both and compare - if (TypeConstants.TYPE_BIG_DOUBLE.equals(boxedFirstType) - || TypeConstants.TYPE_BIG_DOUBLE.equals(boxedSecondType)) - { - return handleNumericComparison(firstArg, secondArg, BigDecimal.class); - } - - // JSP.2.3.5.6, step 4 if either is a float or double, promote both to - // double and compare - if (TypeConstants.TYPE_BOXED_DOUBLE.equals(boxedFirstType) - || TypeConstants.TYPE_BOXED_FLOAT.equals(boxedFirstType) - || TypeConstants.TYPE_BOXED_DOUBLE.equals(boxedSecondType) - || TypeConstants.TYPE_BOXED_FLOAT.equals(boxedSecondType)) - { - return handleNumericComparison(firstArg, secondArg, Double.class); - } - - // JSP.2.3.5.6, step 5 if either is a big integer, promote and compare - if (TypeConstants.TYPE_BIG_INTEGER.equals(boxedFirstType) - || TypeConstants.TYPE_BIG_INTEGER.equals(boxedSecondType)) - { - return handleNumericComparison(firstArg, secondArg, BigInteger.class); - } - - // JSP.2.3.5.6, step 6 if either is Long or smaller, coerce both to Long - if (TypeConstants.TYPE_BOXED_LONG.equals(boxedFirstType) - || TypeConstants.TYPE_BOXED_LONG.equals(boxedSecondType) - || TypeConstants.TYPE_BOXED_INTEGER.equals(boxedFirstType) - || TypeConstants.TYPE_BOXED_INTEGER.equals(boxedSecondType) - || TypeConstants.TYPE_BOXED_SHORT.equals(boxedFirstType) - || TypeConstants.TYPE_BOXED_SHORT.equals(boxedSecondType) - || TypeConstants.TYPE_BOXED_BYTE.equals(boxedFirstType) - || TypeConstants.TYPE_BOXED_BYTE.equals(boxedSecondType) - || TypeConstants.SIGNATURE_BOXED_CHARACTER.equals(boxedFirstType) - || TypeConstants.SIGNATURE_BOXED_CHARACTER.equals(boxedSecondType)) - { - return handleNumericComparison(firstArg, secondArg, Long.class); - } - - // JSP.2.3.5.7, step 7 if either is a string, coerce to string and - // compare lexically - if (TypeConstants.TYPE_STRING.equals(boxedFirstType) - || TypeConstants.TYPE_STRING.equals(boxedSecondType)) - { - return handleStringComparison(firstArg, secondArg); - } - - // JSP.2.3.5.7, steps 8 and 9 -- if either one implements the - // Comparable interface, then as far as we can determine statically - // (compareTo may not work on the other arg, but who knows), - // we are good - if (firstArg.isInstanceOf(TypeConstants.TYPE_COMPARABLE) - || secondArg.isInstanceOf(TypeConstants.TYPE_COMPARABLE)) - { - if (checkIfIncompatibleEnums(firstArg, secondArg)) - { - // error: no point in validating further since expr will probably throw an exception - return null; - } - - return new ValueType(Signature.SIG_BOOLEAN, IAssignable.ASSIGNMENT_TYPE_RHS); - } - - // JSP.2.3.5.6, step 10 -- otherwise, error - return null; - - } - - public Diagnostic validate(ValueType firstArg, ValueType secondArg) - { - // JSP.2.3.5.6 step 2 if either operand is null, then always false - if (TypeCoercer.typeIsNull(firstArg.getSignature()) - || TypeCoercer.typeIsNull(secondArg.getSignature())) - { - return _diagnosticFactory. - create_BINARY_OP_EQUALITY_COMP_WITH_NULL_ALWAYS_EVAL_SAME(Messages.getString("LtGtRelationalBinaryOperator.ConstantName.False")); //$NON-NLS-1$ - } - - String boxedFirstType = TypeTransformer.transformBoxPrimitives(firstArg.getSignature()); - String boxedSecondType = TypeTransformer.transformBoxPrimitives(secondArg.getSignature()); - - // JSP.2.3.5.6 step 3, if either is BigDecimal, promote both and compare - if (TypeConstants.TYPE_BIG_DOUBLE.equals(boxedFirstType) - || TypeConstants.TYPE_BIG_DOUBLE.equals(boxedSecondType)) - { - return validateNumericComparison(firstArg, secondArg, BigDecimal.class); - } - - // JSP.2.3.5.6, step 4 if either is a float or double, promote both to - // double and compare - if (TypeConstants.TYPE_BOXED_DOUBLE.equals(boxedFirstType) - || TypeConstants.TYPE_BOXED_FLOAT.equals(boxedFirstType) - || TypeConstants.TYPE_BOXED_DOUBLE.equals(boxedSecondType) - || TypeConstants.TYPE_BOXED_FLOAT.equals(boxedSecondType)) - { - return validateNumericComparison(firstArg, secondArg, Double.class); - } - - // JSP.2.3.5.6, step 5 if either is a big integer, promote and compare - if (TypeConstants.TYPE_BIG_INTEGER.equals(boxedFirstType) - || TypeConstants.TYPE_BIG_INTEGER.equals(boxedSecondType)) - { - return validateNumericComparison(firstArg, secondArg, BigInteger.class); - } - - // JSP.2.3.5.6, step 6 if either is Long or smaller, coerce both to Long - if (TypeConstants.TYPE_BOXED_LONG.equals(boxedFirstType) - || TypeConstants.TYPE_BOXED_LONG.equals(boxedSecondType) - || TypeConstants.TYPE_BOXED_INTEGER.equals(boxedFirstType) - || TypeConstants.TYPE_BOXED_INTEGER.equals(boxedSecondType) - || TypeConstants.TYPE_BOXED_SHORT.equals(boxedFirstType) - || TypeConstants.TYPE_BOXED_SHORT.equals(boxedSecondType) - || TypeConstants.TYPE_BOXED_BYTE.equals(boxedFirstType) - || TypeConstants.TYPE_BOXED_BYTE.equals(boxedSecondType) - || TypeConstants.SIGNATURE_BOXED_CHARACTER.equals(boxedFirstType) - || TypeConstants.SIGNATURE_BOXED_CHARACTER.equals(boxedSecondType)) - { - return validateNumericComparison(firstArg, secondArg, Long.class); - } - - // JSP.2.3.5.7, step 7 if either is a string, coerce to string and - // compare lexically - if (TypeConstants.TYPE_STRING.equals(boxedFirstType) - || TypeConstants.TYPE_STRING.equals(boxedSecondType)) - { - return validateStringComparison(firstArg, secondArg); - } - - // JSP.2.3.5.7, steps 8 and 9 -- if either one implements the - // Comparable interface, then as far as we can determine statically - // (compareTo may not work on the other arg, but who knows), - // we are good - if (firstArg.isInstanceOf(TypeConstants.TYPE_COMPARABLE) - || secondArg.isInstanceOf(TypeConstants.TYPE_COMPARABLE)) - { - Diagnostic diag = Diagnostic.OK_INSTANCE; - if(checkIfIncompatibleEnums(firstArg, secondArg)) - { - diag = _diagnosticFactory.create_BINARY_OP_COMPARISON_OF_ENUMS_INCOMPATIBLE(); - } - return diag; - } - - // JSP.2.3.5.6, step 10 -- otherwise, error - return _diagnosticFactory.create_BINARY_OP_NO_AVAILABLE_TYPE_COERCION(); - } - - /** - * @param firstArg - * @param secondArg - * @return diagnostic if firstArg and secondArg are incompatible with each other - * for compareTo purpose or OK if not - */ - private boolean checkIfIncompatibleEnums(ValueType firstArg, - ValueType secondArg) - { - if (firstArg.isEnumType() - && secondArg.isEnumType() - && !TypeUtil.isEnumsCompareCompatible(firstArg.getSignature() - , secondArg.getSignature())) - { - return true; - } - - return false; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/MemberAccessorOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/MemberAccessorOperator.java deleted file mode 100644 index 505a12527..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/MemberAccessorOperator.java +++ /dev/null @@ -1,309 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.validation.internal.el.operators; - -import org.eclipse.core.resources.IFile; -import org.eclipse.emf.common.util.Diagnostic; -import org.eclipse.jst.jsf.common.internal.types.LiteralType; -import org.eclipse.jst.jsf.common.internal.types.NullLiteralType; -import org.eclipse.jst.jsf.common.internal.types.SignatureBasedType; -import org.eclipse.jst.jsf.common.internal.types.TypeCoercer; -import org.eclipse.jst.jsf.common.internal.types.TypeConstants; -import org.eclipse.jst.jsf.common.internal.types.ValueType; -import org.eclipse.jst.jsf.context.symbol.IMethodSymbol; -import org.eclipse.jst.jsf.context.symbol.IObjectSymbol; -import org.eclipse.jst.jsf.context.symbol.IPropertySymbol; -import org.eclipse.jst.jsf.context.symbol.ISymbol; -import org.eclipse.jst.jsf.context.symbol.internal.util.IMethodSymbolBasedType; -import org.eclipse.jst.jsf.context.symbol.internal.util.IObjectSymbolBasedValueType; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.designtime.DesignTimeApplicationManager; -import org.eclipse.jst.jsf.designtime.el.AbstractDTMethodResolver; -import org.eclipse.jst.jsf.designtime.el.AbstractDTPropertyResolver; -import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory; - -/** - * Super-class for all operators whose function is to access members of an EL - * object. i.e. the "." and "[]" operators - * - * @author cbateman - * - */ -public abstract class MemberAccessorOperator -{ - /** - * The source file for the EL expression in which this operator is being - * evaluated. - */ - protected final IFile _file; - - /** - * the common factory used to create diagnostics - */ - protected final DiagnosticFactory _diagnosticFactory; - - // TODO: need to reconcile with BinaryOperator? performOperation must return - // SignatureBasedType since it may return a method. This can't happen - // with other operators (besides eqiv []) - /** - * @param file - * @param diagnosticFactory - */ - protected MemberAccessorOperator(final IFile file, - final DiagnosticFactory diagnosticFactory) - { - _file = file; - _diagnosticFactory = diagnosticFactory; - } - - /** - * @param firstArg - * @param secondArg - * @return the result of validating the dot operation with these arguments. - */ - public Diagnostic validate(final ValueType firstArg, final ValueType secondArg) - { - if (!(firstArg instanceof IObjectSymbolBasedValueType)) - { - throw new AssertionError( - "The first argument of the member operator must always be a symbol resolvable value type"); - } - - if (TypeCoercer.typeIsNull(secondArg.getSignature())) - { - return _diagnosticFactory - .create_BINARY_OP_DOT_WITH_VALUEB_NULL(getOperatorName()); - } - - return validateObjectSymbolValue( - (IObjectSymbolBasedValueType) firstArg, secondArg); - } - - /** - * @param firstArg - * @param secondArg - * @return the diagnostic for member(firstArg, secondArg) - */ - protected abstract Diagnostic validateObjectSymbolValue( - IObjectSymbolBasedValueType firstArg, ValueType secondArg); - - /** - * @param firstArg - * @param secondArg - * @return a validation of a named property accessible base (map or bean) - * given an a literal key argument - */ - protected Diagnostic validateNamedPropertyAccessorBase( - final IObjectSymbolBasedValueType firstArg, final LiteralType secondArg) - { - final IObjectSymbol curBaseSymbol = firstArg.getSymbol(); - - final ISymbol nextSymbol = - getMemberSymbol(firstArg.getSymbol(), secondArg - .getLiteralValueRaw()); - - // if the x in x.y is an unconstrained map an it returns - // a java.lang.Object, then return null. We can't really say - // anything meaningful about such a property anyway. - // TODO: do we need to refine the type descriptor on such - // a property object to make this more precise? - if (curBaseSymbol.supportsCoercion(TypeConstants.TYPE_MAP) - && nextSymbol instanceof IPropertySymbol - && TypeConstants.TYPE_JAVAOBJECT - .equals(((IPropertySymbol) nextSymbol) - .getTypeDescriptor().getTypeSignature())) - { - // if we get a symbol back that's a generic object coming from a map - // then stop validating; we can't tell anything for sure - return Diagnostic.OK_INSTANCE; - } - - if (nextSymbol == null) - { - return _diagnosticFactory.create_MEMBER_NOT_FOUND(secondArg - .getLiteralValue(), firstArg.getSymbol().getName()); - } - - return Diagnostic.OK_INSTANCE; - } - - /** - * @param firstArg - * @param secondArg - * @return the resolved type for the operation or null if not computable - */ - public SignatureBasedType performOperation(final ValueType firstArg, - final ValueType secondArg) - { - if (!(firstArg instanceof IObjectSymbolBasedValueType)) - { - return null; - } - - // per JSP.2.3.4, if value-b is null, then return null (not literal - // null) - if (TypeCoercer.typeIsNull(secondArg.getSignature())) - { - return null; - } - - return handlePerformObjectSymbolValue( - (IObjectSymbolBasedValueType) firstArg, secondArg); - } - - /** - * @param firstArg -- - * represents value-a (expr-a after step 1) in JSP.2.3.4 - * @param secondArg -- - * represents value-b (expr-b after step 3) in JSP.2.3.4 - * @return the new ValueType for this operation or null - */ - protected abstract SignatureBasedType handlePerformObjectSymbolValue( - IObjectSymbolBasedValueType firstArg, ValueType secondArg); - - /** - * @param firstArg - * @param secondArg - * @return the resolved type for firstArg[secondArg] treating firstArg as a - * type that uses a named property accessor (i.e. a map or bean but - * not a list or array) or null if unresolved - */ - protected SignatureBasedType handlePerformNamedPropertyAccessorBase( - final IObjectSymbolBasedValueType firstArg, final LiteralType secondArg) - { - final ISymbol symbol = - getMemberSymbol(firstArg.getSymbol(), secondArg - .getLiteralValueRaw()); - - if (symbol instanceof IPropertySymbol) - { - return new IObjectSymbolBasedValueType((IPropertySymbol) symbol); - } - else if (symbol instanceof IMethodSymbol) - { - return new IMethodSymbolBasedType((IMethodSymbol) symbol); - } - - // fall-through and return null - // per JSP2.3.4 steps 5 and 6, return null literal if map, null (error) - // otherwise - if (firstArg.isInstanceOf(TypeConstants.TYPE_MAP)) - { - return NullLiteralType.SINGLETON; - } - return null; - } - - /** - * @param symbol - * @param name - * @return the member symbol of 'symbol' corresponding to 'name' or null if - * there is no such member - */ - protected final ISymbol getMemberSymbol(final IObjectSymbol symbol, - final Object name) - { - ISymbol memberSymbol = getPropertySymbol(symbol, name); - - if (memberSymbol != null) - { - return memberSymbol; - } - - memberSymbol = getMethodSymbol(symbol, name); - - // otherwise, see if it's a valid method - if (memberSymbol != null) - { - return memberSymbol; - } - - // if not a property or method, then not a valid member - return null; - } - - /** - * @param symbol - * @param name - * @return the property symbol called name relative to 'symbol' or null if - * one doesn't exist - */ - protected final ISymbol getPropertySymbol(final ISymbol symbol, - final Object name) - { - final AbstractDTPropertyResolver resolver = getPropertyResolver(); - - if (resolver != null) - { - return resolver.getProperty(symbol, name); - } - - JSFCorePlugin.log("Error acquiring property resolver", new Throwable()); - return null; - } - - /** - * @param symbol - * @param name - * @return the method symbol on 'symbol' corresponding to 'name' or null if - * no such member - */ - protected final IMethodSymbol getMethodSymbol(final IObjectSymbol symbol, - final Object name) - { - final AbstractDTMethodResolver resolver = getMethodResolver(); - - if (resolver != null) - { - return resolver.getMethod(symbol, name); - } - - JSFCorePlugin.log("Error acquiring property resolver", new Throwable()); - return null; - - } - - /** - * @return the property resolver for the current source file - */ - protected final AbstractDTPropertyResolver getPropertyResolver() - { - final DesignTimeApplicationManager manager = - DesignTimeApplicationManager.getInstance(_file.getProject()); - - if (manager != null) - { - return manager.getPropertyResolver(); - } - - return null; - } - - /** - * @return the method resolver for the current source file - */ - protected final AbstractDTMethodResolver getMethodResolver() - { - final DesignTimeApplicationManager manager = - DesignTimeApplicationManager.getInstance(_file.getProject()); - - if (manager != null) - { - return manager.getMethodResolver(); - } - return null; - } - - /** - * @return a user-readable name of the operator (i.e. dot or bracket) - */ - protected abstract String getOperatorName(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/Messages.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/Messages.java deleted file mode 100644 index 22c4c5618..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/Messages.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.validation.internal.el.operators; - -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -class Messages { - private static final String BUNDLE_NAME = "org.eclipse.jst.jsf.validation.internal.el.operators.messages"; //$NON-NLS-1$ - - private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle - .getBundle(BUNDLE_NAME); - - private Messages() { - // no external instantiation - } - - /** - * @param key - * @return the string or !key! if not found - */ - public static String getString(String key) { - try { - return RESOURCE_BUNDLE.getString(key); - } catch (MissingResourceException e) { - return '!' + key + '!'; - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/MinusUnaryOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/MinusUnaryOperator.java deleted file mode 100644 index 7dcdc3b8d..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/MinusUnaryOperator.java +++ /dev/null @@ -1,212 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.validation.internal.el.operators; - -import org.eclipse.emf.common.util.Diagnostic; -import org.eclipse.jdt.core.Signature; -import org.eclipse.jst.jsf.common.internal.types.FloatLiteralType; -import org.eclipse.jst.jsf.common.internal.types.IAssignable; -import org.eclipse.jst.jsf.common.internal.types.IntegerLiteralType; -import org.eclipse.jst.jsf.common.internal.types.LiteralType; -import org.eclipse.jst.jsf.common.internal.types.StringLiteralType; -import org.eclipse.jst.jsf.common.internal.types.TypeCoercer; -import org.eclipse.jst.jsf.common.internal.types.TypeCoercionException; -import org.eclipse.jst.jsf.common.internal.types.TypeConstants; -import org.eclipse.jst.jsf.common.internal.types.TypeTransformer; -import org.eclipse.jst.jsf.common.internal.types.ValueType; -import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory; - -/** - * Represents the EL unary operator '-' on a ValueType - * as described by JSP.2.3.5.4 - * - * - * @author cbateman - * - */ -/*package*/class MinusUnaryOperator extends UnaryOperator -{ - private static final String UNARY_MINUS = "unary minus"; - - MinusUnaryOperator(DiagnosticFactory diagnosticFactory) - { - super(diagnosticFactory); - } - - public Diagnostic validate(ValueType type) - { - // must coerce to numeric type - try - { - // if coerceTypeNumber doesn't throw an exception, then - // give the benefit of the doubt - final String coercedType = - TypeCoercer. - coerceToNumber(TypeTransformer. - transformBoxPrimitives(type.getSignature())); - - if (TypeCoercer.typeIsNull(coercedType)) - { - // null always coerces to 0L on this operator - return _diagnosticFactory. - create_UNARY_OP_MINUS_ON_NULL_ALWAYS_ZERO(); - } - - // JSP.2.3.5.4, step 2 if BigDecimal or BigInteger, then can't be - // literal and retains type - if (TypeConstants.TYPE_BIG_DOUBLE.equals(coercedType) - || TypeConstants.TYPE_BIG_INTEGER.equals(coercedType)) - { - return Diagnostic.OK_INSTANCE; - } - - // JSP.2.4.5.4, step 3: if String - // note, use uncoerced type, since type coercer will return null for strings - if (TypeCoercer.typeIsString(type.getSignature())) - { - // if it's a string and we have the value, we can determine for - // sure whether or not it's coercable to a number - // per JSP.2.3.5.4 step 3.1 - if (type instanceof StringLiteralType) - { - String literalValue = ((LiteralType)type).getLiteralValue(); - if (literalValue.indexOf('.') > -1 - || literalValue.indexOf('e') > -1 - || literalValue.indexOf('E') > -1) - { - // if it coerces to double, then it's a double - ((LiteralType)type).coerceToNumber(Double.class); - // this is okay, because an expression like #{-3.3} can't be folded - return Diagnostic.OK_INSTANCE; - } - // per JSP.2.3.5.4, step 3.2 try to coerce to long - // if it coerces to long, then it's a long - ((LiteralType)type).coerceToNumber(Long.class); - // this is okay, because an expression like #{-3} can't be folded - return Diagnostic.OK_INSTANCE; - } - // if non-literal string, warn that coercion to number is not - // guaranteed since Long.valueOf and Double.valueOf - // (unlike Boolean.valueOf) throw NumberFormatExceptions - return _diagnosticFactory.create_UNARY_OP_STRING_CONVERSION_NOT_GUARANTEED(UNARY_MINUS); - } - - // JSP.2.3.5.4, step 4, for all numeric types, retain type, - // validate constant folding - // note that this return true for big int and decimal, so those cases - // must already have been handled. - if (TypeCoercer.typeIsNumeric(coercedType)) - { - // otherwise, we are fine - return Diagnostic.OK_INSTANCE; - } - - } - catch (TypeCoercionException tce) - { - // fallthrough to error below - } - // otherwise, error - return _diagnosticFactory.create_UNARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION(UNARY_MINUS); - } - - /** - * Based on JSP.2.3.5.4 - * - * @param type - * @return type of type after a minus is applied or null if unknown - */ - public ValueType performOperation(ValueType type) - { - try - { - final String boxedType = - TypeTransformer.transformBoxPrimitives(type.getSignature()); - // check for valid type coercion - String coercedType = TypeCoercer.coerceToNumber(boxedType); - - if (TypeCoercer.typeIsNull(coercedType)) - { - // null always coerces to 0L on this operator - return new IntegerLiteralType(0L); - } - - // JSP.2.3.5.4, step 2 if BigDecimal or BigInteger, then can't be - // literal and retains type - if (TypeConstants.TYPE_BIG_DOUBLE.equals(coercedType)) - { - return new ValueType(TypeConstants.TYPE_BIG_DOUBLE, IAssignable.ASSIGNMENT_TYPE_RHS); - } - else if (TypeConstants.TYPE_BIG_INTEGER.equals(coercedType)) - { - return new ValueType(TypeConstants.TYPE_BIG_INTEGER, IAssignable.ASSIGNMENT_TYPE_RHS); - } - - if (TypeCoercer.typeIsString(type.getSignature())) - { - // if it's string and we have the value, we can determine for - // sure whether or not it's coercable to a number - // per JSP.2.3.5.4 step 3 - if (type instanceof StringLiteralType) - { - String literalValue = ((LiteralType)type).getLiteralValue(); - if (literalValue.indexOf('.') > -1 - || literalValue.indexOf('e') > -1 - || literalValue.indexOf('E') > -1) - { - // if it coerces to double, then it's a double - Number value = ((LiteralType)type).coerceToNumber(Double.class); - return new FloatLiteralType(-1 * value.doubleValue()); - } - - // if it coerces to long, then it's a long - Number value = ((LiteralType)type).coerceToNumber(Long.class); - return new IntegerLiteralType(-1 * value.longValue()); - } - - // otherwise, just return a long typed value - return new ValueType(Signature.SIG_LONG, IAssignable.ASSIGNMENT_TYPE_RHS); - } - - // JSP.2.3.5.4 - // big integer and big decimal retain type - // all numeric types retain type - if (TypeCoercer.typeIsNumeric(boxedType)) - { - // integer and float literals are special because -1 or -1.0 - // is syntically minusOp(1) and minusOp(1.0) - if (type instanceof IntegerLiteralType) - { - return new IntegerLiteralType(-1 * ((IntegerLiteralType)type).coerceToNumber(Long.class).longValue()); - } - else if (type instanceof FloatLiteralType) - { - return new FloatLiteralType(-1 * ((FloatLiteralType)type).coerceToNumber(Double.class).doubleValue()); - } - return type; - } - - // all other cases, return null - // even is type represents a String, without it's value, we have - // no idea how to coerce it without it's value - // fall through and return null - } - catch (TypeCoercionException tce) - { - // do nothing, fall through and return null - } - - return null; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/ModArithmeticBinaryOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/ModArithmeticBinaryOperator.java deleted file mode 100644 index ba4765b65..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/ModArithmeticBinaryOperator.java +++ /dev/null @@ -1,383 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.validation.internal.el.operators; - -import java.math.BigDecimal; -import java.math.BigInteger; - -import org.eclipse.emf.common.util.Diagnostic; -import org.eclipse.jdt.core.Signature; -import org.eclipse.jst.jsf.common.internal.types.FloatLiteralType; -import org.eclipse.jst.jsf.common.internal.types.IAssignable; -import org.eclipse.jst.jsf.common.internal.types.IntegerLiteralType; -import org.eclipse.jst.jsf.common.internal.types.LiteralType; -import org.eclipse.jst.jsf.common.internal.types.TypeCoercer; -import org.eclipse.jst.jsf.common.internal.types.TypeCoercionException; -import org.eclipse.jst.jsf.common.internal.types.TypeConstants; -import org.eclipse.jst.jsf.common.internal.types.TypeTransformer; -import org.eclipse.jst.jsf.common.internal.types.ValueType; -import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory; - -/** - * Represents the EL modulo operator: % or mod - * Based JSP.2.3.5.3 - * - * @author cbateman - * - */ -/*package*/ class ModArithmeticBinaryOperator extends ArithmeticBinaryOperator -{ - private static final String MODULO = "modulo"; - - ModArithmeticBinaryOperator(DiagnosticFactory diagnosticFactory) { - super(diagnosticFactory); - } - - public ValueType performOperation(ValueType firstArg, ValueType secondArg) - { - // JSP.2.3.5.3, step 1 if both null, then return zero - if (TypeCoercer.typeIsNull(firstArg.getSignature()) - && TypeCoercer.typeIsNull(secondArg.getSignature())) - { - return IntegerLiteralType.ZERO; - } - - final String boxedFirstArg = TypeTransformer.transformBoxPrimitives(firstArg.getSignature()); - final String boxedSecondArg = TypeTransformer.transformBoxPrimitives(secondArg.getSignature()); - - // JSP.2.3.5.3, step 2, if either arg is BigDecimal, Float, Double - // or String (ignoring whether it is value coercable), then coerce - // to Double and do op - if (TypeConstants.TYPE_BIG_DOUBLE.equals(boxedFirstArg) - || TypeConstants.TYPE_BIG_DOUBLE.equals(boxedSecondArg) - || TypeConstants.TYPE_BOXED_DOUBLE.equals(boxedFirstArg) - || TypeConstants.TYPE_BOXED_DOUBLE.equals(boxedSecondArg) - || TypeConstants.TYPE_BOXED_FLOAT.equals(boxedFirstArg) - || TypeConstants.TYPE_BOXED_FLOAT.equals(boxedSecondArg)) - { - // TODO: handle case where one is a literal or resolvable string value - // that containss ".", "e" or "E" - return performDouble(firstArg, secondArg); - } - - // JSP.2.3.5.3, step 3, if either arg is a BigInteger, coerce - // both to BigInteger - if (TypeConstants.TYPE_BIG_INTEGER.equals(boxedFirstArg) - || TypeConstants.TYPE_BIG_INTEGER.equals(boxedSecondArg)) - { - return performBigInteger(firstArg, secondArg); - } - - // JSP.2.3.5.3, step 4, otherwise try to perform as a Long op - return performLong(firstArg, secondArg); - } - - public Diagnostic validate(ValueType firstArg, ValueType secondArg) { - // JSP.2.3.5.3, step 1 if both null, then return zero - if (TypeCoercer.typeIsNull(firstArg.getSignature()) - && TypeCoercer.typeIsNull(secondArg.getSignature())) - { - return _diagnosticFactory.create_BINARY_OP_BOTH_OPERANDS_NULL(MODULO); - } - - final String boxedFirstArg = TypeTransformer.transformBoxPrimitives(firstArg.getSignature()); - final String boxedSecondArg = TypeTransformer.transformBoxPrimitives(secondArg.getSignature()); - - // JSP.2.3.5.3, step 2, if either arg is BigDecimal, Float, Double - // or String (ignoring whether it is value coercable), then coerce - // to Double and do op - if (TypeConstants.TYPE_BIG_DOUBLE.equals(boxedFirstArg) - || TypeConstants.TYPE_BIG_DOUBLE.equals(boxedSecondArg) - || TypeConstants.TYPE_BOXED_DOUBLE.equals(boxedFirstArg) - || TypeConstants.TYPE_BOXED_DOUBLE.equals(boxedSecondArg) - || TypeConstants.TYPE_BOXED_FLOAT.equals(boxedFirstArg) - || TypeConstants.TYPE_BOXED_FLOAT.equals(boxedSecondArg)) - { - // TODO: handle case where one is a literal or resolvable string value - // that containss ".", "e" or "E" - return validateDouble(firstArg, secondArg); - } - - // JSP.2.3.5.3, step 3, if either arg is a BigInteger, coerce - // both to BigInteger - if (TypeConstants.TYPE_BIG_INTEGER.equals(boxedFirstArg) - || TypeConstants.TYPE_BIG_INTEGER.equals(boxedSecondArg)) - { - return validateBigInteger(firstArg, secondArg); - } - - // JSP.2.3.5.3, step 4, otherwise try to perform as a Long op - return validateLong(firstArg, secondArg); - } - - private ValueType performDouble(ValueType firstArg, ValueType secondArg) - { - try - { - TypeCoercer.coerceToNumber(TypeTransformer.transformBoxPrimitives(firstArg.getSignature())); - TypeCoercer.coerceToNumber(TypeTransformer.transformBoxPrimitives(secondArg.getSignature())); - - Number secondValue = null; - - if (secondArg instanceof LiteralType) - { - secondValue = ((LiteralType)secondArg).coerceToNumber(Double.class); - - if (secondValue.doubleValue() == 0.0) - { - // division by zero - return null; - } - } - - Number firstValue = null; - - if (firstArg instanceof LiteralType) - { - firstValue = ((LiteralType)firstArg).coerceToNumber(Double.class); - } - - if (firstValue != null && secondValue != null) - { - return new FloatLiteralType( - doRealOperation(new Double(firstValue.doubleValue()), - new Double(secondValue.doubleValue())).doubleValue()); - } - - // if we get to here, the coercion is valid, so a Double will be - // returned - return new ValueType(Signature.SIG_DOUBLE, IAssignable.ASSIGNMENT_TYPE_RHS); - } - catch (TypeCoercionException tce) - { - // could not coerce, so null - return null; - } - } - - private ValueType performBigInteger(ValueType firstArg, ValueType secondArg) - { - try - { - TypeCoercer.coerceToNumber(TypeTransformer.transformBoxPrimitives(firstArg.getSignature())); - TypeCoercer.coerceToNumber(TypeTransformer.transformBoxPrimitives(secondArg.getSignature())); - - // check second arg for zero - if (secondArg instanceof LiteralType) - { - if (((LiteralType)secondArg).coerceToNumber(BigInteger.class).equals(BigInteger.ZERO)) - { - // division by zero - return null; - } - } - - // since one of the args is BigInteger, they are not both literals, - // so if we get to here, we have a successful mod of two - // big integers to one big integer - return new ValueType(TypeConstants.TYPE_BIG_INTEGER, IAssignable.ASSIGNMENT_TYPE_RHS); - } - catch (TypeCoercionException tce) - { - // no coercion - return null; - } - } - - private ValueType performLong(ValueType firstArg, ValueType secondArg) - { - try - { - TypeCoercer.coerceToNumber(TypeTransformer.transformBoxPrimitives(firstArg.getSignature())); - TypeCoercer.coerceToNumber(TypeTransformer.transformBoxPrimitives(secondArg.getSignature())); - - Number secondValue = null; - - if (secondArg instanceof LiteralType) - { - secondValue = ((LiteralType)secondArg).coerceToNumber(Long.class); - - if (secondValue.longValue() == 0) - { - // division by zero - return null; - } - } - - Number firstValue = null; - - if (firstArg instanceof LiteralType) - { - firstValue = ((LiteralType)firstArg).coerceToNumber(Long.class); - } - - if (firstValue != null && secondValue != null) - { - return new IntegerLiteralType( - doRealOperation(Long.valueOf(firstValue.longValue()), - Long.valueOf(secondValue.longValue())).longValue()); - } - - // if we get to here, the coercion is valid, so a Long will be - // returned - return new ValueType(Signature.SIG_LONG, IAssignable.ASSIGNMENT_TYPE_RHS); - } - catch (TypeCoercionException tce) - { - // could not coerce, so null - return null; - } - } - - private Diagnostic validateDouble(ValueType firstArg, ValueType secondArg) - { - try - { - TypeCoercer.coerceToNumber(TypeTransformer.transformBoxPrimitives(firstArg.getSignature())); - TypeCoercer.coerceToNumber(TypeTransformer.transformBoxPrimitives(secondArg.getSignature())); - - Number secondValue = null; - - if (secondArg instanceof LiteralType) - { - secondValue = ((LiteralType)secondArg).coerceToNumber(Double.class); - - if (secondValue.doubleValue() == 0.0) - { - // division by zero - return _diagnosticFactory.create_BINARY_OP_POSSIBLE_DIVISION_BY_ZERO(); - } - } - - Number firstValue = null; - - if (firstArg instanceof LiteralType) - { - firstValue = ((LiteralType)firstArg).coerceToNumber(Double.class); - } - - if (firstValue != null && secondValue != null) - { - return _diagnosticFactory. - create_BINARY_OP_CONSTANT_EXPRESSION_ALWAYS_EVAL_SAME - (MODULO, Double.toString( - firstValue.doubleValue()%secondValue.doubleValue())); - } - - // if we get to here, the coercion is valid, so a Double will be - // returned and everything is good - return Diagnostic.OK_INSTANCE; - } - catch (TypeCoercionException tce) - { - // could not coerce, so error - return _diagnosticFactory. - create_BINARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION(MODULO); - } - } - - private Diagnostic validateBigInteger(ValueType firstArg, ValueType secondArg) - { - try - { - TypeCoercer.coerceToNumber(TypeTransformer.transformBoxPrimitives(firstArg.getSignature())); - TypeCoercer.coerceToNumber(TypeTransformer.transformBoxPrimitives(secondArg.getSignature())); - - // check second arg for zero - if (secondArg instanceof LiteralType) - { - if (((LiteralType)secondArg).coerceToNumber(BigInteger.class).equals(BigInteger.ZERO)) - { - // division by zero - return _diagnosticFactory.create_BINARY_OP_POSSIBLE_DIVISION_BY_ZERO(); - } - } - - // since one of the args is BigInteger, they are not both literals, - // so if we get to here, we have a successful mod of two - // big integers to one big integer - return Diagnostic.OK_INSTANCE; - } - catch (TypeCoercionException tce) - { - // no coercion - return _diagnosticFactory. - create_BINARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION(MODULO); - } - } - - private Diagnostic validateLong(ValueType firstArg, ValueType secondArg) - { - try - { - TypeCoercer.coerceToNumber(TypeTransformer.transformBoxPrimitives(firstArg.getSignature())); - TypeCoercer.coerceToNumber(TypeTransformer.transformBoxPrimitives(secondArg.getSignature())); - - Number secondValue = null; - - if (secondArg instanceof LiteralType) - { - secondValue = ((LiteralType)secondArg).coerceToNumber(Long.class); - - if (secondValue.longValue() == 0) - { - // division by zero - return _diagnosticFactory. - create_BINARY_OP_POSSIBLE_DIVISION_BY_ZERO(); - } - } - - Number firstValue = null; - - if (firstArg instanceof LiteralType) - { - firstValue = ((LiteralType)firstArg).coerceToNumber(Long.class); - } - - if (firstValue != null && secondValue != null) - { - return _diagnosticFactory. - create_BINARY_OP_CONSTANT_EXPRESSION_ALWAYS_EVAL_SAME - (MODULO, Long.toString(firstValue.longValue()%secondValue.longValue())); - } - - // if we get to here, the coercion is valid, so a Long will be - // returned - return Diagnostic.OK_INSTANCE; - } - catch (TypeCoercionException tce) - { - // could not coerce, so error - return _diagnosticFactory. - create_BINARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION(MODULO); - } - } - - protected Long doRealOperation(Long firstArg, Long secondArg) { - return Long.valueOf(firstArg.longValue() % secondArg.longValue()); - } - - protected Double doRealOperation(Double firstArg, Double secondArg) { - return new Double(firstArg.doubleValue() % secondArg.doubleValue()); - } - - protected BigDecimal doRealOperation(BigDecimal firstArg, - BigDecimal secondArg) { - return new BigDecimal(firstArg.doubleValue() % secondArg.doubleValue()); - } - - protected String getOperatorName() { - return MODULO; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/MultiplyArithmeticBinaryOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/MultiplyArithmeticBinaryOperator.java deleted file mode 100644 index 70766224c..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/MultiplyArithmeticBinaryOperator.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.validation.internal.el.operators; - -import java.math.BigDecimal; - -import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory; - -/** - * Represents the EL Multiply arithmetic binary operator "*" - * - * @author cbateman - * - */ -/*package*/ class MultiplyArithmeticBinaryOperator extends - NoDivArithmeticBinaryOperator -{ - private static final String MULTIPLICATION = "multiplication"; - - - MultiplyArithmeticBinaryOperator(DiagnosticFactory diagnosticFactory) - { - super(diagnosticFactory); - } - - protected Long doRealOperation(Long firstArg, Long secondArg) - { - return Long.valueOf(firstArg.longValue() * secondArg.longValue()); - } - - protected Double doRealOperation(Double firstArg, Double secondArg) - { - return new Double(firstArg.doubleValue() * secondArg.doubleValue()); - } - - protected BigDecimal doRealOperation(BigDecimal firstArg, - BigDecimal secondArg) - { - return firstArg.multiply(secondArg); - } - - protected String getOperatorName() { - return MULTIPLICATION; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/NoDivArithmeticBinaryOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/NoDivArithmeticBinaryOperator.java deleted file mode 100644 index 5bdc163fc..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/NoDivArithmeticBinaryOperator.java +++ /dev/null @@ -1,300 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.validation.internal.el.operators; - -import java.math.BigDecimal; -import java.math.BigInteger; - -import org.eclipse.emf.common.util.Diagnostic; -import org.eclipse.jdt.core.Signature; -import org.eclipse.jst.jsf.common.internal.types.FloatLiteralType; -import org.eclipse.jst.jsf.common.internal.types.IAssignable; -import org.eclipse.jst.jsf.common.internal.types.IntegerLiteralType; -import org.eclipse.jst.jsf.common.internal.types.LiteralType; -import org.eclipse.jst.jsf.common.internal.types.TypeCoercer; -import org.eclipse.jst.jsf.common.internal.types.TypeCoercionException; -import org.eclipse.jst.jsf.common.internal.types.TypeConstants; -import org.eclipse.jst.jsf.common.internal.types.TypeTransformer; -import org.eclipse.jst.jsf.common.internal.types.ValueType; -import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory; - -/** - * Represents non-dividing arithmetic EL operators: +,-,* - * Based on JSP.2.3.5.1 - * - * @author cbateman - * - */ -/*package*/ abstract class NoDivArithmeticBinaryOperator extends ArithmeticBinaryOperator -{ - NoDivArithmeticBinaryOperator(DiagnosticFactory diagnosticFactory) { - super(diagnosticFactory); - } - - protected abstract Long doRealOperation(Long firstArg, Long secondArg); - - protected abstract Double doRealOperation(Double firstArg, Double secondArg); - - public ValueType performOperation(ValueType firstArg, ValueType secondArg) - { - // JSP.2.3.5.1, step 1, if either arg is null, return (Long) 0 - if (TypeCoercer.typeIsNull(firstArg.getSignature()) - && TypeCoercer.typeIsNull(secondArg.getSignature())) - { - return new IntegerLiteralType(0); - } - - final String boxedFirstArg = TypeTransformer.transformBoxPrimitives(firstArg.getSignature()); - final String boxedSecondArg = TypeTransformer.transformBoxPrimitives(secondArg.getSignature()); - - // JSP.2.3.5.1, step 2, if either arg is a BigDecimal, coerce to BigDecimal - // and apply - if (TypeConstants.TYPE_BIG_DOUBLE.equals(boxedFirstArg) - || TypeConstants.TYPE_BIG_DOUBLE.equals(boxedSecondArg)) - { - return handleNumericArithmetic(firstArg, secondArg, BigDecimal.class); - } - - // JSP.2.3.5.1, step 3, if either arg is float or double or - // a String containing "., e or E", then coerce if the other is - // a big int, coerce up to BigDecimal, else to Double - // Note: we are ignoring strings we can't resolve to figure out - // if the contain "., e or E". Assume they always do - if (TypeConstants.TYPE_BOXED_DOUBLE.equals(boxedFirstArg) - ||TypeConstants.TYPE_BOXED_DOUBLE.equals(boxedSecondArg) - ||TypeConstants.TYPE_BOXED_FLOAT.equals(boxedFirstArg) - ||TypeConstants.TYPE_BOXED_FLOAT.equals(boxedSecondArg)) - { - if (TypeConstants.TYPE_BIG_INTEGER.equals(boxedFirstArg) - ||TypeConstants.TYPE_BIG_INTEGER.equals(boxedSecondArg)) - { - // if the other operand is BigInteger, treat as BigDecimal - return handleNumericArithmetic(firstArg, secondArg, BigDecimal.class); - } - - // otherwise as double - return handleNumericArithmetic(firstArg, secondArg, Double.class); - } - - // JSP.2.3.5.1, step 4, if one is a big integer, coerce to big integer - if (TypeConstants.TYPE_BIG_INTEGER.equals(boxedFirstArg) - || TypeConstants.TYPE_BIG_INTEGER.equals(boxedSecondArg)) - { - return handleNumericArithmetic(firstArg, secondArg, BigInteger.class); - } - - // JSP.2.3.5.1, step 5, otherwise, try to coerce to Long - return handleNumericArithmetic(firstArg, secondArg, Long.class); - } - - public Diagnostic validate(ValueType firstArg, ValueType secondArg) - { - // JSP.2.3.5.1, step 1, if either arg is null, return (Long) 0 - if (TypeCoercer.typeIsNull(firstArg.getSignature()) - && TypeCoercer.typeIsNull(secondArg.getSignature())) - { - return _diagnosticFactory.create_BINARY_OP_BOTH_OPERANDS_NULL(getOperatorName()); - } - - final String boxedFirstArg = TypeTransformer.transformBoxPrimitives(firstArg.getSignature()); - final String boxedSecondArg = TypeTransformer.transformBoxPrimitives(secondArg.getSignature()); - - // JSP.2.3.5.1, step 2, if either arg is a BigDecimal, coerce to BigDecimal - // and apply - if (TypeConstants.TYPE_BIG_DOUBLE.equals(boxedFirstArg) - || TypeConstants.TYPE_BIG_DOUBLE.equals(boxedSecondArg)) - { - return validateNumericArithmetic(firstArg, secondArg, BigDecimal.class); - } - - // JSP.2.3.5.1, step 3, if either arg is float or double or - // a String containing "., e or E", then coerce if the other is - // a big int, coerce up to BigDecimal, else to Double - // Note: we are ignoring strings we can't resolve to figure out - // if the contain "., e or E". Assume they always do - if (TypeConstants.TYPE_BOXED_DOUBLE.equals(boxedFirstArg) - ||TypeConstants.TYPE_BOXED_DOUBLE.equals(boxedSecondArg) - ||TypeConstants.TYPE_BOXED_FLOAT.equals(boxedFirstArg) - ||TypeConstants.TYPE_BOXED_FLOAT.equals(boxedSecondArg)) - { - if (TypeConstants.TYPE_BIG_INTEGER.equals(boxedFirstArg) - ||TypeConstants.TYPE_BIG_INTEGER.equals(boxedSecondArg)) - { - // if the other operand is BigInteger, treat as BigDecimal - return validateNumericArithmetic(firstArg, secondArg, BigDecimal.class); - } - - // otherwise as double - return validateNumericArithmetic(firstArg, secondArg, Double.class); - } - - // JSP.2.3.5.1, step 4, if one is a big integer, coerce to big integer - if (TypeConstants.TYPE_BIG_INTEGER.equals(boxedFirstArg) - || TypeConstants.TYPE_BIG_INTEGER.equals(boxedSecondArg)) - { - return validateNumericArithmetic(firstArg, secondArg, BigInteger.class); - } - - // JSP.2.3.5.1, step 5, otherwise, try to coerce to Long - return validateNumericArithmetic(firstArg, secondArg, Long.class); - } - - /** - * @param firstArg - * @param secondArg - * @param numberType - * @return a value type based on the result of the arithmetic operation - */ - protected ValueType handleNumericArithmetic(ValueType firstArg, ValueType secondArg, Class numberType) - { - try - { -// final String coercedFirstArg = - TypeCoercer.coerceToNumber(TypeTransformer.transformBoxPrimitives(firstArg.getSignature())); -// final String coercedSecondArg = - TypeCoercer.coerceToNumber(TypeTransformer.transformBoxPrimitives(secondArg.getSignature())); - - if (firstArg instanceof LiteralType && secondArg instanceof LiteralType) - { - try - { - Number firstValue = - ((LiteralType)firstArg).coerceToNumber(numberType); - Number secondValue = - ((LiteralType)secondArg).coerceToNumber(numberType); - - LiteralType result = null; - - if (numberType == Double.class) - { - Double resultValue = - doRealOperation((Double)firstValue, - (Double) secondValue); - result = new FloatLiteralType(resultValue.doubleValue()); - } - else if (numberType == Long.class) - { - Long resultValue = - doRealOperation((Long) firstValue, (Long) secondValue); - result = new IntegerLiteralType(resultValue.longValue()); - } - else - { - throw new AssertionError("unsupport arithmetic upcast type"); - } - - return result; - } - catch (TypeCoercionException tce) - { - // could happen if two string literals passed - return null; - } - } - - // if we get to here, then we have two valid numeric arith - // types, but at least one is not a literal, so the best we can - // say is that the return will be the same asthe type of numeric - // coercion - if (numberType == BigDecimal.class) - { - return new ValueType(TypeConstants.TYPE_BIG_DOUBLE, IAssignable.ASSIGNMENT_TYPE_RHS); - } - else if (numberType == Double.class) - { - return new ValueType(Signature.SIG_DOUBLE, IAssignable.ASSIGNMENT_TYPE_RHS); - } - else if (numberType == BigInteger.class) - { - return new ValueType(TypeConstants.TYPE_BIG_INTEGER, IAssignable.ASSIGNMENT_TYPE_RHS); - } - else - { - return new ValueType(Signature.SIG_LONG, IAssignable.ASSIGNMENT_TYPE_RHS); - } - } - catch (TypeCoercionException tce) - { - // coercion to number failed, so no go - return null; - } - } - - /** - * @param firstArg - * @param secondArg - * @param numberType - * @return a diagnostic validating the arithmetic expr firstArg op secondArg - */ - protected Diagnostic validateNumericArithmetic(ValueType firstArg, ValueType secondArg, Class numberType) - { - try - { -// final String coercedFirstArg = - TypeCoercer.coerceToNumber(TypeTransformer.transformBoxPrimitives(firstArg.getSignature())); -// final String coercedSecondArg = - TypeCoercer.coerceToNumber(TypeTransformer.transformBoxPrimitives(secondArg.getSignature())); - - if (firstArg instanceof LiteralType && secondArg instanceof LiteralType) - { - try - { - Number firstValue = - ((LiteralType)firstArg).coerceToNumber(numberType); - Number secondValue = - ((LiteralType)secondArg).coerceToNumber(numberType); - - Number result = null; - - if (numberType == Double.class) - { - result = - doRealOperation((Double)firstValue, - (Double) secondValue); - } - else if (numberType == Long.class) - { - result = - doRealOperation((Long) firstValue, (Long) secondValue); - } - else - { - throw new AssertionError("unsupport arithmetic upcast type"); - } - - return _diagnosticFactory. - create_BINARY_OP_CONSTANT_EXPRESSION_ALWAYS_EVAL_SAME - (getOperatorName(), result.toString()); - } - catch (TypeCoercionException tce) - { - // could happen when two strings are passed - return _diagnosticFactory. - create_BINARY_OP_COULD_NOT_COERCE_LITERALS_TO_NUMBERS(); - } - } - - // if we get to here, then we have two valid numeric arith - // types, but at least one is not a literal - // everything should be ok - return Diagnostic.OK_INSTANCE; - } - catch (TypeCoercionException tce) - { - // coercion to number failed, so no go - return _diagnosticFactory. - create_BINARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION(getOperatorName()); - } - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/NotEqualsBinaryRelationalOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/NotEqualsBinaryRelationalOperator.java deleted file mode 100644 index 1d6245426..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/NotEqualsBinaryRelationalOperator.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.validation.internal.el.operators; - -import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory; - -/** - * Represents the not equals -- "!="/ne EL binary operator - * @author cbateman - * - */ -/*package*/ class NotEqualsBinaryRelationalOperator extends - EqualityRelationalBinaryOperator { - - NotEqualsBinaryRelationalOperator(final DiagnosticFactory diagnosticFactory, String jsfVersion) - { - super(diagnosticFactory, jsfVersion); - } - - protected boolean doRealOperation(Number firstArg, Number secondArg) { - return !firstArg.equals(secondArg); - } - - protected boolean doRealOperation(Boolean firstArg, Boolean secondArg) { - return !firstArg.equals(secondArg); - } - - protected boolean doRealOperation(String firstArg, String secondArg) { - return !firstArg.equals(secondArg); - } - - protected String getOperationName() - { - return Messages.getString("NotEqualsBinaryRelationalOperator.OperationName"); //$NON-NLS-1$ - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/NotUnaryOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/NotUnaryOperator.java deleted file mode 100644 index dd1d5db1a..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/NotUnaryOperator.java +++ /dev/null @@ -1,102 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.validation.internal.el.operators; - -import org.eclipse.emf.common.util.Diagnostic; -import org.eclipse.jst.jsf.common.internal.types.BooleanLiteralType; -import org.eclipse.jst.jsf.common.internal.types.LiteralType; -import org.eclipse.jst.jsf.common.internal.types.TypeCoercer; -import org.eclipse.jst.jsf.common.internal.types.TypeCoercionException; -import org.eclipse.jst.jsf.common.internal.types.TypeConstants; -import org.eclipse.jst.jsf.common.internal.types.TypeTransformer; -import org.eclipse.jst.jsf.common.internal.types.ValueType; -import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory; - -/** - * Represents te EL unary operators "!" and "not" on a ValueType - * as described by JSP.2.3.6.2 - * - * @author cbateman - * - */ -/*package*/ class NotUnaryOperator extends UnaryOperator -{ - NotUnaryOperator(DiagnosticFactory diagnosticFactory) - { - super(diagnosticFactory); - } - - public Diagnostic validate(ValueType type) - { - boolean canCoerce = - TypeCoercer.canCoerceToBoolean(TypeTransformer.transformBoxPrimitives(type.getSignature())); - - if (canCoerce) - { - // check for constant evaluation - if (type instanceof LiteralType) - { - try - { - Boolean coercedValue = ((LiteralType)type).coerceToBoolean(); - - // we are logically notting, so coerced is true, then false - // if false then true - return _diagnosticFactory.create_UNARY_OP_CONSTANT_EXPRESSION_EVAL_SAME_ID( - "not" - , Boolean.valueOf(!coercedValue.booleanValue()).toString()); - - } - catch (TypeCoercionException tce) - { - throw new AssertionError("coerce should not throw exception"); - } - } - - return Diagnostic.OK_INSTANCE; - } - return _diagnosticFactory.create_UNARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN(); - } - - public ValueType performOperation(ValueType type) - { - boolean canCoerce = - TypeCoercer.canCoerceToBoolean(TypeTransformer.transformBoxPrimitives(type.getSignature())); - - if (canCoerce) - { - if (type instanceof LiteralType) - { - try - { - Boolean coercedValue = ((LiteralType)type).coerceToBoolean(); - - // we are logically notting, so coerced is true, then false - // if false then true - return - coercedValue.booleanValue() ? - BooleanLiteralType.FALSE : - BooleanLiteralType.TRUE; - } - catch (TypeCoercionException tce) - { - throw new AssertionError("coerce should not throw exception"); - } - } - - return new ValueType(TypeConstants.TYPE_BOOLEAN, type.getAssignability()); - } - return null; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/OrBinaryOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/OrBinaryOperator.java deleted file mode 100644 index 33bd4be7f..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/OrBinaryOperator.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.validation.internal.el.operators; - -import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory; - -/** - * Encapsulates the 'and'/'&&' boolean-AND operator - * Based on JSP.2.3.6.1 - * - * @author cbateman - * - */ -/*package*/class OrBinaryOperator extends LogicalBinaryOperator -{ - OrBinaryOperator(DiagnosticFactory diagnosticFactory) - { - super(diagnosticFactory); - } - - protected boolean doRealOperation(Boolean firstArg, Boolean secondArg) - { - return (firstArg.booleanValue() || secondArg.booleanValue()); - } - - protected String readableOperatorName() - { - return "logical-OR"; - } - - protected boolean shortCircuitValue() - { - // OR short-circuits on true - return true; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/RelationalBinaryOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/RelationalBinaryOperator.java deleted file mode 100644 index 924ec9854..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/RelationalBinaryOperator.java +++ /dev/null @@ -1,239 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.validation.internal.el.operators; - -import org.eclipse.emf.common.util.Diagnostic; -import org.eclipse.jst.jsf.common.internal.types.BooleanLiteralType; -import org.eclipse.jst.jsf.common.internal.types.IAssignable; -import org.eclipse.jst.jsf.common.internal.types.LiteralType; -import org.eclipse.jst.jsf.common.internal.types.TypeCoercer; -import org.eclipse.jst.jsf.common.internal.types.TypeCoercionException; -import org.eclipse.jst.jsf.common.internal.types.TypeConstants; -import org.eclipse.jst.jsf.common.internal.types.TypeTransformer; -import org.eclipse.jst.jsf.common.internal.types.ValueType; -import org.eclipse.jst.jsf.core.IJSFCoreConstants; -import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory; - - -/** - * Super-class of all relational binary ops - "==", "!=", "<", ">", "<=", ">=" - * @author cbateman - * - */ -/*package*/ abstract class RelationalBinaryOperator extends BinaryOperator -{ - private final String _jsfVersion; - - RelationalBinaryOperator(final DiagnosticFactory diagnosticFactory, final String jsfVersion) - { - super(diagnosticFactory); - _jsfVersion = jsfVersion; - } - - /** - * @param firstArg - * @param secondArg - * @return the result of the operation - */ - protected abstract boolean doRealOperation(Number firstArg, Number secondArg); - - /** - * @param firstArg - * @param secondArg - * @return the result of the operation - */ - protected abstract boolean doRealOperation(String firstArg, String secondArg); - - /** - * @return the operation's user readable name - */ - protected abstract String getOperationName(); - - /** - * Performs a the operation, casting both args to BigDecimal first - * - * @param firstArg - * @param secondArg - * @param numberType - * @return the result of the comparison or null if indeterminate - */ - protected ValueType handleNumericComparison(ValueType firstArg, ValueType secondArg, Class numberType) - { - try - { - TypeCoercer.coerceToNumber(TypeTransformer.transformBoxPrimitives(firstArg.getSignature())); - TypeCoercer.coerceToNumber(TypeTransformer.transformBoxPrimitives(secondArg.getSignature())); - - Number firstValue = null; - if (firstArg instanceof LiteralType) - { - firstValue = ((LiteralType)firstArg).coerceToNumber(numberType); - } - - Number secondValue = null; - if (secondArg instanceof LiteralType) - { - secondValue = ((LiteralType)secondArg).coerceToNumber(numberType); - } - - if (firstValue != null && secondValue != null) - { - boolean result = doRealOperation(firstValue, secondValue); - - return result ? BooleanLiteralType.TRUE : BooleanLiteralType.FALSE; - } - - // if we get to here, we only know that both can be up cast to BigDecimal - // and compared. This will yield a boolean result - // this value cannot be lhs - return new ValueType(TypeConstants.TYPE_BOOLEAN, IAssignable.ASSIGNMENT_TYPE_RHS); - } - catch (TypeCoercionException tce) - { - // no valid coercion, so return null - return null; - } - } - - /** - * @param firstType - * @param secondType - * @param numberType - * @return a diagnostic validating the relational comparison of firstType to secondType - */ - protected Diagnostic validateNumericComparison(ValueType firstType, ValueType secondType, Class numberType) - { - try - { - TypeCoercer.coerceToNumber(TypeTransformer.transformBoxPrimitives(firstType.getSignature())); - TypeCoercer.coerceToNumber(TypeTransformer.transformBoxPrimitives(secondType.getSignature())); - - Number firstValue = null; - if (firstType instanceof LiteralType) - { - firstValue = ((LiteralType)firstType).coerceToNumber(numberType); - } - - Number secondValue = null; - if (secondType instanceof LiteralType) - { - secondValue = ((LiteralType)secondType).coerceToNumber(numberType); - } - - if (firstValue != null && secondValue != null) - { - boolean result = doRealOperation(firstValue, secondValue); - - return _diagnosticFactory. - create_BINARY_OP_CONSTANT_EXPRESSION_ALWAYS_EVAL_SAME - (getOperationName(), Boolean.toString(result)); - } - - // if we get to here, we only know that both can be up cast to BigDecimal - // and compared. This condition is okay - return Diagnostic.OK_INSTANCE; - } - catch (TypeCoercionException tce) - { - // could not make numeric coercion for valid comparison - return _diagnosticFactory.create_BINARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION(getOperationName()); - } - } - - /** - * @param firstType - * @param secondType - * @return the result of the operation - */ - protected ValueType handleStringComparison(ValueType firstType, ValueType secondType) - { - String firstValue = null; - - if (firstType instanceof LiteralType) - { - firstValue = ((LiteralType)firstType).getLiteralValue(); - } - - String secondValue = null; - if (secondType instanceof LiteralType) - { - secondValue = ((LiteralType)secondType).getLiteralValue(); - } - - if (firstValue != null && secondValue != null) - { - boolean newValue = doRealOperation(firstValue, secondValue); - return newValue ? BooleanLiteralType.TRUE : BooleanLiteralType.FALSE; - } - - // if don't have all literals, just return boolean type - return new ValueType(TypeConstants.TYPE_BOOLEAN, IAssignable.ASSIGNMENT_TYPE_RHS); - } - - /** - * @param firstType - * @param secondType - * @return a diagnostic validating the string comparison of firstType to secondType - */ - protected Diagnostic validateStringComparison(ValueType firstType, ValueType secondType) - { - String firstValue = null; - - if (firstType instanceof LiteralType) - { - firstValue = ((LiteralType)firstType).getLiteralValue(); - } - - String secondValue = null; - if (secondType instanceof LiteralType) - { - secondValue = ((LiteralType)secondType).getLiteralValue(); - } - - if (firstValue != null && secondValue != null) - { - boolean newValue = doRealOperation(firstValue, secondValue); - return _diagnosticFactory. - create_BINARY_OP_CONSTANT_EXPRESSION_ALWAYS_EVAL_SAME - (getOperationName(), Boolean.toString(newValue)); - } - - // if don't have all literals, just return boolean type - return Diagnostic.OK_INSTANCE; - } - - - /** - * @return the current JSF version string - */ - protected final String getJsfVersion() { - return _jsfVersion; - } - - /** - * @return true if the JSF version for this operator is JSF 1.1 or 1.0 - */ - protected final boolean isPreJSF12() - { - return IJSFCoreConstants.JSF_VERSION_1_1.equals(_jsfVersion) - || IJSFCoreConstants.JSF_VERSION_1_0.equals(_jsfVersion); - } - - /** - * @return true if the JSF version for this operator is JSF 1.2 or later - */ - protected final boolean isJSF12OrLater() - { - return !isPreJSF12(); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/SubtractArithmeticBinaryOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/SubtractArithmeticBinaryOperator.java deleted file mode 100644 index 2879cec03..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/SubtractArithmeticBinaryOperator.java +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.validation.internal.el.operators; - -import java.math.BigDecimal; - -import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory; - -/** - * Represents the EL arithmetic subtraction binary operator - * - * @author cbateman - * - */ -/*package*/ class SubtractArithmeticBinaryOperator extends - NoDivArithmeticBinaryOperator -{ - - private static final String SUBTRACTION = "subtraction"; - - SubtractArithmeticBinaryOperator(DiagnosticFactory diagnosticFactory) { - super(diagnosticFactory); - } - - protected Long doRealOperation(Long firstArg, Long secondArg) - { - return Long.valueOf(firstArg.longValue() - secondArg.longValue()); - } - - protected Double doRealOperation(Double firstArg, Double secondArg) - { - return new Double(firstArg.doubleValue() - secondArg.doubleValue()); - } - - protected BigDecimal doRealOperation(BigDecimal firstArg, - BigDecimal secondArg) - { - return firstArg.subtract(secondArg); - } - - protected String getOperatorName() - { - return SUBTRACTION; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/TernaryChoiceOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/TernaryChoiceOperator.java deleted file mode 100644 index c50d8ab44..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/TernaryChoiceOperator.java +++ /dev/null @@ -1,138 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.validation.internal.el.operators; - -import org.eclipse.emf.common.util.Diagnostic; -import org.eclipse.jst.jsf.common.internal.types.IAssignable; -import org.eclipse.jst.jsf.common.internal.types.LiteralType; -import org.eclipse.jst.jsf.common.internal.types.TypeCoercer; -import org.eclipse.jst.jsf.common.internal.types.TypeCoercionException; -import org.eclipse.jst.jsf.common.internal.types.TypeTransformer; -import org.eclipse.jst.jsf.common.internal.types.ValueType; -import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory; - -/** - * Represents the ternary choice op in EL: a ? b :c - * Based on JSP.2.3.8 - * - * @author cbateman - * - */ -public class TernaryChoiceOperator -{ - private final DiagnosticFactory _diagnosticFactory; - - - /** - * @param diagnosticFactory - */ - public TernaryChoiceOperator(DiagnosticFactory diagnosticFactory) - { - super(); - _diagnosticFactory = diagnosticFactory; - } - - /** - * @param choiceArg - * @param whenTrueArg - * @param whenFalseArg - * @return the result of the choice arguments or null if indeterminant - */ - public ValueType perform(ValueType choiceArg, ValueType whenTrueArg, ValueType whenFalseArg) - { - final boolean isChoiceBoolean = - TypeCoercer.canCoerceToBoolean(TypeTransformer.transformBoxPrimitives(choiceArg.getSignature())); - - if (isChoiceBoolean) - { - if (choiceArg instanceof LiteralType) - { - try - { - Boolean result = ((LiteralType)choiceArg).coerceToBoolean(); - - if (result != null) - { - return result.booleanValue() ? whenTrueArg : whenFalseArg; - } - } - catch (TypeCoercionException tce) - { - return null; - } - } - - final String boxedWhenTrueArg = - TypeTransformer.transformBoxPrimitives(whenTrueArg.getSignature()); - - final String boxedWhenFalseArg = - TypeTransformer.transformBoxPrimitives(whenFalseArg.getSignature()); - // check if the two results are the same type - // TODO: could increase accuracy by appoximating type:i.e. if both - // are numeric etc. - if (boxedWhenTrueArg.equals(boxedWhenFalseArg)) - { - return new ValueType(whenTrueArg, IAssignable.ASSIGNMENT_TYPE_RHS); - } - - // otherwise, we have no idea what the resulting type is - return null; - } - - // if choice is not boolean, then can't resolve - return null; - } - - /** - * @param choiceArg - * @return a diagnostic validating the choice expr with these arguments - */ - public Diagnostic validate(ValueType choiceArg) - { - final boolean isChoiceBoolean = - TypeCoercer.canCoerceToBoolean(TypeTransformer.transformBoxPrimitives(choiceArg.getSignature())); - - if (isChoiceBoolean) - { - if (choiceArg instanceof LiteralType) - { - try - { - Boolean result = ((LiteralType)choiceArg).coerceToBoolean(); - - if (result != null) - { - String whichSelected = result.booleanValue() ? "first" : "second"; - return _diagnosticFactory. - create_TERNARY_OP_CHOICE_IS_ALWAYS_SAME - (result.booleanValue(), whichSelected); - } - } - catch (TypeCoercionException tce) - { - return _diagnosticFactory. - create_TERNARY_OP_CANNOT_COERCE_CHOICE_TO_BOOLEAN(); - } - } - - // in both the case where the two arguments are the same and when - // they are different types, the best we can say is "OK", since - // we really don't know - return Diagnostic.OK_INSTANCE; - } - - // if choice is not boolean, then can't resolve - return _diagnosticFactory. - create_TERNARY_OP_CANNOT_COERCE_CHOICE_TO_BOOLEAN(); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/UnaryOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/UnaryOperator.java deleted file mode 100644 index d6a075999..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/UnaryOperator.java +++ /dev/null @@ -1,106 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.validation.internal.el.operators; - -import org.eclipse.emf.common.util.Diagnostic; -import org.eclipse.jst.jsf.common.internal.types.ValueType; -import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory; -import org.eclipse.jst.jsp.core.internal.java.jspel.JSPELParserConstants; -import org.eclipse.jst.jsp.core.internal.java.jspel.Token; - -/** - * Encapsulates an EL unary operator - * @author cbateman - * - */ -public abstract class UnaryOperator -{ - /** - * The common factory used to construct diagnostics - */ - protected final DiagnosticFactory _diagnosticFactory; - - /** - * @param token - * @return true if the token is a unary operator - */ - public static boolean isUnaryOperator(Token token) - { - return (token.kind == JSPELParserConstants.MINUS) - || (token.kind == JSPELParserConstants.NOT1) - || (token.kind == JSPELParserConstants.NOT2) - || (token.kind == JSPELParserConstants.EMPTY); - } - - /** - * @param token - * @param diagnosticFactory - * @return a new UnaryOperator instance matching token - */ - public static UnaryOperator createUnaryOperator(Token token, DiagnosticFactory diagnosticFactory) - { - if (!isUnaryOperator(token)) - { - throw new IllegalArgumentException("token must be a unary operator"); - } - - switch(token.kind) - { - case JSPELParserConstants.MINUS: - return new MinusUnaryOperator(diagnosticFactory); - - case JSPELParserConstants.NOT1: - case JSPELParserConstants.NOT2: - return new NotUnaryOperator(diagnosticFactory); - - case JSPELParserConstants.EMPTY: - return new EmptyUnaryOperator(diagnosticFactory); - } - - // should never get here because all four ops are covered - throw new AssertionError(); - } - - /** - * Constructor - */ - UnaryOperator(DiagnosticFactory diagnosticFactory) - { - /* no construction or sub-classing outside package*/ - _diagnosticFactory = diagnosticFactory; - } - - /** - * If ValueType is a literal and the operation can be performed, then - * the return must be a new LiteralType transformed using this operator. - * - * If ValueType is not a literal and the operaton can be performed, then - * the return is a new ValueType transformed per the rules of the operator - * (i.e. if it is a string type and the operator is "!", then the string - * must be coerced to a boolean and this is what will be returned) - * - * If the operation cannot be performed on ValueType, return null - * - * @param type - * @return a new value type after the operation is performed - */ - public abstract ValueType performOperation(ValueType type); - - - /** - * @param type - * @return a Diagnostic interpreting whether it is valid to perform the - * operation on this type - */ - public abstract Diagnostic validate(ValueType type); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/messages.properties b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/messages.properties deleted file mode 100644 index ae40823e8..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/messages.properties +++ /dev/null @@ -1,21 +0,0 @@ -############################################################################### -# Copyright (c) 2001, 2007 Oracle Corporation and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle Corporation - initial API and implementation -############################################################################### -EqualityRelationalBinaryOperator.FirstArgument=first -EqualsBinaryRelationalOperator.OperationName=equals -EqualityRelationalBinaryOperator.SecondArgument=second -GreaterThanEqRelationalBinaryOperator.OperationName=greater than or equal to -GreaterThanRelationalBinaryOperator.OperationName=greater than -LessThanEqRelationalBinaryOperator.OperationName=less than or equal to -LessThanRelationalBinaryOperator.OperationName=less than -LtGtRelationalBinaryOperator.ConstantName.False=false -NotEqualsBinaryRelationalOperator.OperationName=not equals -BracketOperator.Name=bracket -DotOperator.Name=dot diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/strategy/AttributeValidatingStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/strategy/AttributeValidatingStrategy.java deleted file mode 100644 index f65e5e1fd..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/strategy/AttributeValidatingStrategy.java +++ /dev/null @@ -1,659 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.validation.internal.strategy; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.ISafeRunnable; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.SafeRunner; -import org.eclipse.emf.common.util.BasicDiagnostic; -import org.eclipse.emf.common.util.Diagnostic; -import org.eclipse.jdt.core.Signature; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jst.jsf.common.dom.AttrDOMAdapter; -import org.eclipse.jst.jsf.common.dom.AttributeIdentifier; -import org.eclipse.jst.jsf.common.dom.DOMAdapter; -import org.eclipse.jst.jsf.common.internal.types.CompositeType; -import org.eclipse.jst.jsf.common.internal.types.TypeComparator; -import org.eclipse.jst.jsf.common.internal.types.TypeComparatorDiagnosticFactory; -import org.eclipse.jst.jsf.common.runtime.internal.model.ViewObject; -import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentFactory; -import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentInfo; -import org.eclipse.jst.jsf.common.runtime.internal.model.decorator.ConverterDecorator; -import org.eclipse.jst.jsf.common.runtime.internal.model.decorator.ConverterTypeInfo; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContextFactory; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.core.internal.region.Region2AttrAdapter; -import org.eclipse.jst.jsf.core.internal.region.Region2ElementAdapter; -import org.eclipse.jst.jsf.core.jsfappconfig.JSFAppConfigManager; -import org.eclipse.jst.jsf.designtime.DTAppManagerUtil; -import org.eclipse.jst.jsf.designtime.internal.view.DTUIViewRoot; -import org.eclipse.jst.jsf.designtime.internal.view.IViewRootHandle; -import org.eclipse.jst.jsf.designtime.internal.view.XMLViewDefnAdapter; -import org.eclipse.jst.jsf.designtime.internal.view.XMLViewObjectMappingService; -import org.eclipse.jst.jsf.designtime.internal.view.IDTViewHandler.ViewHandlerException; -import org.eclipse.jst.jsf.designtime.internal.view.XMLViewDefnAdapter.DTELExpression; -import org.eclipse.jst.jsf.designtime.internal.view.XMLViewObjectMappingService.ElementData; -import org.eclipse.jst.jsf.facesconfig.emf.ConverterForClassType; -import org.eclipse.jst.jsf.facesconfig.emf.ConverterType; -import org.eclipse.jst.jsf.metadataprocessors.MetaDataEnabledProcessingFactory; -import org.eclipse.jst.jsf.metadataprocessors.features.ELIsNotValidException; -import org.eclipse.jst.jsf.metadataprocessors.features.IValidELValues; -import org.eclipse.jst.jsf.metadataprocessors.features.IValidValues; -import org.eclipse.jst.jsf.metadataprocessors.features.IValidationMessage; -import org.eclipse.jst.jsf.validation.internal.AbstractXMLViewValidationStrategy; -import org.eclipse.jst.jsf.validation.internal.JSFValidationContext; -import org.eclipse.jst.jsf.validation.internal.el.ELExpressionValidator; -import org.eclipse.jst.jsp.core.internal.regions.DOMJSPRegionContexts; -import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion; -import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionCollection; -import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionList; -import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext; - -/** - * An XML view validation strategy that validates - * - * @author cbateman - * - */ -public class AttributeValidatingStrategy extends -AbstractXMLViewValidationStrategy -{ - private static final String DISABLE_ALTERATIVE_TYPES_KEY = "jsfCoreDisableConverterValidation"; //$NON-NLS-1$ - static final boolean DEBUG; - static - { - final String value = Platform - .getDebugOption("org.eclipse.jst.jsf.validation.internal.el/debug/jspsemanticsvalidator"); //$NON-NLS-1$ - DEBUG = value != null && value.equalsIgnoreCase("true"); //$NON-NLS-1$ - } - - /** - * identifier - */ - public final static String ID = "org.eclipse.jst.jsf.validation.strategy.AttributeValidatingStrategy"; //$NON-NLS-1$ - private final static String DISPLAY_NAME = "Attribute Validator"; //$NON-NLS-1$ - - private final JSFValidationContext _validationContext; - private final TypeComparator _typeComparator; - private Set<String> _conversionTypes; - - /** - * Default constructor - * - * @param validationContext - */ - public AttributeValidatingStrategy( - final JSFValidationContext validationContext) - { - super(ID, DISPLAY_NAME); - - _validationContext = validationContext; - _typeComparator = new TypeComparator( - new TypeComparatorDiagnosticFactory(validationContext - .getPrefs().getTypeComparatorPrefs())); - } - - @Override - public boolean isInteresting(final DOMAdapter domAdapter) - { - return (domAdapter instanceof AttrDOMAdapter); - } - - @Override - public void validate(final DOMAdapter domAdapter) - { - if (domAdapter instanceof AttrDOMAdapter) - { - final Region2AttrAdapter attrAdapter = (Region2AttrAdapter) domAdapter; - // check that this is attribute value region - 221722 - if (attrAdapter.getAttributeValueRegion() != null) - { - final IStructuredDocumentContext context = IStructuredDocumentContextFactory.INSTANCE - .getContext(attrAdapter.getDocumentContext() - .getStructuredDocument(), attrAdapter - .getOwningElement().getDocumentContext() - .getDocumentPosition() - + attrAdapter.getAttributeValueRegion() - .getStart()); - - validateAttributeValue(context, attrAdapter); - } - } - } - - /** - * Validates the attribute value. Reports any problems to the reporter in - * the JSFValidationContext. - * - * @param context - * @param attrAdapter - */ - private void validateAttributeValue( - final IStructuredDocumentContext context, - final Region2AttrAdapter attrAdapter) - { - // so of the code in run calls out into extension code or code - // dependent on external data (meta-data) - SafeRunner.run(new ISafeRunnable() - { - public void handleException(final Throwable exception) - { - JSFCorePlugin.log(String.format( - "Error validating attribute: %s on element %s", //$NON-NLS-1$ - attrAdapter.getNodeName(), attrAdapter - .getOwningElement().getNodeName()), exception); - } - - public void run() throws Exception - { - final Region2ElementAdapter elementAdapter = - attrAdapter.getOwningElement(); - // if there's elText then validate it - // TODO: this approach will fail with mixed expressions - if (!checkIfELAndValidate(elementAdapter, attrAdapter, context)) - { - validateNonELAttributeValue(context, attrAdapter); - } - } - }); - } - - private boolean checkIfELAndValidate(final Region2ElementAdapter elementAdapter, - final Region2AttrAdapter attrAdapter, - final IStructuredDocumentContext context) - { - int offsetOfFirstEL = -1; - final String attrValue = attrAdapter.getValue(); - - // TODO: should find and validate all - offsetOfFirstEL = attrValue.indexOf('#'); - - if (offsetOfFirstEL != -1 && offsetOfFirstEL < attrValue.length() - 1 - && attrValue.charAt(offsetOfFirstEL + 1) == '{') - { - offsetOfFirstEL += 2; - } - else - { - offsetOfFirstEL = -1; - } - - final XMLViewDefnAdapter adapter = DTAppManagerUtil - .getXMLViewDefnAdapter(context); - - boolean isEL = false; - if (adapter != null && offsetOfFirstEL != -1) - { - try - { - // use the attribute's context plus the offset into the - // whole attribute value to find where we think the el - // expression starts. Add one since the attribute value - // string returned by attrAdapter will have the value quotes - // removed, but the region offsets include the quotes. - IStructuredDocumentContext elContext = IStructuredDocumentContextFactory.INSTANCE - .getContext(context.getStructuredDocument(), context - .getDocumentPosition() - + offsetOfFirstEL + 1); - final DTELExpression elExpression = adapter - .getELExpression(elContext); - if (elExpression != null) - { - final String elText = elExpression.getText(); - - if (DEBUG) - { - System.out.println(addDebugSpacer(3) + "EL attrVal= " //$NON-NLS-1$ - + elText); - } - - elContext = elExpression.getDocumentContext(); - // EL validation is user configurable because - // it can be computationally costly. - if (_validationContext.shouldValidateEL()) - { - // also, skip the validation if the expression is empty - // or only whitespace, since the parser doesn't handle - // it - // anyway. - if ("".equals(elText.trim())) //$NON-NLS-1$ - { - final int offset = elContext.getDocumentPosition() - 1; - final int length = elText.length() + 2; - final Diagnostic diagnostic = _validationContext - .getDiagnosticFactory() - .create_EMPTY_EL_EXPRESSION(); - // detected empty EL expression - if (_validationContext.shouldValidateEL()) - { - _validationContext.getReporter().report( - diagnostic, offset, length); - } - } - else - { - final List elVals = MetaDataEnabledProcessingFactory - .getInstance() - .getAttributeValueRuntimeTypeFeatureProcessors( - IValidELValues.class, - elContext, - attrAdapter - .getAttributeIdentifier()); - final String safeELText = elText.replaceAll( - "[\n\r\t]", " "); //$NON-NLS-1$ //$NON-NLS-2$ - validateELExpression(context, elContext, elVals, - elementAdapter, attrAdapter, safeELText); - isEL = true; - } - } - } - } - catch (final ViewHandlerException e) - { - // fall through to return false - } - } - - // is el if we've already detected it or if the step 2 method - // finds it. Run the method first to avoid short-circuiting - final boolean isEL2 = checkIfELAndValidate2(attrAdapter, context); - - return isEL || isEL2; - } - - /** - * Checks the region to see if it contains an EL attribute value. If it - * does, validates it - * - * @return true if validated EL, false otherwise - */ - private boolean checkIfELAndValidate2(final Region2AttrAdapter attrAdapter, - final IStructuredDocumentContext sDocContext) - { - final ITextRegion attrValueRegion = attrAdapter - .getAttributeValueRegion(); - if (attrValueRegion instanceof ITextRegionCollection) - { - final ITextRegionCollection parentRegion = ((ITextRegionCollection) attrValueRegion); - if (parentRegion.getType() == DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE) - { - final ITextRegionList regionList = parentRegion.getRegions(); - - if (regionList.size() >= 3) - { - final ITextRegion openQuote = regionList.get(0); - final ITextRegion vblOpen = regionList.get(1); - - if ((openQuote.getType() == DOMJSPRegionContexts.XML_TAG_ATTRIBUTE_VALUE_DQUOTE || openQuote - .getType() == DOMJSPRegionContexts.JSP_VBL_DQUOTE) - && vblOpen.getType() == DOMJSPRegionContexts.JSP_VBL_OPEN) - { - boolean foundClosingQuote = false; - for (int i = 2; !foundClosingQuote - && i < regionList.size(); i++) - { - final ITextRegion searchRegion = regionList.get(i); - if (searchRegion.getType() == DOMJSPRegionContexts.JSP_VBL_CLOSE) - { - foundClosingQuote = true; - } - } - - if (!foundClosingQuote - && _validationContext.shouldValidateEL()) - { - final int offset = sDocContext - .getDocumentPosition() + 1; - final int length = parentRegion.getText().length(); - final Diagnostic diagnostic = _validationContext - .getDiagnosticFactory() - .create_MISSING_CLOSING_EXPR_BRACKET(); - _validationContext.getReporter().report(diagnostic, - offset, length); - } - return true; - } - } - } - } - return false; - } - - private void validateELExpression(final IStructuredDocumentContext context, - final IStructuredDocumentContext elContext, final List elVals, - final Region2ElementAdapter elementAdapter, - final Region2AttrAdapter attrAdapter, final String elText) - { - // Call EL validator which will perform at least the syntactical - // validation - final ELExpressionValidator elValidator = new ELExpressionValidator( - elContext, elText, _validationContext - .getSymbolResolverFactory(), _validationContext - .getReporter()); - elValidator.validateXMLNode(); - - final CompositeType exprType = elValidator.getExpressionType(); - if (exprType != null) - { - for (final Iterator it = elVals.iterator(); it.hasNext();) - { - final IValidELValues elval = (IValidELValues) it.next(); - final String attributeVal = attrAdapter.getValue(); - CompositeType expectedType; - Diagnostic status = null; - try - { - expectedType = elval.getExpectedRuntimeType(); - - if (expectedType != null) - { - expectedType = maybeAddAlternativeTypes( - expectedType, exprType, elementAdapter, - attrAdapter); - status = _typeComparator.calculateTypeCompatibility( - expectedType, exprType); - if (status.getSeverity() != Diagnostic.OK) - { - reportValidationMessage(status, context, - attributeVal); - } - } - } - catch (final ELIsNotValidException e) - { - reportValidationMessage(createValidationMessage(context, - attributeVal, IStatus.WARNING, e.getMessage(), - _validationContext.getFile()), context, - attributeVal); - } - } - } - } - - private boolean disableAlternativeTypes() - { - String res = System.getProperty(DISABLE_ALTERATIVE_TYPES_KEY); - if (res == null) { - //check env var also - res = System.getenv(DISABLE_ALTERATIVE_TYPES_KEY); - } - if (res != null) - { - return true; - } - final IPreferenceStore prefStore = JSFCorePlugin.getDefault().getPreferenceStore(); - return prefStore.getBoolean("org.eclipse.jst.jsf.core."+DISABLE_ALTERATIVE_TYPES_KEY); //$NON-NLS-1$ - } - /** - * @return true if alternative type comparison (i.e. post-conversion) passes - */ - private CompositeType maybeAddAlternativeTypes( - final CompositeType expectedType, - final CompositeType exprTypes, - final Region2ElementAdapter elementAdapter, - final Region2AttrAdapter attrAdapter) - { - if (disableAlternativeTypes()) - { - return expectedType; - } - - final IStructuredDocumentContext context = elementAdapter - .getDocumentContext(); - final IViewRootHandle viewRootHandle = DTAppManagerUtil - .getViewRootHandle(context); - if (viewRootHandle != null) - { - // ok to call update view root here since validation not called - // on the UI thread. - final DTUIViewRoot viewRoot = viewRootHandle.updateViewRoot(); - final IAdaptable serviceAdaptable = viewRoot.getServices(); - final XMLViewObjectMappingService mappingService = (XMLViewObjectMappingService) serviceAdaptable - .getAdapter(XMLViewObjectMappingService.class); - if (mappingService != null) - { - final ElementData elementData = XMLViewObjectMappingService - .createElementData(elementAdapter.getNamespace(), - elementAdapter.getLocalName(), context, - Collections.EMPTY_MAP); - final ViewObject viewObject = mappingService - .findViewObject(elementData); - // if the corresponding view object is a valueholder, then - // we need to see if you think there a valid conversion - // available - if (viewObject instanceof ComponentInfo - && ((ComponentInfo) viewObject).getComponentTypeInfo() != null - && ((ComponentInfo) viewObject).getComponentTypeInfo() - .isInstanceOf( - ComponentFactory.INTERFACE_VALUEHOLDER)) - { - final ComponentInfo component = (ComponentInfo) viewObject; - // get the original elementData - final ElementData mappedElementData = mappingService - .findElementData(component); - final String propName = mappedElementData - .getPropertyName(attrAdapter.getLocalName()); - if ("value".equals(propName)) //$NON-NLS-1$ - { - // final List converters = - // component.getDecorators(ComponentFactory.CONVERTER); - - // (ConverterDecorator) it.next(); - return createCompositeType( - expectedType, - exprTypes, - component - .getDecorators(ComponentFactory.CONVERTER)); - } - } - } - } - // don't add anything by default - return expectedType; - } - - private CompositeType createCompositeType(final CompositeType initialTypes, - final CompositeType testTypes, final List<ConverterDecorator> decorators) - { - // indicates unknown converter - final Set<String> types = new HashSet(Arrays.asList(initialTypes - .getSignatures())); - // look for converters. If there's one where we don't know the type, - // simply copy over the testTypes to force validation to ignore, since - // we have no idea. - for (final ConverterDecorator decorator : decorators) - { - if (decorator.getTypeInfo() != null) - { - final ConverterTypeInfo converterTypeInfo = decorator.getTypeInfo(); - if (converterTypeInfo.getForClass().length == 0) - { - types.addAll(Arrays.asList(testTypes.getSignatures())); - break; - } - types.addAll(createSignatures(converterTypeInfo.getForClass())); - } - } - types.addAll(getRegisteredConversionTypesByClass()); - return new CompositeType(types.toArray(new String[0]) - , initialTypes.getAssignmentTypeMask()); - } - - private Set<String> getRegisteredConversionTypesByClass() - { - if (_conversionTypes == null) - { - _conversionTypes = new HashSet<String>(); - final IProject project = _validationContext.getFile().getProject(); - final JSFAppConfigManager appConfig = JSFAppConfigManager.getInstance(project); - final List converters = appConfig.getConverters(); - for (final Iterator it = converters.iterator(); it.hasNext();) - { - final ConverterType converterType = (ConverterType) it.next(); - final ConverterForClassType forClassType = converterType.getConverterForClass(); - if (forClassType != null) - { - final String forClass = forClassType.getTextContent(); - if (forClass != null) - { - String signature = forClass.trim(); - try - { - signature = Signature.createTypeSignature(signature, true); - _conversionTypes.add(signature); - } - catch (final Exception e) - { - JSFCorePlugin.log(IStatus.INFO, "Could not use registered converter for-class: "+forClass); //$NON-NLS-1$ - } - } - } - } - } - return _conversionTypes; - } - - private List<String> createSignatures(final String[] classNames) - { - final List<String> signatures = new ArrayList<String>(); - for (final String className : classNames) - { - try - { - String signature = Signature.createTypeSignature(className, true); - signatures.add(signature); - } - catch (final Exception e) - { - JSFCorePlugin.log(e, "Trying to create signature"); //$NON-NLS-1$ - } - } - return signatures; - } - - /** - * Validates an attribute value in context using the JSF metadata processing - * framework - * - * @param context - * @param region - * @param uri - * @param tagName - * @param attrName - * @param attributeVal - * @param reporter - * @param file - */ - private void validateNonELAttributeValue( - final IStructuredDocumentContext context, - final Region2AttrAdapter attrAdapter) - { - final String attributeValue = attrAdapter.getValue(); - // else validate as static attribute value - if (DEBUG) - { - System.out.println(addDebugSpacer(3) + "attrVal= " //$NON-NLS-1$ - + (attributeValue != null ? attributeValue : "null")); //$NON-NLS-1$ - } - - final AttributeIdentifier attributeId = attrAdapter - .getAttributeIdentifier(); - - if (attributeId.getTagIdentifier() == null - || attributeId.getTagIdentifier().getTagName() == null - || attributeId.getName() == null) - { - return; - } - - final List vv = MetaDataEnabledProcessingFactory.getInstance() - .getAttributeValueRuntimeTypeFeatureProcessors( - IValidValues.class, context, attributeId); - if (!vv.isEmpty()) - { - for (final Iterator it = vv.iterator(); it.hasNext();) - { - final IValidValues v = (IValidValues) it.next(); - if (!v.isValidValue(attributeValue.trim())) - { - if (DEBUG) - { - System.out.println(addDebugSpacer(4) + "NOT VALID "); //$NON-NLS-1$ - } - - for (final Iterator msgs = v.getValidationMessages() - .iterator(); msgs.hasNext();) - { - final IValidationMessage msg = (IValidationMessage) msgs - .next(); - reportValidationMessage(createValidationMessage( - context, attributeValue, msg.getSeverity(), msg - .getMessage(), _validationContext - .getFile()), context, attributeValue); - } - } - else if (DEBUG) - { - System.out.println(addDebugSpacer(5) + "VALID "); //$NON-NLS-1$ - } - } - } - else if (DEBUG) - { - System.out.println(addDebugSpacer(4) + "NO META DATA "); //$NON-NLS-1$ - } - } - - private void reportValidationMessage(final Diagnostic problem, - final IStructuredDocumentContext context, - final String attributeValue) - { - final int start = context.getDocumentPosition() + 1; - final int length = attributeValue.length(); - _validationContext.getReporter().report(problem, start, length); - } - - private Diagnostic createValidationMessage( - final IStructuredDocumentContext context, - final String attributeValue, final int severity, final String msg, - final IFile file) - { - // TODO: need factory - final Diagnostic diagnostic = new BasicDiagnostic(severity, "", -1, //$NON-NLS-1$ - msg, null); - return diagnostic; - } - - private String addDebugSpacer(final int count) - { - final String TAB = "\t"; //$NON-NLS-1$ - final StringBuffer ret = new StringBuffer(""); //$NON-NLS-1$ - for (int i = 0; i <= count; i++) - { - ret.append(TAB); - } - return ret.toString(); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/strategy/ContainmentValidatingStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/strategy/ContainmentValidatingStrategy.java deleted file mode 100644 index 2a70394e7..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/strategy/ContainmentValidatingStrategy.java +++ /dev/null @@ -1,228 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.validation.internal.strategy; - -import java.text.MessageFormat; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.emf.common.util.BasicDiagnostic; -import org.eclipse.emf.common.util.Diagnostic; -import org.eclipse.jst.jsf.common.dom.DOMAdapter; -import org.eclipse.jst.jsf.common.dom.TagIdentifier; -import org.eclipse.jst.jsf.common.internal.JSPUtil; -import org.eclipse.jst.jsf.common.metadata.Entity; -import org.eclipse.jst.jsf.common.metadata.Trait; -import org.eclipse.jst.jsf.common.metadata.query.ITaglibDomainMetaDataModelContext; -import org.eclipse.jst.jsf.common.metadata.query.TaglibDomainMetaDataQueryHelper; -import org.eclipse.jst.jsf.common.sets.AxiomaticSet; -import org.eclipse.jst.jsf.common.sets.ConcreteAxiomaticSet; -import org.eclipse.jst.jsf.context.resolver.structureddocument.IDOMContextResolver; -import org.eclipse.jst.jsf.context.resolver.structureddocument.IStructuredDocumentContextResolverFactory; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.core.internal.region.Region2ElementAdapter; -import org.eclipse.jst.jsf.core.internal.tld.TagIdentifierFactory; -import org.eclipse.jst.jsf.core.set.constraint.MemberConstraint; -import org.eclipse.jst.jsf.core.set.mapping.ElementToTagIdentifierMapping; -import org.eclipse.jst.jsf.core.tagmatcher.EvaluationException; -import org.eclipse.jst.jsf.core.tagmatcher.InvalidExpressionException; -import org.eclipse.jst.jsf.core.tagmatcher.XPathMatchingAlgorithm; -import org.eclipse.jst.jsf.validation.internal.AbstractXMLViewValidationStrategy; -import org.eclipse.jst.jsf.validation.internal.JSFValidationContext; -import org.eclipse.jst.jsf.validation.internal.constraints.ContainsTagConstraint; -import org.eclipse.jst.jsf.validation.internal.constraints.TagId; -import org.eclipse.jst.jsf.validation.internal.constraints.TagSet; -import org.w3c.dom.Node; - -/** - * @author cbateman - * - */ -public class ContainmentValidatingStrategy extends - AbstractXMLViewValidationStrategy -{ - /** - * identifier - */ - public final static String ID = - "org.eclipse.jst.jsf.validation.strategy.ElementValidatingStrategy"; - private final static String DISPLAY_NAME = - "Tag Containment Validator"; - private final static ElementToTagIdentifierMapping elem2TagIdMapper = - new ElementToTagIdentifierMapping(); - private int _containmentValidationCount; // = 0; - private final JSFValidationContext _jsfValidationContext; - - /** - * @param jsfValidationContext - */ - public ContainmentValidatingStrategy( - final JSFValidationContext jsfValidationContext) - { - super(ID, DISPLAY_NAME); - _jsfValidationContext = jsfValidationContext; - } - - @Override - public boolean isInteresting(DOMAdapter domAdapter) - { - return domAdapter instanceof Region2ElementAdapter; - } - - @Override - public void validate(DOMAdapter domAdapter) - { - if (domAdapter instanceof Region2ElementAdapter) - { - final Region2ElementAdapter elementAdapter = - (Region2ElementAdapter) domAdapter; - validateContainment(elementAdapter, _jsfValidationContext); - } - } - - private void validateContainment( - final Region2ElementAdapter elementAdapter, - final JSFValidationContext jsfValidationContext) - { - // don't validate JSP fragments since the necessary containment may - // existing - // in the JSP files that include them - // also only validate the first instance of containment violation in a - // file - if (JSPUtil.isJSPFragment(jsfValidationContext.getFile()) - || _containmentValidationCount > 0) - { - return; - } - - final IStructuredDocumentContext context = elementAdapter - .getDocumentContext(); - final IDOMContextResolver resolver = IStructuredDocumentContextResolverFactory.INSTANCE - .getDOMContextResolver(context); - final Node node = resolver.getNode(); - - final String uri = elementAdapter.getNamespace(); - final String tagName = elementAdapter.getLocalName(); - // final Element node = elementAdapter. - - final ITaglibDomainMetaDataModelContext modelContext = TaglibDomainMetaDataQueryHelper - .createMetaDataModelContext(jsfValidationContext.getFile() - .getProject(), uri); - final Entity entity = TaglibDomainMetaDataQueryHelper.getEntity( - modelContext, tagName); - if (entity != null) - { - final Trait trait = TaglibDomainMetaDataQueryHelper.getTrait( - entity, "containment-constraint"); - - if (trait != null) - { - final ContainsTagConstraint tagConstraint = (ContainsTagConstraint) trait - .getValue(); - - final String algorithm = tagConstraint.getSetGenerator() - .getAlgorithm(); - - // TODO: need generalized factory mechanism for registering and - // constructing algorithms. - if (!"xpath".equals(algorithm)) - { - return; - } - - final String expr = tagConstraint.getSetGenerator() - .getExpression(); - - // TODO: optimize on the expression and cache for reuse - final XPathMatchingAlgorithm xpathAlg = new XPathMatchingAlgorithm( - expr); - - AxiomaticSet set = null; - - try - { - set = xpathAlg.evaluate(node); - // map dom nodes to tag identifiers - set = elem2TagIdMapper.map(set); - } - catch (final InvalidExpressionException e) - { - JSFCorePlugin.log(e, "Problem with expression: " + expr - + " on node " + node); - return; - } - catch (final EvaluationException e) - { - JSFCorePlugin.log(e, "Problem evaluating expression: " - + expr + " on node " + node); - return; - } - - final TagSet constraintData = tagConstraint.getSatisfiesSet(); - final AxiomaticSet constraintSet = new ConcreteAxiomaticSet(); - for (final Iterator it = constraintData.getTags().iterator(); it - .hasNext();) - { - final TagId tagId = (TagId) it.next(); - constraintSet.add(TagIdentifierFactory.createJSPTagWrapper( - tagId.getUri(), tagId.getName())); - } - final MemberConstraint memberConstraint = new MemberConstraint( - constraintSet); - final Diagnostic diag = memberConstraint.isSatisfied(set); - - if (diag.getSeverity() != Diagnostic.OK) - { - _containmentValidationCount++; // found a violation - - final List data = diag.getData(); - - for (final Iterator it = data.iterator(); it.hasNext();) - { - final TagIdentifier missingParent = (TagIdentifier) it - .next(); - - reportContainmentProblem(context, node.getNodeName(), - Diagnostic.WARNING, - missingParent.getTagName(), missingParent - .getUri()); - } - } - } - } - } - - private static final String MESSAGE_PATTERN = - "Tag {0} is missing required parent tag \"{1}\" ({2})"; - - // TODO: need a diagnostic factory - private void reportContainmentProblem( - final IStructuredDocumentContext context, - final String nodeName, final int severity, - final String tagName, final String uri) - { - - final String msg = MessageFormat.format( - MESSAGE_PATTERN, new Object[] - {nodeName, tagName, uri}); - - final Diagnostic problem = - new BasicDiagnostic(severity, "", -1, msg, null); - // add one so that the start offset is at the node name, rather - // than the opening brace. - final int start = context.getDocumentPosition()+1; - final int length = nodeName.length(); - - _jsfValidationContext.getReporter().report(problem, start, length); - } - -} |