diff options
Diffstat (limited to 'jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst')
392 files changed, 0 insertions, 50817 deletions
diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/JSFCommonPlugin.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/JSFCommonPlugin.java deleted file mode 100644 index e9492ef84..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/JSFCommonPlugin.java +++ /dev/null @@ -1,345 +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.common; - -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.eclipse.core.runtime.IExtension; -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.emf.common.EMFPlugin; -import org.eclipse.emf.common.util.ResourceLocator; -import org.eclipse.jst.jsf.context.symbol.source.AbstractContextSymbolFactory; -import org.eclipse.jst.jsf.context.symbol.source.ISymbolSourceProvider; -import org.eclipse.jst.jsf.context.symbol.source.ISymbolSourceProviderFactory; -import org.osgi.framework.Bundle; - -/** - * This is the central singleton for the My edit plugin. - * <!-- begin-user-doc --> - * This class is not API. - * <!-- end-user-doc --> - * @generated - */ -public final class JSFCommonPlugin extends EMFPlugin { - - /** - * Plugin id - */ - public static final String PLUGIN_ID = "org.eclipse.jst.jsf.common"; //$NON-NLS-1$ - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright 2006 Oracle"; //$NON-NLS-1$ - - private static List<ISymbolSourceProviderFactory> registeredSymbolSourceProviders; - private static Map<String,AbstractContextSymbolFactory> registeredSymbolFactories; - - private final static String FACTORY_ATTRIBUTE_NAME = "factory"; //$NON-NLS-1$ - private final static String FACTORY_ATTRIBUTE_ID_NAME = "factoryId"; //$NON-NLS-1$ - private final static String SYMBOL_SOURCE_ID = "symbolSourceId"; //$NON-NLS-1$ - private final static String CONTEXT_SYMBOL_FACTORY = "contextSymbolFactory"; //$NON-NLS-1$ - /** - * Keep track of the singleton. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final JSFCommonPlugin INSTANCE = new JSFCommonPlugin(); - - /** - * Keep track of the singleton. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private static Implementation plugin; - - /** - * Create the instance. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public JSFCommonPlugin() { - super - (new ResourceLocator [] { - }); - } - - /** - * Returns the singleton instance of the Eclipse plugin. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the singleton instance. - * @generated - */ - public ResourceLocator getPluginResourceLocator() { - return plugin; - } - - /** - * Returns the singleton instance of the Eclipse plugin. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the singleton instance. - * @generated - */ - public static Implementation getPlugin() { - return plugin; - } - - /** - * @param e - * @param msg - */ - public static void log(final Throwable e, final String msg) { - Implementation plugin2 = getPlugin(); - if (plugin2 != null) - { - final ILog log = getPlugin().getLog(); - if (log != null) - { - log.log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, msg, e)); - return; - } - } - // if plugin not active, dump to stderr - System.err.print(msg+": "); //$NON-NLS-1$ - if (e != null) - { - e.printStackTrace(System.err); - } - } - - /** - * 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(int severity, String message, Throwable ex) { - getPlugin().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(int severity, String message) { - log(severity, message, null); - } - /** - * @return all registered symbol source providers - */ - public static ISymbolSourceProvider[] getSymbolSourceProvider() - { - return registeredSymbolSourceProviders.toArray(new ISymbolSourceProvider[0]); - } - - /** - * @return all registered symbol source providers - */ - public synchronized static List<ISymbolSourceProviderFactory> getSymbolSourceProviders() - { - if (registeredSymbolSourceProviders == null) - { - registerProviders(); - if (registeredSymbolSourceProviders == null) - { - throw new AssertionError("registerProviders failed"); //$NON-NLS-1$ - } - } - return Collections.unmodifiableList(registeredSymbolSourceProviders); - } - - private static void registerProviders() - { - final IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(plugin.getBundle().getSymbolicName(), Implementation.SYMBOL_SOURCE_EXT_ID); - final IExtension[] extensions = point.getExtensions(); - registeredSymbolSourceProviders = new ArrayList<ISymbolSourceProviderFactory>(extensions.length); - - for (int i = 0; i < extensions.length; i++) - { - final IExtension extension = extensions[i]; - final IConfigurationElement[] elements = - extension.getConfigurationElements(); - final String bundleId = extension.getContributor().getName(); - - for (int j = 0; j < elements.length; j++) - { - final IConfigurationElement element = elements[j]; - if (SYMBOL_SOURCE_ID.equals(element.getName()) - && element.getAttribute(FACTORY_ATTRIBUTE_NAME) != null) - { - String factoryClassName = element.getAttribute(FACTORY_ATTRIBUTE_NAME); - final Bundle bundle = Platform.getBundle(bundleId); - - if (bundle != null) - { - try - { - Class factoryClass = bundle.loadClass(factoryClassName); - - ISymbolSourceProviderFactory factory = - (ISymbolSourceProviderFactory) factoryClass.newInstance(); - - registeredSymbolSourceProviders.add(factory); - } - catch (Exception e) - { - plugin.log(new Status(IStatus.ERROR, plugin.getBundle().getSymbolicName(), 0, "Error loading symbol provider extension point",e)); //$NON-NLS-1$ - } - } - } - } - } - } - - /** - * @return the list of registed symbol factories - */ - public synchronized static Map<String, AbstractContextSymbolFactory> getSymbolFactories() - { - if (registeredSymbolFactories == null) - { - registerSymbolFactories(); - if (registeredSymbolFactories == null) - { - throw new AssertionError("registerProviders failed"); //$NON-NLS-1$ - } - } - return Collections.unmodifiableMap(registeredSymbolFactories); - } - - private static void registerSymbolFactories() - { - final IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(plugin.getBundle().getSymbolicName(), Implementation.SYMBOL_FACTORY_EXT_ID); - final IExtension[] extensions = point.getExtensions(); - registeredSymbolFactories = new HashMap<String, AbstractContextSymbolFactory>(extensions.length); - - for (int i = 0; i < extensions.length; i++) - { - final IExtension extension = extensions[i]; - final IConfigurationElement[] elements = - extension.getConfigurationElements(); - final String bundleId = extension.getContributor().getName(); - - for (int j = 0; j < elements.length; j++) - { - final IConfigurationElement element = elements[j]; - if (CONTEXT_SYMBOL_FACTORY.equals(element.getName()) - && element.getAttribute(FACTORY_ATTRIBUTE_NAME) != null) - { - final String factoryClassName = element.getAttribute(FACTORY_ATTRIBUTE_NAME); - final String factoryId = element.getAttribute(FACTORY_ATTRIBUTE_ID_NAME); - final Bundle bundle = Platform.getBundle(bundleId); - - if (bundle != null) - { - try { - Class factoryClass = bundle.loadClass(factoryClassName); - - AbstractContextSymbolFactory factory = - (AbstractContextSymbolFactory) factoryClass.newInstance(); - registeredSymbolFactories.put(factoryId, factory); - } catch (InstantiationException e) { - plugin.log(new Status(IStatus.ERROR, plugin.getBundle().getSymbolicName(), 0, "Error loading symbol factory extension point",e)); //$NON-NLS-1$ - } catch (IllegalAccessException e) { - plugin.log(new Status(IStatus.ERROR, plugin.getBundle().getSymbolicName(), 0, "Error loading symbol factory extension point",e)); //$NON-NLS-1$ - } catch (ClassNotFoundException e) { - plugin.log(new Status(IStatus.ERROR, plugin.getBundle().getSymbolicName(), 0, "Error loading symbol factory extension point",e)); //$NON-NLS-1$ - } - } - } - } - } - } - - /** - * Logs an exception in this plugin to the error log - * - * @param t - */ - public static void log(Throwable t) - { - ILog log = getPlugin().getLog(); - IStatus status = new Status(IStatus.ERROR, getPlugin().getSymbolicName(), 0, "Caught exception", t); //$NON-NLS-1$ - log.log(status); - } - - /** - * The actual implementation of the Eclipse <b>Plugin</b>. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static class Implementation extends EclipsePlugin - { - /** - * Name of the symbolSourceProvider ext point - */ - public static final String SYMBOL_SOURCE_EXT_ID = "symbolSourceProvider"; //$NON-NLS-1$ - /** - * Local identifier for the symbol factory extension point - */ - public static final String SYMBOL_FACTORY_EXT_ID = "contextSymbolFactory"; //$NON-NLS-1$ - /** - * Creates an instance. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Implementation() { - super(); - - // Remember the static instance. - // - plugin = this; - } - } - - - /** - * Utility method returning class from class name using classloader from specified bundle - * @param className - * @param bundleId - * @return Class - */ - public static Class<?> loadClass(String className, String bundleId) { - Class<?> aClass = null; - try { - if (bundleId != null){ - Bundle bundle = Platform.getBundle(bundleId); - if (bundle != null){ - aClass = bundle.loadClass(className); - } - } - } catch (ClassNotFoundException e) { - log(e); - } - return aClass; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/dom/AttrDOMAdapter.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/dom/AttrDOMAdapter.java deleted file mode 100644 index ec51032f6..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/dom/AttrDOMAdapter.java +++ /dev/null @@ -1,92 +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.common.dom; - -import org.w3c.dom.Node; - -/** - * Generic adapter for DOM attribute structures. - * - * @author cbateman - * - * <p> - * <b>Provisional API - subject to change</b> - * </p> - */ -public abstract class AttrDOMAdapter extends DOMAdapter -{ - - private AttributeIdentifier _attributeId; // lazily instantiated. - private final ElementDOMAdapter _owner; - - /** - * @param owner - */ - protected AttrDOMAdapter(final ElementDOMAdapter owner) - { - _owner = owner; - } - - /** - * The default implementation always returns the owner specified in the - * constructor. - * - * @return the element that owns this attribute - */ - public ElementDOMAdapter getOwningElement() - { - return _owner; - } - - /** - * @return the value of the attribute. May return null if the attribute has - * no value. - */ - public abstract String getValue(); - - @Override - public final short getNodeType() - { - return Node.ATTRIBUTE_NODE; - } - - /** - * @return the attribute identifier - */ - public final AttributeIdentifier getAttributeIdentifier() - { - synchronized (this) - { - if (_attributeId == null) - { - _attributeId = new MyAttributeIdentifier(); - } - } - return _attributeId; - } - - private class MyAttributeIdentifier extends AttributeIdentifier - { - - @Override - public String getName() - { - return AttrDOMAdapter.this.getLocalName(); - } - - @Override - public TagIdentifier getTagIdentifier() - { - return getOwningElement().getTagId(); - } - - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/dom/AttributeIdentifier.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/dom/AttributeIdentifier.java deleted file mode 100644 index 2bf163efc..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/dom/AttributeIdentifier.java +++ /dev/null @@ -1,80 +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.common.dom; - -/** - * Uniquely identifies a named attribute on a tag usint TagIdentifier as a way - * to uniquely identify the host tag. All instances should be considered - * immutable and idempotent. Factories may cache copies as transparent - * singletons for unique TagIdentifier/attribute. - * - * THIS CLASS IS NOT API AND SHOULD NOT BE USED - * - * @author cbateman - * - */ -public abstract class AttributeIdentifier -{ - /** - * @return the attribute name (local name, namespace prefix is currently ignored) - */ - public abstract String getName(); - - /** - * @return the tag identifier - */ - public abstract TagIdentifier getTagIdentifier(); - - public final boolean equals(Object compareTo) - { - if (compareTo instanceof AttributeIdentifier) - { - return isSameAttributeType((AttributeIdentifier) compareTo); - } - return false; - } - - public final int hashCode() - { - // use toLowerCase to ensure equals matches - int hashCode = getName().toLowerCase().hashCode(); - - int tagCode = getTagIdentifier().hashCode(); - - hashCode = hashCode ^ tagCode; - - return hashCode; - } - - /** - * @param attributeId - * @return true if attributeId represents the same attribute as this. - */ - public final boolean isSameAttributeType(AttributeIdentifier attributeId) - { - // if same object, always true - if (attributeId == this) - { - return true; - } - - - // if tag identifiers not same, then always false. - if (!getTagIdentifier().isSameTagType(attributeId.getTagIdentifier())) - { - return false; - } - - // if tag id is the same, the tag name must be too. - return getName().toLowerCase().equals(attributeId.getName().toLowerCase()); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/dom/DOMAdapter.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/dom/DOMAdapter.java deleted file mode 100644 index fb3c43b75..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/dom/DOMAdapter.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.common.dom; - -/** - * A generic adapter that can adapt some non-DOM - * things to a dom-like structure like an IRegion to a DOM-like structure. - * - * <p><b>Provisional API - subject to change</b></p> - * - * @author cbateman - * - */ -public abstract class DOMAdapter -{ - /** - * @return the node type. Conforms to Node.getNodeType. - */ - public abstract short getNodeType(); - - /** - * @return the name prefix. Conforms to W3C Node.getPrefix() - */ - public abstract String getPrefix(); - - /** - * @return the local part of the name. Conforms to W3C Node.getLocalName() - */ - public abstract String getLocalName(); - - /** - * @return the name of the node. Conforms the W3C Node.getNodeName interface - */ - public abstract String getNodeName(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/dom/ElementDOMAdapter.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/dom/ElementDOMAdapter.java deleted file mode 100644 index 4d0ad5d91..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/dom/ElementDOMAdapter.java +++ /dev/null @@ -1,84 +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.common.dom; - -import java.util.Map; - -import org.w3c.dom.Node; - -/** - * T - * @author cbateman - * - * <p><b>Provisional API - subject to change</b></p> - * - */ -public abstract class ElementDOMAdapter extends DOMAdapter -{ - private TagIdentifier _tagIdentifier; // lazily initialized - - /** - * Map should be considered immutable and may throw exceptions if - * mutations are attempted. - * - * @return a nodeName keyed map of attributes belonging to this element - */ - public abstract Map<String, ? extends AttrDOMAdapter> getAttributes(); - - @Override - public final short getNodeType() - { - return Node.ELEMENT_NODE; - } - - /** - * @return the namespace uri for element or null if not applicable (i.e. HTML). - */ - public abstract String getNamespace(); - - /** - * @return the tag identifier for this attribute - */ - public final TagIdentifier getTagId() - { - synchronized(this) - { - if (_tagIdentifier == null) - { - _tagIdentifier = new MyTagIdentifier(); - } - } - return _tagIdentifier; - } - - private final class MyTagIdentifier extends TagIdentifier - { - @Override - public String getTagName() - { - return getLocalName(); - } - - @Override - public String getUri() - { - return getNamespace(); - } - - @Override - public boolean isJSPTag() - { - // shouldn't be called - throw new UnsupportedOperationException("jsp flag not supported on this identifier"); //$NON-NLS-1$ - } - - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/dom/TagIdentifier.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/dom/TagIdentifier.java deleted file mode 100644 index 3d675a69d..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/dom/TagIdentifier.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.common.dom; - -import javax.xml.namespace.QName; - - -/** - * Creates an abstraction for a tag. A tag is defined as a DOM Element whose - * namespace uri may be defined outside of the DOM, such as in a JSP tag library - * declaration. This allows tags to be abstracted from actual DOM elements, which - * is useful in situations like palette creation drops where the construction information - * is known, but we are not ready to create and add a node to the document yet. - * - * All tag TagIdentifier<i>s</i> should be considered immutable and idempotent. - * TagIdentifier instances may be cached by the factory. - * - * <p><b>Provisional API - subject to change</b></p> - * - * @author cbateman - * - */ -public abstract class TagIdentifier -{ - /** - * @return the uri that uniquely identifies the tag. - * - * i.e. - * - * If the tag is defined by an XML namespace, then that uri string will be returned. - * If the tag is defined by a JSP tag library, then the tag library uri should - * be returned. - */ - public abstract String getUri(); - - /** - * @return the local name of the tag (without namespace prefix) - */ - public abstract String getTagName(); - - /** - * @return true if this tag is a JSP tag - */ - public abstract boolean isJSPTag(); - - public final boolean equals(Object compareTo) - { - if (compareTo instanceof TagIdentifier) - { - return isSameTagType((TagIdentifier) compareTo); - } - return false; - } - - public final int hashCode() - { - // use toLowerCase to ensure equals matches - int hashCode = getTagName().toLowerCase().hashCode(); - - String uri = getUri(); - if (uri != null) - { - hashCode ^= uri.hashCode(); - } - return hashCode; - } - - /** - * @param tagWrapper - * @return true if tagWrapper represents the same tag as this. - */ - public final boolean isSameTagType(TagIdentifier tagWrapper) - { - if (tagWrapper == this) - { - return true; - } - - final String uri = tagWrapper.getUri(); - - if (uri == null) - { - if (getUri() != null) - { - return false; - } - } - else if (uri.equals(getUri())) - { - final String tagName = tagWrapper.getTagName(); - - if (tagName == null) - { - if(getTagName() != null) - { - return false; - } - } - else - { - // uri and tag name must both the same for it to be the same type - // TODO: the ignore case thing is dependent on the type of container document - // Use toLower instead of equalsIgnoreCase to ensure that hashCode generates - // a hashCode that guarantees x.equals(y) => x.hashCode == y.hashCode - if (tagName.toLowerCase().equals((getTagName().toLowerCase()))) - { - return true; - } - } - } - - // fall-through, not same - return false; - } - - /** - * @return the QName equivalent. Returns a new object on every invocation. - */ - public final QName asQName() - { - return new QName(getUri(), getTagName()); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/dom/package-info.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/dom/package-info.java deleted file mode 100644 index af4d45aef..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/dom/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 - * - ********************************************************************************/ - -/** - * API for manipulating DOM-based objects. - * - * <p><b>Provisional API - subject to change</b></p> - */ -package org.eclipse.jst.jsf.common.dom; diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/facet/Messages.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/facet/Messages.java deleted file mode 100644 index 595aa36f9..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/facet/Messages.java +++ /dev/null @@ -1,47 +0,0 @@ -/** - * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved. - */ - - -package org.eclipse.jst.jsf.common.facet; - - -import org.eclipse.osgi.util.NLS; - - -/** - * Resource bundle - * - * @author Debajit Adhikary - */ -public class Messages extends NLS -{ - private static final String BUNDLE_NAME = "org.eclipse.jst.jsf.common.facet.messages"; //$NON-NLS-1$ - - /** - * see messages.properties - */ - public static String UserLibraryVersionValidator_cannotReadLibraryVersion; - - /** - * see messages.properties - */ - public static String UserLibraryVersionValidator_possiblyIncompatibleLibrary; - - /** - * see messages.properties - */ - public static String UserLibraryVersionValidator_versionMismatch; - - static - { - // initialize resource bundle - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } - - - private Messages () - { - // - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/facet/libraryprovider/UserLibraryVersionValidator.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/facet/libraryprovider/UserLibraryVersionValidator.java deleted file mode 100644 index 8747e7ee8..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/facet/libraryprovider/UserLibraryVersionValidator.java +++ /dev/null @@ -1,205 +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.common.facet.libraryprovider; - -import java.io.File; -import java.io.IOException; -import java.util.Enumeration; -import java.util.jar.Attributes; -import java.util.jar.JarFile; -import java.util.jar.Manifest; -import java.util.zip.ZipEntry; -import java.util.zip.ZipFile; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jdt.core.IClasspathEntry; -import org.eclipse.jst.common.project.facet.core.libprov.user.KeyClassesValidator; -import org.eclipse.jst.common.project.facet.core.libprov.user.UserLibraryProviderInstallOperationConfig; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; -import org.eclipse.jst.jsf.common.facet.Messages; - - -/** - * Checks that a user library is version-compatible with the facet. - * - * @author Debajit Adhikary - * - */ -public abstract class UserLibraryVersionValidator extends KeyClassesValidator -{ - private static final String MANIFEST_SPECIFICATION_VERSION = "Specification-Version"; //$NON-NLS-1$ - private static final String MANIFEST_IMPLEMENTATION_VERSION = "Implementation-Version"; //$NON-NLS-1$ - - private final String classNameIdentifyingImplementationJar; - - - /** - * @param classNameIdentifyingImplementationJar - */ - public UserLibraryVersionValidator (final String classNameIdentifyingImplementationJar) - { - this.classNameIdentifyingImplementationJar = classNameIdentifyingImplementationJar; - } - - - @Override - public IStatus validate (final UserLibraryProviderInstallOperationConfig config) - { - // Check super validator - final IStatus status = super.validate(config); - if (status.getSeverity() != IStatus.OK) - return status; - - // Superclass validated this lib successfully. - // Check user library version now. - final String facetVersion = getFacetVersion(config); - final String libraryVersion = getLibraryVersion(config); - return validateVersionStrings(facetVersion, libraryVersion); - } - - - /** - * @param facetVersion - * @param libraryVersion - * @return the diagnostic for whether the facetVersion and libraryVersion - * match. - */ - protected IStatus validateVersionStrings (final String facetVersion, - final String libraryVersion) - { - if (facetVersion == null) - throw new IllegalArgumentException("Cannot read facet version"); //$NON-NLS-1$ - - if (libraryVersion == null) - return new Status(IStatus.WARNING, JSFCommonPlugin.PLUGIN_ID, Messages.UserLibraryVersionValidator_cannotReadLibraryVersion); - - if (libraryVersion.compareToIgnoreCase(facetVersion) >= 0) // JSF 2.0 lib for JSF 1.2 app, JSF 1.2 lib for JSF 1.2 app - return Status.OK_STATUS; - - // e.g. JSF 1.2 library used for a JSF 2.0 app - return new Status(IStatus.WARNING, JSFCommonPlugin.PLUGIN_ID, Messages.UserLibraryVersionValidator_possiblyIncompatibleLibrary); - } - - - private String getFacetVersion (final UserLibraryProviderInstallOperationConfig config) - { - return config.getProjectFacetVersion().getVersionString(); - } - - - private String getLibraryVersion (final UserLibraryProviderInstallOperationConfig config) - { - String libraryVersion = null; - - try - { - for (final IClasspathEntry cpe : config.resolve()) - { - if (isLibrary(cpe)) - { - final File libraryFile = cpe.getPath().toFile(); - - if (libraryFile.exists() && isCorrectLibraryJar(cpe, this.classNameIdentifyingImplementationJar)) - { - JarFile jarFile = null; - try - { - jarFile = new JarFile(libraryFile); - libraryVersion = getLibraryVersion(jarFile); - } - finally - { - if (jarFile != null) - jarFile.close(); - } - } - } - } - } - catch (final IOException e) - { - JSFCommonPlugin.log(e, e.getLocalizedMessage()); - } - - return libraryVersion; - } - - - private boolean isLibrary (final IClasspathEntry cpe) - { - return cpe.getEntryKind() == IClasspathEntry.CPE_LIBRARY; - } - - - private boolean isCorrectLibraryJar (final IClasspathEntry cpe, - final String classNameIdentifyingJar) - throws IOException - { - final File libraryFile = cpe.getPath().toFile(); - - if (!libraryFile.exists()) - return false; - - ZipFile zipFile = null; - - try - { - zipFile = new ZipFile(libraryFile); - - for (final Enumeration<? extends ZipEntry> entries = zipFile.entries(); entries.hasMoreElements();) - { - final ZipEntry entry = entries.nextElement(); - final String entryName = entry.getName(); - if (entryName.equals(classNameIdentifyingJar)) - return true; - } - } - finally - { - if (zipFile != null) - zipFile.close(); - } - - return false; - } - - - /** - * @param jarFile - * Library jar file to read - * - * @return Version of the specified Jar. Uses the manifest - * Specification-Version entry. If that is not available, then uses - * the Implementation-Version entry. - * - * @throws IOException - */ - protected String getLibraryVersion (final JarFile jarFile) - throws IOException - { - final Manifest manifest = jarFile.getManifest(); - - if (manifest == null) - return null; - - final Attributes attributes = manifest.getMainAttributes(); - - final String specificationVersion = attributes.getValue(MANIFEST_SPECIFICATION_VERSION); - if (specificationVersion != null) - return specificationVersion; - - final String implementationVersion = manifest.getMainAttributes().getValue(MANIFEST_IMPLEMENTATION_VERSION); - return implementationVersion; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/facet/libraryprovider/jsf/JsfLibraryUtil.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/facet/libraryprovider/jsf/JsfLibraryUtil.java deleted file mode 100644 index e55cdf0e0..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/facet/libraryprovider/jsf/JsfLibraryUtil.java +++ /dev/null @@ -1,123 +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.common.facet.libraryprovider.jsf; - -import java.io.File; -import java.io.IOException; -import java.util.Enumeration; -import java.util.zip.ZipEntry; -import java.util.zip.ZipException; -import java.util.zip.ZipFile; - -import org.eclipse.jdt.core.IClasspathEntry; -import org.eclipse.jst.common.project.facet.core.libprov.user.UserLibraryProviderInstallOperationConfig; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; - - -/** - * Utility methods for JSF libraries. - * - * @author Debajit Adhikary - * - */ -public class JsfLibraryUtil -{ - /** - * JSF library vendor type - */ - public static enum JsfLibraryVendorType - { - /** Unknown JSF library type */ - UNKNOWN, - - /** Apache MyFaces JSF library */ - MYFACES, - - /** Sun-RI JSF library */ - SUN_RI - } - - - /** - * @param libConfig UserLibraryProviderInstallOperationConfig - * @return JsfLibraryVendorType - */ - public static JsfLibraryVendorType getJsfLibraryVendorType (final UserLibraryProviderInstallOperationConfig libConfig) - { - final String MYFACES_IDENTIFYING_CLASS = "org/apache/myfaces/el/VariableResolverImpl.class"; //$NON-NLS-1$ - final String SUNRI_IDENTIFYING_CLASS = "com/sun/faces/el/VariableResolverImpl.class"; //$NON-NLS-1$ - - - for (final IClasspathEntry cpe : libConfig.resolve()) - { - if (isLibrary(cpe)) - { - final File libraryFile = cpe.getPath().toFile(); - - if (!libraryFile.exists()) - continue; - - ZipFile zipFile = null; - - try - { - zipFile = new ZipFile(libraryFile); - - for (final Enumeration<? extends ZipEntry> entries = zipFile.entries(); entries.hasMoreElements();) - { - final ZipEntry entry = entries.nextElement(); - final String entryName = entry.getName(); - - if (entryName.equals(MYFACES_IDENTIFYING_CLASS)) - return JsfLibraryVendorType.MYFACES; - - if (entryName.equals(SUNRI_IDENTIFYING_CLASS)) - return JsfLibraryVendorType.SUN_RI; - } - } - catch (final ZipException e) - { - JSFCommonPlugin.log(e, e.getLocalizedMessage()); - } - catch (final IOException e) - { - JSFCommonPlugin.log(e, e.getLocalizedMessage()); - } - finally - { - try - { - if (zipFile != null) - zipFile.close(); - } - catch (final IOException e) - { - JSFCommonPlugin.log(e, e.getLocalizedMessage()); - } - } - } - } - - return JsfLibraryVendorType.UNKNOWN; - } - - - /** - * @param cpe - * @return True if the classpath entry is a library. - */ - public static boolean isLibrary (final IClasspathEntry cpe) - { - return cpe.getEntryKind() == IClasspathEntry.CPE_LIBRARY; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/facet/messages.properties b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/facet/messages.properties deleted file mode 100644 index 7e26b507e..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/facet/messages.properties +++ /dev/null @@ -1,3 +0,0 @@ -UserLibraryVersionValidator_cannotReadLibraryVersion=Could not read version for selected library. The library may not be correct for this facet version. -UserLibraryVersionValidator_possiblyIncompatibleLibrary=The library may be incompatible with the selected facet version. -UserLibraryVersionValidator_versionMismatch=Incorrect library version: The selected library version ({0}) does not match the facet version ({1})
\ No newline at end of file diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/ITestTracker.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/ITestTracker.java deleted file mode 100644 index 259d90921..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/ITestTracker.java +++ /dev/null @@ -1,50 +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.common.internal; - -/** - * An injection interface that allows classes to selectively report test progress. - * - * @author cbateman - * - */ -public interface ITestTracker -{ - /** - * Event types - * - */ - public enum Event - { - /** - * Signals that tracking should begin on the eventLabel - * The seqId must be repeated on the STOP_TRACKING event - * for the same event. - */ - START_TRACKING, - /** - * Signals that tracking should stop on the named event - * for the seqId that was passed first in the START_TRACKING. - * - */ - STOP_TRACKING - } - - /** - * Fires the event of type event, a unique instance tracking seqId - * and a label called eventLabel. - * - * @param event - * @param seqId - * @param eventLabel - */ - void fireEvent(Event event, long seqId, String eventLabel); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/JSPUtil.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/JSPUtil.java deleted file mode 100644 index 37e7a9999..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/JSPUtil.java +++ /dev/null @@ -1,97 +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.common.internal; - -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; - -/** - * Utility JSP methods - * @author cbateman - * - */ -public final class JSPUtil -{ - private final static String CTYPE_JSPSOURCE = - "org.eclipse.jst.jsp.core.jspsource"; //$NON-NLS-1$ - private final static String CTYPE_JSPFRAGMENTSOURCE = - "org.eclipse.jst.jsp.core.jspfragmentsource"; //$NON-NLS-1$ - /** - * @param contentType - * @return true if contentType is one of the content types registered - * for JSP files - */ - public static boolean isJSPContentType(final String contentType) - { - return CTYPE_JSPSOURCE.equals(contentType) - || CTYPE_JSPFRAGMENTSOURCE.equals(contentType); - } - - /** - * @param file - * @return true if file is associated with a JSP or JSP fragment content type - */ - public static boolean isJSPContentType(final IFile file) - { - final boolean isJSPSource = isJSPSource(file); - if (isJSPSource) - { - return true; - } - - final boolean isJSPFragment = isJSPFragment(file); - - if (isJSPFragment) - { - return true; - } - - return false; - } - - private JSPUtil() - { - // no instantiation - } - - /** - * @param file - * @return true if file is associated with the JSP source content type - * (returns if JSP fragment) - */ - public static boolean isJSPSource(IFile file) { - return isAssociatedWithContentType(file, CTYPE_JSPSOURCE); - } - - /** - * @param file - * @return true if the file is associated with the JSP fragment content type - */ - public static boolean isJSPFragment(IFile file) { - return isAssociatedWithContentType(file, CTYPE_JSPFRAGMENTSOURCE); - } - - private static boolean isAssociatedWithContentType(final IFile file, final String contentType) - { - final IContentTypeManager typeManager = Platform.getContentTypeManager(); - IContentType jspContentType = - typeManager.getContentType(contentType); - if (jspContentType != null - && jspContentType.isAssociatedWith(file.getName())) - { - return true; - } - - return false; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/RunOnCompletionPattern.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/RunOnCompletionPattern.java deleted file mode 100644 index 6ae5a195a..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/RunOnCompletionPattern.java +++ /dev/null @@ -1,76 +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.common.internal; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.jobs.IJobChangeEvent; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.core.runtime.jobs.JobChangeAdapter; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; - -/** - * A pattern that runs a Job and either joins on the job's completion - * or runs some completion behaviour. - * - * @author cbateman - * - */ -public class RunOnCompletionPattern implements Runnable -{ - private final Job _job; - private final Runnable _runAfter; - - /** - * @param job - * @param runAfter - */ - public RunOnCompletionPattern(Job job, Runnable runAfter) - { - _job = job; - _runAfter = runAfter; - } - - public void run() - { - if (_runAfter != null) - { - _job.addJobChangeListener(new JobChangeAdapter() - { - - @Override - public void done(IJobChangeEvent event) - { - if (event.getResult().getSeverity() != IStatus.ERROR) - { - _runAfter.run(); - } - } - - }); - } - - _job.schedule(); - - if (_runAfter == null) - { - try - { - _job.join(); - } - catch (InterruptedException e) - { - JSFCommonPlugin.log(e, "Joining on job"); //$NON-NLS-1$ - } - } - } - - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/componentcore/AbstractVirtualComponentQuery.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/componentcore/AbstractVirtualComponentQuery.java deleted file mode 100644 index ae797b30f..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/componentcore/AbstractVirtualComponentQuery.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.eclipse.jst.jsf.common.internal.componentcore; - -import org.eclipse.core.resources.IProject; -import org.eclipse.wst.common.componentcore.ComponentCore; -import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; -import org.eclipse.wst.common.componentcore.resources.IVirtualFolder; - -/** - * Wraps parts of the component core in a way that always PDE-free injection - * during test. - * - * @author cbateman - * - */ -public abstract class AbstractVirtualComponentQuery -{ - /** - * TODO: reconcile with duplicate. This was taken from JSFAppConfigUtils. - * - * 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 abstract IVirtualFolder getWebContentFolder(IProject project); - - /** - * The default implementation that makes static calls to ComponentCore. - * @author cbateman - * - */ - public static class DefaultVirtualComponentQuery extends - AbstractVirtualComponentQuery - { - @Override - public IVirtualFolder getWebContentFolder(IProject project) - { - IVirtualFolder folder = null; - IVirtualComponent component = ComponentCore - .createComponent(project); - if (component != null) - { - folder = component.getRootFolder(); - } - return folder; - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/finder/AbstractFinder.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/finder/AbstractFinder.java deleted file mode 100644 index 17411f4c9..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/finder/AbstractFinder.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.eclipse.jst.jsf.common.internal.finder; - -import org.eclipse.jst.jsf.common.internal.strategy.AbstractIdentifiableStrategy; - - -/** - * An abstract strategy that finds it's OUTPUT value in a container designated - * by it's INPUT value. - * - * @author cbateman - * - * @param <INPUT> - * @param <OUTPUT> - * @param <IDTYPE> - */ -public abstract class AbstractFinder<INPUT, OUTPUT, IDTYPE> extends AbstractIdentifiableStrategy<INPUT, OUTPUT, IDTYPE> -{ - - /** - * @param id - * @param displayName - * @param noResultValue - */ - public AbstractFinder(IDTYPE id, String displayName, OUTPUT noResultValue) - { - super(id, displayName, noResultValue); - } - - /** - * @param input - * @return the output found in input or getNoResult() if not found. - * @throws Exception - */ - public final OUTPUT find(INPUT input) throws Exception - { - return perform(input); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/finder/AbstractMatcher.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/finder/AbstractMatcher.java deleted file mode 100644 index 4cd661b05..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/finder/AbstractMatcher.java +++ /dev/null @@ -1,66 +0,0 @@ -package org.eclipse.jst.jsf.common.internal.finder; - -import java.util.Collections; -import java.util.List; - -/** - * A finder that finds it's OUTPUT in INPUT by using a matching strategy. - * @author cbateman - * @param <INPUT> - * @param <OUTPUT> - * @param <IDTYPE> - * - */ -public abstract class AbstractMatcher<INPUT, OUTPUT, IDTYPE> extends AbstractFinder<INPUT, OUTPUT, IDTYPE> -{ - private final List<? extends IMatcher> _matchers; - - /** - * An interface that defines a match. - * - */ - public interface IMatcher - { - /** - * @param matchThis - * @return true if T matches the expected critieria - */ - boolean matches(Object matchThis); - } - - /** - * A matcher that matches always. - * @author cbateman - * - */ - public static final class AlwaysMatcher implements IMatcher - { - public boolean matches(Object matchThis) - { - return true; - } - } - - /** - * @param id - * @param displayName - * @param noResultValue - * @param matchers - */ - public AbstractMatcher(final IDTYPE id, final String displayName, final OUTPUT noResultValue, final List<? extends IMatcher> matchers) - { - super(id, displayName, noResultValue); - _matchers = matchers; - } - - @Override - public abstract OUTPUT perform(INPUT input) throws Exception; - - /** - * @return the matchers - */ - protected final List<IMatcher> getMatchers() - { - return Collections.unmodifiableList(_matchers); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/finder/VisitorMatcher.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/finder/VisitorMatcher.java deleted file mode 100644 index 9182e7ee8..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/finder/VisitorMatcher.java +++ /dev/null @@ -1,117 +0,0 @@ -package org.eclipse.jst.jsf.common.internal.finder; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -/** - * A matcher finder that uses a visitor to traverse its INPUT and match values - * using its matchers. An optional value resolver can be used to get the - * matching value used. - * - * INPUT need not implement it's own visitation interface. Rather, an instance - * of MatchingVisitor must be provided to handle this. - * - * @author cbateman - * @param <INPUT> - * @param <VISITTYPE> - * @param <IDTYPE> - * - */ -public class VisitorMatcher<INPUT, VISITTYPE, IDTYPE> extends - AbstractMatcher<INPUT, Collection<? extends VISITTYPE>, IDTYPE> -{ - private final MatchingAcceptor _acceptor; - - /** - * @param id - * @param displayName - * @param acceptor - * @param matchers - */ - public VisitorMatcher(IDTYPE id, String displayName, - final MatchingAcceptor<INPUT, VISITTYPE> acceptor, - final List<? extends IMatcher> matchers) - { - super(id, displayName, Collections.EMPTY_LIST, matchers); - _acceptor = acceptor; - } - - @Override - public Collection<? extends VISITTYPE> perform(final INPUT input) throws Exception - { - MatchingVisitor visitor = new MatchingVisitor(getMatchers()); - _acceptor.accept(input, visitor); - return visitor.getFoundMatches(); - } - - /** - * Call visit on each VISITTYPE. Sub-classes must provide implementations of - * getInputChildren and getVisitableChildren to control what gets visited - * from the INPUT root. - * - * @param <INPUT> - * @param <VISITTYPE> - */ - public abstract static class MatchingAcceptor<INPUT, VISITTYPE> - { - private void accept(final INPUT input, - final MatchingVisitor<VISITTYPE> visitor) - { - final Collection<? extends VISITTYPE> inputChildren = getInputChildren(input); - accept(visitor, inputChildren); - } - - private void accept(final MatchingVisitor<VISITTYPE> visitor, - final Collection<? extends VISITTYPE> inputChildren) - { - for (final VISITTYPE visitable : inputChildren) - { - visitor.visit(visitable); - accept(visitor, getVisitableChildren(visitable)); - } - } - - /** - * @param inputType - * @return the first level children of INPUT to be visited. - */ - protected abstract Collection<? extends VISITTYPE> getInputChildren( - INPUT inputType); - - /** - * @param visitType - * @return the visitable children of visitType. - */ - protected abstract Collection<? extends VISITTYPE> getVisitableChildren( - VISITTYPE visitType); - } - - private static final class MatchingVisitor<VISITTYPE> - { - private final List<IMatcher> _matchers; - private final List<VISITTYPE> _foundMatches = new ArrayList<VISITTYPE>(); - public MatchingVisitor(final List<IMatcher> matcher) - { - _matchers = matcher; - } - - public void visit(final VISITTYPE visitable) - { - MATCH_LOOP: for (final IMatcher matcher : _matchers) - { - if (matcher.matches(visitable)) - { - _foundMatches.add(visitable); - break MATCH_LOOP; - } - } - } - - protected final List<VISITTYPE> getFoundMatches() - { - return _foundMatches; - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/finder/acceptor/ClasspathEntryJarMatchingAcceptor.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/finder/acceptor/ClasspathEntryJarMatchingAcceptor.java deleted file mode 100644 index 855e4c78a..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/finder/acceptor/ClasspathEntryJarMatchingAcceptor.java +++ /dev/null @@ -1,91 +0,0 @@ -package org.eclipse.jst.jsf.common.internal.finder.acceptor; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jdt.core.IPackageFragmentRoot; -import org.eclipse.jst.jsf.common.internal.finder.VisitorMatcher.MatchingAcceptor; -import org.eclipse.jst.jsf.common.internal.resource.ClasspathJarFile; - -/** - * Accepts all the jars underlying a classpath entry. - * - * @author cbateman - * - */ -public class ClasspathEntryJarMatchingAcceptor extends - MatchingAcceptor<IPackageFragmentRoot, ClasspathJarFile> -{ - private final IProject project; - - /** - * @param project - */ - public ClasspathEntryJarMatchingAcceptor(final IProject project) - { - super(); - this.project = project; - } - - @Override - protected Collection<? extends ClasspathJarFile> getInputChildren( - final IPackageFragmentRoot inputType) - { - final List<ClasspathJarFile> jarFiles = new ArrayList<ClasspathJarFile>(); - if (inputType.isArchive()) - { - jarFiles.add(new ClasspathJarFile(project, inputType.getPath())); - } - // if (inputType.exists()) - // { - // List<ClasspathJarFile> jarFiles = new ArrayList<ClasspathJarFile>(); - // switch (inputType.getEntryKind()) - // { - // // this entry describes a source root in its project - // case IClasspathEntry.CPE_SOURCE: - // break; - // // - this entry describes a folder or JAR containing - // // binaries - // case IClasspathEntry.CPE_LIBRARY: - // { - // jarFiles.add(new ClasspathJarFile(project, inputType)); - // } - // break; - // // - this entry describes another project - // case IClasspathEntry.CPE_PROJECT: - // // { - // // final IPath pathToProject = entry.getPath(); - // // IWorkspace wkspace = ResourcesPlugin.getWorkspace(); - // // IResource res = - // // wkspace.getRoot().findMember(pathToProject); - // // if (res instanceof IProject) - // // { - // // tagLibsFound.addAll(); - // // } - // // } - // break; - // // - this entry describes a project or library indirectly - // // via a - // // classpath variable in the first segment of the path * - // case IClasspathEntry.CPE_VARIABLE: - // break; - // // - this entry describes set of entries referenced - // // indirectly - // // via a classpath container - // case IClasspathEntry.CPE_CONTAINER: - // break; - // } - // } - return jarFiles; - } - - @Override - protected Collection<? extends ClasspathJarFile> getVisitableChildren( - final ClasspathJarFile visitType) - { - return Collections.EMPTY_LIST; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/finder/acceptor/FileMatchingAcceptor.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/finder/acceptor/FileMatchingAcceptor.java deleted file mode 100644 index 650e1748a..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/finder/acceptor/FileMatchingAcceptor.java +++ /dev/null @@ -1,47 +0,0 @@ -package org.eclipse.jst.jsf.common.internal.finder.acceptor; - -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; -import org.eclipse.jst.jsf.common.internal.finder.VisitorMatcher.MatchingAcceptor; - -/** - * A matching acceptor that traverses all of the children of an IContainer. - * - * @author cbateman - * - */ -public class FileMatchingAcceptor extends MatchingAcceptor<IContainer, IResource> -{ - @Override - protected Collection<? extends IResource> getInputChildren( - final IContainer container) - { - IResource[] members = new IResource[0]; - try - { - members = container.members(); - } catch (CoreException e) - { - JSFCommonPlugin.log(e); - } - return Arrays.asList(members); - } - - @Override - protected Collection<? extends IResource> getVisitableChildren( - IResource visitType) - { - if (visitType instanceof IContainer) - { - return getInputChildren((IContainer)visitType); - } - return Collections.emptyList(); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/finder/acceptor/JarEntryMatchingAcceptor.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/finder/acceptor/JarEntryMatchingAcceptor.java deleted file mode 100644 index 79d03937a..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/finder/acceptor/JarEntryMatchingAcceptor.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.eclipse.jst.jsf.common.internal.finder.acceptor; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Enumeration; -import java.util.List; -import java.util.jar.JarEntry; -import java.util.jar.JarFile; - -import org.eclipse.jst.jsf.common.internal.finder.VisitorMatcher.MatchingAcceptor; - -/** - * An acceptor that gets the jar entries from a jar file. - * - * @author cbateman - * - */ -public class JarEntryMatchingAcceptor extends - MatchingAcceptor<JarFile, JarEntry> -{ - - @Override - protected Collection<? extends JarEntry> getInputChildren(JarFile inputType) - { - final List<JarEntry> children = new ArrayList<JarEntry>(); - Enumeration<JarEntry> entries = inputType.entries(); - while (entries.hasMoreElements()) - { - children.add(entries.nextElement()); - } - return children; - } - - @Override - protected Collection<? extends JarEntry> getVisitableChildren( - JarEntry visitType) - { - return Collections.EMPTY_LIST; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/finder/acceptor/JarMatchingAcceptor.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/finder/acceptor/JarMatchingAcceptor.java deleted file mode 100644 index 7742d75f7..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/finder/acceptor/JarMatchingAcceptor.java +++ /dev/null @@ -1,78 +0,0 @@ -package org.eclipse.jst.jsf.common.internal.finder.acceptor; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IPackageFragmentRoot; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; -import org.eclipse.jst.jsf.common.internal.finder.AbstractMatcher.AlwaysMatcher; -import org.eclipse.jst.jsf.common.internal.finder.VisitorMatcher; -import org.eclipse.jst.jsf.common.internal.finder.VisitorMatcher.MatchingAcceptor; -import org.eclipse.jst.jsf.common.internal.resource.ClasspathJarFile; -import org.eclipse.jst.jsf.common.internal.resource.JavaCoreMediator; - -/** - * A matching acceptor that provides the jars referenced by a project. - * - * @author cbateman - * - */ -public class JarMatchingAcceptor extends - MatchingAcceptor<IProject, ClasspathJarFile> -{ - private final JavaCoreMediator _javaCoreMediator; - - /** - * @param javaCoreMediator - */ - public JarMatchingAcceptor(final JavaCoreMediator javaCoreMediator) - { - _javaCoreMediator = javaCoreMediator; - } - - @Override - protected Collection<ClasspathJarFile> getInputChildren( - final IProject project) - { - final IJavaProject javaProject = _javaCoreMediator.create(project); - IPackageFragmentRoot[] roots = null; - try - { - roots = javaProject.getPackageFragmentRoots(); - } catch (final JavaModelException e1) - { - JSFCommonPlugin.log(e1); - } - if (roots == null || roots.length == 0) - { - return Collections.EMPTY_LIST; - } - final List<ClasspathJarFile> jars = new ArrayList<ClasspathJarFile>(); - VisitorMatcher<IPackageFragmentRoot, ClasspathJarFile, String> entryMatcher = new VisitorMatcher<IPackageFragmentRoot, ClasspathJarFile, String>( - "", "", new ClasspathEntryJarMatchingAcceptor(project), //$NON-NLS-1$ //$NON-NLS-2$ - Collections.singletonList(new AlwaysMatcher())); - for (final IPackageFragmentRoot root : roots) - { - try - { - jars.addAll(entryMatcher.perform(root)); - } catch (Exception e) - { - JSFCommonPlugin.log(e); - } - } - return jars; - } - - @Override - protected Collection<ClasspathJarFile> getVisitableChildren( - final ClasspathJarFile visitType) - { - return Collections.EMPTY_LIST; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/finder/matcher/TaglibFinder.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/finder/matcher/TaglibFinder.java deleted file mode 100644 index 0febe25b6..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/finder/matcher/TaglibFinder.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.eclipse.jst.jsf.common.internal.finder.matcher; - -import org.eclipse.jst.jsf.common.internal.strategy.AbstractIdentifiableStrategy; - - -/** - * A finder strategy for Facelet tag libraries. - * @author cbateman - * - * @param <INPUT> - * @param <OUTPUT> - */ -public abstract class TaglibFinder<INPUT, OUTPUT> extends AbstractIdentifiableStrategy<INPUT, OUTPUT, String> -{ - /** - * @param id - * @param displayName - * @param noResultValue - */ - public TaglibFinder(String id, String displayName, - OUTPUT noResultValue) - { - super(id, displayName, noResultValue); - } - - @Override - public abstract OUTPUT perform(INPUT input) throws Exception; -}
\ No newline at end of file diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/finder/matcher/TaglibJarEntryFinder.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/finder/matcher/TaglibJarEntryFinder.java deleted file mode 100644 index fb5c9616a..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/finder/matcher/TaglibJarEntryFinder.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.eclipse.jst.jsf.common.internal.finder.matcher; - -import java.util.jar.JarEntry; -import java.util.regex.Pattern; - -import org.eclipse.jst.jsf.common.JSFCommonPlugin; -import org.eclipse.jst.jsf.common.internal.finder.AbstractMatcher.IMatcher; - - -/** - * @author cbateman - * - */ -public class TaglibJarEntryFinder extends TaglibFinder<JarEntry, JarEntry> implements IMatcher -{ - /** - * Unique id of this strategy. - */ - public static final String ID = TaglibJarEntryFinder.class.getCanonicalName(); - private static final String DISPLAY_NAME = "Display Name"; //$NON-NLS-1$ - private final Pattern _pattern; - - /** - * @param pattern - */ - public TaglibJarEntryFinder(final Pattern pattern) - { - super(ID, DISPLAY_NAME, null); - _pattern = pattern; - } - - @Override - public JarEntry perform(JarEntry input) throws Exception - { - if (_pattern.matcher(input.getName()).matches()) - { - return input; - } - return getNoResult(); - } - - public boolean matches(Object matchThis) - { - if (matchThis instanceof JarEntry) - { - try - { - return perform((JarEntry) matchThis) != getNoResult(); - } catch (Exception e) - { - JSFCommonPlugin.log(e, "While matching jar entry: "+matchThis); //$NON-NLS-1$ - } - } - return false; - } -}
\ No newline at end of file diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/locator/AbstractLocator.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/locator/AbstractLocator.java deleted file mode 100644 index 409c744dd..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/locator/AbstractLocator.java +++ /dev/null @@ -1,177 +0,0 @@ -package org.eclipse.jst.jsf.common.internal.locator; - -import java.util.concurrent.CopyOnWriteArrayList; - -import org.eclipse.jst.jsf.common.internal.locator.ILocatorChangeListener.LocatorChangeEvent; - -/** - * The abstract base class of all ILocator implementations. - * - * @author cbateman - * - * @param <LOCATORTYPE> - * @param <CONTEXTTYPE> - * @param <IDTYPE> - */ -public abstract class AbstractLocator<LOCATORTYPE, CONTEXTTYPE, IDTYPE> - implements ILocator<LOCATORTYPE, CONTEXTTYPE, IDTYPE> -{ - /** - * The default value used for "no result". - */ - protected static final Object DEFAULT_NO_RESULT_VALUE = null; - - private final CopyOnWriteArrayList<ILocatorChangeListener> _listeners; - private final LOCATORTYPE _noResultValue; - private final IDTYPE _id; - private final String _displayName; - private boolean _isStarted; - - private Exception _startTrace; - - /** - * Available for sub-classes that want to use reasonable defaults and only provide - * mandatory data. - * - * No result value is null. - * A new instance of CopyOnWriteArrayList is used and held private. - * - * @param id - * @param displayName - * - */ - public AbstractLocator(final IDTYPE id, final String displayName) - { - this(id, - displayName, - null, - new CopyOnWriteArrayList<ILocatorChangeListener>()); - } - - /** - * Available for sub-classes to manually inject dependencies. - * - * @param id - * @param displayName - * @param noResultValue - * @param mutableListenerList - */ - protected AbstractLocator( - final IDTYPE id, - final String displayName, - final LOCATORTYPE noResultValue, - final CopyOnWriteArrayList<ILocatorChangeListener> mutableListenerList) - { - _id = id; - _displayName = displayName; - _listeners = mutableListenerList; - _noResultValue = noResultValue; - } - - public final LOCATORTYPE perform(final CONTEXTTYPE context) - throws Exception - { - return locate(context); - } - - public LOCATORTYPE getNoResult() - { - return _noResultValue; - } - - public IDTYPE getId() - { - return _id; - } - - public String getDisplayName() - { - return _displayName; - } - - public LOCATORTYPE locate(final CONTEXTTYPE context) - { - if (isStarted()) - { - return doLocate(context); - } - throw new IllegalStateException("Locator not started"); //$NON-NLS-1$ - } - - - /** - * @param context - * @return the located type. - */ - protected abstract LOCATORTYPE doLocate(CONTEXTTYPE context); - - public void start(final CONTEXTTYPE initialContext) - { - if (isStarted()) - { - throw new IllegalStateException("Locator was already started", _startTrace); //$NON-NLS-1$ - } - - // set the started flag - setStarted(true); - _startTrace = new Exception("Locator was started on this trace"); //$NON-NLS-1$ - } - - public void stop() - { - // set the started flag - // clear all listeners - _listeners.clear(); - setStarted(false); - _startTrace = null; - } - - /** - * @param listener - */ - public void addListener(final ILocatorChangeListener listener) - { - _listeners.addIfAbsent(listener); - } - - /** - * @param listener - */ - public void removeListener(final ILocatorChangeListener listener) - { - _listeners.remove(listener); - } - - /** - * @param event - */ - protected void fireChangeEvent(final LocatorChangeEvent event) - { - for (final ILocatorChangeListener listener : _listeners) - { - listener.changed(event); - } - } - - public final boolean isStarted() - { - return _isStarted; - } - - public boolean canStart() - { - if (isStarted()) - { - return false; - } - return true; - } - - /** - * @param newValue - */ - protected final void setStarted(final boolean newValue) - { - _isStarted = newValue; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/locator/AbstractLocatorProvider.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/locator/AbstractLocatorProvider.java deleted file mode 100644 index edd77dc23..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/locator/AbstractLocatorProvider.java +++ /dev/null @@ -1,72 +0,0 @@ -package org.eclipse.jst.jsf.common.internal.locator; - -import java.util.Collections; -import java.util.List; - -/** - * The super-class of all ILocatorProvider's. - * - * @author cbateman - * @param <LOCATORTYPE> - * - */ -public abstract class AbstractLocatorProvider<LOCATORTYPE> implements ILocatorProvider<LOCATORTYPE> -{ - private boolean _isInit = false; - - public void initialize() - { - doInitialize(); - _isInit = true; - } - - /** - * Overrride to do the init. You can override initialize if you want to - */ - protected abstract void doInitialize(); - - public List<? extends LOCATORTYPE> getLocators() - { - if (!_isInit) - { - throw new IllegalStateException( - "initialize must be called before getLocators"); //$NON-NLS-1$ - } - return doGetLocators(); - } - - /** - * @return the locators. - */ - protected abstract List<? extends LOCATORTYPE> doGetLocators(); - - /** - * A default implementation of the provider that simply sits on a list - * of a locators. - * - * @param <LOCATORTYPE> - */ - public static class DefaultLocatorProvider<LOCATORTYPE> extends AbstractLocatorProvider<LOCATORTYPE> - { - private final List<LOCATORTYPE> _locators; - - /** - * @param locators - */ - public DefaultLocatorProvider(List<LOCATORTYPE> locators) - { - _locators = locators; - } - @Override - protected void doInitialize() - { - // nothing to do. - } - - @Override - protected List<? extends LOCATORTYPE> doGetLocators() - { - return Collections.unmodifiableList(_locators); - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/locator/CompositeLocator.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/locator/CompositeLocator.java deleted file mode 100644 index 65658e89d..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/locator/CompositeLocator.java +++ /dev/null @@ -1,154 +0,0 @@ -package org.eclipse.jst.jsf.common.internal.locator; - -import java.util.Iterator; - -import org.eclipse.jst.jsf.common.internal.policy.IIteratorPolicy; -import org.eclipse.jst.jsf.common.internal.strategy.IteratorPolicyBasedStrategyComposite; - -/** - * @author cbateman - * - * @param <LOCATORTYPE> - * @param <COMPOSITETYPE> - * @param <CONTEXTTYPE> - * @param <IDTYPE> - */ -public abstract class CompositeLocator<LOCATORTYPE, COMPOSITETYPE, CONTEXTTYPE, IDTYPE> extends -IteratorPolicyBasedStrategyComposite<CONTEXTTYPE, LOCATORTYPE, COMPOSITETYPE, IDTYPE, ILocator<LOCATORTYPE, CONTEXTTYPE, IDTYPE>> -implements ILocator<COMPOSITETYPE, CONTEXTTYPE, IDTYPE>, ILocatorChangeListener -{ - private DefaultComposingLocatorDelegate<LOCATORTYPE, COMPOSITETYPE, CONTEXTTYPE, IDTYPE> _delegate; - private final COMPOSITETYPE _noResultValue; - - /** - * @param id - * @param displayName - * @param policy - * @param noResultValue - * @param compositionStrategy - */ - public CompositeLocator( - final IDTYPE id, - final String displayName, - final IIteratorPolicy<IDTYPE> policy, - final COMPOSITETYPE noResultValue, - final DefaultCompositionStrategy<CONTEXTTYPE, LOCATORTYPE, COMPOSITETYPE, ILocator<LOCATORTYPE, CONTEXTTYPE, IDTYPE>> compositionStrategy) - { - super(policy, compositionStrategy); - _delegate = new DefaultComposingLocatorDelegate<LOCATORTYPE, COMPOSITETYPE, CONTEXTTYPE, IDTYPE>(id, displayName) - { - @Override - protected COMPOSITETYPE doLocate(final CONTEXTTYPE context) - { - return CompositeLocator.this.doLocate(context); - } - }; - _noResultValue = noResultValue; - } - - /** - * @param context - * @return the located value. - */ - protected abstract COMPOSITETYPE doLocate(CONTEXTTYPE context); - - public final IDTYPE getId() - { - return _delegate.getId(); - } - - public String getDisplayName() - { - return _delegate.getDisplayName(); - } - - public void start(final CONTEXTTYPE initialContext) - { - if (canStart()) - { - final Iterator<ILocator<LOCATORTYPE, CONTEXTTYPE, IDTYPE>> iterator = getIterator(); - while (iterator.hasNext()) - { - - final ILocator<LOCATORTYPE, CONTEXTTYPE, IDTYPE> next = iterator.next(); - next.addListener(this); - next.start(initialContext); - } - _delegate.start(initialContext); - } - throw new IllegalStateException("canStart must be called before calling start"); //$NON-NLS-1$ - } - - public boolean canStart() - { - boolean canStart = true; - final Iterator<ILocator<LOCATORTYPE, CONTEXTTYPE, IDTYPE>> iterator = getIterator(); - while (canStart && iterator.hasNext()) - { - canStart &= iterator.next().canStart(); - } - - return canStart && _delegate.canStart(); - } - - public boolean isStarted() - { - return _delegate.isStarted(); - } - - public void stop() - { - if (!isStarted()) - { - final Iterator<ILocator<LOCATORTYPE, CONTEXTTYPE, IDTYPE>> iterator = getIterator(); - while (iterator.hasNext()) - { - final ILocator<LOCATORTYPE, CONTEXTTYPE, IDTYPE> next = iterator.next(); - next.removeListener(this); - next.stop(); - } - - _delegate.stop(); - } - } - - public COMPOSITETYPE locate(final CONTEXTTYPE context) - { - return _delegate.locate(context); - } - - @Override - public COMPOSITETYPE getNoResult() - { - return _noResultValue; - } - - - public void changed(final LocatorChangeEvent event) - { - _delegate.fireChangeEvent(event); - } - - - public void addListener(final ILocatorChangeListener listener) - { - _delegate.addListener(listener); - } - - - public void removeListener(final ILocatorChangeListener listener) - { - _delegate.removeListener(listener); - } - - /** - * Re-fire events from composed strategies. - * - * @param event - */ - protected void fireChangeEvent(final LocatorChangeEvent event) - { - _delegate.fireChangeEvent(event); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/locator/DefaultComposingLocatorDelegate.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/locator/DefaultComposingLocatorDelegate.java deleted file mode 100644 index ac698d342..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/locator/DefaultComposingLocatorDelegate.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.eclipse.jst.jsf.common.internal.locator; - -import java.util.concurrent.CopyOnWriteArrayList; - -/** - * Default delegatable locator for composing locators. - * - * @author cbateman - * - * @param <LOCATORTYPE> - * @param <COMPOSITETYPE> - * @param <CONTEXTTYPE> - * @param <IDTYPE> - */ -public class DefaultComposingLocatorDelegate<LOCATORTYPE, COMPOSITETYPE, CONTEXTTYPE, IDTYPE> extends - AbstractLocator<COMPOSITETYPE, CONTEXTTYPE, IDTYPE> -{ - - /** - * @param id - * @param displayName - */ - public DefaultComposingLocatorDelegate(IDTYPE id, String displayName) - { - super(id, displayName); - } - - - /** - * @param id - * @param displayName - * @param noResultValue - * @param mutableListenerList - */ - public DefaultComposingLocatorDelegate( - IDTYPE id, - String displayName, - COMPOSITETYPE noResultValue, - CopyOnWriteArrayList<ILocatorChangeListener> mutableListenerList) - { - super(id, displayName, noResultValue, mutableListenerList); - } - - - @Override - protected COMPOSITETYPE doLocate(CONTEXTTYPE context) - { - throw new UnsupportedOperationException("This method is abstract and should not be called"); //$NON-NLS-1$ - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/locator/DefaultLocatorDelegate.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/locator/DefaultLocatorDelegate.java deleted file mode 100644 index 04d8fdb90..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/locator/DefaultLocatorDelegate.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.eclipse.jst.jsf.common.internal.locator; - -import java.util.concurrent.CopyOnWriteArrayList; - -/** - * Implements the bare minimum of AbstractLocator needed to treat it as a - * sub-class by composition (delegation). - * - * @author cbateman - * @param <LOCATORTYPE> - * @param <CONTEXTTYPE> - * @param <IDTYPE> - * - */ -public class DefaultLocatorDelegate<LOCATORTYPE, CONTEXTTYPE, IDTYPE> extends - AbstractLocator<LOCATORTYPE, CONTEXTTYPE, IDTYPE> -{ - - /** - * @param id - * @param displayName - */ - public DefaultLocatorDelegate(IDTYPE id, String displayName) - { - super(id, displayName); - } - - - /** - * @param id - * @param displayName - * @param noResultValue - * @param mutableListenerList - */ - public DefaultLocatorDelegate( - IDTYPE id, - String displayName, - LOCATORTYPE noResultValue, - CopyOnWriteArrayList<ILocatorChangeListener> mutableListenerList) - { - super(id, displayName, noResultValue, mutableListenerList); - } - - - @Override - protected LOCATORTYPE doLocate(CONTEXTTYPE context) - { - throw new UnsupportedOperationException("This method is abstract and should not be called"); //$NON-NLS-1$ - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/locator/ILocator.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/locator/ILocator.java deleted file mode 100644 index abf6bade9..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/locator/ILocator.java +++ /dev/null @@ -1,68 +0,0 @@ -package org.eclipse.jst.jsf.common.internal.locator; - -import org.eclipse.jst.jsf.common.internal.strategy.IIdentifiableStrategy; - -/** - * A generic location strategy object. - * - * @author cbateman - * - * @param <LOCATORTYPE> - * the type of object being returned by the locator - * @param <CONTEXTTYPE> - * the type of the context object passed for starting and locating - * @param <IDTYPE> - * the type of the id used to identify a locator - * @noimplement extend AbstractLocator instead - */ -public interface ILocator<LOCATORTYPE, CONTEXTTYPE, IDTYPE> extends - IIdentifiableStrategy<CONTEXTTYPE, LOCATORTYPE, IDTYPE> -{ - /** - * Initialize the locator optionally using initialContext. - * - * Must be called before any other methods. Implementations should throw - * IllegalStateException if this has not been called before anything else. - * - * @param initialContext - */ - void start(CONTEXTTYPE initialContext); - - /** - * Implementations should return false if the system prevents them from - * starting. It must also be checked before a client attempts to restart a - * stopped locator. Must return false if isStarted is true. - * - * @return true if the locator can be started - */ - boolean canStart(); - - /** - * @return true if the start() has been called but stop has not yet been - * called. - */ - boolean isStarted(); - - /** - * Stop the locator. - */ - void stop(); - - /** - * @param listener - */ - void addListener( final ILocatorChangeListener listener); - - /** - * @param listener - */ - void removeListener(final ILocatorChangeListener listener); - - /** - * perform must call this method in any concrete implementation. - * - * @param context - * @return the located type. - */ - LOCATORTYPE locate(CONTEXTTYPE context); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/locator/ILocatorChangeListener.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/locator/ILocatorChangeListener.java deleted file mode 100644 index 0b996dffa..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/locator/ILocatorChangeListener.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.eclipse.jst.jsf.common.internal.locator; - -import java.util.EventListener; -import java.util.EventObject; - -/** - * @author cbateman - * - */ -public interface ILocatorChangeListener extends EventListener -{ - /** - * @param event - */ - public void changed(final LocatorChangeEvent event); - - /** - * @author cbateman - * - */ - public static class LocatorChangeEvent extends EventObject - { - /** - * @param source - */ - public LocatorChangeEvent(ILocator source) { - super(source); - } - - @Override - public ILocator getSource() { - return (ILocator) super.getSource(); - } - - /** - * - */ - private static final long serialVersionUID = -7930804700395142768L; - - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/locator/ILocatorProvider.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/locator/ILocatorProvider.java deleted file mode 100644 index 57472ad8e..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/locator/ILocatorProvider.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.eclipse.jst.jsf.common.internal.locator; - -import java.util.List; - -/** - * An object that provides zero or more locators to a client. - * - * @author cbateman - * @param <LOCATORTYPE> - * - */ -public interface ILocatorProvider<LOCATORTYPE> -{ - /** - * Must be called before getLocators is called. Implementations MUST - * support multiple calls to initialize on the same instance but need not - * do anything on any of them. - */ - void initialize(); - - /** - * @return the list of locators. - */ - List<? extends LOCATORTYPE> getLocators(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/managedobject/AbstractManagedObject.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/managedobject/AbstractManagedObject.java deleted file mode 100644 index 9138f0e35..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/managedobject/AbstractManagedObject.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.common.internal.managedobject; - -import java.util.concurrent.atomic.AtomicBoolean; - - -/** - * Sub-class for managed objects. - * - */ -/** - * @author cbateman - * - */ -public abstract class AbstractManagedObject implements IManagedObject -{ - /** - * Flag for checking disposal. - */ - protected final AtomicBoolean _isDisposed = new AtomicBoolean(false); - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.jst.jsf.common.internal.managedobject.IManagedObject#dispose - * () - */ - public void dispose() - { - _isDisposed.set(true); - } - - public boolean isDisposed() - { - return _isDisposed.get(); - } - - /** - * Checks if this object is disposed and throws IllegalStateException if it - * is. - */ - protected final void assertNotDisposed() - { - if (isDisposed()) - { - throw new IllegalStateException(this.toString() + " is disposed"); //$NON-NLS-1$ - } - } - /* - * (non-Javadoc) - * - * @see - * org.eclipse.jst.jsf.common.internal.managedobject.IManagedObject#checkpoint - * () - */ - public abstract void checkpoint(); - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.jst.jsf.common.internal.managedobject.IManagedObject#destroy - * () - */ - public abstract void destroy(); - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/managedobject/IManagedObject.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/managedobject/IManagedObject.java deleted file mode 100644 index 2c43679c9..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/managedobject/IManagedObject.java +++ /dev/null @@ -1,48 +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.common.internal.managedobject; - -/** - * Represents an object that wishes to be managed by the framework. - * - * Clients should not implement: sub-class AbstractManagedObject instead. - * - */ -public interface IManagedObject -{ - /** - * Called by the object client to indicate is finished with the object. The - * object should save any data it may want between sessions, perhaps by - * calling its checkpoint, before cleaning held resources and clearing - * memory references. - */ - void dispose(); - - /** - * @return true if dispose has been successfully called on the object. - */ - boolean isDisposed(); - - /** - * Called to indicate that the object should remove all its data from both - * memory and persistent storage. This differentiates it from dispose in - * that it signals that this object and its associated state will never - * again be loaded for associated objects. - */ - void destroy(); - - /** - * Indicates that an object should flush cached data and make durable any - * data it might want between sessions. It does not indicate a disposal of - * the object. - */ - void checkpoint(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/managedobject/ObjectManager.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/managedobject/ObjectManager.java deleted file mode 100644 index 569517099..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/managedobject/ObjectManager.java +++ /dev/null @@ -1,92 +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.common.internal.managedobject; - - -/** - * An abstraction for a manager that manages managed objects based on a KEYTYPE - * - * @author cbateman - * - * @param <T> - * @param <KEYTYPE> - */ -public abstract class ObjectManager<T extends IManagedObject, KEYTYPE> extends - AbstractManagedObject -{ - - /** - * A valid instance of T for the key. The instance of T may be unique on a - * per-key basis or may not. - * - * @param key - * @return an instance of the managed object associated with key - * @throws ManagedObjectException - * if an error occurs during construction - */ - public abstract T getInstance(KEYTYPE key) throws ManagedObjectException; - - @Override - public abstract void destroy(); - - @Override - public abstract void checkpoint(); - - @Override - public abstract void dispose(); - - /** - * Indicates a problem that occurred during a managed object operation - * - * @author cbateman - * - */ - public static class ManagedObjectException extends Exception - { - /** - * - */ - private static final long serialVersionUID = -8723548990029368844L; - - /** - * - */ - public ManagedObjectException() - { - super(); - } - - /** - * @param message - * @param cause - */ - public ManagedObjectException(final String message, final Throwable cause) - { - super(message, cause); - } - - /** - * @param message - */ - public ManagedObjectException(final String message) - { - super(message); - } - - /** - * @param cause - */ - public ManagedObjectException(final Throwable cause) - { - super(cause); - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/pde/AbstractRegistryReader.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/pde/AbstractRegistryReader.java deleted file mode 100644 index 64677fe62..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/pde/AbstractRegistryReader.java +++ /dev/null @@ -1,97 +0,0 @@ -package org.eclipse.jst.jsf.common.internal.pde; - -import java.util.Collections; -import java.util.List; -import java.util.concurrent.atomic.AtomicBoolean; - -import org.eclipse.core.runtime.ISafeRunnable; -import org.eclipse.core.runtime.SafeRunner; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; - -/** - * A utility base class that simplifies the reading and caching of extension - * point information. - * - * @author cbateman - * @param <T> - * - */ -public abstract class AbstractRegistryReader<T> -{ - private final String _extPtNamespace; - private final String _extPtId; - private List<T> _extensions; - private final AtomicBoolean _isInitialized = new AtomicBoolean(false); - - /** - * @param extPtNamespace - * @param extPtId - */ - protected AbstractRegistryReader(final String extPtNamespace, - final String extPtId) - { - _extPtNamespace = extPtNamespace; - _extPtId = extPtId; - } - - /** - * @return the extensions - */ - public final List<T> getExtensions() - { - synchronized (_isInitialized) - { - if (_isInitialized.compareAndSet(false, true)) - { - SafeRunner.run(new ISafeRunnable() - { - public void run() throws Exception - { - initialize(); - } - - public void handleException(Throwable exception) - { - // This is expected during testing if there running as JUnit test (non-plugin) - JSFCommonPlugin.log(exception, "Loading extension point"); //$NON-NLS-1$ - } - }); - } - return _extensions; - } - } - - /** - * @param extensions - */ - protected final void internalSetExtensions(List<T> extensions) - { - if (_extensions != null) - { - throw new IllegalStateException( - "internalSetExtensions should be called exactly once"); //$NON-NLS-1$ - } - _extensions = Collections.unmodifiableList(extensions); - } - - /** - * Called exactly once to initialize the registry. - */ - protected abstract void initialize(); - - /** - * @return the extension point id. see IConfigurationElement.getName - */ - protected final String getExtPtId() - { - return _extPtId; - } - - /** - * @return the namespace of the extension point. see Bundle.getSymbolicName - */ - protected final String getExtPtNamespace() - { - return _extPtNamespace; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/pde/AbstractSimpleClassExtensionRegistryReader.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/pde/AbstractSimpleClassExtensionRegistryReader.java deleted file mode 100644 index 288d1d2e0..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/pde/AbstractSimpleClassExtensionRegistryReader.java +++ /dev/null @@ -1,265 +0,0 @@ -package org.eclipse.jst.jsf.common.internal.pde; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; - -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.IStatus; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.Status; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; - -/** - * @author cbateman - * @param <T> - * - */ -public abstract class AbstractSimpleClassExtensionRegistryReader<T> extends - AbstractRegistryReader<T> -{ - /** - * Indicates no sorting of extension. - */ - protected final static Comparator NO_SORT = null; - - private final String _attributeName; - private final String _configElementName; - private final Comparator<SortableExecutableExtension<T>> _comparator; - - private boolean _logWarnings = false; - - /** - * @param extPtNamespace - * @param extPtId - * @param configElementName - * @param attributeName - * @param listComparator - * May be null if no sorting of the extensions list is required. - */ - protected AbstractSimpleClassExtensionRegistryReader( - final String extPtNamespace, final String extPtId, - final String configElementName, final String attributeName, - final Comparator<SortableExecutableExtension<T>> listComparator) - { - super(extPtNamespace, extPtId); - _configElementName = configElementName; - _attributeName = attributeName; - _comparator = listComparator; - } - - @Override - protected final void initialize() - { - final List<SortableExecutableExtension<T>> result = new ArrayList<SortableExecutableExtension<T>>(); - final IExtensionPoint extensionPoint = Platform.getExtensionRegistry() - .getExtensionPoint(getExtPtNamespace(), getExtPtId()); - if (extensionPoint == null) - { - return; - } - IExtension[] extensions = extensionPoint.getExtensions(); - for (int i = 0; i < extensions.length; i++) - { - IExtension ext = extensions[i]; - IConfigurationElement[] tagConverter = ext - .getConfigurationElements(); - - for (int j = 0; j < tagConverter.length; j++) - { - final IConfigurationElement element = tagConverter[j]; - - if (element.getName().equals(_configElementName)) - { - element.getAttribute(_attributeName); - try - { - final T obj = (T) element - .createExecutableExtension(_attributeName); - result.add(new SortableExecutableExtension<T>( - _comparator, element.getContributor().getName(), - obj)); - } catch (ClassCastException ce) - { - handleLoadFailure(new CoreException(new Status( - IStatus.ERROR, JSFCommonPlugin.PLUGIN_ID, - "Extension class is not the expected type", ce))); //$NON-NLS-1$ - } catch (CoreException e) - { - handleLoadFailure(e); - } - } - } - } - - if (result.size() > 0) - { - if (_comparator != NO_SORT) - { - Collections.sort(result, _comparator); - } - } else if (_logWarnings) - { - JSFCommonPlugin.log(IStatus.WARNING, String.format( - "No extensions found for: %s.%s", //$NON-NLS-1$ - getExtPtNamespace(), getExtPtId())); - } - final List<T> finalExtensions = new ArrayList<T>(); - for (final SortableExecutableExtension<T> sortable : result) - { - finalExtensions.add(sortable.getExtensionObject()); - } - internalSetExtensions(finalExtensions); - } - - /** - * Called by initialize when an error occurs trying to load a class from an - * extension point. Sub-class should implement to handle the failure, - * typically to log it using their bundle id. - * - * @param ce - */ - protected abstract void handleLoadFailure(final CoreException ce); - - /** - * @param doLogWarnings - */ - protected void logWarnings(final boolean doLogWarnings) { - _logWarnings = doLogWarnings; - } - - /** - * A comparator that sorts canonically by extension namespace and id, but - * can make exceptions for certain prefices. - * - * @param <T> - * - */ - protected abstract static class CanonicalComparatorWithPrefixExceptions<T> - implements Comparator<SortableExecutableExtension<T>> - { - - public int compare(SortableExecutableExtension<T> o1, - SortableExecutableExtension<T> o2) - { - int result = prefixSort(o1, o2); - - // if the prefix sort doesn't distinguish a sort order, then - // compare it canonically - if (result == 0) - { - result = o1.getContributorId().compareTo(o2.getContributorId()); - } - - return result; - } - - /** - * @param o1 - * @param o2 - * @return -1 if o1 should sort before o2 based on prefix. 1 if o2 - * should sort before o1 or 0 if there is sort preference based - * on prefix. - */ - protected abstract int prefixSort(SortableExecutableExtension<T> o1, - SortableExecutableExtension<T> o2); - } - - /** - * Ensures that contributions from "org.eclipse.jst" plugins are sorted last - * - * @param <T> - */ - public static class CompareOrgEclipseJstContributorsLastComparator<T> extends CanonicalComparatorWithPrefixExceptions<T> { - @Override - protected int prefixSort( - SortableExecutableExtension<T> o1, - SortableExecutableExtension<T> o2) - { - // if o1 is contributed by open source, sort it - // after - if (o1.getContributorId().startsWith("org.eclipse.jst")) //$NON-NLS-1$ - { - return 1; - } - // if o2 is contributed by open source, sort o1 first - else if (o2.getContributorId().startsWith("org.eclipse.jst")) //$NON-NLS-1$ - { - return -1; - } - // otherwise, we don't care - return 0; - } - - } - /** - * Used to sort extensions before locking down the list. - * - * @param <T> - */ - protected final static class SortableExecutableExtension<T> implements - Comparable<SortableExecutableExtension> - { - private final Comparator _comparator; - private final String _contributorId; - private final T _extensionObject; - - private SortableExecutableExtension(final Comparator comparator, - final String contributorId, final T extensionObject) - { - if (comparator == null) - { - _comparator = new Comparator<T>() - { - public int compare(T o1, T o2) - { - // always return equal. - return 0; - } - }; - } else - { - _comparator = comparator; - } - _contributorId = contributorId; - _extensionObject = extensionObject; - } - - public int compareTo(SortableExecutableExtension o) - { - return _comparator.compare(this, o); - } - - @Override - public boolean equals(Object obj) - { - return _comparator.compare(this, obj) == 0; - } - - @Override - public int hashCode() - { - return _contributorId.hashCode() ^ _extensionObject.hashCode(); - } - - /** - * @return the id of the bundle that contributed this extension - */ - public String getContributorId() - { - return _contributorId; - } - - /** - * @return the extension object - */ - public T getExtensionObject() - { - return _extensionObject; - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/policy/CanonicallyOrderedIteratorPolicy.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/policy/CanonicallyOrderedIteratorPolicy.java deleted file mode 100644 index 24ba27d82..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/policy/CanonicallyOrderedIteratorPolicy.java +++ /dev/null @@ -1,64 +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.common.internal.policy; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; - -/** - * An iterator policy that sorts a comparable iterator type canonically. This - * policy takes a private copy of the collectin passed in getIterator. The - * cost of the sort is incurred when getIterator() is called under the - * assumption that the iterator will normally be used immediately after - * construction, so there is little value in deferring. - * - * @author cbateman - * - * @param <ITERATORTYPE> - */ -public class CanonicallyOrderedIteratorPolicy<ITERATORTYPE extends Comparable<ITERATORTYPE>> - implements IIteratorPolicy<ITERATORTYPE> -{ - - public Iterator<ITERATORTYPE> getIterator( - Collection<ITERATORTYPE> forCollection) - { - return new CanonicalIterator<ITERATORTYPE>(forCollection); - } - - private final static class CanonicalIterator<ITERATORTYPE extends Comparable> implements Iterator<ITERATORTYPE> - { - private final Iterator<ITERATORTYPE> _sortedIterator; - private CanonicalIterator(final Collection<ITERATORTYPE> source) - { - List<ITERATORTYPE> sortable = new ArrayList<ITERATORTYPE>(source); - Collections.sort(sortable); - _sortedIterator = sortable.iterator(); - } - - public boolean hasNext() - { - return _sortedIterator.hasNext(); - } - - public ITERATORTYPE next() - { - return _sortedIterator.next(); - } - public void remove() - { - throw new UnsupportedOperationException(); - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/policy/IIdentifiable.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/policy/IIdentifiable.java deleted file mode 100644 index 6e6368def..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/policy/IIdentifiable.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.common.internal.policy; - -/** - * An object with an unique identity - * @author cbateman - * @param <IDTYPE> - * - */ -public interface IIdentifiable<IDTYPE> -{ - /** - * @return the unique identifier - */ - IDTYPE getId(); - - /** - * @return a human-readable name for this identifier. - */ - String getDisplayName(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/policy/IIteratorPolicy.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/policy/IIteratorPolicy.java deleted file mode 100644 index 6b567f368..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/policy/IIteratorPolicy.java +++ /dev/null @@ -1,33 +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.common.internal.policy; - -import java.util.Collection; -import java.util.Iterator; - -/** - * A policy that allows a strategy composite to change the order in which - * it queries it's list of strategies. - * - * @author cbateman - * @param <ITERATORTYPE> - * - */ -public interface IIteratorPolicy<ITERATORTYPE> -{ - /** - * @param forCollection - * @return an iterator that controls the ordering through forCollection - * in a policy directed way. The policy may take a copy of the collection - * or may choose to iterate in place. - */ - Iterator<ITERATORTYPE> getIterator(Collection<ITERATORTYPE> forCollection); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/policy/IdentifierOrderedIteratorPolicy.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/policy/IdentifierOrderedIteratorPolicy.java deleted file mode 100644 index a566af0c7..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/policy/IdentifierOrderedIteratorPolicy.java +++ /dev/null @@ -1,142 +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.common.internal.policy; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * An iterator policy that creates Iterators that traverse a target collection - * by returning items in the order they are in the policyOrder object pased at - * construction. The target collection passed to getIterator is copied, so the - * iterator will not be effected by subsequent changes to the target. - * - * NOTE: the policyOrder iterable collection should not be modified after it is - * passed to the constructor. - * - * The class is thread-safe, however the iterators are not. That is, more than - * one thread can safely call any of the public methods, however each Iterator - * returned by getIterator can only be used safely by a single thread. - * - * @author cbateman - * - * @param <ITERATORTYPE> - */ -public class IdentifierOrderedIteratorPolicy<ITERATORTYPE> implements - IIteratorPolicy<ITERATORTYPE> -{ - private final Iterable<ITERATORTYPE> _policyOrder; - // controls whether the policy iterator will return items that are - // not explicitly listed in policyOrder. - private volatile boolean _excludeNonExplicitValues = false; - - /** - * @param policyOrder - */ - public IdentifierOrderedIteratorPolicy(final Iterable<ITERATORTYPE> policyOrder) - { - _policyOrder = policyOrder; - } - - /** - * Default value is <b>false</b>. - * - * @return if true, the iterator will not return values in the forCollection - * passed to getIterator whose identifier are not explicitly listed in - * the policyOrder, If false, these values will be return after all - * the policyOrder values have been returned. - */ - public boolean isExcludeNonExplicitValues() - { - return _excludeNonExplicitValues; - } - - /** - * @param excludeNonExplicitValues - */ - public void setExcludeNonExplicitValues(boolean excludeNonExplicitValues) - { - _excludeNonExplicitValues = excludeNonExplicitValues; - } - - public Iterator<ITERATORTYPE> getIterator( - final Collection<ITERATORTYPE> forCollection) - { - final boolean excludeNonExplicitValues = _excludeNonExplicitValues; - return new MyIterator<ITERATORTYPE>(forCollection, excludeNonExplicitValues, _policyOrder); - } - - private static class MyIterator<ITERATORTYPE> implements Iterator<ITERATORTYPE> - { - private final List<ITERATORTYPE> _items; - private final Iterator<ITERATORTYPE> _policyIterator; - private ITERATORTYPE _next; - - MyIterator(final Collection<ITERATORTYPE> collection, - final boolean excludeNonExplicitValues, - final Iterable<ITERATORTYPE> policyOrder) - { - _items = new ArrayList(); - _items.addAll(collection); - - _policyIterator = policyOrder.iterator(); - _next = findNext(); - } - - public boolean hasNext() - { - return _next != null; - } - - public ITERATORTYPE next() - { - if (_next != null) - { - ITERATORTYPE next = _next; - //calculate next one before returning - _next = findNext(); - return next; - } - - throw new NoSuchElementException("No more elements"); //$NON-NLS-1$ - } - - public void remove() - { - throw new UnsupportedOperationException(); - } - - private ITERATORTYPE findNext() - { - while (_policyIterator.hasNext()) - { - ITERATORTYPE next = _policyIterator.next(); - if (_items.contains(next)) - { - _items.remove(next); - return next; - } - } - - // we have exhausted the _items that are in the policy iterator - // now return any further _items in the order they are in the list - if (_items.size() > 0) - { - return _items.remove(0); - } - - return null; - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/policy/OrderedListProvider.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/policy/OrderedListProvider.java deleted file mode 100644 index 75407553e..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/policy/OrderedListProvider.java +++ /dev/null @@ -1,178 +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.common.internal.policy; - -import java.util.List; - -/** - * Provides a list of order, enablement-modifiable objects. - * - * @author cbateman - * - */ -public abstract class OrderedListProvider -{ - private List<OrderableObject> _orderableObjects; - - /** - * - * @return the list of ordered objects - */ - public final List<OrderableObject> getOrderedObjects() - { - if (_orderableObjects == null) - { - _orderableObjects = createAndPopulateOrderedObjects(); - } - return _orderableObjects; - } - - /** - * <p>Clears the orderableObjects collection so that the next call - * of getOrderedObjects() </p> - */ - public final void resetOrderedObjects() - { - _orderableObjects = null; - } - - /** - * Move the object one toward the front of the list - * - * @param object - */ - public final void moveUp(final OrderableObject object) - { - final List<OrderableObject> list = getOrderedObjects(); - final int index = list.indexOf(object); - if (index > 0) - { - OrderableObject item = list.remove(index); - list.add(index - 1, item); - } - } - - /** - * Move the object one toward the end - * @param object - */ - public final void moveDown(final OrderableObject object) - { - final List<OrderableObject> list = getOrderedObjects(); - int index = list.indexOf(object); - if (index < list.size() - 1) - { - OrderableObject item = list.remove(index); - list.add(index + 1, item); - } - } - - /** - * @return a new list orderable objects populate in their initial order - * The list must be modifiable. - */ - protected abstract List<OrderableObject> createAndPopulateOrderedObjects(); - - /** - * Proxy object for ordering in list - * - * @author cbateman - * - */ - public static class OrderableObject implements Cloneable - { - private boolean _enabled; - private Object _object; - - /** - * @param object - * @param enabled - */ - public OrderableObject(final Object object, final boolean enabled) - { - _object = object; - _enabled = enabled; - } - - private OrderableObject(final OrderableObject copyMe) - { - _object = copyMe._object; - _enabled = copyMe._enabled; - } - - /** - * @return true if this object is enabled - */ - public boolean isEnabled() - { - return _enabled; - } - - /** - * @param enabled - */ - public void setEnabled(boolean enabled) - { - _enabled = enabled; - } - - /** - * @return the object in the ordered list - */ - public Object getObject() - { - return _object; - } - - /** - * @param object - */ - public void setObject(Object object) - { - _object = object; - } - - @Override - public OrderableObject clone() - { - return new OrderableObject(this); - } - - @Override - public boolean equals(Object obj) - { - if (obj instanceof OrderableObject) - { - if (_enabled == ((OrderableObject)obj)._enabled) - { - Object other = ((OrderableObject)obj)._object; - if (other != null) - { - return other.equals(_object); - } - return _object == null; - } - } - return false; - } - - @Override - public int hashCode() - { - int enabledCode = _enabled ? 0xcccccccc : 0x33333333; - if (_object == null) - { - return enabledCode; - } - return _object.hashCode() ^ enabledCode; - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/resource/AbstractJarLocator.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/resource/AbstractJarLocator.java deleted file mode 100644 index ba1a51edb..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/resource/AbstractJarLocator.java +++ /dev/null @@ -1,67 +0,0 @@ -package org.eclipse.jst.jsf.common.internal.resource; - -import java.util.Collection; -import java.util.Collections; -import java.util.concurrent.CopyOnWriteArrayList; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.jsf.common.internal.locator.AbstractLocator; -import org.eclipse.jst.jsf.common.internal.locator.ILocatorChangeListener; - -/** - * An abstract implementation of the JarLocator. - * - * @author cbateman - * - */ -public abstract class AbstractJarLocator extends - AbstractLocator<Collection<? extends ClasspathJarFile>, IProject, String> - implements IJarLocator -{ - /** - * @param id - * @param displayName - */ - public AbstractJarLocator(final String id, final String displayName) - { - super(id, displayName, Collections.EMPTY_LIST, - new CopyOnWriteArrayList<ILocatorChangeListener>()); - } - - private final CopyOnWriteArrayList<JarChangeListener> _listeners = new CopyOnWriteArrayList<JarChangeListener>(); - - public final Collection<? extends ClasspathJarFile> getJars(final IProject project) - { - return locate(project); - } - - @Override - protected abstract Collection<? extends ClasspathJarFile> doLocate(IProject context); - - public void addListener(final JarChangeListener listener) - { - _listeners.addIfAbsent(listener); - } - - public void removeListener(final JarChangeListener listener) - { - _listeners.remove(listener); - } - - /** - * @param event - */ - protected void fireChangeEvent(final JarChangeEvent event) - { - for (final JarChangeListener listener : _listeners) - { - listener.changed(event); - } - } - - public void dispose() - { - _listeners.clear(); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/resource/AbstractLifecycleListener.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/resource/AbstractLifecycleListener.java deleted file mode 100644 index 3bafecd91..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/resource/AbstractLifecycleListener.java +++ /dev/null @@ -1,221 +0,0 @@ -package org.eclipse.jst.jsf.common.internal.resource; - -import java.util.Collection; -import java.util.Collections; -import java.util.EventObject; -import java.util.concurrent.CopyOnWriteArrayList; -import java.util.concurrent.atomic.AtomicBoolean; - -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; - -/** - * - * @author cbateman - * @param <EVENTTYPE> - * @param <LISTENERTYPE> - * @param <LIFECYCLEOBJECT> - * - */ -public abstract class AbstractLifecycleListener<EVENTTYPE extends EventObject, LISTENERTYPE extends ILifecycleListener<EVENTTYPE>, LIFECYCLEOBJECT> - extends ImmutableLifecycleListener<LISTENERTYPE> -{ - /** - * Exception (non-localized) error message thrown when a null object is - * added. - */ - protected static final String CANNOT_ADD_NULL_RESOURCE = "Cannot add null object"; //$NON-NLS-1$ - static final boolean TRACE_EVENTS; - static - { - TRACE_EVENTS = Boolean.valueOf( - Platform.getDebugOption(JSFCommonPlugin.PLUGIN_ID - + "/debug/lifecyclelistener")).booleanValue() //$NON-NLS-1$ - || Boolean.valueOf(System.getProperty("org.eclipse.jst.jsf.common/debug/lifecyclelistener")).booleanValue(); //$NON-NLS-1$ - } - - private final CopyOnWriteArrayList<LISTENERTYPE> _listeners = new CopyOnWriteArrayList<LISTENERTYPE>(); - private final CopyOnWriteArrayList<LIFECYCLEOBJECT> _lifecycleObjects = new CopyOnWriteArrayList<LIFECYCLEOBJECT>(); - private final AtomicBoolean _isDisposed = new AtomicBoolean(false); - - /** - * Adds listener to the list of objects registered to receive lifecycle - * events for this resource. Only adds the listener if it is not already in - * the list. - * - * Method is thread-safe and may block the caller - * - * Throws {@link IllegalStateException} if isDisposed() == true Throws - * {@link NullPointerException} if listener == null - * - * @param listener - */ - @Override - public void addListener(final LISTENERTYPE listener) - { - if (isDisposed()) - { - throw new IllegalStateException(); - } - if (listener == null) - { - throw new NullPointerException("Cannot pass null listener"); //$NON-NLS-1$ - } - _listeners.addIfAbsent(listener); - } - - /** - * Removes listener from the list of registered listeners - * - * Method is thread-safe and may block the caller - * - * Throws {@link IllegalStateException} if isDisposed() == true - * - * @param listener - */ - @Override - public void removeListener(final LISTENERTYPE listener) - { - if (isDisposed()) - { - throw new IllegalStateException(); - } - _listeners.remove(listener); - } - - /** - * @param event - */ - protected void fireLifecycleEvent(final EVENTTYPE event) - { - boolean disposeAfter = false; - if (TRACE_EVENTS) - { - System.err.println(event); - } - // NOTE: must use iterator through _listeners so that - // CopyOnWriteArrayList protects us from concurrent modification - for (final LISTENERTYPE listener : _listeners) - { - final EventResult result = listener.acceptEvent(event); - disposeAfter |= result.getDisposeAfterEvent(); - } - if (disposeAfter) - { - dispose(); - } - } - - /** - * @return true if the listener has been disposed - */ - public boolean isDisposed() - { - return _isDisposed.get(); - } - - /** - * Release the resource change listener - */ - public final void dispose() - { - if (_isDisposed.compareAndSet(false, true)) - { - // ensure that add/removeResource don't cause races to add or - // remove the resource listener - synchronized (_lifecycleObjects) - { - // remove first to minimize the chance that the listener will - // be triggered during the remainder of dispose - removeSystemChangeListener(); - _lifecycleObjects.clear(); - doDispose(); - } - } - } - - /** - * Sub-class disposal specialization. - */ - protected void doDispose() - { - // do nothing by default; sub-classes should override to provide their - // own disposal. - } - - /** - * @param object - */ - protected void addLifecycleObject(final LIFECYCLEOBJECT object) - { - if (object == null) - { - throw new NullPointerException(CANNOT_ADD_NULL_RESOURCE); - } - synchronized (_lifecycleObjects) - { - // don't add any resources if we've disposed before acquiring the - // lock - if (isDisposed()) - { - return; - } - final int preSize = _lifecycleObjects.size(); - if (!_lifecycleObjects.contains(object)) - { - _lifecycleObjects.add(object); - } - // if the size of the array was 0 - // and is now greater, make sure the listener is added - if (preSize == 0 && _lifecycleObjects.size() > 0) - { - addSystemChangeListener(); - } - } - } - - /** - * If there are no longer resources being targeted, the resource change - * listener will be removed. - * - * @param res - */ - public void removeResource(final IResource res) - { - synchronized (_lifecycleObjects) - { - // don't bother with this stuff if we're disposed. - if (isDisposed()) - { - return; - } - _lifecycleObjects.remove(res); - // if there are no longer target resources, - // remove the workspace listener - if (_lifecycleObjects.size() == 0) - { - removeSystemChangeListener(); - } - } - } - - /** - * @return an iterable of the lifecycle objects being tracked. - */ - protected Collection<LIFECYCLEOBJECT> getLifecycleObjects() - { - return Collections.unmodifiableCollection(_lifecycleObjects); - } - - /** - * Add the system change listener that is used to collect events that will - * be processed into lifecycle change events. - */ - protected abstract void addSystemChangeListener(); - - /** - * Remove a system change listener added using addSystemChangeListener - */ - protected abstract void removeSystemChangeListener(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/resource/ClasspathEntryLifecycleListener.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/resource/ClasspathEntryLifecycleListener.java deleted file mode 100644 index 80e8c9a90..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/resource/ClasspathEntryLifecycleListener.java +++ /dev/null @@ -1,213 +0,0 @@ -package org.eclipse.jst.jsf.common.internal.resource; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IResourceDelta; -import org.eclipse.core.resources.IResourceDeltaVisitor; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jdt.core.ElementChangedEvent; -import org.eclipse.jdt.core.IElementChangedListener; -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jdt.core.IJavaElementDelta; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; -import org.eclipse.jst.jsf.common.internal.resource.IClasspathLifecycleListener.ClasspathLifecycleEvent; - -/** - * @author cbateman - */ -public class ClasspathEntryLifecycleListener - extends - AbstractLifecycleListener<IClasspathLifecycleListener.ClasspathLifecycleEvent, IClasspathLifecycleListener, IProject> - implements IElementChangedListener -{ - private final JavaCoreMediator _mediator; - - /** - * Initialize an inactive lifecycle listener. A classpath listener will not - * be installed by this constructor. The object created using this - * constructor will not fire any events until addClasspathEntry is called at - * least once to add a target resource - * - * @param mediator - * the mediator to use to access JavaCore operations - * @throws NullPointerException - * if mediator is null. - */ - public ClasspathEntryLifecycleListener(final JavaCoreMediator mediator) - { - if (mediator == null) - { - throw new NullPointerException(CANNOT_ADD_NULL_RESOURCE); - } - _mediator = mediator; - } - - /** - * Create a new lifecycle listener for the res - * - * @param entry - * @param mediator - * the workspace to listen to for changes. - * @throws NullPointerException - * if res or workspace is null. - */ - public ClasspathEntryLifecycleListener(final IProject entry, - final JavaCoreMediator mediator) - { - this(mediator); - if (entry == null) - { - throw new NullPointerException(CANNOT_ADD_NULL_RESOURCE); - } - addLifecycleObject(entry); - } - - public void elementChanged(final ElementChangedEvent event) - { - // we are only interested in package fragment roots that are listening - // for - if (event.getType() == ElementChangedEvent.POST_CHANGE) - { - handlePostChangeEvent(event); - } - } - - private void handlePostChangeEvent(final ElementChangedEvent event) - { - final IJavaElementDelta delta = event.getDelta(); - new DeltaAcceptor().accept(new DeltaAcceptor.DeltaVisitor() - { - public void visit(final IJavaElementDelta visitDelta) - { - // we are only interested in package_fragment_root's - final IJavaElement element = visitDelta.getElement(); - // only interested if a project in our entries list owns the - // element. - final IJavaProject javaProject = element.getJavaProject(); - if (javaProject == null - || !getLifecycleObjects().contains( - javaProject.getProject())) - { - return; - } - if (element.getElementType() == IJavaElement.PACKAGE_FRAGMENT_ROOT) - { - handlePackageFragmentRoot(visitDelta); - } else if (element.getElementType() == IJavaElement.JAVA_PROJECT - && visitDelta.getResourceDeltas() != null) - { - handleProject(visitDelta); - } - // need to test the flags only for package fragment roots - } - - private void handleProject(final IJavaElementDelta visitDelta) - { - for (final IResourceDelta resDelta : visitDelta - .getResourceDeltas()) - { - try - { - resDelta.accept(new IResourceDeltaVisitor() - { - public boolean visit(final IResourceDelta resDelta2) - throws CoreException - { - if (resDelta2.getKind() == IResourceDelta.REMOVED - && resDelta2.getResource().getType() == IResource.FILE - && "jar".equals(resDelta2.getResource().getFileExtension())) //$NON-NLS-1$ - { - fireLifecycleEvent(new ClasspathLifecycleEvent( - ClasspathEntryLifecycleListener.this, - visitDelta.getElement(), - ClasspathLifecycleEvent.Type.REMOVED_DELTA, - resDelta2.getResource())); - } - return true; - } - }); - } catch (final CoreException e) - { - JSFCommonPlugin.log(e); - } - } - } - - private void handlePackageFragmentRoot( - final IJavaElementDelta visitDelta) - { - final int flags = visitDelta.getFlags(); - switch (visitDelta.getKind()) - { - case IJavaElementDelta.ADDED: - { - fireLifecycleEvent(new ClasspathLifecycleEvent( - ClasspathEntryLifecycleListener.this, - visitDelta.getElement(), - ClasspathLifecycleEvent.Type.ADDED)); - } - break; - case IJavaElementDelta.REMOVED: - { - fireLifecycleEvent(new ClasspathLifecycleEvent( - ClasspathEntryLifecycleListener.this, - visitDelta.getElement(), - ClasspathLifecycleEvent.Type.REMOVED)); - } - break; - case IJavaElementDelta.CHANGED: - if ((flags & IJavaElementDelta.F_ADDED_TO_CLASSPATH) != 0) - { - fireLifecycleEvent(new ClasspathLifecycleEvent( - ClasspathEntryLifecycleListener.this, - visitDelta.getElement(), - ClasspathLifecycleEvent.Type.ADDED)); - } else if ((flags & IJavaElementDelta.F_REMOVED_FROM_CLASSPATH) != 0) - { - fireLifecycleEvent(new ClasspathLifecycleEvent( - ClasspathEntryLifecycleListener.this, - visitDelta.getElement(), - ClasspathLifecycleEvent.Type.REMOVED)); - } else if ((flags & IJavaElementDelta.F_REORDER) != 0) - { - // TODO: how important is the case of a classpath - // reordering? - } - break; - } - } - }, delta); - } - - @Override - protected void addSystemChangeListener() - { - _mediator.addElementChangedListener(this); - } - - @Override - protected void removeSystemChangeListener() - { - _mediator.removeElementChangeListener(this); - } - - private static class DeltaAcceptor - { - public interface DeltaVisitor - { - public void visit(final IJavaElementDelta delta); - } - - public void accept(final DeltaVisitor visitor, - final IJavaElementDelta delta) - { - visitor.visit(delta); - for (final IJavaElementDelta childDelta : delta - .getAffectedChildren()) - { - accept(visitor, childDelta); - } - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/resource/ClasspathJarFile.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/resource/ClasspathJarFile.java deleted file mode 100644 index 0c4bba176..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/resource/ClasspathJarFile.java +++ /dev/null @@ -1,133 +0,0 @@ -package org.eclipse.jst.jsf.common.internal.resource; - -import java.io.File; -import java.io.IOException; -import java.util.jar.JarFile; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IWorkspace; -import org.eclipse.core.resources.IWorkspaceRoot; -import org.eclipse.core.runtime.IPath; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; - -/** - * Represents a jar that is available on the classpath. Encapsulates the jar - * as well as information about where it is provided from. - * - * The jar itself may have been deleted in which case, exists() will return false. - * - * @author cbateman - * - */ -public class ClasspathJarFile -{ - private final IProject _project; - private final IPath _iPath; - - /** - * @param project - * @param iPath - */ - public ClasspathJarFile(final IProject project, final IPath iPath) - { - _project = project; - _iPath = iPath; - } - - /** - * @return the project that this jar file is being referenced from. Note that this - * is not necessarily the same as the project that owns it (if it is in the - * workspace) and a jar file may be referenced by more than one project. - */ - public IProject getProject() - { - return _project; - } - - /** - * @return the class path entry - */ - public IPath getPath() - { - return _iPath; - } - - /** - * @return a new JarFile for the underlying jar. Caller MUST close the jar when - * done. - */ - public JarFile getJarFile() - { - JarFile jarFileFromCPE = null; - try - { - jarFileFromCPE = getJarFileFromCPE(_iPath, _project.getWorkspace()); - } catch (final IOException e) - { - JSFCommonPlugin.log(e); - } - return jarFileFromCPE; - } - - /** - * TODO: Merge into JSFAppConfigUtils. - * - * @param entry - * @param workspace - * @return - */ - private JarFile getJarFileFromCPE(final IPath entry, final IWorkspace workspace) - throws IOException - { - IPath path = _iPath; - if (path.getFileExtension() != null - && path.getFileExtension().length() > 0) - { - final IWorkspaceRoot workspaceRoot = workspace.getRoot(); - if (path.getDevice() == null - && workspaceRoot.getProject(path.segment(0)) - .exists()) - { - path = workspaceRoot.getFile(path) - .getLocation(); - } - final String libraryPathString = path.toString(); - final File file = new File(libraryPathString); - if (file.exists()) - { - return new JarFile(file); - } - } - return null; - } - - @Override - public boolean equals(Object obj) - { - if (obj == this) - { - return true; - } - - if (! (obj instanceof ClasspathJarFile)) - { - return false; - } - - ClasspathJarFile other = (ClasspathJarFile) obj; - return _project.equals(other._project) && _iPath.equals(other._iPath); - } - - @Override - public int hashCode() - { - return _project.hashCode() ^ _iPath.hashCode(); - } - - @Override - public String toString() - { - return String.format("ClasspathJarFile for project=%s, entry=%s", _project, _iPath); //$NON-NLS-1$ - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/resource/ContentTypeResolver.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/resource/ContentTypeResolver.java deleted file mode 100644 index c4cd6da06..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/resource/ContentTypeResolver.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.eclipse.jst.jsf.common.internal.resource; - -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.content.IContentType; -import org.eclipse.core.runtime.content.IContentTypeManager; - -/** - * Tools for resolving content types of resources or other object linked from - * the workspace (i.e. "files" in classpath entries). - * - * @author cbateman - * - */ -public class ContentTypeResolver -{ - private final IContentTypeManager _typeManager; - - /** - * Equivalent to Platform.getContentTypeManager(). - */ - public ContentTypeResolver() - { - this(Platform.getContentTypeManager()); - } - - /** - * @param typeManager - */ - public ContentTypeResolver(final IContentTypeManager typeManager) - { - _typeManager = typeManager; - } - - /** - * @param contentTypeId - * @param fileName - * @return true if the fileName matches the content type provided. May also return - * false if the fileName alone is not enough to determine type. - */ - public boolean matchesType(final String contentTypeId, final String fileName) - { - IContentType jspContentType = _typeManager.getContentType(contentTypeId); - if (jspContentType != null - && jspContentType.isAssociatedWith(fileName)) - { - return true; - } - - return false; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/resource/DefaultJarLocator.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/resource/DefaultJarLocator.java deleted file mode 100644 index 4f31cc178..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/resource/DefaultJarLocator.java +++ /dev/null @@ -1,172 +0,0 @@ -package org.eclipse.jst.jsf.common.internal.resource; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.IPath; -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jdt.core.IPackageFragmentRoot; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; -import org.eclipse.jst.jsf.common.internal.finder.AbstractMatcher.AlwaysMatcher; -import org.eclipse.jst.jsf.common.internal.finder.AbstractMatcher.IMatcher; -import org.eclipse.jst.jsf.common.internal.finder.VisitorMatcher; -import org.eclipse.jst.jsf.common.internal.finder.acceptor.ClasspathEntryJarMatchingAcceptor; -import org.eclipse.jst.jsf.common.internal.finder.acceptor.JarMatchingAcceptor; -import org.eclipse.jst.jsf.common.internal.resource.IClasspathLifecycleListener.ClasspathLifecycleEvent; -import org.eclipse.jst.jsf.common.internal.resource.IJarLocator.JarChangeEvent.Type; - -/** - * A default jar provider that traverses a project and returns all found jars on - * the classpath that a list of matcher criteria. - * - * @author cbateman - * - */ -public class DefaultJarLocator extends AbstractJarLocator -{ - private static final String DISPLAY_NAME = "Default Jar Provider"; //$NON-NLS-1$ - private static final String ID = DefaultJarLocator.class.getCanonicalName(); - private final VisitorMatcher<IProject, ClasspathJarFile, String> _matcher; - private ClasspathEntryLifecycleListener _classpathEntryListener; - private final JavaCoreMediator _javaCoreMediator; - - /** - * @param javaCoreMediator - */ - public DefaultJarLocator(final JavaCoreMediator javaCoreMediator) - { - this(Collections.singletonList(new AlwaysMatcher()), javaCoreMediator); - } - - /** - * @param matchers - * @param javaCoreMediator - */ - public DefaultJarLocator(final List<? extends IMatcher> matchers, - final JavaCoreMediator javaCoreMediator) - { - super(ID, DISPLAY_NAME); - _matcher = new VisitorMatcher<IProject, ClasspathJarFile, String>(ID, - DISPLAY_NAME, new JarMatchingAcceptor(javaCoreMediator), - matchers); - _javaCoreMediator = javaCoreMediator; - _classpathEntryListener = new ClasspathEntryLifecycleListener( - _javaCoreMediator); - } - - @Override - public void start(final IProject project) - { - _classpathEntryListener.addLifecycleObject(project); - _classpathEntryListener.addListener(new IClasspathLifecycleListener() - { - public EventResult acceptEvent(final ClasspathLifecycleEvent event) - { - final IJavaElement affectedElement = event.getAffectedElement(); - final List<ClasspathJarFile> affectedJarFiles = new ArrayList<ClasspathJarFile>(); - if (isInteresting(project, affectedElement, event)) - { - Type jarEventType = null; - switch (event.getType()) - { - case ADDED: - jarEventType = Type.JAR_ADDED; - affectedJarFiles.addAll(getChangedJars((IPackageFragmentRoot) affectedElement)); - break; - case REMOVED: - jarEventType = Type.JAR_REMOVED; - affectedJarFiles.addAll(getChangedJars((IPackageFragmentRoot) affectedElement)); - break; - case REMOVED_DELTA: - jarEventType = Type.JAR_REMOVED; - IResource res = event.getAffectedResource(); - if (res.getType() == IResource.FILE && - "jar".equals(res.getFileExtension())) //$NON-NLS-1$ - { - IPath path = res.getLocation(); - if (path != null) - { - affectedJarFiles.add(new ClasspathJarFile(project, path)); - } - } - break; - } - - if (jarEventType != null && !affectedJarFiles.isEmpty()) - { - for (final ClasspathJarFile changedJar : affectedJarFiles) - { - fireChangeEvent(new JarChangeEvent( - DefaultJarLocator.this, jarEventType, - changedJar)); - } - } - } - return EventResult.getDefaultEventResult(); - } - - private Collection<? extends ClasspathJarFile> getChangedJars( - final IPackageFragmentRoot affectedElement) - { - try - { - return new VisitorMatcher<IPackageFragmentRoot, ClasspathJarFile, String>( - "", "", new ClasspathEntryJarMatchingAcceptor(project), //$NON-NLS-1$ //$NON-NLS-2$ - Collections.singletonList(new AlwaysMatcher())) - .find(affectedElement); - } catch (final JavaModelException e) - { - return Collections.EMPTY_LIST; - } catch (final Exception e) - { - return Collections.EMPTY_LIST; - } - } - }); - super.start(project); - } - - private boolean isInteresting(final IProject project, - final IJavaElement affectedElement, final ClasspathLifecycleEvent event) - { - return - // first filter out events that aren't related to the project we care about. - (affectedElement != null - && affectedElement.getJavaProject() != null - && project - .equals(affectedElement.getJavaProject().getProject())) - // then filter down to only events impacting frag roots - // or jar file deletions - && (affectedElement.getElementType() == IJavaElement.PACKAGE_FRAGMENT_ROOT - || (affectedElement.getElementType() == IJavaElement.JAVA_PROJECT - && event.getAffectedResource() != null - && event.getType() == ClasspathLifecycleEvent.Type.REMOVED_DELTA)); - } - - @Override - public void stop() - { - _classpathEntryListener.dispose(); - super.stop(); - } - - @Override - protected Collection<? extends ClasspathJarFile> doLocate( - final IProject project) - { - try - { - return _matcher.find(project); - } catch (final Exception e) - { - JSFCommonPlugin - .log(e, "While getting jars for project: " + project); //$NON-NLS-1$ - return getNoResult(); - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/resource/EventResult.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/resource/EventResult.java deleted file mode 100644 index 68aae9538..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/resource/EventResult.java +++ /dev/null @@ -1,84 +0,0 @@ -package org.eclipse.jst.jsf.common.internal.resource; - -/** - * @author cbateman - * - */ -public class EventResult -{ - private static EventResult DEFAULT; - - /** - * @return an event result with defaults initialized - */ - public synchronized static EventResult getDefaultEventResult() - { - if (DEFAULT == null) - { - DEFAULT = new EventResult() - { - @Override - protected void setDisposeAfterEvent(final boolean disposeAfterEvent) - { - throw new UnsupportedOperationException(); - } - }; - } - return DEFAULT; - } - - private static EventResult DISPOSE_AFTER_EVENT; - - /** - * @return an event result with default except dispose after - * is set - */ - public synchronized static EventResult getDisposeAfterEventResult() - { - if (DISPOSE_AFTER_EVENT == null) - { - DISPOSE_AFTER_EVENT = new EventResult() - { - /** - * @return the remove listener flag - */ - @Override - public boolean getDisposeAfterEvent() - { - return true; - } - - /** - * @param disposeAfterEvent - */ - @Override - protected void setDisposeAfterEvent(final boolean disposeAfterEvent) { - _disposeAfterEvent = disposeAfterEvent; - } - - }; - } - return DISPOSE_AFTER_EVENT; - } - - /** - * set to true if after the current event is finished firing, the source - * should be disposed. If self-disposal is not applicable, the flag is ignored - */ - protected boolean _disposeAfterEvent; - - /** - * @return the remove listener flag - */ - public boolean getDisposeAfterEvent() - { - return _disposeAfterEvent; - } - - /** - * @param disposeAfterEvent - */ - protected void setDisposeAfterEvent(final boolean disposeAfterEvent) { - _disposeAfterEvent = disposeAfterEvent; - } -}
\ No newline at end of file diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/resource/IClasspathLifecycleListener.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/resource/IClasspathLifecycleListener.java deleted file mode 100644 index e2fcfccac..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/resource/IClasspathLifecycleListener.java +++ /dev/null @@ -1,162 +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.common.internal.resource; - -import java.util.EventObject; - -import org.eclipse.core.resources.IResource; -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jst.jsf.common.internal.resource.IClasspathLifecycleListener.ClasspathLifecycleEvent; - -/** - * Listener can register for events ona particular LifecycleListener - * - * @author cbateman - * - */ -public interface IClasspathLifecycleListener extends - ILifecycleListener<ClasspathLifecycleEvent> -{ - /** - * Listener accepts the classpath lifecycle event - * - * @param event - */ - EventResult acceptEvent(ClasspathLifecycleEvent event); - - /** - * An event indicating a change on the classpath - * - */ - public static class ClasspathLifecycleEvent extends EventObject - { - /** - * Indicates the type of change. - * - */ - public enum Type - { - /** - * The affected element was added to the classpath - */ - ADDED, - /** - * The affected element was removed from the classpath - */ - REMOVED, - /** - * A classpath object has been deleted from the workspace. The - * affected element is the owning IJavaProject. The actual deleted - * object can be obtained by query getAffectedResource. Note that - * this is a post change event, so the underlying resources most - * likely don't exist any more. - * - */ - REMOVED_DELTA - } - - private final IJavaElement _affectedElement; - private final IResource _affectedResource; - private final Type _type; - - /** - * @param source - * @param affectedElement - * @param type - */ - public ClasspathLifecycleEvent( - final ClasspathEntryLifecycleListener source, - final IJavaElement affectedElement, final Type type) - { - this(source, affectedElement, type, null); - } - - /** - * @param source - * @param affectedElement - * @param type - * @param affectedResource - * @throws IllegalArgumentException - * if affectedResource is non-null but type doesn't match - * one that has affectedResources (see - * isAffectResourceEvent) - */ - public ClasspathLifecycleEvent( - final ClasspathEntryLifecycleListener source, - final IJavaElement affectedElement, final Type type, - final IResource affectedResource) - { - super(source); - _affectedElement = affectedElement; - _type = type; - _affectedResource = affectedResource; - if (affectedResource != null && !isAffectResourceEvent(type)) - { - throw new IllegalArgumentException(); - } - } - - @Override - public ClasspathEntryLifecycleListener getSource() - { - return (ClasspathEntryLifecycleListener) super.getSource(); - } - - /** - * @return the type of event. - */ - public Type getType() - { - return _type; - } - - /** - * @return the affected resource or null if none. - */ - public IResource getAffectedResource() - { - return _affectedResource; - } - - /** - * - */ - private static final long serialVersionUID = -2510218872082581659L; - - /** - * @return the element that changed. - */ - public IJavaElement getAffectedElement() - { - return _affectedElement; - } - - /** - * @param type - * @return true if the type instance matches one for which - * affectedResource's are valid in the change event. - */ - public boolean isAffectResourceEvent(final Type type) - { - return type == Type.REMOVED_DELTA; - } - - @Override - public String toString() - { - return String.format( - "ClasspathLifecycleEvent: IJavaElement=%s, Res = %s, Event=%s", //$NON-NLS-1$ - getAffectedElement(), getAffectedResource(), getType()); - } - - - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/resource/IJarLocator.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/resource/IJarLocator.java deleted file mode 100644 index 34629f990..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/resource/IJarLocator.java +++ /dev/null @@ -1,116 +0,0 @@ -package org.eclipse.jst.jsf.common.internal.resource; - -import java.util.Collection; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.jsf.common.internal.locator.ILocator; -import org.eclipse.jst.jsf.common.internal.locator.ILocatorChangeListener; -import org.eclipse.jst.jsf.common.internal.locator.ILocatorChangeListener.LocatorChangeEvent; - -/** - * Provider of jars for use by the locator. Exists to abstract the locator from - * JDT for test purposes. - * - */ -public interface IJarLocator extends - ILocator<Collection<? extends ClasspathJarFile>, IProject, String> -{ - /** - * @param project - * @return a list of valid jar files. - */ - Collection<? extends ClasspathJarFile> getJars(final IProject project); - - /** - * @param listener - */ - void addListener(final JarChangeListener listener); - - /** - * @param listener - */ - void removeListener(final JarChangeListener listener); - - /** - * Disposes the provider. - */ - void dispose(); - - /** - * Implemented by classes that want receive events signalling a change on - * the classpath. - * - */ - public abstract class JarChangeListener implements ILocatorChangeListener - { - /** - * @param event - */ - public abstract void changed(JarChangeEvent event); - - public final void changed(final LocatorChangeEvent event) - { - changed((JarChangeEvent) event); - } - } - - /** - * Indicates a change on the class path. - * - */ - public class JarChangeEvent extends LocatorChangeEvent - { - /** - * Indicates the type of event - * - */ - public enum Type - { - /** - * Indicates a jar has been added. - */ - JAR_ADDED, - /** - * Indicates a jar has been removed. - */ - JAR_REMOVED; - } - - private final Type _type; - private final ClasspathJarFile _jar; - - /** - * @param source - * @param type - * @param jar - */ - public JarChangeEvent(final ILocator source, final Type type, - final ClasspathJarFile jar) - { - super(source); - _type = type; - _jar = jar; - } - - /** - * @return the type of the event - */ - public Type getType() - { - return _type; - } - - /** - * @return the affected jar. - */ - public ClasspathJarFile getJar() - { - return _jar; - } - - /** - * - */ - private static final long serialVersionUID = 8163703453414731319L; - } -}
\ No newline at end of file diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/resource/ILifecycleListener.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/resource/ILifecycleListener.java deleted file mode 100644 index 93acba85c..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/resource/ILifecycleListener.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.eclipse.jst.jsf.common.internal.resource; - -import java.util.EventObject; - -/** - * @author cbateman - * - * @param <EVENTTYPE> - */ -public interface ILifecycleListener<EVENTTYPE extends EventObject> -{ - /** - * Listener accepts the resource lifecycle event - * - * @param event - * @return the result of accepting the event - */ - EventResult acceptEvent(EVENTTYPE event); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/resource/IResourceLifecycleListener.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/resource/IResourceLifecycleListener.java deleted file mode 100644 index 2306d598c..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/resource/IResourceLifecycleListener.java +++ /dev/null @@ -1,29 +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.common.internal.resource; - - -/** - * Listener can register for events ona particular LifecycleListener - * - * @author cbateman - * - */ -public interface IResourceLifecycleListener extends ILifecycleListener<ResourceLifecycleEvent> -{ - /** - * Listener accepts the classpath lifecycle event - * - * @param event - */ - EventResult acceptEvent(ResourceLifecycleEvent event); - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/resource/ImmutableLifecycleListener.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/resource/ImmutableLifecycleListener.java deleted file mode 100644 index f54421613..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/resource/ImmutableLifecycleListener.java +++ /dev/null @@ -1,48 +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.common.internal.resource; - - -/** - * A lifecycle listener abstraction that cannot have its resources modified. - * Clients may only register and deregister for events. - * - * @author cbateman - * @param <LISTENERTYPE> - * - */ -public abstract class ImmutableLifecycleListener<LISTENERTYPE extends ILifecycleListener> -{ - - /** - * Adds listener to the list of objects registered to receive - * lifecycle events for this resource. Only adds the listener - * if it is not already in the list. - * - * Method is thread-safe and may block the caller - * - * Throws {@link IllegalStateException} if isDisposed() == true - * - * @param listener - */ - public abstract void addListener(final LISTENERTYPE listener); - - /** - * Removes listener from the list of registered listeners - * - * Method is thread-safe and may block the caller - * - * Throws {@link IllegalStateException} if isDisposed() == true - * - * @param listener - */ - public abstract void removeListener(final LISTENERTYPE listener); -}
\ No newline at end of file diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/resource/JavaCoreMediator.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/resource/JavaCoreMediator.java deleted file mode 100644 index 7f84c3fec..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/resource/JavaCoreMediator.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.eclipse.jst.jsf.common.internal.resource; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jdt.core.IElementChangedListener; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.JavaCore; - -/** - * Implements pass-through methods to the static JavaCore class. This allows us - * to decouple from JavaCore for testing and other dep-injection purposes. - * - * @author cbateman - * - */ -public class JavaCoreMediator -{ - /** - * @param project - * @return a java project for project. Return null if project is null. - */ - public IJavaProject create(final IProject project) - { - return JavaCore.create(project); - } - - /** - * @param listener - */ - public void addElementChangedListener(final IElementChangedListener listener) - { - JavaCore.addElementChangedListener(listener); - } - - /** - * @param listener - */ - public void removeElementChangeListener( - final ClasspathEntryLifecycleListener listener) - { - JavaCore.removeElementChangedListener(listener); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/resource/LifecycleListener.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/resource/LifecycleListener.java deleted file mode 100644 index 3aee0decd..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/resource/LifecycleListener.java +++ /dev/null @@ -1,381 +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.common.internal.resource; - -import java.util.List; - -import org.eclipse.core.resources.IContainer; -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.jst.jsf.common.internal.ITestTracker; -import org.eclipse.jst.jsf.common.internal.ITestTracker.Event; -import org.eclipse.jst.jsf.common.internal.resource.ResourceLifecycleEvent.EventType; -import org.eclipse.jst.jsf.common.internal.resource.ResourceLifecycleEvent.ReasonType; - -/** - * Listens to resource changes and fires lifecycle events - * - * @author cbateman - * - */ -public class LifecycleListener extends - AbstractLifecycleListener<ResourceLifecycleEvent, IResourceLifecycleListener, IResource> - implements IResourceChangeListener -{ - private static boolean ENABLE_TEST_TRACKING = false; - private static long _seqId; - private ITestTracker _testTracker; // == - final IWorkspace _workspace; - - // null; - // initialized - // by - // setter - // injection - /** - * Initialize an inactive lifecycle listener. A workspace listener will not - * be installed by this constructor. The object created using this - * constructor will not fire any events until addResource is called at least - * once to add a target resource - * - * @param workspace - * the workspace to listen to for changes. - * @throws NullPointerException - * if workspace is null. - */ - public LifecycleListener(final IWorkspace workspace) - { - super(); - if (workspace == null) - { - throw new NullPointerException(CANNOT_ADD_NULL_RESOURCE); - } - _workspace = workspace; - } - - /** - * Create a new lifecycle listener for the res - * - * @param res - * @param workspace - * the workspace to listen to for changes. - * @throws NullPointerException - * if res or workspace is null. - */ - public LifecycleListener(final IResource res, final IWorkspace workspace) - { - this(workspace); - if (res == null) - { - throw new NullPointerException(CANNOT_ADD_NULL_RESOURCE); - } - addResource(res); - } - - /** - * @param resources - * @param workspace - * the workspace to listen to for changes. - * @throws NullPointerException - * if resources, a member of resources or workspace is null. - */ - public LifecycleListener(final List<IResource> resources, - final IWorkspace workspace) - { - this(workspace); - for (final IResource resource : resources) - { - if (resource != null) - { - addResource(resource); - } else - { - throw new NullPointerException(CANNOT_ADD_NULL_RESOURCE); - } - } - } - - @Override - protected void addSystemChangeListener() - { - _workspace.addResourceChangeListener(this); - } - - @Override - protected void removeSystemChangeListener() - { - _workspace.removeResourceChangeListener(this); - } - - /** - * @param testTracker - */ - public final void setTestTracker(final ITestTracker testTracker) - { - _testTracker = testTracker; - } - - /** - * @param newValue - */ - protected final void setEnableTracing(final boolean newValue) - { - ENABLE_TEST_TRACKING = newValue; - } - - /** - * @param res - * a resource you want to receive events for. MUST NOT BE NULL. - * @throw {@link NullPointerException} if res is null - */ - public void addResource(final IResource res) - { - addLifecycleObject(res); - } - - public void resourceChanged(final IResourceChangeEvent event) - { - final long seqId = _seqId++; - if (_testTracker != null && ENABLE_TEST_TRACKING) - { - _testTracker.fireEvent(Event.START_TRACKING, seqId, - "trackMethod_resourceChanged"); //$NON-NLS-1$ - } - assert (!isDisposed()); - switch (event.getType()) - { - case IResourceChangeEvent.PRE_CLOSE: - { - final IProject proj = (IProject) event.getResource(); - // must use iterator to ensure copy on write behaviour - for (final IResource res : getLifecycleObjects()) - { - if (proj == res || proj == res.getProject()) - { - fireLifecycleEvent(new ResourceLifecycleEvent(this, - res, EventType.RESOURCE_INACCESSIBLE, - ReasonType.RESOURCE_PROJECT_CLOSED)); - } - } - } - break; - case IResourceChangeEvent.PRE_DELETE: - { - final IProject proj = (IProject) event.getResource(); - // must use iterator to ensure copy on write behaviour - for (final IResource res : getLifecycleObjects()) - { - // if the resource being tracked is the resource being - // deleted, - // then fire a resource delete event - if (proj == res) - { - fireLifecycleEvent(new ResourceLifecycleEvent(this, - res, EventType.RESOURCE_INACCESSIBLE, - ReasonType.RESOURCE_DELETED)); - } - // if the resource being tracked is a resource in the - // project being - // deleted, then fire a project deleted event - else if (proj == res.getProject()) - { - fireLifecycleEvent(new ResourceLifecycleEvent(this, - res, EventType.RESOURCE_INACCESSIBLE, - ReasonType.RESOURCE_PROJECT_DELETED)); - } - } - } - break; - case IResourceChangeEvent.POST_CHANGE: - { - for (final IResource res : getLifecycleObjects()) - { - IResourceDelta delta = event.getDelta(); - // only care about post change events to resources - // that we are tracking - if (delta != null) - { - delta = delta.findMember(res.getFullPath()); - if (delta != null) - { - visit(delta); - } - } - } - } - break; - default: - // do nothing - // we only handle these three - } - if (ENABLE_TEST_TRACKING && _testTracker != null) - { - _testTracker.fireEvent(Event.STOP_TRACKING, seqId, - "trackMethod_resourceChanged"); //$NON-NLS-1$ - } - } - - private void visit(final IResourceDelta delta) - { - assert (!isDisposed()); - final IResource res = delta.getResource(); - // the wkspace root is a special case since even though - // it is registered as the target resource, we are interested - // in new projects created in the root - if (res.getType() == IResource.ROOT) - { - handleWorkspaceRoot(delta); - } else if (res instanceof IContainer) - { - handleContainer(delta, res); - } else - { - handleFile(delta, res); - } - } - - private void handleContainer(final IResourceDelta delta, IResource container) - { - handleChange(delta, container, container); - for (final IResourceDelta childDelta : delta.getAffectedChildren()) - { - if (childDelta.getResource().getType() == IResource.FILE - || childDelta.getResource().getType() == IResource.FOLDER) - { - handleChange(childDelta, childDelta.getResource(), container); - } - } - } - - private void handleFile(final IResourceDelta delta, final IResource res) - { - switch (delta.getKind()) - { - case IResourceDelta.ADDED: - case IResourceDelta.REMOVED: - { - handleChange(delta, res, res); - } - break; - case IResourceDelta.CHANGED: - { - // the contents of the file have changed - if ((delta.getFlags() & IResourceDelta.CONTENT) != 0) - { - fireLifecycleEvent(new ResourceLifecycleEvent(this, res, - EventType.RESOURCE_CHANGED, - ReasonType.RESOURCE_CHANGED_CONTENTS)); - } - } - break; - } - } - - private void handleChange(final IResourceDelta delta, final IResource res, - final IResource interestedResource) - { - switch (delta.getKind()) - { - case IResourceDelta.ADDED: - { - handleAdd(delta, res, interestedResource); - } - break; - case IResourceDelta.REMOVED: - { - handleRemove(delta, res, interestedResource); - } - break; - } - } - - private void handleRemove(final IResourceDelta delta, final IResource res, - final IResource interestedResource) - { - if ((delta.getFlags() & IResourceDelta.MOVED_TO) != 0) - { - if (res.equals(interestedResource)) - { - fireLifecycleEvent(new ResourceLifecycleEvent(this, res, - EventType.RESOURCE_INACCESSIBLE, - ReasonType.RESOURCE_MOVED)); - } else if (res.getParent().equals(interestedResource)) - { - fireLifecycleEvent(new ResourceLifecycleEvent(this, res, - EventType.RESOURCE_INACCESSIBLE, - ReasonType.RESOURCE_MOVED_CONTAINER)); - } - } else - { - if (res.equals(interestedResource)) - { - fireLifecycleEvent(new ResourceLifecycleEvent(this, res, - EventType.RESOURCE_INACCESSIBLE, - ReasonType.RESOURCE_DELETED)); - } else if (res.getParent().equals(interestedResource)) - { - fireLifecycleEvent(new ResourceLifecycleEvent(this, res, - EventType.RESOURCE_INACCESSIBLE, - ReasonType.RESOURCE_DELETED_FROM_CONTAINER)); - } - } - } - - private void handleAdd(final IResourceDelta delta, final IResource res, - final IResource interestedResource) - { - if ((delta.getFlags() & IResourceDelta.MOVED_FROM) != 0) - { - if (res.equals(interestedResource)) - { - fireLifecycleEvent(new ResourceLifecycleEvent(this, res, - EventType.RESOURCE_ADDED, ReasonType.RESOURCE_MOVED)); - } else if (res.getParent().equals(interestedResource)) - { - fireLifecycleEvent(new ResourceLifecycleEvent(this, res, - EventType.RESOURCE_ADDED, - ReasonType.RESOURCE_MOVED_CONTAINER)); - } - } else - { - if (res.equals(interestedResource)) - { - fireLifecycleEvent(new ResourceLifecycleEvent(this, res, - EventType.RESOURCE_ADDED, ReasonType.RESOURCE_ADDED)); - } else if (res.getParent().equals(interestedResource)) - { - fireLifecycleEvent(new ResourceLifecycleEvent(this, res, - EventType.RESOURCE_ADDED, - ReasonType.RESOURCE_ADDED_TO_CONTAINER)); - } - } - } - - private void handleWorkspaceRoot(final IResourceDelta delta) - { - for (final IResourceDelta childDelta : delta - .getAffectedChildren(IResourceDelta.ADDED|IResourceDelta.CHANGED)) - { - final IResource res = childDelta.getResource(); - if ((childDelta.getFlags() & IResourceDelta.OPEN) != 0 && - // project was just opened - res.getType() == IResource.PROJECT) - { - fireLifecycleEvent(new ResourceLifecycleEvent(this, res, - EventType.RESOURCE_ADDED, ReasonType.PROJECT_OPENED)); - } - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/resource/ResourceLifecycleEvent.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/resource/ResourceLifecycleEvent.java deleted file mode 100644 index 15ac306aa..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/resource/ResourceLifecycleEvent.java +++ /dev/null @@ -1,167 +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.common.internal.resource; - -import java.util.EventObject; - -import org.eclipse.core.resources.IResource; - -/** - * @author cbateman - * - */ -public class ResourceLifecycleEvent extends EventObject -{ - /** - * - */ - private static final long serialVersionUID = -8692801944833729L; - - /** - * the type of lifecycle event this enum is not closed and may add new - * fields in the future - */ - public enum EventType - { - /** - * Indicates that the resource is no longer accessible (as testable with - * IResource.isAccessible). The reasonType will indicate why. - */ - RESOURCE_INACCESSIBLE, - - /** - * Indicates that the resource being tracked has changed in some way, - * use ReasonType to determine specifics - */ - RESOURCE_CHANGED, - - /** - * Indicates that the resource being tracked hass been added. Use - * ReasonType to determine specifics. - */ - RESOURCE_ADDED; - } - - /** - * encodes the cause of the event if the event type provides one this enum - * is not closed and may add new fields in the future - */ - public enum ReasonType - { - /** - * The resource was deleted from the workspace, this event is pre change - * if the event is project and post change otherwise - */ - RESOURCE_DELETED, - /** - * The resource was delete from it's container. This fired when the - * PARENT of the resource being deleted is registered for lifecycle - * events (i.e. _affectedResource.getParent() == registeredResource) - */ - RESOURCE_DELETED_FROM_CONTAINER, - /** - * The resource's project was deleted. This event is pre-change. Note - * that if the tracked resource is a project, RESOURCE_DELETED will be - * fired, not this event. - */ - RESOURCE_PROJECT_DELETED, - /** - * The resource's project was closed. This event is pre-change - */ - RESOURCE_PROJECT_CLOSED, - /** - * Occurs when the contents of a non-project resource has changed - */ - RESOURCE_CHANGED_CONTENTS, - /** - * Occurs when a project resource is added - */ - PROJECT_OPENED, - /** - * Occurs when a non-project resource is added to a container. This is - * fired if the resource being added was in the list of resources - * registered for lifecycle events (i.e. _affectedResource == - * registeredResource). - */ - RESOURCE_ADDED, - /** - * Occurs when a non-project resource is added to a container. This is - * fired if the PARENT of the resource being added was in the resources - * registered for lifecycle events (i.e. _affectedResource.getParent() = - * registeredResource) - */ - RESOURCE_ADDED_TO_CONTAINER, - /** - * Occurs when a resource has becomes added or inaccessible due to a - * move operation. This event is fired when the resource being moved is - * the one of interest. - */ - RESOURCE_MOVED, - /** - * Occurs when a resource has becomes added or inaccessible due to a - * move operation. This event is fired when the PARENT of resource being - * moved is the one of interest. - */ - RESOURCE_MOVED_CONTAINER - } - - private final IResource _affectedResource; - private final EventType _eventType; - private final ReasonType _reasonType; - - /** - * @param source - * @param affectedResource - * @param eventType - * @param reasonType - */ - public ResourceLifecycleEvent(final LifecycleListener source, - final IResource affectedResource, - final EventType eventType, final ReasonType reasonType) - { - super(source); - _affectedResource = affectedResource; - _eventType = eventType; - _reasonType = reasonType; - } - - /** - * @return the affected resource - */ - public IResource getAffectedResource() - { - return _affectedResource; - } - - /** - * @return the event that has occurred - */ - public EventType getEventType() - { - return _eventType; - } - - /** - * @return the cause of the event - */ - public ReasonType getReasonType() - { - return _reasonType; - } - - @Override - public String toString() - { - return String.format( - "ResourceLifecycleEvent: Res = %s, Event=%s, Reason=%s", //$NON-NLS-1$ - getAffectedResource(), getEventType(), getReasonType()); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/resource/ResourceManager.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/resource/ResourceManager.java deleted file mode 100644 index 2ecedd469..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/resource/ResourceManager.java +++ /dev/null @@ -1,63 +0,0 @@ -package org.eclipse.jst.jsf.common.internal.resource; - -import java.util.List; - -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IWorkspace; - -/** - * A resource singleton object manager that manages singletons that are aware - * of the the resources they are singletons for. - * - * @author cbateman - * @param <RESTYPE> - * - */ -public abstract class ResourceManager<RESTYPE extends IResource> extends - ResourceSingletonObjectManager<ResourceTracker<RESTYPE>, IResource> -{ - /** - * @param workspace - */ - public ResourceManager(IWorkspace workspace) - { - super(workspace); - } - - public void dispose() - { - super.dispose(); - } - - /** - * @param listener - */ - public void addListener(final IResourceLifecycleListener listener) - { - super.addLifecycleEventListener(listener); - } - - /** - * @param listener - */ - public void removeListener(final IResourceLifecycleListener listener) - { - super.removeLifecycleEventListener(listener); - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.internal.resource.ResourceSingletonObjectManager#createNewInstance(org.eclipse.core.resources.IResource) - */ - protected abstract ResourceTracker<RESTYPE> createNewInstance(final IResource resource); - - /** - * Initialize any state about the current resources we are managing. - */ - public abstract void initResources(); - - /** - * @return the current list of resources being managed. - */ - public abstract List<RESTYPE> getResources(); - -}
\ No newline at end of file diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/resource/ResourceSingletonObjectManager.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/resource/ResourceSingletonObjectManager.java deleted file mode 100644 index d2b98f466..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/resource/ResourceSingletonObjectManager.java +++ /dev/null @@ -1,419 +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.common.internal.resource; - -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; - -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IWorkspace; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.jst.jsf.common.internal.managedobject.IManagedObject; -import org.eclipse.jst.jsf.common.internal.managedobject.ObjectManager; -import org.eclipse.jst.jsf.common.internal.resource.ResourceLifecycleEvent.EventType; -import org.eclipse.jst.jsf.common.internal.resource.ResourceLifecycleEvent.ReasonType; - -/** - * An object manager that manages a single instanceof an IManagedObject per - * resource. The manager takes care of ensuring that a managed object is - * properly disposed when a resource lifecycle event renders it inaccessible - * (i.e file is deleted, project is closed or delete). - * - * @author cbateman - * - * @param <RESOURCE> - * @param <MANAGEDOBJECT> - */ -public abstract class ResourceSingletonObjectManager<MANAGEDOBJECT extends IManagedObject, RESOURCE extends IResource> - extends ObjectManager<MANAGEDOBJECT, RESOURCE> -{ - // lazily initialized - private LifecycleListener _lifecycleListener; - final Map<RESOURCE, ManagedResourceObject<MANAGEDOBJECT>> _perResourceObjects; - private final IWorkspace _workspace; - - /** - * Default constructor - * @param workspace - */ - protected ResourceSingletonObjectManager(final IWorkspace workspace) - { - _workspace = workspace; - _perResourceObjects = new HashMap<RESOURCE, ManagedResourceObject<MANAGEDOBJECT>>(); - } - - /** - * @return the workspace - */ - protected final IWorkspace getWorkspace() - { - return _workspace; - } - - - /** - * @return an unmodifiable view on the map of currently managed objects keyed - * by the resource they are mapped to. - */ - protected final Map<RESOURCE, ManagedResourceObject<MANAGEDOBJECT>> getPerResourceObjects() - { - return Collections.unmodifiableMap(_perResourceObjects); - } - - @Override - public final MANAGEDOBJECT getInstance(final RESOURCE key) - throws ManagedObjectException - { - assertNotDisposed(); - IAdaptable stateObject = null; - try - { - stateObject = unsafeRunBeforeGetInstance(key); - synchronized(this) - { - runBeforeGetInstance(key); - ManagedResourceObject managedResObject = _perResourceObjects.get(key); - - if (managedResObject == null) - { - final MANAGEDOBJECT managedObject = createNewInstance(key); - - if (managedObject == null) - { - throw new ManagedObjectException( - "No object available for resource"); //$NON-NLS-1$ - } - managedResObject = manageResource(key, managedObject); - } - - runAfterGetInstance(key); - return (MANAGEDOBJECT) managedResObject.getManagedObject(); - } - } - finally - { - unsafeRunAfterGetInstance(key, stateObject); - } - } - - /** - * @param resource - * @return a new instance of T associated with S. This operation must not - * cache T: a brand new instance is always required. getInstance - * will perform caching and resource listening. - */ - protected abstract MANAGEDOBJECT createNewInstance(RESOURCE resource); - - /** - * @param resource - */ - protected void runBeforeGetInstance(final RESOURCE resource) - { - // do nothing by default - } - - /** - * @param resource - */ - protected void runAfterGetInstance(final RESOURCE resource) - { - // do nothing by default - } - - /** - * Callback run outside of synchronized code block in getInstance - * @param resource - * @return A state object to be passed to unsafeRunAfterGetInstance, or null. - */ - protected IAdaptable unsafeRunBeforeGetInstance(final RESOURCE resource) - { - // do nothing by default - return null; - } - - /** - * Callback run outside of synchronized code block in getInstance - * @param resource - * @param adaptable State object returned from unsafeRunBeforeGetInstance call, may be null. - */ - protected void unsafeRunAfterGetInstance(final RESOURCE resource, final IAdaptable adaptable) - { - // do nothing by default - } - - /** - * @param resource - * @return true if there already exists a managed object associated with - * the resource - */ - public synchronized boolean isInstance(RESOURCE resource) - { - assertNotDisposed(); - return _perResourceObjects.containsKey(resource); - } - - /** - * @return a copy of the current set of RESOURCE object keys that we - * are managing singletons for. Collection is mutable, but as a copy, - * changes to it do not effect thie object manager. - */ - public synchronized Collection<RESOURCE> getManagedResources() - { - assertNotDisposed(); - return new HashSet(_perResourceObjects.keySet()); - } - /** - * Should be called by concrete classes to indicate they have created a new - * managed object for resource, for which they want to track lifecycle - * changes. - * - * @param resource - * @param managedObject - */ - private synchronized ManagedResourceObject manageResource(final RESOURCE resource, - final MANAGEDOBJECT managedObject) - { - final LifecycleListener listener = lazilyGetLifecycleListener(); - listener.addResource(resource); - final MyLifecycleEventListener<RESOURCE, MANAGEDOBJECT> eventListener = - new MyLifecycleEventListener<RESOURCE, MANAGEDOBJECT>( - this, managedObject, resource); - listener.addListener(eventListener); - - final ManagedResourceObject<MANAGEDOBJECT> managedResourceObject = new ManagedResourceObject<MANAGEDOBJECT>( - managedObject, eventListener); - _perResourceObjects.put(resource, managedResourceObject); - return managedResourceObject; - } - - /** - * Stop managing the resource. If resource is the last one, the resource - * change listener will be removed (it will be added again when next - * manageResource is called). - * - * @param resource - * @return the managed object that has just be disassociated from the resource. - * The object is not disposed, destroyed or checkpointed before being returned. - */ - protected final synchronized MANAGEDOBJECT unmanageResource(final RESOURCE resource) - { - final ManagedResourceObject managedResourceObject = - _perResourceObjects.remove(resource); - final LifecycleListener listener = lazilyGetLifecycleListener(); - - if (managedResourceObject != null) - { - listener.removeListener(managedResourceObject.getEventListener()); - } - - listener.removeResource(resource); - return (MANAGEDOBJECT) managedResourceObject.getManagedObject(); - } - - /** - * Call to register a listener - * - * @param listener - */ - protected final void addLifecycleEventListener( - final IResourceLifecycleListener listener) - { - assertNotDisposed(); - final LifecycleListener lifecycleListener = lazilyGetLifecycleListener(); - lifecycleListener.addListener(listener); - } - - /** - * Call to remove a listener - * - * @param listener - */ - protected final void removeLifecycleEventListener( - final IResourceLifecycleListener listener) - { - final LifecycleListener lifecycleListener = lazilyGetLifecycleListener(); - lifecycleListener.removeListener(listener); - } - - /** - * Add additional resources to the set to listen to. - * - * @param res - */ - protected final void addResource(final IResource res) - { - final LifecycleListener lifecycleListener = lazilyGetLifecycleListener(); - lifecycleListener.addResource(res); - } - - /** - * Remove a resource that is being listened to. Must not be used to remove - * internally added resources (i.e. only use this if you called addResource(res). - * - * @param res - */ - protected final void removeResource(final IResource res) - { - synchronized(this) - { - if (_perResourceObjects.keySet().contains(res)) - { - throw new IllegalArgumentException("Can't remove managed resources with this method"); //$NON-NLS-1$ - } - } - final LifecycleListener lifecycleListener = lazilyGetLifecycleListener(); - lifecycleListener.removeResource(res); - } - - private synchronized LifecycleListener lazilyGetLifecycleListener() - { - if (_lifecycleListener == null) - { - _lifecycleListener = new LifecycleListener(_workspace); - } - return _lifecycleListener; - } - - /** - * @author cbateman - * - * @param <MANAGEDOBJECT> - */ - protected final static class ManagedResourceObject<MANAGEDOBJECT extends IManagedObject> - { - private final MANAGEDOBJECT _managedObject; - private final MyLifecycleEventListener _eventListener; - - private ManagedResourceObject(final MANAGEDOBJECT managedObject, - final MyLifecycleEventListener eventListener) - { - _managedObject = managedObject; - _eventListener = eventListener; - } - - /** - * @return the managed object - */ - public MANAGEDOBJECT getManagedObject() - { - return _managedObject; - } - - /** - * @return the event listener - */ - public MyLifecycleEventListener getEventListener() - { - return _eventListener; - } - } - - private static class MyLifecycleEventListener<RESOURCE extends IResource, MANAGEDOBJECT extends IManagedObject> implements - IResourceLifecycleListener - { - private final RESOURCE _resource; - private final MANAGEDOBJECT _managedObject; - private final ResourceSingletonObjectManager<MANAGEDOBJECT, RESOURCE> _target; - - private MyLifecycleEventListener(final ResourceSingletonObjectManager<MANAGEDOBJECT, RESOURCE> target, - final MANAGEDOBJECT managedObject, - final RESOURCE resource) - { - _resource = resource; - _managedObject = managedObject; - _target = target; - } - - public EventResult acceptEvent(final ResourceLifecycleEvent event) - { - final EventResult result = EventResult.getDefaultEventResult(); - - // not interested - if (!_resource.equals(event.getAffectedResource())) - { - return EventResult.getDefaultEventResult(); - } - - if (event.getEventType() == EventType.RESOURCE_INACCESSIBLE) - { - try - { - if (event.getReasonType() == ReasonType.RESOURCE_DELETED - || event.getReasonType() == ReasonType.RESOURCE_PROJECT_DELETED) - { - _managedObject.destroy(); - } - else - { - _managedObject.dispose(); - } - } - // dispose/destroy is external code out our control, so make sure - // unmanage gets called if it blows up. - finally - { - _target.unmanageResource(_resource); - } - } - return result; - } - } - - - /** - * Unmanages all resources and calls checkpoint and dispose on all managed - * objects. After this call, other methods my throw exception is called. - * - * Sub-class may override, but should always call dispose after disposing - * their own specialized state. - */ - @Override - public void dispose() - { - if (_isDisposed.compareAndSet(false, true)) - { - // TODO: implement a better lock strategy on resource manager - synchronized (this) - { - Map<RESOURCE, ManagedResourceObject<MANAGEDOBJECT>> copy = new HashMap<RESOURCE, ManagedResourceObject<MANAGEDOBJECT>>( - getPerResourceObjects()); - - for (Map.Entry<RESOURCE, ManagedResourceObject<MANAGEDOBJECT>> entry : copy.entrySet()) - { - RESOURCE res = entry.getKey(); - MANAGEDOBJECT unmanagedResource = unmanageResource(res); - unmanagedResource.checkpoint(); - unmanagedResource.dispose(); - } - _perResourceObjects.clear(); - if (_lifecycleListener != null) - { - _lifecycleListener.dispose(); - } - } - } - } - - @Override - public void destroy() - { - // do nothing by default - } - - @Override - public void checkpoint() - { - // do nothing by default - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/resource/ResourceTracker.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/resource/ResourceTracker.java deleted file mode 100644 index 8f431ddbc..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/resource/ResourceTracker.java +++ /dev/null @@ -1,129 +0,0 @@ -package org.eclipse.jst.jsf.common.internal.resource; - -import java.util.concurrent.atomic.AtomicLong; - -import org.eclipse.core.resources.IResource; -import org.eclipse.jst.jsf.common.internal.managedobject.AbstractManagedObject; -import org.eclipse.jst.jsf.common.internal.resource.ResourceLifecycleEvent.EventType; -import org.eclipse.jst.jsf.common.internal.resource.ResourceLifecycleEvent.ReasonType; - -/** - * A managed object that tracks changes to a resource. - * - * @author cbateman - * @param <RESTYPE> - * - */ -public abstract class ResourceTracker<RESTYPE extends IResource> extends - AbstractManagedObject implements IResourceLifecycleListener -{ - private final RESTYPE _resource; - private final AtomicLong _lastModifiedStamp = new AtomicLong(); - - /** - * @param resource - */ - public ResourceTracker(final RESTYPE resource) - { - super(); - _resource = resource; - _lastModifiedStamp.set(resource.getModificationStamp()); - } - - /** - * @return the resource that is being tracked - */ - public final RESTYPE getResource() - { - return _resource; - } - - /** - * @return the last modificatino stamp stored for the resource. - */ - public final long getLastModifiedStamp() - { - return _lastModifiedStamp.get(); - } - - public EventResult acceptEvent(final ResourceLifecycleEvent event) - { - if (!isInteresting(event)) - { - return EventResult.getDefaultEventResult(); - } - - final EventType eventType = event.getEventType(); - - final ReasonType reasonType = event.getReasonType(); - switch (eventType) - { - case RESOURCE_ADDED: - // added resources kick an add event. - fireResourceAdded(event.getAffectedResource(), reasonType); - break; - case RESOURCE_CHANGED: - // changed resources kick a change event - fireResourceChanged(event.getAffectedResource(), reasonType); - break; - case RESOURCE_INACCESSIBLE: - // removed resources kick a remove event - fireResourceInAccessible(event.getAffectedResource(), reasonType); - break; - } - - return EventResult.getDefaultEventResult(); - } - - /** - * @param event - * @return true if this event is interesting - */ - protected boolean isInteresting(final ResourceLifecycleEvent event) - { - return _resource.equals(event.getAffectedResource()); - } - - /** - * @param affectedResource - * @param reasonType - */ - protected abstract void fireResourceInAccessible(IResource affectedResource, ReasonType reasonType); - - /** - * @param affectedResource - * @param reasonType - */ - protected abstract void fireResourceChanged(IResource affectedResource, ReasonType reasonType); - - /** - * Note that this may fire for both the new resource and it's parent - * container if both are registered by the lifecycle event. Check reasonType - * to ensure you getting the event you want: i.e. RESOURCE_ADDED vs. - * RESOURCE_ADDED_TO_CONTAINER - * - * @param affectedResource - * @param reasonType - */ - protected abstract void fireResourceAdded(IResource affectedResource, - ReasonType reasonType); - - @Override - public void dispose() - { - super.dispose(); - } - - @Override - public void checkpoint() - { - // nothing currently persisted - } - - @Override - public void destroy() - { - // nothing currently persisted - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/resource/WorkspaceMediator.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/resource/WorkspaceMediator.java deleted file mode 100644 index 7e870478d..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/resource/WorkspaceMediator.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.eclipse.jst.jsf.common.internal.resource; - -import org.eclipse.core.resources.IWorkspaceRunnable; -import org.eclipse.core.resources.WorkspaceJob; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; - -/** - * Mediates between a client and certain workspace interface. This is allows - * us to decouple from the IWorkspace interface, especially for testing. - * - * @author cbateman - * - */ -public class WorkspaceMediator -{ - /** - * @param runnable - * @param name - */ - public void runInWorkspaceJob(final IWorkspaceRunnable runnable, final String name) - { - new WorkspaceJob(name) - { - @Override - public IStatus runInWorkspace(IProgressMonitor monitor) - throws CoreException - { - runnable.run(monitor); - return Status.OK_STATUS; - } - - }.schedule(); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/strategy/AbstractIdentifiableStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/strategy/AbstractIdentifiableStrategy.java deleted file mode 100644 index 0de9778f4..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/strategy/AbstractIdentifiableStrategy.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.eclipse.jst.jsf.common.internal.strategy; - -/** - * Abstract base implementation for identifiable strategies. - * - * @author cbateman - * - * @param <INPUT> - * @param <OUTPUT> - * @param <IDTYPE> - */ -public abstract class AbstractIdentifiableStrategy<INPUT, OUTPUT, IDTYPE> implements - IIdentifiableStrategy<INPUT, OUTPUT, IDTYPE> -{ - private final IDTYPE _id; - private final OUTPUT _noResultValue; - private final String _displayName; - - /** - * @param id - * @param displayName - * @param noResultValue - */ - public AbstractIdentifiableStrategy(final IDTYPE id, final String displayName, - final OUTPUT noResultValue) - { - _id = id; - _noResultValue = noResultValue; - _displayName = displayName; - } - - public abstract OUTPUT perform(INPUT input) throws Exception; - - public OUTPUT getNoResult() - { - return _noResultValue; - } - - public IDTYPE getId() - { - return _id; - } - - public String getDisplayName() - { - return _displayName; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/strategy/AbstractTestableExtensibleDefaultProviderSelectionStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/strategy/AbstractTestableExtensibleDefaultProviderSelectionStrategy.java deleted file mode 100644 index 028da9766..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/strategy/AbstractTestableExtensibleDefaultProviderSelectionStrategy.java +++ /dev/null @@ -1,114 +0,0 @@ -package org.eclipse.jst.jsf.common.internal.strategy; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.jst.jsf.common.internal.policy.IdentifierOrderedIteratorPolicy; - -/** - * Will select in order the testable, then extension-point, then default strategies. - * <p> - * Users should use addTestableStrategy(), addExtensionStrategy(), and addDefaultStrategy() and <b>NOT</b> addStrategy() - * <p> - * Users must supply a defaultStrategy at minimum; - * <p> - * @param <INPUT> - * @param <OUTPUT> - */ -public abstract class AbstractTestableExtensibleDefaultProviderSelectionStrategy<INPUT, OUTPUT> - extends - IteratorPolicyBasedStrategyComposite<INPUT, OUTPUT, OUTPUT, String, IIdentifiableStrategy<INPUT, OUTPUT, String>> { - - private static final String TEST_STRATEGY_ID = "testInjection"; //$NON-NLS-1$ - /** - * LocatorProviderStrategy id for extension-pt - */ - private static final String EXT_PT_STRATEGY_ID = "extensionPointInjection"; //$NON-NLS-1$ - /** - * LocatorProviderStrategy id for platform default - */ - private static final String DEFAULT_STRATEGY_ID = "platformDefault"; //$NON-NLS-1$ - - /** - * Contructor - */ - protected AbstractTestableExtensibleDefaultProviderSelectionStrategy() { - super(new MyIteratorPolicy()); - } - - @Override - public OUTPUT getNoResult() { - return null; - } - - /** - * @param testStrategy - */ - public void addTestableStrategy(final ISimpleStrategy<INPUT, OUTPUT> testStrategy) { - super.addStrategy(new IdententifiableStrategyWrapper(testStrategy, TEST_STRATEGY_ID)); - } - - /** - * @param extensionStrategy - */ - public void addExtensionStrategy(final ISimpleStrategy<INPUT, OUTPUT> extensionStrategy) { - super.addStrategy(new IdententifiableStrategyWrapper(extensionStrategy, EXT_PT_STRATEGY_ID)); - } - - /** - * @param defaultStrategy - */ - public void addDefaultStrategy(final ISimpleStrategy<INPUT, OUTPUT> defaultStrategy) { - super.addStrategy(new IdententifiableStrategyWrapper(defaultStrategy, DEFAULT_STRATEGY_ID)); - } - - private class IdententifiableStrategyWrapper<INPUT, OUTPUT, String> implements IIdentifiableStrategy<INPUT, OUTPUT, String> { - - private ISimpleStrategy<INPUT, OUTPUT> _innerStrategy; - private String _id; - - IdententifiableStrategyWrapper(final ISimpleStrategy<INPUT, OUTPUT> innerStrategy, final String id) { - _innerStrategy = innerStrategy; - _id = id; - } - - public OUTPUT perform(INPUT input) throws Exception { - return _innerStrategy.perform(input); - } - - public OUTPUT getNoResult() { - return null; - } - - public String getId() { - return _id; - } - - public java.lang.String getDisplayName() { - return null; - } - - } - private static class MyIteratorPolicy extends - IdentifierOrderedIteratorPolicy<String> { - - private static List<String> _selectionOrder; - - static { - _selectionOrder = new ArrayList<String>(); - _selectionOrder - .add(TEST_STRATEGY_ID); - _selectionOrder - .add(EXT_PT_STRATEGY_ID); - _selectionOrder - .add(DEFAULT_STRATEGY_ID); - } - - public MyIteratorPolicy() { - super(_selectionOrder); - setExcludeNonExplicitValues(true); - } - - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/strategy/IIdentifiableStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/strategy/IIdentifiableStrategy.java deleted file mode 100644 index 94cf53d92..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/strategy/IIdentifiableStrategy.java +++ /dev/null @@ -1,29 +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.common.internal.strategy; - -import org.eclipse.jst.jsf.common.internal.policy.IIdentifiable; - - -/** - * A simple strategy that is identifiable - * - * @author cbateman - * - * @param <INPUT> - * @param <OUTPUT> - * @param <IDTYPE> - */ -public interface IIdentifiableStrategy<INPUT, OUTPUT, IDTYPE> - extends ISimpleStrategy<INPUT, OUTPUT>, IIdentifiable<IDTYPE> -{ - // nothing added. -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/strategy/ISimpleStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/strategy/ISimpleStrategy.java deleted file mode 100644 index 787a31090..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/strategy/ISimpleStrategy.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.common.internal.strategy; - -/** - * A strategy that takes an INPUT, performs a calculation on it, and returns - * an OUTPUT - * @author cbateman - * - * @param <INPUT> - * @param <OUTPUT> - */ -public interface ISimpleStrategy<INPUT, OUTPUT> -{ - /** - * Perform the algorithm on input and return OUTPUT. This type of - * operation should avoid side-effects, but may throw exceptions. - * - * @param input - * @return the result of the strategy algorithm - * @throws Exception implementers should narrow what exceptions are thrown. - */ - public OUTPUT perform(INPUT input) throws Exception; - - /** - * @return the single value that perform will return if it cannot calculate - * a meaningful result for an input. The value must be unique, the same - * for all inputs and must be testable using the '==' operator. - */ - public OUTPUT getNoResult(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/strategy/IteratorPolicyBasedStrategyComposite.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/strategy/IteratorPolicyBasedStrategyComposite.java deleted file mode 100644 index ff59abbfd..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/strategy/IteratorPolicyBasedStrategyComposite.java +++ /dev/null @@ -1,168 +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.common.internal.strategy; - -import java.util.Collections; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.Map; - -import org.eclipse.jst.jsf.common.JSFCommonPlugin; -import org.eclipse.jst.jsf.common.internal.policy.IIteratorPolicy; - -/** - * A strategy composite that uses an iterator policy to provide the iterator - * used to decide what order to execute the strategy in. - * - * This composite represents a grouping of strategies which represent N ways - * to perform a particular calculation and which any number for those N ways - * may be applicable to any particular situation given the policy in place. - * - * By default, the first such strategy in policy order to provide the calculation - * wins and it's result is returned. You can modify the way the result is composed - * by providing your own composition strategy using the two-arg constructor. - * - * - * - * @author cbateman - * - * @param <INPUT> - * @param <OUTPUT> - * @param <RESULTTYPE> - * @param <IDTYPE> - * @param <STRATEGYTYPE> - */ -public abstract class IteratorPolicyBasedStrategyComposite<INPUT, OUTPUT, RESULTTYPE, IDTYPE, STRATEGYTYPE extends IIdentifiableStrategy<INPUT, OUTPUT, IDTYPE>> - extends StrategyComposite<INPUT, OUTPUT, RESULTTYPE, IDTYPE, STRATEGYTYPE> -{ - private final Map<IDTYPE, STRATEGYTYPE> _strategies; - private IIteratorPolicy<IDTYPE> _policy; - private final Object _changeLock = new Object(); - - /** - * @param policy - */ - protected IteratorPolicyBasedStrategyComposite(final IIteratorPolicy<IDTYPE> policy) - { - super(); - _policy = policy; - _strategies = new LinkedHashMap<IDTYPE, STRATEGYTYPE>(); - } - - /** - * @param policy - * @param compositionStrategy - */ - protected IteratorPolicyBasedStrategyComposite(final IIteratorPolicy<IDTYPE> policy, AbstractCompositionStrategy<INPUT, OUTPUT, RESULTTYPE, STRATEGYTYPE> compositionStrategy) - { - super(compositionStrategy); - _policy = policy; - _strategies = new LinkedHashMap<IDTYPE, STRATEGYTYPE>(); - } - - /** - * Add strategy if not already present. - * - * @param strategy - */ - public final void addStrategy(final STRATEGYTYPE strategy) - { - synchronized(_changeLock) - { - _strategies.put(strategy.getId(), strategy); - } - } - - /** - * @param strategy - */ - public final void removeStrategy(final STRATEGYTYPE strategy) - { - synchronized(_changeLock) - { - _strategies.remove(strategy.getId()); - } - } - - /** - * Change the active policy used to select the order in which the composite - * calls it's child strategies. - * - * If the policy is not set, then strategies are called in - * - * @param policy - */ - public final void setPolicy(final IIteratorPolicy<IDTYPE> policy) - { - // policy may not be null - if (policy == null) - { - JSFCommonPlugin.log(new Exception("stack trace only"), "Policy can't be null"); //$NON-NLS-1$ //$NON-NLS-2$ - return; - } - - // protect access in case getIterator is being called simulataneously - synchronized(_changeLock) - { - _policy = policy; - } - } - - @Override - public final Iterator<STRATEGYTYPE> getIterator() - { - IIteratorPolicy<IDTYPE> policy = null; - Map<IDTYPE, STRATEGYTYPE> strategies = Collections.emptyMap(); - - synchronized(_changeLock) - { - policy = _policy; - strategies = Collections.unmodifiableMap(new HashMap<IDTYPE, STRATEGYTYPE>(_strategies)); - } - - final Iterator<IDTYPE> iterator = policy.getIterator(strategies.keySet()); - return new StrategyIterator<IDTYPE, STRATEGYTYPE>(strategies, iterator); - } - - @Override - public abstract RESULTTYPE getNoResult(); - - private static class StrategyIterator<IDTYPE, STRATEGYTYPE> implements - Iterator<STRATEGYTYPE> - { - private final Map<IDTYPE, STRATEGYTYPE> _map; - private final Iterator<IDTYPE> _policyIterator; - - private StrategyIterator(final Map<IDTYPE, STRATEGYTYPE> map, - final Iterator<IDTYPE> policyIterator) - { - _map = map; - _policyIterator = policyIterator; - } - - public boolean hasNext() - { - return _policyIterator.hasNext(); - } - - public STRATEGYTYPE next() - { - IDTYPE id = _policyIterator.next(); - return _map.get(id); - } - - public void remove() - { - throw new UnsupportedOperationException(); - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/strategy/MergingCompositionStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/strategy/MergingCompositionStrategy.java deleted file mode 100644 index 4e8cb428b..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/strategy/MergingCompositionStrategy.java +++ /dev/null @@ -1,213 +0,0 @@ -package org.eclipse.jst.jsf.common.internal.strategy; - -import java.util.Collection; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.eclipse.jst.jsf.common.internal.strategy.StrategyComposite.AbstractCompositionStrategy; -import org.eclipse.jst.jsf.common.internal.strategy.StrategyComposite.CompositionArguments; - -/** - * A composition strategy that merges the result of all composed strategies. The - * merge policy is left to concrete implementations. Three concrete impls are - * provided: one that uses compose all (List) and one that uses compose unique - * (Set) and a third that uses Map. - * - * @author cbateman - * - * @param <INPUT> - * @param <MERGETYPE> - * @param <STRATEGY> - */ -/** - * @author cbateman - * - * @param <INPUT> - * @param <OUTPUT> - * @param <MERGETYPE> - * @param <STRATEGY> - */ -public abstract class MergingCompositionStrategy<INPUT, OUTPUT, MERGETYPE, STRATEGY extends ISimpleStrategy<INPUT, OUTPUT>> -extends AbstractCompositionStrategy<INPUT, OUTPUT, MERGETYPE, STRATEGY> -{ - /** - * The result of the merge. - */ - protected final MERGETYPE _composedResult; - - /** - * @param composedResult - * @param noResultValue - */ - public MergingCompositionStrategy(final MERGETYPE composedResult, - final MERGETYPE noResultValue) - { - super(); - _composedResult = composedResult; - } - - @Override - public boolean compose(final CompositionArguments<INPUT, OUTPUT, STRATEGY> args) - throws Exception - { - final OUTPUT result = args.getStrategy().perform(args.getInput()); - if (result != args.getStrategy().getNoResult()) - { - doCompose(result); - } - // never stop composing early - return false; - } - - /** - * Sub-classes must implement to do the detail composition for their result - * type. - * - * @param result - */ - protected abstract void doCompose(OUTPUT result); - - @Override - public MERGETYPE getComposedResult() - { - return _composedResult; - } - - @Override - public abstract void reset(); - - /** - * An implementation that uses a List to implement the list policy. The - * result is to add all results from all composed strategies to a single - * list. Duplicates may occur. - * - * @param <INPUT> - * @param <OUTPUT> - * @param <MERGETYPE> - * @param <STRATEGY> - * ` - */ - public static class ListMergingCompositionStrategy<INPUT, OUTPUT, MERGETYPE extends List, STRATEGY extends ISimpleStrategy<INPUT, OUTPUT>> - extends - MergingCompositionStrategy<INPUT, OUTPUT, MERGETYPE, STRATEGY> - { - /** - * @param composedResult - * @param noResultValue - */ - public ListMergingCompositionStrategy(final MERGETYPE composedResult, - final MERGETYPE noResultValue) - { - super(composedResult, noResultValue); - } - - @Override - protected void doCompose(final OUTPUT result) - { - if (result instanceof Collection) - { - _composedResult.addAll((Collection) result); - } else - { - _composedResult.add(result); - } - } - - @Override - public void reset() - { - _composedResult.clear(); - } - } - - /** - * An implementation that uses a List to implement the list policy. The - * result is to add all results from all composed strategies to a single - * list. Duplicates will not occur. - * - * @param <INPUT> - * @param <OUTPUT> - * @param <MERGETYPE> - * @param <STRATEGY> - */ - public static class SetMergingCompositionStrategy<INPUT, OUTPUT, MERGETYPE extends Set, STRATEGY extends ISimpleStrategy<INPUT, OUTPUT>> - extends - MergingCompositionStrategy<INPUT, OUTPUT, MERGETYPE, STRATEGY> - { - /** - * @param composedResult - * @param noResultValue - */ - public SetMergingCompositionStrategy(final MERGETYPE composedResult, - final MERGETYPE noResultValue) - { - super(composedResult, noResultValue); - } - - @Override - protected void doCompose(final OUTPUT result) - { - if (result instanceof Collection) - { - _composedResult.addAll((Collection) result); - } else - { - _composedResult.add(result); - } - } - - @Override - public void reset() - { - _composedResult.clear(); - } - } - - /** - * @author cbateman - * - * @param <INPUT> - * @param <OUTPUT> - * @param <MERGETYPE> - * @param <STRATEGY> - */ - public abstract static class MapMergingCompositionStrategy<INPUT, OUTPUT, MERGETYPE extends Map, STRATEGY extends ISimpleStrategy<INPUT, OUTPUT>> - extends - MergingCompositionStrategy<INPUT, OUTPUT, MERGETYPE, STRATEGY> - { - /** - * @param composedResult - * @param noResultValue - */ - public MapMergingCompositionStrategy(final MERGETYPE composedResult, - final MERGETYPE noResultValue) - { - super(composedResult, noResultValue); - } - - @Override - protected void doCompose(final OUTPUT result) - { - if (result instanceof Map) - { - _composedResult.putAll((Map) result); - } else - { - _composedResult.put(calculateKey(result), result); - } - } - - /** - * @param result - * @return the key to be used for result in any composed map. - */ - protected abstract Object calculateKey(final OUTPUT result); - - @Override - public void reset() - { - _composedResult.clear(); - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/strategy/SimpleStrategyComposite.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/strategy/SimpleStrategyComposite.java deleted file mode 100644 index 25c567af7..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/strategy/SimpleStrategyComposite.java +++ /dev/null @@ -1,83 +0,0 @@ -package org.eclipse.jst.jsf.common.internal.strategy; - -import java.util.Collection; -import java.util.Collections; -import java.util.Iterator; - -/** - * A simple concrete implementation that uses a constructor provided values - * to implement abstract methods. - * - * @author cbateman - * - * @param <INPUT> - * @param <OUTPUT> - * @param <RESULTTYPE> - * @param <IDTYPE> - * @param <STRATEGYTYPE> - */ -public class SimpleStrategyComposite<INPUT, OUTPUT, RESULTTYPE, IDTYPE, STRATEGYTYPE extends IIdentifiableStrategy<INPUT,OUTPUT,IDTYPE>> extends -StrategyComposite<INPUT, OUTPUT, RESULTTYPE, IDTYPE, STRATEGYTYPE> -{ - - private final RESULTTYPE _noResultValue; - private final Collection<STRATEGYTYPE> _strategies; - - /** - * Use the list of strategies and null as the no result value. - * @param strategies - */ - public SimpleStrategyComposite(final Collection<STRATEGYTYPE> strategies) - { - this(strategies, (RESULTTYPE) null); - } - /** - * Use the list of strategies and the provided no result value. - * @param strategies - * @param noResultValue - */ - public SimpleStrategyComposite(final Collection<STRATEGYTYPE> strategies, final RESULTTYPE noResultValue) - { - super(); - _strategies = strategies; - _noResultValue = noResultValue; - } - - /** - * Use the provided strategies, composition strategy and null for the no result value - * @param strategies - * @param compositionStrategy - */ - public SimpleStrategyComposite(final Collection<STRATEGYTYPE> strategies, - final AbstractCompositionStrategy<INPUT, OUTPUT, RESULTTYPE, STRATEGYTYPE> compositionStrategy) - { - this(strategies, null, compositionStrategy); - } - - /** - * Use the provided strategies, composition strategy and null for the no result value - * @param strategies - * @param noResultValue - * @param compositionStrategy - */ - public SimpleStrategyComposite(final Collection<STRATEGYTYPE> strategies, final RESULTTYPE noResultValue, - final AbstractCompositionStrategy<INPUT, OUTPUT, RESULTTYPE, STRATEGYTYPE> compositionStrategy) - { - super(compositionStrategy); - _strategies = strategies; - _noResultValue = noResultValue; - } - - @Override - public RESULTTYPE getNoResult() - { - return _noResultValue; - } - - @Override - public Iterator<STRATEGYTYPE> getIterator() - { - return Collections.unmodifiableCollection(_strategies).iterator(); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/strategy/StrategyComposite.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/strategy/StrategyComposite.java deleted file mode 100644 index c7842c038..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/strategy/StrategyComposite.java +++ /dev/null @@ -1,240 +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.common.internal.strategy; - -import java.util.Iterator; - -import org.eclipse.jst.jsf.common.JSFCommonPlugin; - -/** - * A composite strategy whos role is to iterate through a number of child - * stategies until one returns a valid value for an input. - * - * @author cbateman - * - * @param <INPUT> - * @param <OUTPUT> - * @param <RESULTOUTPUT> - * @param <IDTYPE> - * @param <STRATEGYTYPE> - */ -public abstract class StrategyComposite<INPUT, OUTPUT, RESULTOUTPUT, IDTYPE, STRATEGYTYPE extends IIdentifiableStrategy<INPUT, OUTPUT, IDTYPE>> -implements ISimpleStrategy<INPUT, RESULTOUTPUT> -{ - private final AbstractCompositionStrategy<INPUT, OUTPUT, RESULTOUTPUT, STRATEGYTYPE> _compositionStrategy; - - /** - * @param compositionStrategy - */ - protected StrategyComposite( - final AbstractCompositionStrategy<INPUT, OUTPUT, RESULTOUTPUT, STRATEGYTYPE> compositionStrategy) - { - _compositionStrategy = compositionStrategy; - } - - /** - * Default constructor: composite returns the first value found. - */ - protected StrategyComposite() - { - // by default, the composition strategy selects the first value - this( - new DefaultCompositionStrategy<INPUT, OUTPUT, RESULTOUTPUT, STRATEGYTYPE>()); - } - - public final RESULTOUTPUT perform(final INPUT input) - { - final Iterator<STRATEGYTYPE> sIt = getIterator(); - - RESULTOUTPUT result = getNoResult(); - boolean finishedComposing = false; - - EXECUTE_LOOP: while (sIt.hasNext()) - { - final STRATEGYTYPE strategy = sIt.next(); - try - { - finishedComposing = _compositionStrategy - .compose(new CompositionArguments<INPUT, OUTPUT, STRATEGYTYPE>( - strategy, input)); - // returns true if we are done composing - if (finishedComposing) - { - result = _compositionStrategy.getComposedResult(); - break EXECUTE_LOOP; - } - } catch (final Exception e) - { - JSFCommonPlugin.log(e); - } - } - - if (finishedComposing) - { - return result; - } - return getNoResult(); - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.jst.jsf.common.internal.strategy.ISimpleStrategy#getNoResult - * () - */ - public abstract RESULTOUTPUT getNoResult(); - - /** - * @return an iterator that will return the next strategy to be executed - */ - public abstract Iterator<STRATEGYTYPE> getIterator(); - - /** - * @author cbateman - * @param <INPUT> - * @param <OUTPUT> - * @param <RESULTOUTPUT> - * @param <STRATEGY> - */ - public abstract static class AbstractCompositionStrategy<INPUT, OUTPUT, RESULTOUTPUT, STRATEGY extends ISimpleStrategy<INPUT, OUTPUT>> - implements ISimpleStrategy<CompositionArguments<INPUT, OUTPUT, STRATEGY>, Boolean> - { - private final Boolean _noResultValue; - - /** - * - */ - protected AbstractCompositionStrategy() - { - _noResultValue = null; - reset(); - } - - /** - * @param input - * @return true if composing is finished based on the input, false - * otherwise - * @throws Exception - */ - public abstract boolean compose(CompositionArguments<INPUT, OUTPUT, STRATEGY> input) throws Exception; - - @SuppressWarnings("boxing") - public final Boolean perform(final CompositionArguments<INPUT, OUTPUT, STRATEGY> input) throws Exception - { - return compose(input); - } - - /** - * @return the result of composing. - */ - public abstract RESULTOUTPUT getComposedResult(); - - public Boolean getNoResult() - { - return _noResultValue; - } - - /** - * Clear any composed result and make strategy reusable as if it were - * newly constructed. This method is only called automatically at construction. - * - * Owners should call to control the contents of their result list. - */ - public abstract void reset(); - } - - /** - * The default composition strategy. This causes the first strategy that returns - * a non-NoResult value to have it's value returned. - * - * @param <INPUT> - * @param <OUTPUT> - * @param <RESULTOUTPUT> - * @param <STRATEGY> - */ - public final static class DefaultCompositionStrategy<INPUT, OUTPUT, RESULTOUTPUT, STRATEGY extends ISimpleStrategy<INPUT, OUTPUT>> - extends AbstractCompositionStrategy<INPUT, OUTPUT, RESULTOUTPUT, STRATEGY> - { - private RESULTOUTPUT _result; - - /** - * - */ - public DefaultCompositionStrategy() - { - super(); - } - - @Override - public boolean compose(final CompositionArguments<INPUT, OUTPUT, STRATEGY> arg) throws Exception - { - final OUTPUT result = arg.getStrategy().perform(arg.getInput()); - if (result != arg.getStrategy().getNoResult()) - { - _result = (RESULTOUTPUT)result; - return true; - } - return false; - } - - @Override - public RESULTOUTPUT getComposedResult() - { - return _result; - } - - @Override - public void reset() - { - _result = null; - } - } - - /** - * Bundle values needed by the composing strategies into a single arg object. - * - * @param <INPUT> - * @param <OUTPUT> - * @param <STRATEGY> - */ - public final static class CompositionArguments<INPUT, OUTPUT, STRATEGY extends ISimpleStrategy<INPUT, OUTPUT>> - { - private final STRATEGY _strategy; - private final INPUT _input; - - /** - * @param strategy - * @param input - */ - public CompositionArguments(final STRATEGY strategy, final INPUT input) - { - _strategy = strategy; - _input = input; - } - - /** - * @return the strategy - */ - public STRATEGY getStrategy() - { - return _strategy; - } - - /** - * @return the input - */ - public INPUT getInput() - { - return _input; - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/strategy/TestableProjectFactoryStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/strategy/TestableProjectFactoryStrategy.java deleted file mode 100644 index 7028bf74d..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/strategy/TestableProjectFactoryStrategy.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.eclipse.jst.jsf.common.internal.strategy; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.QualifiedName; - - -/** - * Abstract class that, when given a project session key, - * will provide the instance of OUTPUT to use, or no result - * <p> - * Users need only set the project session property with the key and OUTPUT instance - * @param <OUTPUT> - */ -public abstract class TestableProjectFactoryStrategy<OUTPUT> implements ISimpleStrategy<IProject, OUTPUT> { - private QualifiedName _key; - - /** - * @param testableFactorySessionKey - project property session key for property value holding testable instance - */ - public TestableProjectFactoryStrategy(final QualifiedName testableFactorySessionKey) { - _key = testableFactorySessionKey; - } - - public OUTPUT perform(final IProject project) throws Exception { - if (_key != null && project != null) { - final Object factory = project.getSessionProperties().get(_key); - if (factory != null) - return (OUTPUT)factory; - } - return getNoResult(); - } - - public OUTPUT getNoResult() { - return null; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/strategy/TestableResourceFactoryStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/strategy/TestableResourceFactoryStrategy.java deleted file mode 100644 index c935e011a..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/strategy/TestableResourceFactoryStrategy.java +++ /dev/null @@ -1,43 +0,0 @@ -package org.eclipse.jst.jsf.common.internal.strategy; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.QualifiedName; - - -/** - * Copy of {@link TestableProjectFactoryStrategy} except that this can accept IResources - * - * An abstract class that, when given a project resource and a project session key, - * will provide the instance of OUTPUT to use, or, - * no result will be returned if the resource is not a project. - * <p> - * Users need only set the project session property with the key and OUTPUT instance - * @param <OUTPUT> - */ -public abstract class TestableResourceFactoryStrategy<OUTPUT> implements ISimpleStrategy<IResource, OUTPUT> { - private QualifiedName _key; - - /** - * @param testableFactorySessionKey - project property session key for property value holding testable instance - */ - public TestableResourceFactoryStrategy(final QualifiedName testableFactorySessionKey) { - _key = testableFactorySessionKey; - } - - public OUTPUT perform(final IResource resource) throws Exception { - if (_key != null && resource != null) { - if (resource instanceof IProject) { - final Object factory = ((IProject)resource).getSessionProperties().get(_key); - if (factory != null) - return (OUTPUT)factory; - } - } - return getNoResult(); - } - - public OUTPUT getNoResult() { - return null; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/BooleanLiteralType.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/BooleanLiteralType.java deleted file mode 100644 index 6055e5f50..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/BooleanLiteralType.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: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.common.internal.types; - -import org.eclipse.jdt.core.Signature; - -/** - * Represents a BooleanLiteral as defined by JSP.2.9 - * - * @author cbateman - * - */ -public class BooleanLiteralType extends LiteralType -{ - /** - * The literal FALSE singleton - */ - public final static BooleanLiteralType FALSE = new BooleanLiteralType(false); - /** - * The literal TRUE singleton - */ - public final static BooleanLiteralType TRUE = new BooleanLiteralType(true); - - private final boolean _literalValue; - - - /** - * @param value - * @return a constant boolean literal type corresponding to value - */ - public static BooleanLiteralType valueOf(boolean value) - { - return value ? TRUE : FALSE; - } - - /** - * @param literalValue - */ - /*package*/BooleanLiteralType(boolean literalValue) - { - super(Signature.SIG_BOOLEAN); - _literalValue = literalValue; - } - - public Number coerceToNumber(Class T) throws TypeCoercionException - { - // illegal to coerce boolean to number per JSP.2.8.3 step 3 - throw new TypeCoercionException("Cannot coerce boolean to number"); //$NON-NLS-1$ - } - - public String getLiteralValue() - { - return Boolean.toString(_literalValue); - } - - public Object getLiteralValueRaw() - { - return Boolean.valueOf(_literalValue); - } - - public Boolean coerceToBoolean() throws TypeCoercionException - { - return Boolean.valueOf(_literalValue); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/CompositeType.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/CompositeType.java deleted file mode 100644 index 9069f056d..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/CompositeType.java +++ /dev/null @@ -1,172 +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.common.internal.types; - -import org.eclipse.jdt.core.Signature; - - -/** - * Encapsulates the runtime type or types of a JSF entity in a - * way that can be compared to other entities - * - * @author cbateman - * - */ -public class CompositeType -{ - private final String[] _signatures; - private final int _assignmentType; - - private boolean[] _isTypeSignature; // = null lazily derived from signatures - // on first access - /** - * @param signatureStrings - * @param assignmentType - */ - public CompositeType(String[] signatureStrings, int assignmentType) - { - if (signatureStrings == null - || signatureStrings.length < 1) - { - throw new AssertionError("Must specify at least one signature string"); //$NON-NLS-1$ - } - - _signatures = new String[signatureStrings.length]; - System.arraycopy(signatureStrings, 0, _signatures, 0, _signatures.length); - _assignmentType = assignmentType; - } - - /** - * Convenience constructor for most common case where composite only - * consistes of a single type signature - * - * @param signatureString - * @param assignmentType - */ - public CompositeType(String signatureString, int assignmentType) - { - this(new String[]{signatureString}, assignmentType); - } - /** - * @return the assignment type mask - */ - public int getAssignmentTypeMask() - { - return _assignmentType; - } - - /** - * @return true if the composite type supports being on the LHS of an - * assignment - */ - public boolean isLHS() - { - return TypeUtil.matchesLHS(_assignmentType); - } - - /** - * @return true if the composite type supports being on the RHS of an - * assignment - */ - public boolean isRHS() - { - return TypeUtil.matchesRHS(_assignmentType); - } - - /** - * @return an array of booleans. The value in each index of the array - * is true if the corresponding position _signatures corresponds to a type - * signature and false if it's a method signature - */ - public boolean[] getIsTypeSignature() - { - return getTypeSignatureFlags(); - } - - /** - * @return the type signatures. Changes to the returned form do not - * affect the internal values - */ - public String[] getSignatures() - { - final String[] copy = new String[_signatures.length]; - System.arraycopy(_signatures, 0, copy, 0, _signatures.length); - return copy; - } - - public String toString() - { - final StringBuffer stringBuffer = new StringBuffer(); - - for (int i = 0; i < _signatures.length; i++) - { - stringBuffer.append(_signatures[i]); - stringBuffer.append(" | "); //$NON-NLS-1$ - } - - return stringBuffer.toString(); - } - - /** - * @return a version of to string with of the type signatures replaced - * with their more Javaeseque names - */ - public String toUserReadableString() - { - final StringBuffer stringBuffer = new StringBuffer(); - - for (int i = 0; i < _signatures.length; i++) - { - final String signature = _signatures[i]; - - if (getTypeSignatureFlags()[i]) - { - stringBuffer.append(Signature.getSignatureSimpleName(signature)); - } - - if (i < _signatures.length -1) - { - stringBuffer.append(", "); //$NON-NLS-1$ - } - } - return stringBuffer.toString(); - } - - private boolean[] getTypeSignatureFlags() - { - if (_isTypeSignature == null) - { - _isTypeSignature = new boolean[_signatures.length]; - - for (int i = 0; i < _signatures.length; i++) - { - try - { - Signature.getTypeSignatureKind(_signatures[i]); - - // if an exception wasn't thrown above, then it - // is some sort of type signature - _isTypeSignature[i] = true; - } - catch (IllegalArgumentException ae) - { - // getTypeSignatureKind threw an exception, so - // this signature is a method - _isTypeSignature[i] = false; - } - } - } - - return _isTypeSignature; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/CompositeTypeCoercer.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/CompositeTypeCoercer.java deleted file mode 100644 index 5f2aff492..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/CompositeTypeCoercer.java +++ /dev/null @@ -1,124 +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.common.internal.types; - - -/** - * Follows type coercion rules codified in section JSP.2.8 of the - * JSP 2.0 Specification. - * - * This class operates on CompositeType's and returns raw - * Java signatures for the single resulting type coercion. - * - * The rules are stretched a little bit since JSP.2.8 defines how to - * coerce an *instance* A to a type T. But since we have no runtime instances, - * only their types, we approximate by taking what we know about the type of A - * and coercing it T as best we can. - * - * Also, whereas the spec says to throw errors when coercion is not possible, - * we have two cases: - * - * 1) We can determine definitively that there is no coercion - * 2) We cannot determine whether there is or isn't a coercion - * - * In case 1, we always throw an exception. In case 2, we return null to indicate - * "indeterminate" result, rather than error. - * - * @author cbateman - * - */ -public class CompositeTypeCoercer -{ - /** - * This method follows JSP.2.8.3 except that rather than returning a specific - * type that has been coerced to, it determines the most exact possible type - * that typeOfA can be coerced to, to be number compatible. The caller must - * decide what do with the return value compared to the type (N in the spec) - * that they want to coerce to. - * - * @param typeOfA - * @return a new signature for the type of A after being coerced to a Number - * @throws TypeCoercionException if A can definitively not be coerced to - * a number - */ - public static String coerceToNumber(final CompositeType typeOfA) - throws TypeCoercionException - { - String coercedType = null; - boolean errorDetected = true; // assume error: only false if we - // find a member of typeOfA that - // coerces to number - - // JSP.2.8.1 -- auto-box primitives - final CompositeType boxedTypeOfA = - TypeTransformer.transformBoxPrimitives(typeOfA); - final boolean[] typesigs = boxedTypeOfA.getIsTypeSignature(); - - // iterate through all of the signatures that represent types - // and find at least one that can be coerced to a number - for (int i = 0; i < typesigs.length; i++) - { - if (typesigs[i]) - { - try - { - final String testType = - TypeCoercer.coerceToNumber(boxedTypeOfA.getSignatures()[i]); - - if (testType != null) - { - // if we have already found a coercible type, then - // we need to return null, since we have a conflict that - // we don't know how to resolve to a type?????? - if (coercedType != null) - { - return null; - } - - coercedType = testType; - } - errorDetected = false; // we have found a number coercion or indeterminate - } - catch (TypeCoercionException tce) - { - // do nothing: so far error still detected - } - } - } - - // we have three choices: - // 1: if errorDetected was never cleared, we definitely never found - // a coerceable type, so throw exception - if (errorDetected) - { - throw new TypeCoercionException(); - } - - // otherwise the flag was cleared return what we found - if (coercedType != null) - { - // need to unbox per JSP.2.8.1 - coercedType = - TypeTransformer.transformUnboxPrimitives(coercedType); - } - - return coercedType; - } - - -// public static String coerceToBoolean(CompositeType compositeType) -// { -// -// } - -}
\ No newline at end of file diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/FloatLiteralType.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/FloatLiteralType.java deleted file mode 100644 index 5631b8700..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/FloatLiteralType.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.common.internal.types; - -import java.math.BigDecimal; -import java.math.BigInteger; - -import org.eclipse.jdt.core.Signature; - -/** - * Represents an FloatLiteral as defined by JSP.2.9 - * @author cbateman - * - */ -public class FloatLiteralType extends NumericTypeLiteral -{ - private final double _literalValue; - - /** - * @param literalValue - */ - public FloatLiteralType(double literalValue) - { - // according to the notes to JSP.2.9, bullet 5, float literals are doubles - super(Signature.SIG_DOUBLE); - _literalValue = literalValue; - } - - protected Number getBoxedValue() - { - return new Double(_literalValue); - } - - public Number coerceToNumber(Class T) throws TypeCoercionException - { - if (T == BigInteger.class) - { - return new BigDecimal(_literalValue).toBigInteger(); - } - else if (T == BigDecimal.class) - { - return new BigDecimal(_literalValue); - } - - Number commonCoercion = super.coerceToNumber(T); - - if (commonCoercion == null) - { - throw new IllegalArgumentException("Not a target numeric type: "+T); //$NON-NLS-1$ - } - - return commonCoercion; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/IAssignable.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/IAssignable.java deleted file mode 100644 index 8b74dfd85..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/IAssignable.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: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.common.internal.types; - -/** - * Defines the lhs/rhs rules for a type - * @author cbateman - * - */ -public interface IAssignable -{ - /** - * Type is none: it cannot be assigned to. method binding. - */ - public static int ASSIGNMENT_TYPE_NONE = 0x0; - /** - * Type is lhs: it can be assigned to - */ - public static int ASSIGNMENT_TYPE_LHS = 0x1; - - /** - * Type is rhs: it can be assigned from - */ - public static int ASSIGNMENT_TYPE_RHS = 0x2; - - /** - * @return the assigment mask - */ - public int getAssignability(); - - /** - * @return true if ASSIGNMENT_TYPE_LHS is set in getAssignability - */ - public boolean isLHS(); - /** - * @return true if ASSIGNMENT_TYPE_RHS is set in getAssignability - */ - public boolean isRHS(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/IntegerLiteralType.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/IntegerLiteralType.java deleted file mode 100644 index d7a3be803..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/IntegerLiteralType.java +++ /dev/null @@ -1,73 +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.common.internal.types; - -import java.math.BigDecimal; -import java.math.BigInteger; - -import org.eclipse.jdt.core.Signature; - -/** - * Represents a IntegerLiteral as defined by JSP.2.9 - * @author cbateman - * - */ -public class IntegerLiteralType extends NumericTypeLiteral -{ - /** - * A singleton for zero literals - */ - public final static IntegerLiteralType ZERO = new IntegerLiteralType(0); - - private final long _literalValue; - - /** - * @param literalValue - */ - public IntegerLiteralType(long literalValue) - { - // according to the notes to JSP.2.9, bullet 4, integer literals are longs - super(Signature.SIG_LONG); - _literalValue = literalValue; - } - - protected Number getBoxedValue() - { - return Long.valueOf(_literalValue); - } - - /** - * Per JSP.2.8.3, step 5 - * @see org.eclipse.jst.jsf.common.internal.types.LiteralType#coerceToNumber(java.lang.Class) - */ - public Number coerceToNumber(Class T) throws TypeCoercionException - { - if (T == BigInteger.class) - { - return BigInteger.valueOf(_literalValue); - } - else if (T == BigDecimal.class) - { - return BigDecimal.valueOf(_literalValue); - } - - Number commonCoercion = super.coerceToNumber(T); - - if (commonCoercion == null) - { - throw new IllegalArgumentException("Not a target numeric type: "+T); //$NON-NLS-1$ - } - - return commonCoercion; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/LiteralType.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/LiteralType.java deleted file mode 100644 index 3ea6de53c..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/LiteralType.java +++ /dev/null @@ -1,80 +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.common.internal.types; - - -/** - * Encodes a type signature and a string that has some literal value based on - * the type signature. The class represents only a value object -- no attempt - * is made to assert that the literalValue is really of the type specified. - * - * @author cbateman - * - */ -public abstract class LiteralType extends ValueType -{ - - /** - * Consider a new literal type - * - * @param signature - */ - protected LiteralType(final String signature) - { - super(signature, IAssignable.ASSIGNMENT_TYPE_RHS); - } - - /** - * @return the literal value string (unparsed) - */ - public abstract String getLiteralValue(); - - /** - * @return the actual untranslated literal value as an object - */ - public abstract Object getLiteralValueRaw(); - - /** - * @return the type signature - */ - public final String getSignature() { - return super.getSignature(); - } - - /** - * @return a type signature for the kind of number this literal will coerce - * into when asked to become a number or null if this cannot be determined - * @throws TypeCoercionException if this literal has no legal coercion into - * a number - */ - public String getNumberCoercion() throws TypeCoercionException - { - // always box before coercion - return - TypeCoercer.coerceToNumber( - TypeTransformer.transformBoxPrimitives(getSignature())); - } - - /** - * @param T - * @return a Number coercion of the literal's value, null if indeterminate - * @throws TypeCoercionException if the coercion is illegal - */ - public abstract Number coerceToNumber(Class T) throws TypeCoercionException; - - /** - * @return a Boolean coercion of the literal's value, null if indeterminate - * @throws TypeCoercionException if the coercion is illegal - */ - public abstract Boolean coerceToBoolean() throws TypeCoercionException; -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/Messages.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/Messages.java deleted file mode 100644 index b3db7a5e6..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/Messages.java +++ /dev/null @@ -1,42 +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.common.internal.types; - -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -/** - * Message bundle - * - */ -public class Messages { - private static final String BUNDLE_NAME = "org.eclipse.jst.jsf.common.internal.types.messages"; //$NON-NLS-1$ - - private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle - .getBundle(BUNDLE_NAME); - - private Messages() { - // no external construction - } - - /** - * @param key - * @return the 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.common/src/org/eclipse/jst/jsf/common/internal/types/MethodType.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/MethodType.java deleted file mode 100644 index 38e47b0c6..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/MethodType.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.common.internal.types; - -/** - * Signature type for method bindings in an EL expression - * - * @author cbateman - * - */ -public class MethodType implements SignatureBasedType -{ - private final String _methodName; - private final String _signature; - - /** - * @param methodName - * @param signature - */ - public MethodType(final String methodName, final String signature) - { - _methodName = methodName; - _signature = signature; - } - - /** - * @see org.eclipse.jst.jsf.common.internal.types.SignatureBasedType#getSignature() - */ - public String getSignature() - { - return _signature; - } - - /** - * @return the method name signature - */ - public String getMethodName() - { - return _methodName; - } - - public CompositeType toCompositeType() - { - return new CompositeType(_signature, IAssignable.ASSIGNMENT_TYPE_NONE); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/NullLiteralType.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/NullLiteralType.java deleted file mode 100644 index eeb43e69d..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/NullLiteralType.java +++ /dev/null @@ -1,110 +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.common.internal.types; - -import java.math.BigDecimal; -import java.math.BigInteger; - -/** - * Represents a NullLiteralType per JSP.2.9 - * - * @author cbateman - * - */ -public class NullLiteralType extends LiteralType -{ - /** - * The singleton null literal - */ - public final static NullLiteralType SINGLETON = new NullLiteralType(); - - /** - * Construct a new null - */ - private NullLiteralType() - { - super(TypeConstants.TYPE_NULL); // use void to indicate null in this situation - } - - /** - * Per JSP.2.8.5 null is always false - * - * @see org.eclipse.jst.jsf.common.internal.types.LiteralType#coerceToBoolean() - */ - public Boolean coerceToBoolean() throws TypeCoercionException - { - return Boolean.FALSE; - } - - /** - * Per JSP.2.8.3, null is always 0 - * - * @see org.eclipse.jst.jsf.common.internal.types.LiteralType#coerceToNumber(java.lang.Class) - */ - public Number coerceToNumber(Class T) throws TypeCoercionException { - if (T == BigInteger.class) - { - return BigInteger.ZERO; - } - else if (T == BigDecimal.class) - { - return new BigDecimal(0.0); - } - else if (T == Double.class || T == Double.TYPE) - { - return new Double(0.0); - } - else if (T == Float.class || T == Float.TYPE) - { - return new Float(0.0); - } - else if (T == Long.class || T == Long.TYPE) - { - return Long.valueOf(0L); - } - else if (T == Integer.class || T == Integer.TYPE) - { - return Integer.valueOf(0); - } - else if (T == Short.class || T == Short.TYPE) - { - return Short.valueOf((short)0); - } - else if (T == Byte.class || T == Byte.TYPE) - { - return Byte.valueOf((byte)0); - } - else - { - throw new IllegalArgumentException("Not a target numeric type: "+T); //$NON-NLS-1$ - } - } - - /** - * Per JSP.2.8.2 null is always an empty string - * @see org.eclipse.jst.jsf.common.internal.types.LiteralType#getLiteralValue() - */ - public String getLiteralValue() - { - return ""; //$NON-NLS-1$ - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.core.internal.types.LiteralType#getLiteralValueRaw() - */ - public Object getLiteralValueRaw() - { - return null; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/NumericTypeLiteral.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/NumericTypeLiteral.java deleted file mode 100644 index 8b6acbe05..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/NumericTypeLiteral.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: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.common.internal.types; - - -/** - * Common super-type for Float and Integer literals - * @author cbateman - * - */ -public abstract class NumericTypeLiteral extends LiteralType -{ - /** - * @param signature - */ - protected NumericTypeLiteral(String signature) - { - super(signature); - } - - /** - * @return the boxed form of the numeric literal value - */ - protected abstract Number getBoxedValue(); - - public Number coerceToNumber(Class T) throws TypeCoercionException - { - Number boxedLiteralValue = getBoxedValue(); - - if (T == Double.class || T == Double.TYPE) - { - return new Double(boxedLiteralValue.doubleValue()); - } - else if (T == Float.class || T == Float.TYPE) - { - return new Float(boxedLiteralValue.floatValue()); - } - else if (T == Long.class || T == Long.TYPE) - { - return boxedLiteralValue; - } - else if (T == Integer.class || T == Integer.TYPE) - { - return Integer.valueOf(boxedLiteralValue.intValue()); - } - else if (T == Short.class || T == Short.TYPE) - { - return Short.valueOf(boxedLiteralValue.shortValue()); - } - else if (T == Byte.class || T == Byte.TYPE) - { - return Byte.valueOf(boxedLiteralValue.byteValue()); - } - else - { - return null; - } - } - - public String getLiteralValue() - { - return getBoxedValue().toString(); - } - - public Object getLiteralValueRaw() - { - return getBoxedValue(); - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.core.internal.types.LiteralType#coerceToBoolean() - */ - public Boolean coerceToBoolean() throws TypeCoercionException { - // JSP.2.8.5 does not provide for number -> boolean coercion - throw new TypeCoercionException("Cannot coerce number to boolean"); //$NON-NLS-1$ - } - - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/SignatureBasedType.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/SignatureBasedType.java deleted file mode 100644 index 41e2bb482..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/SignatureBasedType.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: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.common.internal.types; - -/** - * Defines a signature-based type. Signatures must conform to the JVM - * type signature format as defined in the JVM specs and in the JDT Signature - * class - * - * @author cbateman - * - */ -public interface SignatureBasedType -{ - /** - * @return the signature string - */ - public String getSignature(); - - /** - * @return a version of the this type in CompositeType form - */ - public CompositeType toCompositeType(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/StringLiteralType.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/StringLiteralType.java deleted file mode 100644 index 2e887fde9..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/StringLiteralType.java +++ /dev/null @@ -1,131 +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.common.internal.types; - -import java.math.BigDecimal; -import java.math.BigInteger; - -/** - * Represents a StringLiteral as defined by JSP.2.9 - * - * @author cbateman - */ -public class StringLiteralType extends LiteralType -{ - private final String _literalValue; - - /** - * @param value - */ - public StringLiteralType(String value) - { - super(TypeConstants.TYPE_STRING); - _literalValue = value; - } - - public Number coerceToNumber(Class T) throws TypeCoercionException - { - try - { - if (T == BigInteger.class) - { - if ("".equals(_literalValue)) //$NON-NLS-1$ - { - return BigInteger.ZERO; - } - return new BigInteger(_literalValue); - } - else if (T == BigDecimal.class) - { - if ("".equals(_literalValue)) //$NON-NLS-1$ - { - return new BigDecimal(0.0); - } - return new BigDecimal(_literalValue); - } - else if (T == Double.class || T == Double.TYPE) - { - if ("".equals(_literalValue)) //$NON-NLS-1$ - { - return new Double(0.0); - } - - return Double.valueOf(_literalValue); - } - else if (T == Float.class || T == Float.TYPE) - { - if ("".equals(_literalValue)) //$NON-NLS-1$ - { - return new Float(0.0); - } - return Float.valueOf(_literalValue); - } - else if (T == Long.class || T == Long.TYPE) - { - if ("".equals(_literalValue)) //$NON-NLS-1$ - { - return Long.valueOf(0L); - } - return Long.valueOf(_literalValue); - } - else if (T == Integer.class || T == Integer.TYPE) - { - if ("".equals(_literalValue)) //$NON-NLS-1$ - { - return Integer.valueOf(0); - } - return Integer.valueOf(_literalValue); - } - else if (T == Short.class || T == Short.TYPE) - { - if ("".equals(_literalValue)) //$NON-NLS-1$ - { - return Short.valueOf((short)0); - } - return Short.valueOf(_literalValue); - } - else if (T == Byte.class || T == Byte.TYPE) - { - if ("".equals(_literalValue)) //$NON-NLS-1$ - { - return Byte.valueOf((byte)0); - } - return Byte.valueOf(_literalValue); - } - else - { - throw new IllegalArgumentException("Not a target numeric type: "+T); //$NON-NLS-1$ - } - } - catch (NumberFormatException nfe) - { - throw new TypeCoercionException(nfe); - } - } - - public String getLiteralValue() - { - return _literalValue; - } - - public Object getLiteralValueRaw() - { - return _literalValue; - } - - public Boolean coerceToBoolean() throws TypeCoercionException - { - // JSP.2.8.5 - return Boolean.valueOf(_literalValue); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/TypeCoercer.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/TypeCoercer.java deleted file mode 100644 index fa75a12f9..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/TypeCoercer.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: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.common.internal.types; - -import org.eclipse.jdt.core.Signature; - -/** - * Coercer for simple type signatures - * - * @author cbateman - * - */ -public class TypeCoercer -{ - - /** - * Based on JSP.2.8.3 in JSP 2.0 specification - * - * @param boxedTypeSignature -- an auto-boxed type signature - * @return the coerced type or null if cannot be resolved. No unboxing - * is performed on the return. - * @throws TypeCoercionException if boxedTypeSignature is - */ - public static String coerceToNumber(final String boxedTypeSignature) - throws TypeCoercionException - { - String boxedTypeSignature_ = boxedTypeSignature; - - // can't coerce arrays to numbers - if (Signature.getTypeSignatureKind(boxedTypeSignature_) - == Signature.ARRAY_TYPE_SIGNATURE) - { - throw new TypeCoercionException("Cannot coerce arrays to numbers"); //$NON-NLS-1$ - } - // if it's character, pre-coerce to short per step 2 - if (TypeConstants.SIGNATURE_BOXED_CHARACTER.equals(boxedTypeSignature)) - { - boxedTypeSignature_ = TypeConstants.TYPE_BOXED_SHORT; - } - - if (TypeCoercer.typeIsNumeric(boxedTypeSignature_) - || TypeCoercer.typeIsNull(boxedTypeSignature_)) - { - return boxedTypeSignature_; - } - else if (typeIsString(boxedTypeSignature_)) - { - // undetermined a string may or not resolve to a number - // depending on its runtime value - return null; - } - else - { - throw new TypeCoercionException(); - } - } - - /** - * @param boxedTypeSignature - * @return true if type can be coerced to boolean; null if indeterminate - */ - public static boolean canCoerceToBoolean(String boxedTypeSignature) - { - // JSP.2.8.5 -- boolean is always boolean; string is converted by Boolean.valueOf(String) - if (typeIsBoolean(boxedTypeSignature) - || typeIsString(boxedTypeSignature) - || typeIsNull(boxedTypeSignature)) - { - return true; - } - // nothing else really convertible besides null - return false; - } - - /** - * @param typeSignature -- boxed type signature - * @return true if the typeSignature is numeric - */ - public static boolean typeIsNumeric(final String typeSignature) - { - return (TypeConstants.TYPE_BOXED_BYTE.equals(typeSignature) || - TypeConstants.TYPE_BOXED_SHORT.equals(typeSignature) || - TypeConstants.TYPE_BOXED_INTEGER.equals(typeSignature) || - TypeConstants.TYPE_BOXED_LONG.equals(typeSignature) || - TypeConstants.TYPE_BOXED_FLOAT.equals(typeSignature) || - TypeConstants.TYPE_BOXED_DOUBLE.equals(typeSignature) || - TypeConstants.TYPE_BIG_INTEGER.equals(typeSignature) || - TypeConstants.TYPE_BIG_DOUBLE.equals(typeSignature)); - } - - /** - * @param typeSignature - * @return true if the typeSignature represents a String - */ - public static boolean typeIsString(final String typeSignature) - { - return (TypeConstants.TYPE_STRING.equals(typeSignature)); - } - - /** - * @param typeSignature -- boxed type signature - * @return true if the typeSignature represents a boxed boolean - */ - public static boolean typeIsBoolean(final String typeSignature) - { - return (TypeConstants.TYPE_BOXED_BOOLEAN.equals(typeSignature)); - } - - /** - * @param typeSignature - * @return true if type is the EL null type - */ - public static boolean typeIsNull(final String typeSignature) - { - return (TypeConstants.TYPE_NULL.equals(typeSignature)); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/TypeCoercionException.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/TypeCoercionException.java deleted file mode 100644 index aa18bbd12..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/TypeCoercionException.java +++ /dev/null @@ -1,58 +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.common.internal.types; - -/** - * @author cbateman - * - */ -public class TypeCoercionException extends Exception -{ - /** - * - */ - private static final long serialVersionUID = 1L; - - /** - * @see java.lang.Exception - */ - public TypeCoercionException() { - super(); - } - - /** - * @param message - * @param cause - * @see java.lang.Exception - */ - public TypeCoercionException(String message, Throwable cause) { - super(message, cause); - } - - /** - * @param message - * @see java.lang.Exception - */ - public TypeCoercionException(String message) { - super(message); - } - - /** - * @param cause - * @see java.lang.Exception - */ - public TypeCoercionException(Throwable cause) { - super(cause); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/TypeComparator.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/TypeComparator.java deleted file mode 100644 index a57a94bed..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/TypeComparator.java +++ /dev/null @@ -1,292 +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.common.internal.types; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.eclipse.emf.common.util.Diagnostic; -import org.eclipse.jdt.core.Signature; - -/** - * Static utility class used to compare two CompositeTypes for compatability - * - * @author cbateman - * - */ -public final class TypeComparator { - private static class SignatureTestResult { - /** - * the diagnostic - */ - private final Diagnostic diagnostic; - /** - * Measure of the probability that the tested signatures were meant to - * match. Larger value means higher probability. - */ - private final int matchQuality; - - /** - * @param diagnostic - * @param matchQuality - - * Measure of the probability that the tested signatures were - * meant to match. Larger value means higher probability. - */ - public SignatureTestResult(final Diagnostic diagnostic, - final int matchQuality) { - super(); - this.diagnostic = diagnostic; - this.matchQuality = matchQuality; - } - } - - private final TypeComparatorDiagnosticFactory _factory; - - /** - * Default Constructor - * @param factory - */ - public TypeComparator(final TypeComparatorDiagnosticFactory factory) - { - _factory = factory; - } - - /** - * @param firstType - * @param secondType - * @return true if firstType is assignable to secondType or vice-versa, - * depending on their assignment and runtime types - */ - public Diagnostic calculateTypeCompatibility( - final CompositeType firstType, final CompositeType secondType) { - // first, box all primitives - final CompositeType boxedFirstType = TypeTransformer - .transformBoxPrimitives(firstType); - final CompositeType boxedSecondType = TypeTransformer - .transformBoxPrimitives(secondType); - - final String[] mustBeSatisfied = boxedFirstType.getSignatures(); - final String[] testSignatures = boxedSecondType.getSignatures(); - List<String> mustbeMethods = Collections.emptyList(); - List<String> mustbeTypes = Collections.emptyList(); - for (final String mustbeSignature : mustBeSatisfied) { - if (TypeUtil.isMethodSignature(mustbeSignature)) { - if (mustbeMethods.isEmpty()) { - mustbeMethods = new ArrayList<String>(mustbeSignature - .length()); - } - mustbeMethods.add(mustbeSignature); - } else { - if (mustbeTypes.isEmpty()) { - mustbeTypes = new ArrayList<String>(mustbeSignature - .length()); - } - mustbeTypes.add(mustbeSignature); - } - } - final boolean mustbeWriteable = firstType.isLHS(); - SignatureTestResult bestResult = null; - for (final String isSignature : testSignatures) { - SignatureTestResult testResult; - if (TypeUtil.isMethodSignature(isSignature)) { - testResult = checkMethodSignature(isSignature, mustbeTypes, - mustbeMethods); - if (testResult.diagnostic.getSeverity() == Diagnostic.OK) { - return testResult.diagnostic; - } - } else { - testResult = checkTypeSignature(isSignature, mustbeTypes, - mustbeMethods, mustbeWriteable); - if (testResult.diagnostic.getSeverity() == Diagnostic.OK) { - return checkAssignability(firstType, secondType); - } - } - if (bestResult == null - || bestResult.matchQuality < testResult.matchQuality) { - bestResult = testResult; - } - } - // TODO: bestResult empty? (should not happen, but who knows... - return bestResult.diagnostic; - } - - private SignatureTestResult checkTypeSignature( - final String isSignature, final List<String> mustbeTypes, - final List<String> mustbeMethods, final boolean mustbeWriteable) { - if (mustbeTypes.isEmpty()) { - final Diagnostic diag = _factory.create_METHOD_EXPRESSION_EXPECTED(); - return new SignatureTestResult(diag, 0); - } - for (final String mustbeSignature : mustbeTypes) { - if (mustbeSignature.equals(isSignature) - || canCoerce(isSignature, mustbeSignature, mustbeWriteable)) { - final Diagnostic diag = Diagnostic.OK_INSTANCE; - return new SignatureTestResult(diag, 5); - } - } - final String[] params = new String[2]; - params[0] = readableSignatures(mustbeTypes); - params[1] = Signature.toString(isSignature); - final Diagnostic diag = _factory.create_INCOMPATIBLE_TYPES(params); - return new SignatureTestResult(diag, 1); - } - - private SignatureTestResult checkMethodSignature( - final String isSignature, final List<String> mustbeTypes, - final List<String> mustbeMethods) { - if (mustbeMethods.isEmpty()) { - final Diagnostic diag = _factory.create_VALUE_EXPRESSION_EXPECTED(); - return new SignatureTestResult(diag, 0); - } - for (final String mustbeSignature : mustbeMethods) { - if (methodSignaturesMatch(mustbeSignature, isSignature)) { - final Diagnostic diag = Diagnostic.OK_INSTANCE; - return new SignatureTestResult(diag, 5); - } - } - final String[] params = new String[2]; - params[0] = readableSignatures(mustbeMethods); - params[1] = Signature - .toString(isSignature, "method", null, false, true); //$NON-NLS-1$ - final Diagnostic diag = _factory.create_INCOMPATIBLE_METHOD_TYPES(params); - return new SignatureTestResult(diag, 1); - } - - private static String readableSignatures(final List<String> signatures) { - StringBuilder res = null; - for (final String sig : signatures) { - String sigText; - if (TypeUtil.isMethodSignature(sig)) { - sigText = Signature.toString(sig, "method", null, false, true); //$NON-NLS-1$ - } else { - sigText = Signature.toString(sig); - } - if (res == null) { - res = new StringBuilder(sigText); - } else { - res.append(", ").append(sigText); //$NON-NLS-1$ - } - } - return res != null ? res.toString() : "[no signature]"; //$NON-NLS-1$ - } - - private static boolean canCoerce(final String testType, - final String checkType, final boolean checkTypeIsWritable) { - boolean canCoerce = canCoerce(testType, checkType); - - // if the check type is writable, we need to be sure that the - // coercion can work in both directions - if (canCoerce && checkTypeIsWritable) { - // reverse roles: can checkType assign back to test type? - canCoerce &= canCoerce(checkType, testType); - } - - return canCoerce; - } - - private static boolean canCoerce(final String testType, - final String checkType) { - // can always to coerce to string or object - if (TypeCoercer.typeIsString(checkType)/* - || TypeConstants.TYPE_JAVAOBJECT.equals(checkType)*/) - { - return true; - } else if (TypeCoercer.typeIsNumeric(checkType)) { - return canCoerceNumeric(testType); - } else if (TypeCoercer.typeIsBoolean(checkType)) { - return TypeCoercer.canCoerceToBoolean(testType); - } - - // otherwise, no type coercion available - return false; - } - - private static boolean canCoerceNumeric(final String testType) { - try { - TypeCoercer.coerceToNumber(testType); - // TODO: there is a case when coerceToNumber returns - // null meaning "not sure", that we may want to handle - // differently, with a warning - return true; - } catch (final TypeCoercionException tce) { - // outright failure -- can't coerce - return false; - } - } - - private static boolean methodSignaturesMatch(final String firstMethodSig, - final String secondMethodSig) { - // TODO: need to account for primitive type coercions - if (firstMethodSig.equals(secondMethodSig)) { - return true; - } - final String[] firstMethodParams = Signature - .getParameterTypes(firstMethodSig); - final String[] secondMethodParams = Signature - .getParameterTypes(secondMethodSig); - - // fail fast if param count doesn't match - if (firstMethodParams.length != secondMethodParams.length) { - return false; - } - - // now check each parameter - for (int i = 0; i < firstMethodParams.length; i++) { - // need to box primitives before comparing - final String firstMethodParam = TypeTransformer - .transformBoxPrimitives(firstMethodParams[i]); - final String secondMethodParam = TypeTransformer - .transformBoxPrimitives(secondMethodParams[i]); - - if (!firstMethodParam.equals(secondMethodParam)) { - return false; - } - } - - // if we get to here then we need only check the return type - final String firstReturn = TypeTransformer - .transformBoxPrimitives(Signature.getReturnType(firstMethodSig)); - final String secondReturn = TypeTransformer - .transformBoxPrimitives(Signature - .getReturnType(secondMethodSig)); - - if (!firstReturn.equals(secondReturn)) { - return false; - } - - // if we get to here, then everything checks out - return true; - } - - /** - * Precond: both firstType and secondType must represent value bindings. - * - * @param firstType - * @param secondType - * @return a diagnostic validating that the two composite have compatible - * assignability - */ - private Diagnostic checkAssignability(final CompositeType firstType, - final CompositeType secondType) { - if (firstType.isRHS() && !secondType.isRHS()) { - return _factory.create_PROPERTY_NOT_READABLE(); - } - - if (firstType.isLHS() && !secondType.isLHS()) { - return _factory.create_PROPERTY_NOT_WRITABLE(); - } - - return Diagnostic.OK_INSTANCE; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/TypeComparatorDiagnosticFactory.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/TypeComparatorDiagnosticFactory.java deleted file mode 100644 index 23d2cccc0..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/TypeComparatorDiagnosticFactory.java +++ /dev/null @@ -1,147 +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.common.internal.types; - -import org.eclipse.emf.common.util.BasicDiagnostic; -import org.eclipse.emf.common.util.Diagnostic; -import org.eclipse.osgi.util.NLS; - -/** - * Diagnostic Factory for type comparator diagnostics. - * - * @author cbateman - * - */ -public final class TypeComparatorDiagnosticFactory -{ - /** - * The id used in the source field of all Diagnostic's created by this - * factory to uniquely identify TypeComparator validation as their source - * type. - */ - public final static String SOURCE_IDENTIFIER = "org.eclipse.jst.jsf.common.types.TypeComparator"; //$NON-NLS-1$ - - /** - * A method expression was expected, but something else (i.e. a value - * expression) was provided. - */ - public final static int METHOD_EXPRESSION_EXPECTED_ID = 0; - - /** - * Value expression type was incompatible with the expected type. - */ - public static final int INCOMPATIBLE_TYPES_ID = 1; - - /** - * A value expression was expected, but something else (i.e. a method - * expression) was provided. - */ - public static final int VALUE_EXPRESSION_EXPECTED_ID = 2; - - /** - * Method expression signature did not match what was expected. - */ - public static final int INCOMPATIBLE_METHOD_TYPES_ID = 3; - - /** - * A property was expected to be readable but no getter was found. - */ - public static final int PROPERTY_NOT_READABLE_ID = 4; - - /** - * A property was expected to be writable but no setter was found - */ - public static final int PROPERTY_NOT_WRITABLE_ID = 5; - - /** - * the number of diagnostic ids - */ - public static final int NUM_IDS = 6; - - private final TypeComparatorPreferences _prefs; - - /** - * @param prefs - */ - public TypeComparatorDiagnosticFactory(final TypeComparatorPreferences prefs) - { - _prefs = prefs; - } - // A method expression was supplied as expected, but its signature did - // * not match the expected. - /** - * @return a diagnostic - */ - public Diagnostic create_METHOD_EXPRESSION_EXPECTED() - { - return create(METHOD_EXPRESSION_EXPECTED_ID, Messages - .getString("TypeComparator.Expression.No_Method")); //$NON-NLS-1$ - } - - /** - * @param params - * @return a diagnostic - */ - public Diagnostic create_INCOMPATIBLE_TYPES(final Object[] params) - { - return create( - INCOMPATIBLE_TYPES_ID, - NLS - .bind( - Messages - .getString("TypeComparator.Expression.Incompatible_Value"), params)); //$NON-NLS-1$ - } - - /** - * @return a diagnostic - */ - public Diagnostic create_VALUE_EXPRESSION_EXPECTED() - { - return create(VALUE_EXPRESSION_EXPECTED_ID, Messages - .getString("TypeComparator.Expression.No_Value")); //$NON-NLS-1$ - } - - /** - * @param params - * @return a diagnostic - */ - public Diagnostic create_INCOMPATIBLE_METHOD_TYPES(final Object[] params) - { - return create(INCOMPATIBLE_METHOD_TYPES_ID, NLS.bind(Messages - .getString("TypeComparator.Expression.Incompatible_Method"), //$NON-NLS-1$ - params)); - } - - /** - * @return a diagnostic - */ - public Diagnostic create_PROPERTY_NOT_READABLE() - { - return create(PROPERTY_NOT_READABLE_ID, Messages - .getString("TypeComparator.Expression.Not.Gettable")); //$NON-NLS-1$ - } - - /** - * @return a diagnostic - */ - public Diagnostic create_PROPERTY_NOT_WRITABLE() - { - return create(PROPERTY_NOT_WRITABLE_ID, Messages - .getString("TypeComparator.Expression.Expected.Settable")); //$NON-NLS-1$ - } - - private BasicDiagnostic create(int diagnosticId, String message) - { - final int severity = _prefs.getDefaultSeverity(diagnosticId); - return new BasicDiagnostic(severity, SOURCE_IDENTIFIER, diagnosticId, message, - null); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/TypeComparatorPreferences.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/TypeComparatorPreferences.java deleted file mode 100644 index 49f63bc6a..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/TypeComparatorPreferences.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.common.internal.types; - -import org.eclipse.emf.common.util.Diagnostic; - -/** - * Preference info for type comparator diagnostics - * - * @author cbateman - * - */ -public class TypeComparatorPreferences -{ - - /** - * @param diagnosticId - * @return the default severity of a diagnostic - */ - public int getDefaultSeverity(final int diagnosticId) - { - switch (diagnosticId) - { - case TypeComparatorDiagnosticFactory.METHOD_EXPRESSION_EXPECTED_ID: - return Diagnostic.ERROR; - case TypeComparatorDiagnosticFactory.INCOMPATIBLE_TYPES_ID: - return Diagnostic.INFO; - case TypeComparatorDiagnosticFactory.VALUE_EXPRESSION_EXPECTED_ID: - return Diagnostic.ERROR; - case TypeComparatorDiagnosticFactory.INCOMPATIBLE_METHOD_TYPES_ID: - return Diagnostic.ERROR; - case TypeComparatorDiagnosticFactory.PROPERTY_NOT_READABLE_ID: - return Diagnostic.WARNING; - case TypeComparatorDiagnosticFactory.PROPERTY_NOT_WRITABLE_ID: - return Diagnostic.WARNING; - default: - throw new IllegalArgumentException("Diagnostic Id: "+ diagnosticId +" is out of range"); //$NON-NLS-1$ //$NON-NLS-2$ - - } - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/TypeConstants.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/TypeConstants.java deleted file mode 100644 index 4561f6d3c..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/TypeConstants.java +++ /dev/null @@ -1,114 +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.common.internal.types; - -/** - * @author cbateman - * - */ -public class TypeConstants -{ - /** - * we overload "void" to represent null - */ - public final static String TYPE_NULL = "V"; //$NON-NLS-1$ - /** - * unboxed boolean - */ - public final static String TYPE_BOOLEAN = "Z"; //$NON-NLS-1$ - /** - * string type - */ - public final static String TYPE_STRING = "Ljava.lang.String;"; //$NON-NLS-1$ - /** - * big integer - */ - public final static String TYPE_BIG_INTEGER = "Ljava.math.BigInteger;"; //$NON-NLS-1$ - - /** - * big double - */ - public final static String TYPE_BIG_DOUBLE = "Ljava.math.BigDecimal;"; //$NON-NLS-1$ - - /* boxed types */ - /** - * Boxed byte - */ - public final static String TYPE_BOXED_BYTE = "Ljava.lang.Byte;"; //$NON-NLS-1$ - /** - * Boxed short - */ - public final static String TYPE_BOXED_SHORT = "Ljava.lang.Short;"; //$NON-NLS-1$ - /** - * Boxed int - */ - public final static String TYPE_BOXED_INTEGER = "Ljava.lang.Integer;"; //$NON-NLS-1$ - /** - * Boxed long - */ - public final static String TYPE_BOXED_LONG = "Ljava.lang.Long;"; //$NON-NLS-1$ - /** - * Boxed float - */ - public final static String TYPE_BOXED_FLOAT = "Ljava.lang.Float;"; //$NON-NLS-1$ - /** - * Boxed double - */ - public final static String TYPE_BOXED_DOUBLE = "Ljava.lang.Double;"; //$NON-NLS-1$ - /** - * Boxed boolean - */ - public final static String TYPE_BOXED_BOOLEAN = "Ljava.lang.Boolean;"; //$NON-NLS-1$ - /** - * Boxed char - */ - public final static String SIGNATURE_BOXED_CHARACTER = "Ljava.lang.Character"; //$NON-NLS-1$ - /** - * Map type - */ - public final static String TYPE_MAP = "Ljava.util.Map;"; //$NON-NLS-1$ - /** - * Collection type - */ - public final static String TYPE_COLLECTION = "Ljava.util.Collection;"; //$NON-NLS-1$ - /** - * Comparable type - */ - public final static String TYPE_COMPARABLE = "Ljava.lang.Comparable;"; //$NON-NLS-1$ - - /** - * List type - */ - public final static String TYPE_LIST = "Ljava.util.List;"; //$NON-NLS-1$ - - /** - * java.lang.Object type signature - */ - public static final String TYPE_JAVAOBJECT = "Ljava.lang.Object;"; //$NON-NLS-1$ - /** - * Type signature for the JSF Data Model type - */ - public static final String TYPE_DATA_MODEL = "Ljavax.faces.model.DataModel;"; //$NON-NLS-1$ - /** - * Type signature for the Result Set type - */ - public static final String TYPE_RESULT_SET = "Ljava.sql.ResultSet;"; //$NON-NLS-1$ - /** - * Type signature for the JSTL ResultSet type - */ - public static final String TYPE_JAVAX_SERVLET_JSP_JSTL_SQL_RESULT = "Ljavax.servlet.jsp.jstl.sql.Result;"; //$NON-NLS-1$ - /** - * Type signature of the base type of all enum types - */ - public static final String TYPE_ENUM_BASE = "Ljava.lang.Enum;"; //$NON-NLS-1$ -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/TypeInfo.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/TypeInfo.java deleted file mode 100644 index d514f4236..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/TypeInfo.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.common.internal.types; - -import org.eclipse.jdt.core.IType; -import org.eclipse.jst.jsf.context.symbol.IBeanMethodSymbol; -import org.eclipse.jst.jsf.context.symbol.IBeanPropertySymbol; - -/**This class contains all info that is cached for a given IType. - * @see org.eclipse.jst.jsf.common.internal.types.TypeInfoCache - * - * @author Matthias - */ -class TypeInfo { - - /**Empty String array. Used for the (usual) case when a type has no missing supertypes. - */ - public static String[] NO_NAMES = new String[0]; - - private IBeanMethodSymbol[] methods = null; - private IBeanPropertySymbol[] properties = null; - private IType[] supertypes = null; - private IType[] interfaceTypes = null; - private String[] missingSupertypeNames = null; - - /**Creates an empty TypeInfo object - */ - public TypeInfo() { - super(); - } - - /**Returns the method symbols. Returns <code>null</code> if none have been cached. - * @return the method symbols. May be null. - */ - public IBeanMethodSymbol[] getMethodSymbols() { - return methods; - } - - /**Returns the property symbols. Returns <code>null</code> if none have been cached. - * @return the property symbols. May be null. - */ - public IBeanPropertySymbol[] getPropertySymbols() { - return properties; - } - - /**Sets the methods symbols to be cached. - * @param methods - the method symbols - */ - public void setMethodSymbols(IBeanMethodSymbol[] methods) { - this.methods = methods; - } - - /**Sets the property symbols to be cached. - * @param properties - the property symbols - */ - public void setPropertySymbols(IBeanPropertySymbol[] properties) { - this.properties = properties; - } - - /**Returns the supertypes. Returns <code>null</code> if none have been cached. - * @return the supertypes. May be null. - */ - public IType[] getSupertypes() { - return supertypes; - } - - /**Sets the supertypes to be cached. - * @param superTypes - the property symbols - */ - public void setSupertypes(IType[] superTypes) { - this.supertypes = superTypes; - } - - /**Returns the interface types. Returns <code>null</code> if none have been cached. - * @return the interface types. May be null. - */ - public IType[] getInterfaceTypes() { - return interfaceTypes; - } - - /**Sets the interface types to be cached. - * @param interfaceTypes - the property symbols - */ - public void setInterfaceTypes(IType[] interfaceTypes) { - this.interfaceTypes = interfaceTypes; - } - - /**Returns the names of the missing supertypes. Returns <code>null</code> if none have been cached. - * @return the names of the missing supertypes. May be null. - */ - public String[] getMissingSupertypeNames() { - return missingSupertypeNames; - } - - /**Sets the supertypes to be cached. - * @param missingSupertypeNames - the names of the missing supertypes - */ - public void setMissingSupertypeNames(String[] missingSupertypeNames) { - this.missingSupertypeNames = missingSupertypeNames; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/TypeInfoCache.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/TypeInfoCache.java deleted file mode 100644 index c58f31ce1..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/TypeInfoCache.java +++ /dev/null @@ -1,603 +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.common.internal.types; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.jdt.core.ElementChangedEvent; -import org.eclipse.jdt.core.IClassFile; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.IElementChangedListener; -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jdt.core.IJavaElementDelta; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.ITypeHierarchy; -import org.eclipse.jdt.core.ITypeRoot; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; -import org.eclipse.jst.jsf.context.symbol.IBeanMethodSymbol; -import org.eclipse.jst.jsf.context.symbol.IBeanPropertySymbol; - -/**Provides a cache for java IType properties. It can cache bean property symbols, method symbols, - * supertypes and implemented interfaces per IType. The cache listens to changes in the java model - * and invalidates affected properties, but does not update them. - * - * @author Matthias - */ -public class TypeInfoCache implements IElementChangedListener { - - private static TypeInfoCache instance = null; - - /**Returns the TypeInfoCache instance. This instance is considered - * protected and must not be disposded with disposeInstance. - * - * @return the TypeInfoCache instance - */ - public static synchronized TypeInfoCache getInstance() { - if (instance == null) { - instance = createNewInstance(); - } - return instance; - } - - /** - * Create a new instance of the type cache. - * - * @return a new instance of the type info cache. - */ - public static TypeInfoCache createNewInstance() - { - final TypeInfoCache newCache = new TypeInfoCache(); - JavaCore.addElementChangedListener(newCache, ElementChangedEvent.POST_CHANGE); - return newCache; - } - - /** - * If cache is not the singleton instance acquired with {@link #getInstance()} - * then the cache will be disposed and should not be used. If cache is - * protected instance, then nothing will happen (the singleton instance - * cannot be disposed). - * - * @param cache - */ - public static void disposeInstance(final TypeInfoCache cache) - { - if (cache != null - && cache != instance) - { - JavaCore.removeElementChangedListener(cache); - - synchronized(cache) - { - if (cache.cachedInfo != null) - { - cache.cachedInfo.clear(); - } - - if (cache.cachedTypesByAffectingTypeRoot != null) - { - cache.cachedTypesByAffectingTypeRoot.clear(); - } - - if (cache.cachedTypesByMissingSupertypename != null) - { - cache.cachedTypesByMissingSupertypename.clear(); - } - } - } - } - - private final Map<IType, TypeInfo> cachedInfo; - private final Map<ITypeRoot, Set<IType>> cachedTypesByAffectingTypeRoot; - private final Map<String, Set<IType>> cachedTypesByMissingSupertypename; - - private TypeInfoCache() { - cachedInfo = new HashMap<IType, TypeInfo>(); - cachedTypesByAffectingTypeRoot = new HashMap(); - cachedTypesByMissingSupertypename = new HashMap(10); - } - - public void elementChanged(ElementChangedEvent event) { - updateChangedJavaElement(event.getDelta()); - } - - /**Returns the cached info({@link TypeInfo}) for a given type. Will - * return <code>null</code> if no info has been cached or the the type/something it depends on - * has changed since then. - * - * @param type - the type in question - * @return a TypeInfo instance that contains all cached info for the given type. May be null. - */ - protected TypeInfo getTypeInfo(IType type) { - TypeInfo info = null; - if (type != null) - { - info = cachedInfo.get(type); - } - return info; - } - - /**Returns the cached bean property symbols for a given type. Will return null if no - * bean property symbols have been cached or the type/something it depends on has changed since - * then. - * @param beanType - the bean type in question - * @return the bean property symbols for the given type. May be null. - * @see TypeInfoCache#cachePropertySymbols(IType, IBeanPropertySymbol[]) - */ - public synchronized IBeanPropertySymbol[] getCachedPropertySymbols(IType beanType) { - IBeanPropertySymbol[] props = null; - - if (beanType != null) - { - TypeInfo typeInfo = getTypeInfo(beanType); - if (typeInfo != null) - { - props = typeInfo.getPropertySymbols(); - } - } - return props; - } - - /**Returns the cached method symbols for a given type. Will return null if no - * method symbols have been cached or the type/something it depends on has changed since - * then. - * @param beanType - the bean type in question - * @return the method symbols for the given type. May be null. - * @see TypeInfoCache#cacheMethodSymbols(IType, IBeanMethodSymbol[]) - */ - public synchronized IBeanMethodSymbol[] getCachedMethodSymbols(IType beanType) { - IBeanMethodSymbol[] methods = null; - - if (beanType != null) - { - TypeInfo typeInfo = getTypeInfo(beanType); - if (typeInfo != null) - { - methods = typeInfo.getMethodSymbols(); - } - } - - return methods; - } - - /**Returns the cached supertypes for a given type. Will return null if no supertypes - * have been cached for this type or if the type/something it depends on has changed since - * then. - * @param type - the bean type in question - * @return the supertypes for the given type. May be null. - * @see TypeInfoCache#cacheSupertypesFor(IType) - */ - public synchronized IType[] getCachedSupertypes(IType type) { - IType[] types = null; - - if (type != null) - { - TypeInfo typeInfo = getTypeInfo(type); - if (typeInfo != null) - { - types = typeInfo.getSupertypes(); - } - } - - return types; - } - - /**Returns the cached implemented interfaces for a given type. Will return null if no interfaces - * have been cached for this type or if the type/something it depends on has changed since - * then. - * @param type - the bean type in question - * @return the interface types implemented by the given type. May be null. - * @see TypeInfoCache#cacheInterfaceTypesFor(IType) - */ - public synchronized IType[] getCachedInterfaceTypes(IType type) - { - IType[] types = null; - - if (type != null) - { - TypeInfo typeInfo = getTypeInfo(type); - if (typeInfo != null) - { - types = typeInfo.getInterfaceTypes(); - } - } - - return types; - } - - /**Caches the given method symbols for the given type. - * @param beanType - the type - * @param methods - the method symbols to cache - */ - public synchronized void cacheMethodSymbols(IType beanType, IBeanMethodSymbol[] methods) { - if (beanType != null) - { - TypeInfo typeInfo = getOrCreateTypeInfo(beanType); - if (typeInfo != null) { - typeInfo.setMethodSymbols(methods); - } - } - } - - /**Caches the given property symbols for the given type. - * @param beanType - the type - * @param properties - the property symbols to cache - */ - public synchronized void cachePropertySymbols(IType beanType, IBeanPropertySymbol[] properties) { - if (beanType != null) - { - TypeInfo typeInfo = getOrCreateTypeInfo(beanType); - if (typeInfo != null) { - typeInfo.setPropertySymbols(properties); - } - } - } - - /**Caches the supertypes for the given type. The supertypes will be calculated (and also returned) - * by this method. - * @param type - the type to cache supertypes for - * @return the supertypes of the given type. - */ - public synchronized IType[] cacheSupertypesFor(IType type) - { - IType[] types = null; - - if (type != null) - { - TypeInfo typeInfo = getOrCreateTypeInfo(type); - - if (typeInfo != null) - { - types = typeInfo.getSupertypes(); - } - } - return types; - } - - /**Caches the interface types for the given type. The interface types will be calculated (and also - * returned) by this method. - * @param type - the type to cache interface types for - * @return the interface types implemented by the given type. - */ - public synchronized IType[] cacheInterfaceTypesFor(IType type) - { - IType[] types = null; - - if (type != null) - { - TypeInfo typeInfo = getOrCreateTypeInfo(type); - if (typeInfo != null) - { - types = typeInfo.getInterfaceTypes(); - } - } - return types; - } - - /**Returns the TypeInfo for the given type. If no TypeInfo exists for this type, an empty TypeInfo - * will be created and cached. - * @param type - the type in question - * @return the (modifyable) TypeInfo for the given type - */ - protected TypeInfo getOrCreateTypeInfo(IType type) { - TypeInfo typeInfo = getTypeInfo(type); - if (typeInfo == null) { - try { - final ITypeHierarchy hierarchy = - type.newSupertypeHierarchy(new NullProgressMonitor()); - final IType[] supertypes = hierarchy.getAllSuperclasses(type); - final IType[] interfaceTypes = hierarchy.getAllInterfaces(); - final IType[] rootClasses = hierarchy.getRootClasses(); - List missingSupertypesList = null; - for (int i = 0; i < rootClasses.length; i++) { - String superclassName = rootClasses[i].getSuperclassName(); - if (superclassName != null) { - if (missingSupertypesList == null) { - missingSupertypesList = new ArrayList(1); - } - superclassName = shortTypename(superclassName); - missingSupertypesList.add(superclassName); - } - } - String[] missingSupertypes = null; - if (missingSupertypesList != null) { - missingSupertypes = (String[]) missingSupertypesList.toArray(new String[missingSupertypesList.size()]); - } else { - missingSupertypes = TypeInfo.NO_NAMES; - } - typeInfo = new TypeInfo(); - typeInfo.setSupertypes(supertypes); - typeInfo.setInterfaceTypes(interfaceTypes); - typeInfo.setMissingSupertypeNames(missingSupertypes); - cachedInfo.put(type, typeInfo); - registerCachedType(type, typeInfo); - } catch (JavaModelException e) { - JSFCommonPlugin.log(e); - } - } - return typeInfo; - } - - /**Returns the typename fragment after the last "." (which in most cases is identical to the - * unqualified typename). - * Used only to make sure that if n1 and n2 are names of the same type - * shortname(n1) equals shortname(2) even if one name is qualified and one not. - * @param typename - * @return the typename fragment after the last "." - */ - private String shortTypename(String typename) { - int pos = typename.lastIndexOf('.'); - if (pos >= 0) { - typename = typename.substring(pos + 1); - } - return typename; - } - - /** - * Registers the given type for all ITypeRoot's it depends on, so that it can be uncached if - * one of this ITypeRoot's has changed. The type must be unregistered when it should not be watched - * anymore. - * @param type - the type - * @param typeInfo - TypeInfo of the given type - * @see TypeInfoCache#unregisterCachedType(IType, TypeInfo) - */ - protected void registerCachedType(IType type, TypeInfo typeInfo) { - registerTypeForTypeRoot(type, type.getTypeRoot()); - IType[] supertypes = typeInfo.getSupertypes(); - for (int i = 0; i < supertypes.length; i++) { - registerTypeForTypeRoot(type, supertypes[i].getTypeRoot()); - } - String[] missingSupertypeNames = typeInfo.getMissingSupertypeNames(); - if (missingSupertypeNames != null) { - for (int i = 0; i < missingSupertypeNames.length; i++) { - registerTypeForMissingSupertype(type, missingSupertypeNames[i]); - } - } - } - - private void registerTypeForTypeRoot(IType type, ITypeRoot typeRoot) { - Set dependentTypes = cachedTypesByAffectingTypeRoot.get(typeRoot); - if (dependentTypes == null) { - dependentTypes = new HashSet(5); - cachedTypesByAffectingTypeRoot.put(typeRoot, dependentTypes); - } - dependentTypes.add(type); - } - - private void registerTypeForMissingSupertype(IType type, String supertype) { - Set dependentTypes = cachedTypesByMissingSupertypename.get(supertype); - if (dependentTypes == null) { - dependentTypes = new HashSet(5); - cachedTypesByMissingSupertypename.put(supertype, dependentTypes); - } - dependentTypes.add(type); - } - - /**Unregisters the given type for all ITypeRoot's it depended on. - * @param type - the type - * @param typeInfo - TypeInfo of the given type - */ - protected void unregisterCachedType(IType type, TypeInfo typeInfo) { - unregisterTypeForTypeRoot(type, type.getTypeRoot()); - IType[] supertypes = typeInfo.getSupertypes(); - for (int i = 0; i < supertypes.length; i++) { - unregisterTypeForTypeRoot(type, supertypes[i].getTypeRoot()); - } - String[] missingSupertypeNames = typeInfo.getMissingSupertypeNames(); - if (missingSupertypeNames != null) { - for (int i = 0; i < missingSupertypeNames.length; i++) { - unregisterTypeForMissingSupertype(type, missingSupertypeNames[i]); - } - } - } - - private void unregisterTypeForTypeRoot(IType type, ITypeRoot typeRoot) { - Set dependentTypes = cachedTypesByAffectingTypeRoot.get(typeRoot); - if (dependentTypes != null) { - dependentTypes.remove(type); - if (dependentTypes.isEmpty()) { - cachedTypesByAffectingTypeRoot.remove(typeRoot); - } - } - } - - private void unregisterTypeForMissingSupertype(IType type, String supertype) { - Set dependentTypes = cachedTypesByMissingSupertypename.get(supertype); - if (dependentTypes != null) { - dependentTypes.remove(type); - if (dependentTypes.isEmpty()) { - cachedTypesByMissingSupertypename.remove(supertype); - } - } - } - - /**This will remove all cached info for all types. - */ - protected synchronized void uncacheAllTypes() { - cachedInfo.clear(); - cachedTypesByAffectingTypeRoot.clear(); - cachedTypesByMissingSupertypename.clear(); - } - - /**Removes all cached info for all types that are subtypes of a type of the given ITypeRoot. - * @param typeRoot - */ - protected synchronized void uncacheAffectedTypes(ITypeRoot typeRoot) { - Collection affectedTypes = cachedTypesByAffectingTypeRoot.get(typeRoot); - if (affectedTypes != null && !affectedTypes.isEmpty()) { - List affectedTypesCopy = new ArrayList(affectedTypes); - for (Iterator it = affectedTypesCopy.iterator(); it.hasNext(); ) { - IType cachedType = (IType) it.next(); - TypeInfo typeInfo = cachedInfo.remove(cachedType); - unregisterCachedType(cachedType, typeInfo); - } - } - } - - /**Removes all cached info for all types (or subtypes of types) that specify a supertype - * that has a name similar to the given name. - * @param supertypename - the missing supertype name. May be qualified or not - */ - protected synchronized void uncacheTypesWithMissingSupertype(String supertypename) { - Collection affectedTypes = cachedTypesByMissingSupertypename.get(shortTypename(supertypename)); - if (affectedTypes != null && !affectedTypes.isEmpty()) { - List affectedTypesCopy = new ArrayList(affectedTypes); - for (Iterator it = affectedTypesCopy.iterator(); it.hasNext(); ) { - IType cachedType = (IType) it.next(); - TypeInfo typeInfo = cachedInfo.remove(cachedType); - unregisterCachedType(cachedType, typeInfo); - } - } - } - - /**Removes all cached info that may be affected by the given change. - * @param delta - the change in the java model - */ - protected void updateChangedJavaElement(IJavaElementDelta delta) { - IJavaElement element= delta.getElement(); - switch (element.getElementType()) { - case IJavaElement.JAVA_MODEL: - updateChangedJavaModel(delta, element); - break; - case IJavaElement.JAVA_PROJECT: - updateChangedJavaProject(delta, element); - break; - case IJavaElement.PACKAGE_FRAGMENT_ROOT: - updateChangedPackageFragmentRoot(delta, element); - break; - case IJavaElement.PACKAGE_FRAGMENT: - updateChangedPackageFragment(delta, (IPackageFragment) element); - break; - case IJavaElement.CLASS_FILE: - case IJavaElement.COMPILATION_UNIT: - updateChangedOpenable(delta, element); - break; - } - } - - private void updateChangedChildren(IJavaElementDelta delta) { - if ((delta.getFlags() & IJavaElementDelta.F_CHILDREN) > 0) { - IJavaElementDelta[] children= delta.getAffectedChildren(); - for (int i= 0; i < children.length; i++) { - updateChangedJavaElement(children[i]); - } - } - } - - private void updateChangedJavaModel(IJavaElementDelta delta, IJavaElement element) { - switch (delta.getKind()) { - case IJavaElementDelta.ADDED : - case IJavaElementDelta.REMOVED : - uncacheAllTypes(); - break; - case IJavaElementDelta.CHANGED : - updateChangedChildren(delta); - break; - } - } - - private void updateChangedJavaProject(IJavaElementDelta delta, IJavaElement element) { - int kind = delta.getKind(); - int flags = delta.getFlags(); - if ((flags & IJavaElementDelta.F_OPENED) != 0) { - kind = IJavaElementDelta.ADDED; // affected in the same way - } - if ((flags & IJavaElementDelta.F_CLOSED) != 0) { - kind = IJavaElementDelta.REMOVED; // affected in the same way - } - switch (kind) { - case IJavaElementDelta.ADDED : - case IJavaElementDelta.REMOVED : - uncacheAllTypes(); - break; - case IJavaElementDelta.CHANGED : - updateChangedChildren(delta); - break; - } - } - - private void updateChangedPackageFragment(IJavaElementDelta delta, IPackageFragment element) { - switch (delta.getKind()) { - case IJavaElementDelta.ADDED : - // if the package fragment is in the projects being considered, this could - // introduce new types, changing the hierarchy - case IJavaElementDelta.REMOVED : - // is a change if the package fragment contains supertypes? - uncacheAllTypes(); - break; - case IJavaElementDelta.CHANGED : - // look at the files in the package fragment - updateChangedChildren(delta); - } - } - - private void updateChangedPackageFragmentRoot(IJavaElementDelta delta, IJavaElement element) { - switch (delta.getKind()) { - case IJavaElementDelta.ADDED : - case IJavaElementDelta.REMOVED : - uncacheAllTypes(); - break; - case IJavaElementDelta.CHANGED : - int flags = delta.getFlags(); - if (((flags & IJavaElementDelta.F_ADDED_TO_CLASSPATH) > 0)||(flags & IJavaElementDelta.F_REMOVED_FROM_CLASSPATH) > 0) { - uncacheAllTypes(); - } else { - updateChangedChildren(delta); - } - break; - } - } - - /**Removes all cached info that may be affected by the change in this IOpenable - * @param delta - the change in the java model - * @param element - the (changed) IOpenable considered - */ - protected void updateChangedOpenable(IJavaElementDelta delta, IJavaElement element) { - if (element instanceof ITypeRoot) { - ITypeRoot typeRoot = (ITypeRoot) element; - uncacheAffectedTypes(typeRoot); - // Creates missing superclass for any cached type? - if (delta.getKind() == IJavaElementDelta.ADDED) { - if (typeRoot instanceof ICompilationUnit) { - ICompilationUnit cu = (ICompilationUnit) typeRoot; - try { - IType[] types = cu.getAllTypes(); - for (int i = 0; i < types.length; i++) { - uncacheTypesWithMissingSupertype(types[i].getElementName()); - } - } catch (JavaModelException e) { - if (!e.isDoesNotExist()) - { - JSFCommonPlugin.log(IStatus.INFO, "Unable to get types for compilation unit " + cu, e); //$NON-NLS-1$ - } - uncacheAllTypes(); - } - } else if (typeRoot instanceof IClassFile) { - IClassFile cf = (IClassFile) typeRoot; - IType type = cf.getType(); - uncacheTypesWithMissingSupertype(type.getElementName()); - } - } - } - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/TypeTransformer.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/TypeTransformer.java deleted file mode 100644 index 4c5718f89..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/TypeTransformer.java +++ /dev/null @@ -1,213 +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.common.internal.types; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - -import org.eclipse.jdt.core.Signature; - -/** - * Transforms one CompositeType to another according to particular - * transform rules. - * - * In general, every transformation should be of the form: - * - * CompositeType transform(CompositeType original, other inputs...); - * - * @author cbateman - * - */ -public class TypeTransformer -{ - private final static Map boxConversions = new HashMap(); - private final static Map unBoxConversions = new HashMap(); - - static - { - // see jdt.core.Signature or JVM link spec for more details - boxConversions.put("B", "Ljava.lang.Byte;"); //$NON-NLS-1$//$NON-NLS-2$ - boxConversions.put("C", "Ljava.lang.Character;"); //$NON-NLS-1$ //$NON-NLS-2$ - boxConversions.put("D", "Ljava.lang.Double;"); //$NON-NLS-1$ //$NON-NLS-2$ - boxConversions.put("F", "Ljava.lang.Float;"); //$NON-NLS-1$ //$NON-NLS-2$ - boxConversions.put("I", "Ljava.lang.Integer;"); //$NON-NLS-1$ //$NON-NLS-2$ - boxConversions.put("J", "Ljava.lang.Long;"); //$NON-NLS-1$ //$NON-NLS-2$ - boxConversions.put("S", "Ljava.lang.Short;"); //$NON-NLS-1$ //$NON-NLS-2$ - boxConversions.put("Z", "Ljava.lang.Boolean;"); //$NON-NLS-1$ //$NON-NLS-2$ - // don't box V - boxConversions.put("V", "V"); //$NON-NLS-1$ //$NON-NLS-2$ - - // invert hte box conversions - for (final Iterator it = boxConversions.keySet().iterator(); it.hasNext();) - { - final String newValue = (String) it.next(); - final String newKey = (String) boxConversions.get(newValue); - if (unBoxConversions.put(newKey, newValue) != null) - { - // if put returns non-null then we have replaced a key - // added on a previous iteration. This implies - // that box mappings are no longer one-to-one - throw new AssertionError("Duplicated boxing value"); //$NON-NLS-1$ - } - } - } - - /** - * @param compositeType - * @return an equivilent form of compositeType with all primitive type - * signatures converted to their fully qualified boxed equivilent but - * otherwise unchanged. - * - * Example: J -> Ljava.lang.Long; - */ - public static CompositeType transformBoxPrimitives(CompositeType compositeType) - { - String[] signatures = compositeType.getSignatures(); - String[] newsignatures = new String[signatures.length]; - - for (int i = 0; i < signatures.length; i++) - { - newsignatures[i] = transformBoxPrimitives(signatures[i]); - } - - return new CompositeType(newsignatures, compositeType.getAssignmentTypeMask()); - } - - /** - * Performs boxing for a single typeSignature string - * @param curSignature - * @return the boxed signature - */ - public static String transformBoxPrimitives(final String curSignature) - { - String newSignature = curSignature; - - // first determine if we have a type or method signature - try - { - int kind = Signature.getTypeSignatureKind(curSignature); - - // interested in base types, since these need boxing - if (kind == Signature.BASE_TYPE_SIGNATURE) - { - // grab the box for the primitive - newSignature = (String) boxConversions.get(curSignature); - } - else if (kind == Signature.ARRAY_TYPE_SIGNATURE) - { - // check if it's array of primitives - final String baseType = Signature.getElementType(curSignature); - - if (Signature.getTypeSignatureKind(baseType) == Signature.BASE_TYPE_SIGNATURE) - { - // it is, so box it - final String newBaseType = (String) boxConversions.get(baseType); - final int numBraces = Signature.getArrayCount(curSignature); - newSignature = ""; //$NON-NLS-1$ - for (int j = 0; j < numBraces; j++) - { - newSignature += "["; //$NON-NLS-1$ - } - - newSignature += newBaseType; - } - } - } - catch (IllegalArgumentException e) - { - // signature was not a type signature, so must be a method sig - // do nothing: don't box method types - } - - return newSignature; - } - - /** - * Performs the exact inverse of transformBoxPrimitives -- takes all - * boxing type signatures and replaces them with their primitive equivilent - * @param compositeType - * @return a new composite with all boxed primitives unboxed - */ - public static CompositeType transformUnboxPrimitives(CompositeType compositeType) - { - String[] signatures = compositeType.getSignatures(); - String[] newsignatures = new String[signatures.length]; - - for (int i = 0; i < signatures.length; i++) - { - newsignatures[i] = transformUnboxPrimitives(signatures[i]); - } - - return new CompositeType(newsignatures, compositeType.getAssignmentTypeMask()); - } - - /** - * Performs unboxing for a single typeSignature string - * - * @param typeSignature - * @return the transformed signature - */ - public static String transformUnboxPrimitives(final String typeSignature) - { - String newSignature = typeSignature; - - // first determine if we have a type or method signature - try - { - int kind = Signature.getTypeSignatureKind(typeSignature); - - // interested in class types, since these need boxing - if (kind == Signature.CLASS_TYPE_SIGNATURE) - { - // grab the box for the primitive - String checkForUnbox = (String) unBoxConversions.get(typeSignature); - - if (checkForUnbox != null) - { - newSignature = checkForUnbox; - } - } - else if (kind == Signature.ARRAY_TYPE_SIGNATURE) - { - // check if it's array of objects - final String baseType = Signature.getElementType(typeSignature); - - if (Signature.getTypeSignatureKind(baseType) == Signature.CLASS_TYPE_SIGNATURE) - { - // it is, so unbox it - final String newBaseTypeCandidate = (String) unBoxConversions.get(baseType); - - if (newBaseTypeCandidate != null) - { - final int numBraces = Signature.getArrayCount(typeSignature); - newSignature = ""; //$NON-NLS-1$ - for (int j = 0; j < numBraces; j++) - { - newSignature += "["; //$NON-NLS-1$ - } - - newSignature += newBaseTypeCandidate; - } - } - } - } - catch (IllegalArgumentException e) - { - // signature was not a type signature, so must be a method sig - // do nothing: don't box method types - } - - return newSignature; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/TypeUtil.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/TypeUtil.java deleted file mode 100644 index a302fc4d6..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/TypeUtil.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.common.internal.types; - -import org.eclipse.jdt.core.Signature; - -/** - * Package utility class - * @author cbateman - * - */ -/*package*/final class TypeUtil -{ - /** - * @param assignmentType - * @return true if assignmentType has lhs flag set - */ - public static boolean matchesLHS(int assignmentType) - { - return (assignmentType & IAssignable.ASSIGNMENT_TYPE_LHS) != 0; - } - - /** - * @param assignmentType - * @return true if assignmentType has rhs flag set - */ - public static boolean matchesRHS(int assignmentType) - { - return (assignmentType & IAssignable.ASSIGNMENT_TYPE_RHS) != 0; - } - - /** - * @param signature - * @return true if the signature is a method signature - */ - public static boolean isMethodSignature(final String signature) - { - // method signature must start with a "(" - return signature.charAt(0) == Signature.C_PARAM_START; - } - private TypeUtil() {/*not instantiable*/} -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/ValueType.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/ValueType.java deleted file mode 100644 index 2d1282586..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/ValueType.java +++ /dev/null @@ -1,238 +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.common.internal.types; - -import org.eclipse.jdt.core.Signature; - -/** - * Value object representing a value binding type by it's type and assignability - * information - * - * @author cbateman - * - */ -public class ValueType implements SignatureBasedType, IAssignable -{ - /** - * A default empty string array - */ - protected final static String[] EMPTY_STRING_ARRAY = new String[0]; - - private final String _signature; - private final String[] _typeArgs; - private final int _assignmentMask; - private final String[] _superTypes; - private final String[] _interfaceTypes; - - private final boolean _isEnumType; - - private String[] _allTypes; // lazy creation on getAllTypes - - /** - * Construct a new ValueType object with the given - * signature - * - * @param signature - * @param typeArgs generic type arguments for signature or empty if none - * @param superTypes - * @param interfaceTypes - * @param isEnumType - * @param assignmentMask - */ - public ValueType(final String signature, - final String[] typeArgs, - final String[] superTypes, - final String[] interfaceTypes, - final boolean isEnumType, - final int assignmentMask) - { - if (signature == null) - { - throw new AssertionError("signature can never be null"); //$NON-NLS-1$ - } - - _signature = signature; - _typeArgs = typeArgs; - _assignmentMask = assignmentMask; - _superTypes = superTypes != null ? superTypes : EMPTY_STRING_ARRAY; - _interfaceTypes = interfaceTypes != null ? interfaceTypes : EMPTY_STRING_ARRAY; - _isEnumType = isEnumType; - } - - /** - * Copy constructor equivilent to - * ValueType(template.getSignature(), template.getSuperTypes(), template.getInterfaceTypes(),assingmentMask, template._isEnumType) - * - * @param template - * @param assignmentMask - */ - public ValueType(final ValueType template, final int assignmentMask) - { - this(template._signature, template._typeArgs, template._superTypes, - template._interfaceTypes, template._isEnumType, assignmentMask); - } - - /** - * Convienence constructor for creating ValueType's with no supertype, type argument - * or interface info. Equivilent to: - * ValueType(signature, new String[0], new String[0], new String[0], false, assignmentMask) - * - * @param signature - * @param assignmentMask - */ - public ValueType(final String signature, final int assignmentMask) - { - this(signature, EMPTY_STRING_ARRAY, EMPTY_STRING_ARRAY, EMPTY_STRING_ARRAY, false, assignmentMask); - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.core.internal.types.SignatureBasedType#getSignature() - */ - public String getSignature() - { - return _signature; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.internal.types.IAssignable#getAssignability() - */ - public int getAssignability() { - return _assignmentMask; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.internal.types.IAssignable#isLHS() - */ - public boolean isLHS() { - return TypeUtil.matchesLHS(_assignmentMask); - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.internal.types.IAssignable#isRHS() - */ - public boolean isRHS() { - return TypeUtil.matchesRHS(_assignmentMask); - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - public String toString() - { - return Signature.getSignatureSimpleName - (TypeTransformer.transformBoxPrimitives(_signature)); - } - - /** - * @return an array of all signatures of all super types or empty - * array if there are no super types for this type - * - * Note: if isArray() == true, then these are the super types of - * the base element - */ - public String[] getSuperTypes() - { - return _superTypes; - } - - /** - * @return an array of all interfaces implemented or empty array - * if none - * - * Note: if isArray() == true, then these are the interfacess of - * the base element - */ - public String[] getInterfaceTypes() - { - return _interfaceTypes; - } - - /** - * @return all types including the base type, super types and interface - * types. - * - * Note: if isArray() == true, then these are the super types of - * the base element - - */ - public String[] getAllTypes() - { - if (_allTypes == null) - { - int numberOfTypes = 1 + _superTypes.length + _interfaceTypes.length; - _allTypes = new String[numberOfTypes]; - _allTypes[0] = _signature; - System.arraycopy(_superTypes, 0, _allTypes, 1, _superTypes.length); - System.arraycopy(_interfaceTypes, 0, _allTypes, 1+_superTypes.length, _interfaceTypes.length); - } - return _allTypes; - } - - /** - * @return the type arguments for getSignature() if any or empty array if none - */ - public String[] getTypeArguments() - { - return _typeArgs; - } - - /** - * - */ - public CompositeType toCompositeType() - { - return new CompositeType(getAllTypes(), getAssignability()); - } - - /** - * @param signature - * @return true if an instance of this type would satisfy instanceof signature - * - */ - public boolean isInstanceOf(final String signature) - { - // if this is an array, then the super types are for the base - // type and we can't be an instance of anything but signature - if (isArray()) - { - return getSignature().equals(signature); - } - - final String[] allTypes = getAllTypes(); - - for (int i = 0; i < allTypes.length; i++) - { - if (allTypes[i].equals(signature)) - { - return true; - } - } - - return false; - } - - /** - * @return true if this is an array type - */ - public boolean isArray() - { - return Signature.getArrayCount(getSignature()) > 0; - } - - /** - * @return true if the value type represents a (>=Java5) enum type - */ - public boolean isEnumType() { - return _isEnumType; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/messages.properties b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/messages.properties deleted file mode 100644 index 3df119baf..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/types/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 -############################################################################### -TypeComparator.Expression.Doesnt.Match.Expected.Types=EL expression does not evaluate to expected types for this attribute -TypeComparator.Expression.Not.Gettable=Expression is not gettable -TypeComparator.Expression.Expected.Settable=Attribute expects settable value, but expression is not settable - -TypeComparator.Expression.No_Method=Expression must be a method expression but is a value expression -TypeComparator.Expression.No_Value=Expression must be a value expression but is a method expression -TypeComparator.Expression.Incompatible_Method=Method must have signature "{0}" but has signature "{1}" -TypeComparator.Expression.Incompatible_Value=Cannot coerce type {1} to {0} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/util/JarUtilities.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/util/JarUtilities.java deleted file mode 100644 index 76c609ea3..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/util/JarUtilities.java +++ /dev/null @@ -1,90 +0,0 @@ -package org.eclipse.jst.jsf.common.internal.util; - -import java.io.File; -import java.net.MalformedURLException; -import java.net.URI; -import java.net.URL; -import java.util.jar.JarEntry; -import java.util.jar.JarFile; - -/** - * @author cbateman - * - */ -public class JarUtilities -{ - private static final String JAR_PREFIX = "jar:"; //$NON-NLS-1$ - private static final String JAR_FILE_PREFIX = JAR_PREFIX + "file:"; //$NON-NLS-1$ - /** - * A common instance. - */ - public static final JarUtilities INSTANCE = new JarUtilities(); - /** - * @param jarFile - * @return the URL for the jarFile - * @throws MalformedURLException - */ - public URL createJarUrl(final JarFile jarFile) throws MalformedURLException - { - return createJarUrl(jarFile, ""); //$NON-NLS-1$ - } - - /** - * @param jarFile - * @param jarEntry - * @return the URL for the jarEntry inside jarFile. - * @throws MalformedURLException - */ - public URL createJarUrl(final JarFile jarFile, final JarEntry jarEntry) throws MalformedURLException - { - return createJarUrl(jarFile, jarEntry != null ? jarEntry.getName() : ""); //$NON-NLS-1$ - } - - /** - * @param jarFile - * @param jarEntryName - * @return the URL for the jarEntryName inside jarFile. - * @throws MalformedURLException - */ - public URL createJarUrl(final JarFile jarFile, final String jarEntryName) throws MalformedURLException - { - final String fixedJarFileName = jarFile.getName().replace("\\", "/"); //$NON-NLS-1$ //$NON-NLS-2$ - return createJarUrl(fixedJarFileName, jarEntryName != null ? jarEntryName : ""); //$NON-NLS-1$ - } - - /** - * @param filePath - * @param jarEntryName - * @return the URL for the jarEntryName in the file at filePath - * @throws MalformedURLException - */ - public URL createJarUrl(final String filePath, final String jarEntryName) throws MalformedURLException - { - final String urlString = String.format("jar:file:///%s!/%s", //$NON-NLS-1$ - filePath, jarEntryName); - return new URL(urlString); - } - - /** - * @param url - * @return a file for the URL if url is in the local file system (must conform to jar:file:// uri). - * or null. - */ - public File getFile(final URL url) - { - String string = url.toString(); - if (string != null && string.startsWith(JAR_FILE_PREFIX)) - { - string = string.substring(JAR_PREFIX.length()); - try - { - return new File(URI.create(string)); - } catch (IllegalArgumentException e) - { - // fallthorough and return null if the file can't do anything - // with the string. - } - } - return null; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/Entity.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/Entity.java deleted file mode 100644 index f00918be9..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/Entity.java +++ /dev/null @@ -1,162 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id$ - */ -package org.eclipse.jst.jsf.common.metadata; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jst.jsf.common.metadata.query.IEntityVisitor; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Entity</b></em>'. - * <p><b>Provisional API - subject to change</b></p> - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.jst.jsf.common.metadata.Entity#getChildEntities <em>Child Entities</em>}</li> - * <li>{@link org.eclipse.jst.jsf.common.metadata.Entity#getTraits <em>Traits</em>}</li> - * <li>{@link org.eclipse.jst.jsf.common.metadata.Entity#getId <em>Id</em>}</li> - * <li>{@link org.eclipse.jst.jsf.common.metadata.Entity#getType <em>Type</em>}</li> - * <li>{@link org.eclipse.jst.jsf.common.metadata.Entity#getIncludeGroups <em>Include Groups</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.jst.jsf.common.metadata.MetadataPackage#getEntity() - * @model extendedMetaData="kind='element' name='entity'" - * @generated - */ -public interface Entity extends EObject { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - /** - * Returns the value of the '<em><b>Child Entities</b></em>' containment reference list. - * The list contents are of type {@link org.eclipse.jst.jsf.common.metadata.Entity}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Child Entities</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>Child Entities</em>' containment reference list. - * @see org.eclipse.jst.jsf.common.metadata.MetadataPackage#getEntity_ChildEntities() - * @model containment="true" keys="id type" - * extendedMetaData="kind='element' name='entity'" - * @generated - */ - EList<Entity> getChildEntities(); - - /** - * Returns the value of the '<em><b>Traits</b></em>' containment reference list. - * The list contents are of type {@link org.eclipse.jst.jsf.common.metadata.Trait}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Traits</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>Traits</em>' containment reference list. - * @see org.eclipse.jst.jsf.common.metadata.MetadataPackage#getEntity_Traits() - * @model containment="true" keys="id" - * extendedMetaData="kind='element' name='trait'" - * @generated - */ - EList<Trait> getTraits(); - - /** - * 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.common.metadata.MetadataPackage#getEntity_Id() - * @model id="true" required="true" - * @generated - */ - String getId(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.common.metadata.Entity#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>Type</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>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>Type</em>' attribute. - * @see #setType(String) - * @see org.eclipse.jst.jsf.common.metadata.MetadataPackage#getEntity_Type() - * @model - * @generated - */ - String getType(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.common.metadata.Entity#getType <em>Type</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Type</em>' attribute. - * @see #getType() - * @generated - */ - void setType(String value); - - /** - * Returns the value of the '<em><b>Include Groups</b></em>' reference list. - * The list contents are of type {@link org.eclipse.jst.jsf.common.metadata.IncludeEntityGroup}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Include Groups</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>Include Groups</em>' reference list. - * @see org.eclipse.jst.jsf.common.metadata.MetadataPackage#getEntity_IncludeGroups() - * @model extendedMetaData="kind='element' name='include-entity-group'" - * @generated - */ - EList<IncludeEntityGroup> getIncludeGroups(); - - /** - * <!-- begin-user-doc --> - * @param visitor - * <!-- end-user-doc --> - * @model visitorDataType="org.eclipse.jst.jsf.common.metadata.IEntityVisitor" - * @generated - */ - void accept(IEntityVisitor visitor); - - /** - * <!-- begin-user-doc --> - * @return Model - * <!-- end-user-doc --> - * @model kind="operation" - * @generated - */ - Model getModel(); - -} // Entity diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/EntityGroup.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/EntityGroup.java deleted file mode 100644 index fd98b48a8..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/EntityGroup.java +++ /dev/null @@ -1,29 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id$ - */ -package org.eclipse.jst.jsf.common.metadata; - - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Entity Group</b></em>'. - * <p><b>Provisional API - subject to change</b></p> - * <!-- end-user-doc --> - * - * - * @see org.eclipse.jst.jsf.common.metadata.MetadataPackage#getEntityGroup() - * @model - * @generated - */ -public interface EntityGroup extends Entity { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - -} // EntityGroup diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/IncludeEntityGroup.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/IncludeEntityGroup.java deleted file mode 100644 index be4f1463f..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/IncludeEntityGroup.java +++ /dev/null @@ -1,89 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id$ - */ -package org.eclipse.jst.jsf.common.metadata; - -import org.eclipse.emf.ecore.EObject; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Include Entity Group</b></em>'. - * <p><b>Provisional API - subject to change</b></p> - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.jst.jsf.common.metadata.IncludeEntityGroup#getId <em>Id</em>}</li> - * <li>{@link org.eclipse.jst.jsf.common.metadata.IncludeEntityGroup#getModelUri <em>Model Uri</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.jst.jsf.common.metadata.MetadataPackage#getIncludeEntityGroup() - * @model - * @generated - */ -public interface IncludeEntityGroup extends EObject { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - /** - * 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.common.metadata.MetadataPackage#getIncludeEntityGroup_Id() - * @model required="true" - * @generated - */ - String getId(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.common.metadata.IncludeEntityGroup#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>Model Uri</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Model 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>Model Uri</em>' attribute. - * @see #setModelUri(String) - * @see org.eclipse.jst.jsf.common.metadata.MetadataPackage#getIncludeEntityGroup_ModelUri() - * @model extendedMetaData="name='uri'" - * @generated - */ - String getModelUri(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.common.metadata.IncludeEntityGroup#getModelUri <em>Model Uri</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Model Uri</em>' attribute. - * @see #getModelUri() - * @generated - */ - void setModelUri(String value); - -} // IncludeEntityGroup diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/MetadataFactory.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/MetadataFactory.java deleted file mode 100644 index 8b8ea0c04..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/MetadataFactory.java +++ /dev/null @@ -1,90 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id$ - */ -package org.eclipse.jst.jsf.common.metadata; - -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. - * <p><b>NOT API</b></p> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.MetadataPackage - * @generated - */ -public interface MetadataFactory extends EFactory { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - /** - * The singleton instance of the factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - MetadataFactory eINSTANCE = org.eclipse.jst.jsf.common.metadata.internal.impl.MetadataFactoryImpl.init(); - - /** - * Returns a new object of class '<em>Trait</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Trait</em>'. - * @generated - */ - Trait createTrait(); - - /** - * Returns a new object of class '<em>Include Entity Group</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Include Entity Group</em>'. - * @generated - */ - IncludeEntityGroup createIncludeEntityGroup(); - - /** - * Returns a new object of class '<em>Model</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Model</em>'. - * @generated - */ - Model createModel(); - - /** - * Returns a new object of class '<em>Entity</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Entity</em>'. - * @generated - */ - Entity createEntity(); - - /** - * Returns a new object of class '<em>Entity Group</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Entity Group</em>'. - * @generated - */ - EntityGroup createEntityGroup(); - - /** - * Returns the package supported by this factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the package supported by this factory. - * @generated - */ - MetadataPackage getMetadataPackage(); - -} //MetadataFactory diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/MetadataPackage.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/MetadataPackage.java deleted file mode 100644 index d444f826f..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/MetadataPackage.java +++ /dev/null @@ -1,871 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id$ - */ -package org.eclipse.jst.jsf.common.metadata; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EDataType; -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> - * <p><b>NOT API</b></p> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.MetadataFactory - * @model kind="package" - * @generated - */ -public interface MetadataPackage extends EPackage { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - /** - * The package name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNAME = "metadata"; //$NON-NLS-1$ - - /** - * The package namespace URI. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNS_URI = "http://org.eclipse.jst.jsf.common.metadata/metadata.ecore"; //$NON-NLS-1$ - - /** - * The package namespace name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNS_PREFIX = "md"; //$NON-NLS-1$ - - /** - * The singleton instance of the package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - MetadataPackage eINSTANCE = org.eclipse.jst.jsf.common.metadata.internal.impl.MetadataPackageImpl.init(); - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.common.metadata.internal.impl.TraitImpl <em>Trait</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.internal.impl.TraitImpl - * @see org.eclipse.jst.jsf.common.metadata.internal.impl.MetadataPackageImpl#getTrait() - * @generated - */ - int TRAIT = 4; - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.common.metadata.internal.impl.EntityImpl <em>Entity</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.internal.impl.EntityImpl - * @see org.eclipse.jst.jsf.common.metadata.internal.impl.MetadataPackageImpl#getEntity() - * @generated - */ - int ENTITY = 2; - - /** - * The feature id for the '<em><b>Child Entities</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ENTITY__CHILD_ENTITIES = 0; - - /** - * The feature id for the '<em><b>Traits</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ENTITY__TRAITS = 1; - - /** - * The feature id for the '<em><b>Id</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ENTITY__ID = 2; - - /** - * The feature id for the '<em><b>Type</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ENTITY__TYPE = 3; - - /** - * The feature id for the '<em><b>Include Groups</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ENTITY__INCLUDE_GROUPS = 4; - - /** - * The number of structural features of the '<em>Entity</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ENTITY_FEATURE_COUNT = 5; - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.common.metadata.internal.impl.ModelImpl <em>Model</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.internal.impl.ModelImpl - * @see org.eclipse.jst.jsf.common.metadata.internal.impl.MetadataPackageImpl#getModel() - * @generated - */ - int MODEL = 0; - - /** - * The feature id for the '<em><b>Child Entities</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int MODEL__CHILD_ENTITIES = ENTITY__CHILD_ENTITIES; - - /** - * The feature id for the '<em><b>Traits</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int MODEL__TRAITS = ENTITY__TRAITS; - - /** - * The feature id for the '<em><b>Id</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int MODEL__ID = ENTITY__ID; - - /** - * The feature id for the '<em><b>Type</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int MODEL__TYPE = ENTITY__TYPE; - - /** - * The feature id for the '<em><b>Include Groups</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int MODEL__INCLUDE_GROUPS = ENTITY__INCLUDE_GROUPS; - - /** - * The feature id for the '<em><b>Entity Groups</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int MODEL__ENTITY_GROUPS = ENTITY_FEATURE_COUNT + 0; - - /** - * The feature id for the '<em><b>Source Model Provider</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int MODEL__SOURCE_MODEL_PROVIDER = ENTITY_FEATURE_COUNT + 1; - - /** - * The feature id for the '<em><b>Current Model Context</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int MODEL__CURRENT_MODEL_CONTEXT = ENTITY_FEATURE_COUNT + 2; - - /** - * The number of structural features of the '<em>Model</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int MODEL_FEATURE_COUNT = ENTITY_FEATURE_COUNT + 3; - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.common.metadata.internal.impl.IncludeEntityGroupImpl <em>Include Entity Group</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.internal.impl.IncludeEntityGroupImpl - * @see org.eclipse.jst.jsf.common.metadata.internal.impl.MetadataPackageImpl#getIncludeEntityGroup() - * @generated - */ - int INCLUDE_ENTITY_GROUP = 3; - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.common.metadata.internal.impl.EntityGroupImpl <em>Entity Group</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.internal.impl.EntityGroupImpl - * @see org.eclipse.jst.jsf.common.metadata.internal.impl.MetadataPackageImpl#getEntityGroup() - * @generated - */ - int ENTITY_GROUP = 1; - - /** - * The feature id for the '<em><b>Child Entities</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ENTITY_GROUP__CHILD_ENTITIES = ENTITY__CHILD_ENTITIES; - - /** - * The feature id for the '<em><b>Traits</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ENTITY_GROUP__TRAITS = ENTITY__TRAITS; - - /** - * The feature id for the '<em><b>Id</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ENTITY_GROUP__ID = ENTITY__ID; - - /** - * The feature id for the '<em><b>Type</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ENTITY_GROUP__TYPE = ENTITY__TYPE; - - /** - * The feature id for the '<em><b>Include Groups</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ENTITY_GROUP__INCLUDE_GROUPS = ENTITY__INCLUDE_GROUPS; - - /** - * The number of structural features of the '<em>Entity Group</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ENTITY_GROUP_FEATURE_COUNT = ENTITY_FEATURE_COUNT + 0; - - /** - * The feature id for the '<em><b>Id</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int INCLUDE_ENTITY_GROUP__ID = 0; - - /** - * The feature id for the '<em><b>Model Uri</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int INCLUDE_ENTITY_GROUP__MODEL_URI = 1; - - /** - * The number of structural features of the '<em>Include Entity Group</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int INCLUDE_ENTITY_GROUP_FEATURE_COUNT = 2; - - /** - * The feature id for the '<em><b>Id</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int TRAIT__ID = 0; - - /** - * The feature id for the '<em><b>Value</b></em>' containment reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int TRAIT__VALUE = 1; - - /** - * The feature id for the '<em><b>Source Model Provider</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int TRAIT__SOURCE_MODEL_PROVIDER = 2; - - /** - * The number of structural features of the '<em>Trait</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int TRAIT_FEATURE_COUNT = 3; - - /** - * The meta object id for the '<em>ITrait Visitor</em>' data type. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.query.ITraitVisitor - * @see org.eclipse.jst.jsf.common.metadata.internal.impl.MetadataPackageImpl#getITraitVisitor() - * @generated - */ - int ITRAIT_VISITOR = 5; - - /** - * The meta object id for the '<em>IEntity Visitor</em>' data type. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.query.IEntityVisitor - * @see org.eclipse.jst.jsf.common.metadata.internal.impl.MetadataPackageImpl#getIEntityVisitor() - * @generated - */ - int IENTITY_VISITOR = 6; - - /** - * The meta object id for the '<em>IMeta Data Source Model Provider</em>' data type. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.internal.IMetaDataSourceModelProvider - * @see org.eclipse.jst.jsf.common.metadata.internal.impl.MetadataPackageImpl#getIMetaDataSourceModelProvider() - * @generated - */ - int IMETA_DATA_SOURCE_MODEL_PROVIDER = 7; - - - /** - * The meta object id for the '<em>Model Context</em>' data type. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.internal.ModelKeyDescriptor - * @see org.eclipse.jst.jsf.common.metadata.internal.impl.MetadataPackageImpl#getModelContext() - * @generated - */ - int MODEL_CONTEXT = 8; - - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.common.metadata.Trait <em>Trait</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Trait</em>'. - * @see org.eclipse.jst.jsf.common.metadata.Trait - * @generated - */ - EClass getTrait(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.common.metadata.Trait#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.common.metadata.Trait#getId() - * @see #getTrait() - * @generated - */ - EAttribute getTrait_Id(); - - /** - * Returns the meta object for the containment reference '{@link org.eclipse.jst.jsf.common.metadata.Trait#getValue <em>Value</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the containment reference '<em>Value</em>'. - * @see org.eclipse.jst.jsf.common.metadata.Trait#getValue() - * @see #getTrait() - * @generated - */ - EReference getTrait_Value(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.common.metadata.Trait#getSourceModelProvider <em>Source Model Provider</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Source Model Provider</em>'. - * @see org.eclipse.jst.jsf.common.metadata.Trait#getSourceModelProvider() - * @see #getTrait() - * @generated - */ - EAttribute getTrait_SourceModelProvider(); - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.common.metadata.IncludeEntityGroup <em>Include Entity Group</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Include Entity Group</em>'. - * @see org.eclipse.jst.jsf.common.metadata.IncludeEntityGroup - * @generated - */ - EClass getIncludeEntityGroup(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.common.metadata.IncludeEntityGroup#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.common.metadata.IncludeEntityGroup#getId() - * @see #getIncludeEntityGroup() - * @generated - */ - EAttribute getIncludeEntityGroup_Id(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.common.metadata.IncludeEntityGroup#getModelUri <em>Model Uri</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Model Uri</em>'. - * @see org.eclipse.jst.jsf.common.metadata.IncludeEntityGroup#getModelUri() - * @see #getIncludeEntityGroup() - * @generated - */ - EAttribute getIncludeEntityGroup_ModelUri(); - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.common.metadata.Model <em>Model</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Model</em>'. - * @see org.eclipse.jst.jsf.common.metadata.Model - * @generated - */ - EClass getModel(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.common.metadata.Model#getSourceModelProvider <em>Source Model Provider</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Source Model Provider</em>'. - * @see org.eclipse.jst.jsf.common.metadata.Model#getSourceModelProvider() - * @see #getModel() - * @generated - */ - EAttribute getModel_SourceModelProvider(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.common.metadata.Model#getCurrentModelContext <em>Current Model Context</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Current Model Context</em>'. - * @see org.eclipse.jst.jsf.common.metadata.Model#getCurrentModelContext() - * @see #getModel() - * @generated - */ - EAttribute getModel_CurrentModelContext(); - - /** - * Returns the meta object for the containment reference list '{@link org.eclipse.jst.jsf.common.metadata.Model#getEntityGroups <em>Entity Groups</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the containment reference list '<em>Entity Groups</em>'. - * @see org.eclipse.jst.jsf.common.metadata.Model#getEntityGroups() - * @see #getModel() - * @generated - */ - EReference getModel_EntityGroups(); - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.common.metadata.Entity <em>Entity</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Entity</em>'. - * @see org.eclipse.jst.jsf.common.metadata.Entity - * @generated - */ - EClass getEntity(); - - /** - * Returns the meta object for the containment reference list '{@link org.eclipse.jst.jsf.common.metadata.Entity#getChildEntities <em>Child Entities</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the containment reference list '<em>Child Entities</em>'. - * @see org.eclipse.jst.jsf.common.metadata.Entity#getChildEntities() - * @see #getEntity() - * @generated - */ - EReference getEntity_ChildEntities(); - - /** - * Returns the meta object for the containment reference list '{@link org.eclipse.jst.jsf.common.metadata.Entity#getTraits <em>Traits</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the containment reference list '<em>Traits</em>'. - * @see org.eclipse.jst.jsf.common.metadata.Entity#getTraits() - * @see #getEntity() - * @generated - */ - EReference getEntity_Traits(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.common.metadata.Entity#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.common.metadata.Entity#getId() - * @see #getEntity() - * @generated - */ - EAttribute getEntity_Id(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.common.metadata.Entity#getType <em>Type</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Type</em>'. - * @see org.eclipse.jst.jsf.common.metadata.Entity#getType() - * @see #getEntity() - * @generated - */ - EAttribute getEntity_Type(); - - /** - * Returns the meta object for the reference list '{@link org.eclipse.jst.jsf.common.metadata.Entity#getIncludeGroups <em>Include Groups</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the reference list '<em>Include Groups</em>'. - * @see org.eclipse.jst.jsf.common.metadata.Entity#getIncludeGroups() - * @see #getEntity() - * @generated - */ - EReference getEntity_IncludeGroups(); - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.common.metadata.EntityGroup <em>Entity Group</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Entity Group</em>'. - * @see org.eclipse.jst.jsf.common.metadata.EntityGroup - * @generated - */ - EClass getEntityGroup(); - - /** - * Returns the meta object for data type '{@link org.eclipse.jst.jsf.common.metadata.query.ITraitVisitor <em>ITrait Visitor</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for data type '<em>ITrait Visitor</em>'. - * @see org.eclipse.jst.jsf.common.metadata.query.ITraitVisitor - * @model instanceClass="org.eclipse.jst.jsf.common.metadata.query.ITraitVisitor" serializeable="false" - * @generated - */ - EDataType getITraitVisitor(); - - /** - * Returns the meta object for data type '{@link org.eclipse.jst.jsf.common.metadata.query.IEntityVisitor <em>IEntity Visitor</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for data type '<em>IEntity Visitor</em>'. - * @see org.eclipse.jst.jsf.common.metadata.query.IEntityVisitor - * @model instanceClass="org.eclipse.jst.jsf.common.metadata.query.IEntityVisitor" serializeable="false" - * @generated - */ - EDataType getIEntityVisitor(); - - /** - * Returns the meta object for data type '{@link org.eclipse.jst.jsf.common.metadata.internal.IMetaDataSourceModelProvider <em>IMeta Data Source Model Provider</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for data type '<em>IMeta Data Source Model Provider</em>'. - * @see org.eclipse.jst.jsf.common.metadata.internal.IMetaDataSourceModelProvider - * @model instanceClass="org.eclipse.jst.jsf.common.metadata.internal.IMetaDataSourceModelProvider" - * @generated - */ - EDataType getIMetaDataSourceModelProvider(); - - /** - * Returns the meta object for data type '{@link org.eclipse.jst.jsf.common.metadata.internal.ModelKeyDescriptor <em>Model Context</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for data type '<em>Model Context</em>'. - * @see org.eclipse.jst.jsf.common.metadata.internal.ModelKeyDescriptor - * @model instanceClass="org.eclipse.jst.jsf.common.metadata.internal.ModelKeyDescriptor" - * @generated - */ - EDataType getModelContext(); - - /** - * 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 - */ - MetadataFactory getMetadataFactory(); - - /** - * <!-- 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.common.metadata.internal.impl.TraitImpl <em>Trait</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.internal.impl.TraitImpl - * @see org.eclipse.jst.jsf.common.metadata.internal.impl.MetadataPackageImpl#getTrait() - * @generated - */ - EClass TRAIT = eINSTANCE.getTrait(); - - /** - * The meta object literal for the '<em><b>Id</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute TRAIT__ID = eINSTANCE.getTrait_Id(); - - /** - * The meta object literal for the '<em><b>Value</b></em>' containment reference feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference TRAIT__VALUE = eINSTANCE.getTrait_Value(); - - /** - * The meta object literal for the '<em><b>Source Model Provider</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute TRAIT__SOURCE_MODEL_PROVIDER = eINSTANCE.getTrait_SourceModelProvider(); - - /** - * The meta object literal for the '{@link org.eclipse.jst.jsf.common.metadata.internal.impl.IncludeEntityGroupImpl <em>Include Entity Group</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.internal.impl.IncludeEntityGroupImpl - * @see org.eclipse.jst.jsf.common.metadata.internal.impl.MetadataPackageImpl#getIncludeEntityGroup() - * @generated - */ - EClass INCLUDE_ENTITY_GROUP = eINSTANCE.getIncludeEntityGroup(); - - /** - * The meta object literal for the '<em><b>Id</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute INCLUDE_ENTITY_GROUP__ID = eINSTANCE.getIncludeEntityGroup_Id(); - - /** - * The meta object literal for the '<em><b>Model Uri</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute INCLUDE_ENTITY_GROUP__MODEL_URI = eINSTANCE.getIncludeEntityGroup_ModelUri(); - - /** - * The meta object literal for the '{@link org.eclipse.jst.jsf.common.metadata.internal.impl.ModelImpl <em>Model</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.internal.impl.ModelImpl - * @see org.eclipse.jst.jsf.common.metadata.internal.impl.MetadataPackageImpl#getModel() - * @generated - */ - EClass MODEL = eINSTANCE.getModel(); - - /** - * The meta object literal for the '<em><b>Source Model Provider</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute MODEL__SOURCE_MODEL_PROVIDER = eINSTANCE.getModel_SourceModelProvider(); - - /** - * The meta object literal for the '<em><b>Current Model Context</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute MODEL__CURRENT_MODEL_CONTEXT = eINSTANCE.getModel_CurrentModelContext(); - - /** - * The meta object literal for the '<em><b>Entity Groups</b></em>' containment reference list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference MODEL__ENTITY_GROUPS = eINSTANCE.getModel_EntityGroups(); - - /** - * The meta object literal for the '{@link org.eclipse.jst.jsf.common.metadata.internal.impl.EntityImpl <em>Entity</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.internal.impl.EntityImpl - * @see org.eclipse.jst.jsf.common.metadata.internal.impl.MetadataPackageImpl#getEntity() - * @generated - */ - EClass ENTITY = eINSTANCE.getEntity(); - - /** - * The meta object literal for the '<em><b>Child Entities</b></em>' containment reference list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference ENTITY__CHILD_ENTITIES = eINSTANCE.getEntity_ChildEntities(); - - /** - * The meta object literal for the '<em><b>Traits</b></em>' containment reference list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference ENTITY__TRAITS = eINSTANCE.getEntity_Traits(); - - /** - * The meta object literal for the '<em><b>Id</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute ENTITY__ID = eINSTANCE.getEntity_Id(); - - /** - * The meta object literal for the '<em><b>Type</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute ENTITY__TYPE = eINSTANCE.getEntity_Type(); - - /** - * The meta object literal for the '<em><b>Include Groups</b></em>' reference list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference ENTITY__INCLUDE_GROUPS = eINSTANCE.getEntity_IncludeGroups(); - - /** - * The meta object literal for the '{@link org.eclipse.jst.jsf.common.metadata.internal.impl.EntityGroupImpl <em>Entity Group</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.internal.impl.EntityGroupImpl - * @see org.eclipse.jst.jsf.common.metadata.internal.impl.MetadataPackageImpl#getEntityGroup() - * @generated - */ - EClass ENTITY_GROUP = eINSTANCE.getEntityGroup(); - - /** - * The meta object literal for the '<em>ITrait Visitor</em>' data type. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.query.ITraitVisitor - * @see org.eclipse.jst.jsf.common.metadata.internal.impl.MetadataPackageImpl#getITraitVisitor() - * @generated - */ - EDataType ITRAIT_VISITOR = eINSTANCE.getITraitVisitor(); - - /** - * The meta object literal for the '<em>IEntity Visitor</em>' data type. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.query.IEntityVisitor - * @see org.eclipse.jst.jsf.common.metadata.internal.impl.MetadataPackageImpl#getIEntityVisitor() - * @generated - */ - EDataType IENTITY_VISITOR = eINSTANCE.getIEntityVisitor(); - - /** - * The meta object literal for the '<em>IMeta Data Source Model Provider</em>' data type. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.internal.IMetaDataSourceModelProvider - * @see org.eclipse.jst.jsf.common.metadata.internal.impl.MetadataPackageImpl#getIMetaDataSourceModelProvider() - * @generated - */ - EDataType IMETA_DATA_SOURCE_MODEL_PROVIDER = eINSTANCE.getIMetaDataSourceModelProvider(); - - /** - * The meta object literal for the '<em>Model Context</em>' data type. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.internal.ModelKeyDescriptor - * @see org.eclipse.jst.jsf.common.metadata.internal.impl.MetadataPackageImpl#getModelContext() - * @generated - */ - EDataType MODEL_CONTEXT = eINSTANCE.getModelContext(); - - } - -} //MetadataPackage diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/Model.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/Model.java deleted file mode 100644 index 121bef296..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/Model.java +++ /dev/null @@ -1,128 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id$ - */ -package org.eclipse.jst.jsf.common.metadata; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataSourceModelProvider; -import org.eclipse.jst.jsf.common.metadata.internal.ModelKeyDescriptor; -import org.eclipse.jst.jsf.common.metadata.query.IEntityVisitor; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Model</b></em>'. - * <p><b>Provisional API - subject to change</b></p> - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.jst.jsf.common.metadata.Model#getEntityGroups <em>Entity Groups</em>}</li> - * <li>{@link org.eclipse.jst.jsf.common.metadata.Model#getSourceModelProvider <em>Source Model Provider</em>}</li> - * <li>{@link org.eclipse.jst.jsf.common.metadata.Model#getCurrentModelContext <em>Current Model Context</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.jst.jsf.common.metadata.MetadataPackage#getModel() - * @model extendedMetaData="kind='element' name='metadatamodel'" - * @generated - */ -public interface Model extends Entity { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - /** - * Returns the value of the '<em><b>Source Model Provider</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Source Model Provider</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 Model Provider</em>' attribute. - * @see #setSourceModelProvider(IMetaDataSourceModelProvider) - * @see org.eclipse.jst.jsf.common.metadata.MetadataPackage#getModel_SourceModelProvider() - * @model unique="false" dataType="org.eclipse.jst.jsf.common.metadata.IMetaDataSourceModelProvider" transient="true" volatile="true" - * @generated - */ - IMetaDataSourceModelProvider getSourceModelProvider(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.common.metadata.Model#getSourceModelProvider <em>Source Model Provider</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Source Model Provider</em>' attribute. - * @see #getSourceModelProvider() - * @generated - */ - void setSourceModelProvider(IMetaDataSourceModelProvider value); - - /** - * Returns the value of the '<em><b>Current Model Context</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Current Model Context</em>' attribute isn't clear, - * there really should be more of a description here... - * @deprecated - Helios - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Current Model Context</em>' attribute. - * @see #setCurrentModelContext(ModelKeyDescriptor) - * @see org.eclipse.jst.jsf.common.metadata.MetadataPackage#getModel_CurrentModelContext() - * @model dataType="org.eclipse.jst.jsf.common.metadata.ModelContext" transient="true" volatile="true" - * @generated - */ - ModelKeyDescriptor getCurrentModelContext(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.common.metadata.Model#getCurrentModelContext <em>Current Model Context</em>}' attribute. - * <!-- begin-user-doc --> - * @deprecated - Helios - * <!-- end-user-doc --> - * @param value the new value of the '<em>Current Model Context</em>' attribute. - * @see #getCurrentModelContext() - * @generated - */ - void setCurrentModelContext(ModelKeyDescriptor value); - - /** - * Returns the value of the '<em><b>Entity Groups</b></em>' containment reference list. - * The list contents are of type {@link org.eclipse.jst.jsf.common.metadata.EntityGroup}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Entity Groups</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>Entity Groups</em>' containment reference list. - * @see org.eclipse.jst.jsf.common.metadata.MetadataPackage#getModel_EntityGroups() - * @model containment="true" keys="id type" - * extendedMetaData="kind='element' name='entityGroup'" - * @generated - */ - EList<EntityGroup> getEntityGroups(); - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @model - * @generated - */ - EntityGroup findIncludeGroup(String groupId); - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @model visitorDataType="org.eclipse.jst.jsf.common.metadata.IEntityVisitor" - * @generated - */ - void accept(IEntityVisitor visitor); - -} // Model diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/Trait.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/Trait.java deleted file mode 100644 index c953b249e..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/Trait.java +++ /dev/null @@ -1,128 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id$ - */ -package org.eclipse.jst.jsf.common.metadata; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataSourceModelProvider; -import org.eclipse.jst.jsf.common.metadata.query.ITraitVisitor; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Trait</b></em>'. - * <p><b>Provisional API - subject to change</b></p> - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.jst.jsf.common.metadata.Trait#getId <em>Id</em>}</li> - * <li>{@link org.eclipse.jst.jsf.common.metadata.Trait#getValue <em>Value</em>}</li> - * <li>{@link org.eclipse.jst.jsf.common.metadata.Trait#getSourceModelProvider <em>Source Model Provider</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.jst.jsf.common.metadata.MetadataPackage#getTrait() - * @model extendedMetaData="kind='element' name='trait'" - * @generated - */ -public interface Trait extends EObject { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - /** - * 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.common.metadata.MetadataPackage#getTrait_Id() - * @model id="true" required="true" - * @generated - */ - String getId(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.common.metadata.Trait#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>' containment reference. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Value</em>' reference isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Value</em>' containment reference. - * @see #setValue(EObject) - * @see org.eclipse.jst.jsf.common.metadata.MetadataPackage#getTrait_Value() - * @model containment="true" required="true" - * extendedMetaData="kind='element'" - * @generated - */ - EObject getValue(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.common.metadata.Trait#getValue <em>Value</em>}' containment reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Value</em>' containment reference. - * @see #getValue() - * @generated - */ - void setValue(EObject value); - - /** - * Returns the value of the '<em><b>Source Model Provider</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Source Model Provider</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 Model Provider</em>' attribute. - * @see #setSourceModelProvider(IMetaDataSourceModelProvider) - * @see org.eclipse.jst.jsf.common.metadata.MetadataPackage#getTrait_SourceModelProvider() - * @model dataType="org.eclipse.jst.jsf.common.metadata.IMetaDataSourceModelProvider" transient="true" - * @generated - */ - IMetaDataSourceModelProvider getSourceModelProvider(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.common.metadata.Trait#getSourceModelProvider <em>Source Model Provider</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Source Model Provider</em>' attribute. - * @see #getSourceModelProvider() - * @generated - */ - void setSourceModelProvider(IMetaDataSourceModelProvider value); - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @model visitorDataType="org.eclipse.jst.jsf.common.metadata.ITraitVisitor" - * annotation="http://www.eclipse.org/emf/2002/GenModel body='visitor.visit(this);'" - * @generated - */ - void accept(ITraitVisitor visitor); - -} // Trait diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/AbstractMetaDataLocator.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/AbstractMetaDataLocator.java deleted file mode 100644 index a3e46e360..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/AbstractMetaDataLocator.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: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.internal; - -import java.util.HashSet; -import java.util.Set; - -/** - * Convenient abstract class that a source model locator should consider extending. - */ -public abstract class AbstractMetaDataLocator implements IMetaDataLocator, IMetaDataObservable{ - - private IDomainSourceModelType domainSourceModelType; - private Set <IMetaDataObserver> observers; - - /** - * Constructor - */ - public AbstractMetaDataLocator(){ - observers = new HashSet(1); - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.internal.IMetaDataLocator#getDomainSourceModelType() - */ - public IDomainSourceModelType getDomainSourceModelType() { - return domainSourceModelType; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.internal.IMetaDataLocator#setDomainSourceModelType(org.eclipse.jst.jsf.common.metadata.internal.IDomainSourceModelType) - */ - public void setDomainSourceModelType( - final IDomainSourceModelType domainSourceModelType) { - this.domainSourceModelType = domainSourceModelType; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.internal.IMetaDataLocator#addObserver(org.eclipse.jst.jsf.common.metadata.internal.IMetaDataObserver) - */ - public void addObserver(final IMetaDataObserver observer) { - observers.add(observer); - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.internal.IMetaDataLocator#removeObserver(org.eclipse.jst.jsf.common.metadata.internal.IMetaDataObserver) - */ - public void removeObserver(final IMetaDataObserver observer) { - observers.remove(observer); - } - - /** - * @return the set of {@link IMetaDataObserver}s for this instance - */ - public Set <IMetaDataObserver> getObservers(){ - return observers; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/AbstractMetaDataModelManager.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/AbstractMetaDataModelManager.java deleted file mode 100644 index 829bf2361..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/AbstractMetaDataModelManager.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 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 and/or initial documentation - *******************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.internal; - -import org.eclipse.jst.jsf.common.internal.managedobject.AbstractManagedObject; - - -/** - * Abstract implementation of an {@link IMetaDataModelManager} that all implementers must subclass - */ -public abstract class AbstractMetaDataModelManager extends AbstractManagedObject implements IMetaDataModelManager { - - @Override - public void dispose() { - //do nothing by default - } - - @Override - public void checkpoint() { - //do nothing by default - } - - @Override - public void destroy() { - // do nothing by default - } - -}
\ No newline at end of file diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/AbstractTagLibDomainContentModelMetaDataTranslator.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/AbstractTagLibDomainContentModelMetaDataTranslator.java deleted file mode 100644 index ed0d1c54a..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/AbstractTagLibDomainContentModelMetaDataTranslator.java +++ /dev/null @@ -1,360 +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.common.metadata.internal; - -import java.util.Iterator; - -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.metadata.traittypes.traittypes.BooleanValue; -import org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.StringValue; -import org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.TraitTypesFactory; -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; - -/** - * Abstract class that the taglib domain translators use to - * convert the CM model to a standard meta data model - * - */ -public abstract class AbstractTagLibDomainContentModelMetaDataTranslator { - - /** - * {@link IMetaDataModelMergeAssistant} to use - */ - protected IMetaDataModelMergeAssistant _assistant; - - /** - * Set the assistant to use during the translation. Must be called prior to doTransalate(doc); - * @param assistant - */ - protected void setAssistant(IMetaDataModelMergeAssistant assistant){ - _assistant = assistant; - } - - /** - * Transforms the CMDocument into entities and traits of a standard metadata model - * using the assistant that must be set before this call. - * @param doc - */ - protected void doTranslate(CMDocument doc){ - createTags(doc); - createTagfileTraits(doc); - } - - /** - * @param entity - * @param key - * @param value - */ - protected void createSimpleStringEntityTraitIfNecessary(final Entity entity, final String key, - final String value) { - Trait t = findTraitOnEntityById(entity, key); - if (t == null){ - t = internalCreateTrait(entity, key); - - StringValue val = TraitTypesFactory.eINSTANCE.createStringValue(); - val.setValue(value); - - t.setValue(val); - } - } - - /** - * @param entity - * @param key - * @param value - */ - protected void createSimpleBooleanObjectEntityTraitIfNecessary(final Entity entity, - String key, boolean value) { - - Trait t = findTraitOnEntityById(entity, key); - if (t == null){ - t = internalCreateTrait(entity, key); - - BooleanValue val = TraitTypesFactory.eINSTANCE.createBooleanValue(); - val.setTrue(value); - - t.setValue(val); - } - - } - - /** - * @param entity - * @param key - * @return Trait - */ - protected Trait internalCreateTrait(final Entity entity, final String key) { - Trait t = MetadataFactory.eINSTANCE.createTrait(); - t.setId(key); - t.setSourceModelProvider(_assistant.getSourceModelProvider()); - entity.getTraits().add(t); - return t; - } - - /** - * @param entity - * @param key - * @return Trait - */ - protected Trait findTraitOnEntityById(final Entity entity, final String key) { - for (Iterator it=entity.getTraits().iterator();it.hasNext();){ - Trait t = (Trait)it.next(); - if (key.equals(t.getId())) - return t; - } - return null; - } - - /** - * @param nodeName - * @return Entity - */ - protected Entity findTagEntity(final String nodeName) { - for (Iterator it=getMergedModel().getChildEntities().iterator();it.hasNext();){ - Entity entity = (Entity)it.next(); - if (nodeName.equals(entity.getId())) - return entity; - } - return null; - } - - /** - * @param tag - * @param attributeName - * @return Attribute entity for supplied attribute name and given Tag entity. Will return null if not found. - */ - protected Entity findAttributeEntityForTagEntity(final Entity tag, final String attributeName) { - for (Iterator it=tag.getChildEntities().iterator();it.hasNext();){ - Entity attr = (Entity)it.next(); - if (attributeName.equals(attr.getId())) - return attr; - } - return null; - } - /** - * Create entities for tags - * @param doc - */ - protected void createTags(final CMDocument doc) { - for (Iterator it=doc.getElements().iterator();it.hasNext();){ - CMElementDeclaration tag = (CMElementDeclaration)it.next(); - Entity entity = findTagEntity(tag.getNodeName()); - if (entity == null){ - entity = MetadataFactory.eINSTANCE.createEntity(); - entity.setId(getTagNodeName(tag)); - entity.setType("tag"); //$NON-NLS-1$ - getMergedModel().getChildEntities().add(entity); - } - setTagEntityTraits(tag, entity); - } - - } - - /** - * @param tag - * @return tag node name - */ - protected String getTagNodeName(CMElementDeclaration tag) { - return tag.getNodeName(); - } - - /** - * Sets the standard traits for a tag entity from the element declaration - * @param tag - * @param entity - */ - protected void setTagEntityTraits(CMElementDeclaration tag, Entity entity) { - createSimpleStringEntityTraitIfNecessary(entity, "display-label", getTagDisplayName(tag)); //$NON-NLS-1$ - createSimpleStringEntityTraitIfNecessary(entity, "description", getTagDescription(tag)); //$NON-NLS-1$ - createSimpleStringEntityTraitIfNecessary(entity, "small-icon", getTagSmallIcon(tag)); //$NON-NLS-1$ - createSimpleStringEntityTraitIfNecessary(entity, "large-icon", getTagLargeIcon(tag)); //$NON-NLS-1$ - createSimpleBooleanObjectEntityTraitIfNecessary(entity, "expert", getTagIsExpert(tag)); //$NON-NLS-1$ - createSimpleBooleanObjectEntityTraitIfNecessary(entity, "hidden", getTagIsHidden(tag)); //$NON-NLS-1$ - - createAttributeEntities(entity, tag); - } - - /** - * @param tagEntity - * @param tag - */ - protected void createAttributeEntities(Entity tagEntity, - CMElementDeclaration tag) { - - for (Iterator it=tag.getAttributes().iterator();it.hasNext();){ - CMAttributeDeclaration cmAttr = (CMAttributeDeclaration)it.next(); - Entity attr = findAttributeEntityForTagEntity(tagEntity, cmAttr.getAttrName()); - if (attr == null) { - attr = MetadataFactory.eINSTANCE.createEntity(); - attr.setId(cmAttr.getAttrName()); - tagEntity.getChildEntities().add(attr); - } - createAttributeTraits(attr, cmAttr); - } - - - } - - /** - * @param attr - * @param cmAttr - */ - protected void createAttributeTraits(Entity attr, - CMAttributeDeclaration cmAttr) { - - createSimpleStringEntityTraitIfNecessary(attr, "description", getTagAttributeDescription(cmAttr)); //$NON-NLS-1$ - createSimpleBooleanObjectEntityTraitIfNecessary(attr, "required", getTagAttributeIsRequired(cmAttr)); //$NON-NLS-1$ - createSimpleStringEntityTraitIfNecessary(attr, "default-value", getTagAttributeDefaultValue(cmAttr)); //$NON-NLS-1$ - } - - /** - * @param cmAttr - * @return null. subclass should override if CMAttributeDeclaration has the metadata. - */ - protected String getTagAttributeDescription(CMAttributeDeclaration cmAttr) {return null;} - - /** - * @param cmAttr - * @return false. subclass should override if CMAttributeDeclaration has the metadata. - */ - protected boolean getTagAttributeIsRequired(CMAttributeDeclaration cmAttr) {return cmAttr.getUsage() == CMAttributeDeclaration.REQUIRED;} - - /** - * @param cmAttr - * @return null. subclass should override if CMAttributeDeclaration has the metadata. - */ - protected String getTagAttributeDefaultValue(CMAttributeDeclaration cmAttr) {return null;} - - /** - * @param tag - * @return false. subclass should override if CMElementDeclaration has the metadata. - */ - protected boolean getTagIsHidden(CMElementDeclaration tag) {return false;} - - /** - * @param tag - * @return false. subclass should override if CMElementDeclaration has the metadata. - */ - protected boolean getTagIsExpert(CMElementDeclaration tag) {return false;} - - /** - * @param tag - * @return null. subclass should override if CMElementDeclaration has the metadata. - */ - protected String getTagLargeIcon(CMElementDeclaration tag) {return null;} - - /** - * @param tag - * @return null. subclass should override if CMElementDeclaration has the metadata. - */ - protected String getTagSmallIcon(CMElementDeclaration tag) {return null;} - - /** - * @param tag - * @return null. subclass should override if CMElementDeclaration has the metadata. - */ - protected String getTagDescription(CMElementDeclaration tag) {return null;} - - /** - * @param tag - * @return tag.getElementName() - */ - protected String getTagDisplayName(CMElementDeclaration tag) {return tag.getElementName();} - - /** - * Creates standard traits for tag file entity from CMDocument metadata - * @param doc - */ - protected void createTagfileTraits(CMDocument doc) { - Model model = getMergedModel(); - - createSimpleStringEntityTraitIfNecessary(model, "display-label", getURIDisplayLabel()); //$NON-NLS-1$ - createSimpleStringEntityTraitIfNecessary(model, "description", getURIDescription()); //$NON-NLS-1$ - createSimpleStringEntityTraitIfNecessary(model, "default-prefix", getURIDefaultPrefix()); //$NON-NLS-1$ - createSimpleBooleanObjectEntityTraitIfNecessary(model, "expert", getURIExpert()); //$NON-NLS-1$ - createSimpleBooleanObjectEntityTraitIfNecessary(model, "hidden", getURIHidden()); //$NON-NLS-1$ - - } - - /** - * @return the display label to use for this model. Subclasses should override if model has the meta data. - */ - protected String getURIDisplayLabel(){ - return getMergedModel().getId(); - } - - /** - * @return default prefix to use for tags. Returns null. Subclasses should override if model has the meta data. - */ - protected String getURIDefaultPrefix(){ - return null; - } - - /** - * @return description to use. Default is the URI. Subclasses should override if model has the meta data. - */ - protected String getURIDescription(){ - return getMergedModel().getId(); - } - - /** - * @return false. Subclasses should override if model has the meta data. - */ - protected boolean getURIExpert() { return false;} - - /** - * @return false. Subclasses should override if model has the meta data. - */ - protected boolean getURIHidden() {return false; } - - /** - * @return a model of all entities and traits - */ - protected Model getMergedModel() { - Model model = (Model)_assistant.getMergedModel().getRoot(); - if (model == null){ - //need to create model key object - Model tld = createTLDModel(); - _assistant.getMergedModel().setRoot(tld); - model = (Model)_assistant.getMergedModel().getRoot(); - } - return model; - } - - /** - * @return new model - */ - protected Model createTLDModel() { - Model entity = getFactory().createModel(); - entity.setId(_assistant.getMergedModel().getModelContext().getModelIdentifier()); - return entity; - } - - /** - * @return MetadataFactory instance - */ - protected MetadataFactory getFactory(){ - return (MetadataFactory) MetadataPackage.eINSTANCE.getEFactoryInstance(); - } - - /** - * @return CMDocument being used for the current translate call - */ - protected CMDocument getSourceModel() { - return (CMDocument)_assistant.getSourceModelProvider().getSourceModel(); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/DomainLoadingStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/DomainLoadingStrategy.java deleted file mode 100644 index 8cfda6a8b..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/DomainLoadingStrategy.java +++ /dev/null @@ -1,195 +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.common.metadata.internal; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; - -/** - * Default class used for loading metadata. - * Loads the source types from extensions defined against the domain. - * - * see org.eclipse.jst.jsf.common.domainLoadingStrategies ext-pt - */ -public class DomainLoadingStrategy implements IDomainLoadingStrategy, IMetaDataObserver { - - /** - * Domain id - */ - protected String domain; - - private MetaDataModel _model; - private List <IDomainSourceModelType> _sourceTypes; - private List <IMetaDataSourceModelProvider> _sources; - - /** - * Constructor - * @param domain - */ - public DomainLoadingStrategy(String domain){ - this.domain = domain; - } - - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.internal.IDomainLoadingStrategy#load(org.eclipse.jst.jsf.common.metadata.internal.MetaDataModel) - */ - public void load(MetaDataModel model) { - this._model = model; - _sourceTypes = loadDomainSourceModelTypes(); - sortSourceTypes(_sourceTypes); - _sources = locateMetaDataSourceInstances(_sourceTypes, model); - mergeModel(model, _sources); - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.internal.IDomainLoadingStrategy#reload() - */ - public void reload() throws ModelNotSetException { - //System.out.println("reload");//debug //$NON-NLS-1$ - if (_model == null) - throw new ModelNotSetException(); - - removeOldLocatorObservers(); - _sources = locateMetaDataSourceInstances(_sourceTypes, _model); - mergeModel(_model, _sources); - } - - /** - * Responsible for iterating through the sorted list of <code>IMetaDataSourceModelProvider</code> - * and merging the models after first translating the source model as required, into a single mreged model of - * standard metadata Entities and Traits. - * @param model - * @param sources - */ - protected void mergeModel(final MetaDataModel model, final List <IMetaDataSourceModelProvider> sources) { - - StandardModelFactory.debug(">> Begin Merge: "+model.getModelContext()+"("+sources.size()+ " sources)", StandardModelFactory.DEBUG_MD_LOAD); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - - final IMetaDataModelMergeAssistant assistant = createModelMergeAssistant(model); - for (final IMetaDataSourceModelProvider mds : sources){ - final Iterator translators = mds.getLocator().getDomainSourceModelType().getTranslators().iterator(); - while (translators.hasNext()){ - final IMetaDataTranslator translator = (IMetaDataTranslator)translators.next(); - if (translator.canTranslate(mds)){ - StandardModelFactory.debug(">>> Merging: "+model.getModelContext()+"::"+mds, StandardModelFactory.DEBUG_MD_LOAD); //$NON-NLS-1$//$NON-NLS-2$ - assistant.setSourceModelProvider(mds); - try { - translator.translate(assistant); - } catch (Exception e) { - StandardModelFactory.debug(">>>> Error during translate/merge of: "+model.getModelContext()+": "+mds, StandardModelFactory.DEBUG_MD_LOAD); //$NON-NLS-1$ //$NON-NLS-2$ - JSFCommonPlugin.log(IStatus.ERROR, "Error during load of: "+mds, e); //$NON-NLS-1$ - } - } - } - } - assistant.setMergeComplete(); - StandardModelFactory.debug(">> End Merge: "+model.getModelContext(),StandardModelFactory.DEBUG_MD_LOAD); //$NON-NLS-1$ - } - - /** - * @param model - * @return an instance of a IMetaDataModelMergeAssistant to be used while merging source models - */ - protected IMetaDataModelMergeAssistant createModelMergeAssistant(MetaDataModel model){ - return new MetaDataModelMergeAssistantImpl(model); - } - - /** - * Allows for subclasses to override the default mechanism for sorting the source types. - * @param sourceTypes - */ - protected void sortSourceTypes(List <IDomainSourceModelType> sourceTypes) { - //allows override - } - - /** - * @return list of <code>IDomainSourceModelType</code>s located in the <code>DomainSourceTypesRegistry</code> - * for the specified uri - */ - protected List <IDomainSourceModelType> loadDomainSourceModelTypes() { - return DomainSourceTypesRegistry.getInstance().getDomainSourceTypes(domain); - } - - /** - * @param sourceTypes - * @param model - * @return list of <code>IMetaDataSourceModelProvider</code> instances from the domain source types applicable for - * this domain for this particular uri specified in the model - */ - protected List <IMetaDataSourceModelProvider> locateMetaDataSourceInstances(final List <IDomainSourceModelType> sourceTypes, MetaDataModel model) { - final List<IMetaDataSourceModelProvider> sources = new ArrayList<IMetaDataSourceModelProvider>(); - final IProject project = getProject(model); - for (final IDomainSourceModelType sourceType : sourceTypes){ - final IMetaDataLocator locator = sourceType.getLocator(project); - if (locator != null) { - //We MUST set the sourceType here to associate the handler with locator to use for the source models - locator.setDomainSourceModelType(sourceType); - - final List <IMetaDataSourceModelProvider> providers = locator.locateMetaDataModelProviders(model.getModelContext().getModelIdentifier()); - if (providers != null && !providers.isEmpty()){ - for (final IMetaDataSourceModelProvider provider : providers){ - //We MUST set the sourceType here to associate the translators to use for the source models - provider.setLocator(locator); - sources.add(provider); - } - } - //listen for changes - locator.addObserver(this); - } - } - return sources; - } - - private IProject getProject(final MetaDataModel model) { - return (IProject)model.getModelContext().getAdapter(IProject.class); - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.internal.IMetaDataObserver#notifyMetadataChanged(org.eclipse.jst.jsf.common.metadata.internal.IMetaDataChangeNotificationEvent) - */ - public void notifyMetadataChanged(final IMetaDataChangeNotificationEvent event) { - //for now, if any event occurs, we need to flush the _model so that it will rebuild - _model.setNeedsRefresh(); - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.internal.IDomainLoadingStrategy#cleanup() - */ - public void cleanup(){ - removeOldLocatorObservers(); - _sources = null; - _sourceTypes = null; - _model = null; - } - - private void removeOldLocatorObservers(){ - if (_sources != null){ - for (final IMetaDataSourceModelProvider provider : _sources){ - if (provider != null) { - final IMetaDataLocator locator = provider.getLocator(); - if (locator != null){ - locator.removeObserver(this); - locator.setDomainSourceModelType(null); - provider.setLocator(null); - } - } - } - } - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/DomainLoadingStrategyRegistry.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/DomainLoadingStrategyRegistry.java deleted file mode 100644 index d5b175599..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/DomainLoadingStrategyRegistry.java +++ /dev/null @@ -1,171 +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.common.metadata.internal; - -import java.lang.reflect.InvocationTargetException; -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtensionPoint; -import org.eclipse.core.runtime.IExtensionRegistry; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; - - -/** - * Registry of strategies used to load domains of metadata. - * Uses the <code>org.eclipse.jst.jsf.common.domainLoadingStrategies</code> ext-pt to load. - * - * see <code>org.eclipse.jst.jsf.common.domainLoadingStrategies</code> ext-pt - */ -public class DomainLoadingStrategyRegistry{ - private static DomainLoadingStrategyRegistry INSTANCE; - - private HashMap <String, DomainLoadingStrategyDescriptorImpl> domainLoadingStrategyDescriptors; - - private static final String EXTENSION_POINT_ID = "domainLoadingStrategies"; //$NON-NLS-1$ - - private DomainLoadingStrategyRegistry(){ - init(); - } - - /** - * @return singleton instance of the DomainLoadingStrategyRegistry - */ - public synchronized static DomainLoadingStrategyRegistry getInstance() { - if (INSTANCE == null){ - INSTANCE = new DomainLoadingStrategyRegistry(); - } - return INSTANCE; - } - - /** - * Loads registry with descriptors from the domainLoadingStrategies ext-pt. - */ - synchronized final void init(){ - final IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry(); - final IExtensionPoint point = extensionRegistry.getExtensionPoint(JSFCommonPlugin.PLUGIN_ID, EXTENSION_POINT_ID ); - if (point != null) { - IConfigurationElement[] elements = point.getConfigurationElements(); - for (int i = 0; i < elements.length; i++) { - IConfigurationElement element = elements[i]; - DomainLoadingStrategyDescriptorImpl dls = new DomainLoadingStrategyDescriptorImpl(element); - addDomainLoadingStrategyDescriptor(dls); - } - } - } - - /** - * Add domain loading strategy descriptor for a domain to the registry domains - * @param strategy - */ - protected void addDomainLoadingStrategyDescriptor(final DomainLoadingStrategyDescriptorImpl strategy){ - getDescriptors().put(strategy.getDomain(), strategy); - } - - /** - * @param domain - * @return an instance of an <code>IDomainLoadingStrategy</code> for the given domain - */ - public IDomainLoadingStrategy getLoadingStrategy(final String domain){ - final DomainLoadingStrategyDescriptorImpl strategy = getDescriptors().get(domain); - if (strategy == null){ - return createDefaultLoadingStrategy(); - } - return createLoadingStrategy(domain); - } - - - /** - * @return strategy that will only use standard metadata files - */ - private IDomainLoadingStrategy createDefaultLoadingStrategy() { - return new DomainLoadingStrategy(null); - } - - private IDomainLoadingStrategy createLoadingStrategy(final String domain){ - return getDescriptors().get(domain).newInstance(); - } - - private Map <String, DomainLoadingStrategyDescriptorImpl> getDescriptors(){ - if (domainLoadingStrategyDescriptors == null){ - domainLoadingStrategyDescriptors = new HashMap<String, DomainLoadingStrategyDescriptorImpl>(); - } - return domainLoadingStrategyDescriptors; - } - - /** - * Implementation of a DomainLoadingStrategy descriptor that is responsible for creating instances of the IDomainLoadingStrategy - */ - private static class DomainLoadingStrategyDescriptorImpl { - String domain; - String loadingStrategyClassName; - String bundleId; - Class strategy; - IConfigurationElement element; - - DomainLoadingStrategyDescriptorImpl(IConfigurationElement element){ - this.element = element; - this.init(); - } - - private void init() { - domain = element.getAttribute("domainId"); //$NON-NLS-1$ - bundleId = element.getContributor().getName(); - loadingStrategyClassName = element.getAttribute("domainLoadingStrategy"); //$NON-NLS-1$ - } - - /** - * @return domain id - */ - public String getDomain() { - return domain; - } - - /** - * @return new instance of IDomainLoadingStrategy - */ - public IDomainLoadingStrategy newInstance(){ - try { - Class[] parameterTypes = new Class[]{String.class}; - Object[] initargs = new Object[]{domain}; - Object loader = this.getLoadingStrategy().getConstructor(parameterTypes).newInstance(initargs); - if (loader instanceof IDomainLoadingStrategy) - return (IDomainLoadingStrategy)loader; - } catch (InstantiationException e) { - JSFCommonPlugin.log(IStatus.ERROR, "Unable to instantiate IDomainLoadingStrategy for: "+ domain,e); //$NON-NLS-1$ - } catch (IllegalAccessException e) { - JSFCommonPlugin.log(IStatus.ERROR, "IllegalAccessException during creation of IDomainLoadingStrategy for: "+ domain,e); //$NON-NLS-1$ - } catch (IllegalArgumentException e) { - JSFCommonPlugin.log(IStatus.ERROR, "IllegalArgumentException during creation of IDomainLoadingStrategy for: "+ domain,e); //$NON-NLS-1$ - } catch (SecurityException e) { - JSFCommonPlugin.log(IStatus.ERROR, "SecurityException during creation of IDomainLoadingStrategy for: "+ domain,e); //$NON-NLS-1$ - } catch (InvocationTargetException e) { - JSFCommonPlugin.log(IStatus.ERROR, "InvocationTargetException during creation of IDomainLoadingStrategy for: "+ domain,e); //$NON-NLS-1$ - } catch (NoSuchMethodException e) { - JSFCommonPlugin.log(IStatus.ERROR, "NoSuchMethodException during creation of IDomainLoadingStrategy for: "+ domain,e); //$NON-NLS-1$ - } - return null; - } - - private Class getLoadingStrategy() { - if (strategy == null){ - strategy = JSFCommonPlugin.loadClass(loadingStrategyClassName, bundleId); - } - return strategy; - } - - } - -}
\ No newline at end of file diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/DomainSourceModelTypeDescriptor.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/DomainSourceModelTypeDescriptor.java deleted file mode 100644 index d2e925100..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/DomainSourceModelTypeDescriptor.java +++ /dev/null @@ -1,235 +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.common.metadata.internal; - -import java.util.HashSet; -import java.util.Iterator; -import java.util.Set; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtensionPoint; -import org.eclipse.core.runtime.IExtensionRegistry; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; - -/** - * Implementation of a {@link IDomainSourceModelType} descriptor. - * Responsible for producing instances of {@link IDomainSourceModelType}. - * Also responsible for creating the {@link IMetaDataTranslator} descriptors from the - * <code>com.eclipse.jst.jsf.common.domainSourceModelTypeTranslators</code> ext-pt - */ -public class DomainSourceModelTypeDescriptor { - private static final String TRANSLATORS_EXTENSION_POINT_ID = "domainSourceModelTypeTranslators"; //$NON-NLS-1$ - private static final String STANDARD_FILE_NULL_TRANSLATOR = "org.eclipse.jst.jsf.common.metadata.internal.StandardMetaDataFilesTranslator"; //$NON-NLS-1$ - private String domain = "DEFAULT"; //$NON-NLS-1$ - private String domainSourceModelTypeId; - private String locatorClassName = "org.eclipse.jst.jsf.common.metadata.internal.StandardMetaDataLocator"; //$NON-NLS-1$ - private Set translatorDescriptors; - private String bundleId = JSFCommonPlugin.PLUGIN_ID; - private int ordinal; - - /** - * Constructor - * @param domain - * @param domainSourceModelTypeId - * @param locatorClassName - * @param bundleId - * @param ordinal - */ - public DomainSourceModelTypeDescriptor(String domain, String domainSourceModelTypeId, String locatorClassName, String bundleId, int ordinal){ - this.domain = domain; - this.locatorClassName = locatorClassName; - this.domainSourceModelTypeId = domainSourceModelTypeId; - this.bundleId = bundleId; - this.ordinal = ordinal; - init(); - } - - /** - * Default model type descriptor that will load only standard metadata files - */ - public DomainSourceModelTypeDescriptor(){ -// getTranslatorDescriptors(); - //createTranslatorInstances() will add the standard null translator - } - - private synchronized void init() { - IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry(); - IExtensionPoint point = extensionRegistry.getExtensionPoint(JSFCommonPlugin.PLUGIN_ID, TRANSLATORS_EXTENSION_POINT_ID ); - if (point != null) { - IConfigurationElement[] elements = point.getConfigurationElements(); - for (int i = 0; i < elements.length; i++) { - IConfigurationElement element = elements[i]; - String srcHdlrId = element.getAttribute("domainSourceModelTypeId"); //$NON-NLS-1$ - if (srcHdlrId.equals(domainSourceModelTypeId)) - addTranslatorDescriptor(element); - } - } - } - - private void addTranslatorDescriptor(IConfigurationElement element) { - String translator = element.getAttribute("translatorClass"); //$NON-NLS-1$ - DomainSourceModelTranslatorDescriptor d = new DomainSourceModelTranslatorDescriptor(translator, element.getContributor().getName()); - getTranslatorDescriptors().add(d); - } - - private Set getTranslatorDescriptors(){ - if (translatorDescriptors == null){ - translatorDescriptors = new HashSet(); - } - return translatorDescriptors; - } - - /** - * @return domain - */ - public String getDomain() { - return domain; - } - - /** - * @return new instance of the {@link IDomainSourceModelType} - */ - public IDomainSourceModelType getInstance(){ - return new DomainSourceModelTypeImpl(); - } - - /** - * Internal class implementing {@link IDomainSourceModelType} - */ - class DomainSourceModelTypeImpl implements IDomainSourceModelType{ - - private Set translators; - private IMetaDataLocator locator; - - DomainSourceModelTypeImpl(){ - // restrict construction to package scope - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.internal.IDomainSourceModelType#getDomain() - */ - public String getDomain() { - return domain; - } - - /** - * @return value of ordinal defined by the ext-pt used for ordering source types for a domain - */ - public int getOrdinal(){ - return ordinal; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.internal.IDomainSourceModelType#getLocator() - */ - public IMetaDataLocator getLocator(IProject project) { - if (locator == null){ - locator = MetaDataLocatorFactory.getInstance().getLocator(locatorClassName, bundleId, project); - } - - return locator; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.internal.IDomainSourceModelType#getTranslators() - */ - public Set getTranslators() { - if (translators == null){ - translators = createTranslatorInstances(); - } - return translators; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - public String toString(){ - StringBuffer buf = new StringBuffer("DomainSourceModelTypeImpl"); //$NON-NLS-1$ - buf.append("(domain = "); //$NON-NLS-1$ - buf.append(getDomain()); - buf.append(", locator = "); //$NON-NLS-1$ - buf.append(locator != null ? locator.toString() : "null"); //$NON-NLS-1$ - buf.append(")"); //$NON-NLS-1$ - return buf.toString(); - } - - private Set createTranslatorInstances() { - translators = new HashSet<IMetaDataTranslator>(); - if (getTranslatorDescriptors().size() == 0){// for TagLibDomain, we are adding null translator via extension (as of 7/16/07) - //would get here if a domain and source type was defined without a domain translator. Should not happen, but - //add Null Translator for now.... - //we could/should raise exception. - //Developers should add a STANDARD_FILE_NULL_TRANSLATOR if using standard metadata format. - Class klass = JSFCommonPlugin.loadClass(STANDARD_FILE_NULL_TRANSLATOR, JSFCommonPlugin.PLUGIN_ID); - try { - translators.add(klass.newInstance()); - return translators; - } catch (InstantiationException e) { - // TODO: other error handling? - JSFCommonPlugin.log(e, "Error in createTranslatorInstances(STANDARD_FILE_NULL_TRANSLATOR)"); //$NON-NLS-1$ - } catch (IllegalAccessException e) { - // TODO: other error handling? - JSFCommonPlugin.log(e, "Error in createTranslatorInstances(STANDARD_FILE_NULL_TRANSLATOR)"); //$NON-NLS-1$ - } - - } - - Iterator <DomainSourceModelTranslatorDescriptor>it = getTranslatorDescriptors().iterator(); - while (it.hasNext()){ - final DomainSourceModelTranslatorDescriptor d = it.next(); - final Class klass = JSFCommonPlugin.loadClass(d.getTranslator(), d.getBundleId()); - try { - translators.add(klass.newInstance()); - } catch (InstantiationException e) { - // TODO: other error handling? - JSFCommonPlugin.log(e, "Error in createTranslatorInstances"); //$NON-NLS-1$ - } catch (IllegalAccessException e) { - // TODO: other error handling? - JSFCommonPlugin.log(e, "Error in createTranslatorInstances"); //$NON-NLS-1$ - } - } - return translators; - } - - } - - /** - * Internal class implementing a descriptor for DomainSourceModelTranslators - */ - static class DomainSourceModelTranslatorDescriptor { - - private final String _translator; - private final String _bundleId; - - /** - * Constructor - * @param translator - * @param bundleId - */ - public DomainSourceModelTranslatorDescriptor(final String translator, final String bundleId) { - this._translator = translator; - this._bundleId = bundleId; - } - - String getTranslator(){ - return _translator; - } - - String getBundleId(){ - return _bundleId; - } - - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/DomainSourceTypesRegistry.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/DomainSourceTypesRegistry.java deleted file mode 100644 index 54d0ed182..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/DomainSourceTypesRegistry.java +++ /dev/null @@ -1,131 +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.common.metadata.internal; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtensionPoint; -import org.eclipse.core.runtime.IExtensionRegistry; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; -import org.eclipse.jst.jsf.common.metadata.internal.DomainSourceModelTypeDescriptor.DomainSourceModelTypeImpl; - -/** - * Registry of Domain Source Types loaded from domainSourceModelTypes ext-pt. - */ -public class DomainSourceTypesRegistry{ - private static final String EXTENSION_POINT_ID = "domainSourceModelTypes"; //$NON-NLS-1$ - private static DomainSourceTypesRegistry INSTANCE; - private Map<String, List<DomainSourceModelTypeDescriptor>> domainSourceTypeDescriptors; - - private DomainSourceTypesRegistry(){ - init(); - } - - /** - * @return singleton instance of DomainSourceTypesRegistry - */ - public synchronized static DomainSourceTypesRegistry getInstance() { - if (INSTANCE == null){ - INSTANCE = new DomainSourceTypesRegistry(); - } - return INSTANCE; - } - - /** - * @param domain identifier - * @return list of <code>IDomainSourceModelType</code> sorted in descending order by ordinal - */ - public List<IDomainSourceModelType> getDomainSourceTypes(String domain){ - final List<DomainSourceModelTypeDescriptor> list = getDomainSourceModelDescriptors(domain); - final List<IDomainSourceModelType> types = new ArrayList<IDomainSourceModelType>(); - for(final DomainSourceModelTypeDescriptor d : list){ - types.add(d.getInstance()); - } - //default sort descending by ordinal - Collections.sort(types, new Comparator(){ - public int compare(final Object o1, final Object o2) { - final DomainSourceModelTypeImpl desc1 = (DomainSourceModelTypeImpl)o1; - final DomainSourceModelTypeImpl desc2 = (DomainSourceModelTypeImpl)o2; - if (desc1.getOrdinal() == desc2.getOrdinal()) - return 0; - if (desc1.getOrdinal() > desc2.getOrdinal()) - return -1; - - return 1; - } - - }); - - return types; - } - - private List getDomainSourceModelDescriptors(final String domain) { - final List ret = getDescriptors().get(domain); - if (ret != null && ret.size()>0) - return ret; - - return getDefaultSourceModelDescriptor(); - } - - private List getDefaultSourceModelDescriptor() { - final List ret = new ArrayList(); - final DomainSourceModelTypeDescriptor desc = new DomainSourceModelTypeDescriptor(); - ret.add(desc); - return ret; - } - - private synchronized void init() { - final IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry(); - final IExtensionPoint point = extensionRegistry.getExtensionPoint(JSFCommonPlugin.PLUGIN_ID, EXTENSION_POINT_ID ); - if (point != null) { - final IConfigurationElement[] elements = point.getConfigurationElements(); - for (int i = 0; i < elements.length; i++) { - final IConfigurationElement element = elements[i]; - addDomainSourceTypeDescriptor(element); - } - } - } - - private void addDomainSourceTypeDescriptor(final IConfigurationElement element) { - final String domainId = element.getAttribute("domainId"); //$NON-NLS-1$ - final String srcHdlrId = element.getAttribute("domainSourceModelTypeId"); //$NON-NLS-1$ - final String locator = element.getAttribute("locator"); //$NON-NLS-1$ - final String ordinalStr = element.getAttribute("ordinal"); //$NON-NLS-1$ - int ordinal = 1; - if (ordinalStr!=null && !ordinalStr.equals("")){ //$NON-NLS-1$ - ordinal = Integer.parseInt(ordinalStr); - } - final DomainSourceModelTypeDescriptor d = new DomainSourceModelTypeDescriptor(domainId, srcHdlrId, locator, element.getContributor().getName(), ordinal); - List<DomainSourceModelTypeDescriptor> descs = getDescriptors().get(domainId); - if (descs == null){ - descs = new ArrayList<DomainSourceModelTypeDescriptor>(); - getDescriptors().put(domainId, descs); - } - descs.add(d); - } - - private Map<String, List<DomainSourceModelTypeDescriptor>> getDescriptors() { - if (domainSourceTypeDescriptors == null){ - domainSourceTypeDescriptors = new HashMap<String, List<DomainSourceModelTypeDescriptor>>(); - } - return domainSourceTypeDescriptors; - } - - -}
\ No newline at end of file diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IClassLoaderProvider.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IClassLoaderProvider.java deleted file mode 100644 index 6c8169616..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IClassLoaderProvider.java +++ /dev/null @@ -1,22 +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.common.metadata.internal; - -/** - * Provides class loading by using the plugin's classloader that defined an item of metadata - */ -public interface IClassLoaderProvider { - /** - * @param className - * @return Class - implementers should eat exceptions and return null whenever class cannot be returned - */ - public Class loadClass(String className); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IDomainLoadingStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IDomainLoadingStrategy.java deleted file mode 100644 index ee21e6249..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IDomainLoadingStrategy.java +++ /dev/null @@ -1,42 +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.common.metadata.internal; - - -/** - * Defines a strategy to use for loading a standard metadata model for a certain domain. - * see <code>org.eclipse.jst.jsf.common.domainLoadingStrategies</code> ext-pt - */ -public interface IDomainLoadingStrategy { - - /** - * Create a merged "standard" metadata model. - * @param model to load - * - */ - public void load(MetaDataModel model); - - /** - * Reload a merged "standard" metadata model. - * Allows for some optimization for reload. - * @throws ModelNotSetException - * - */ - public void reload() throws ModelNotSetException; - - - /** - * Opportunity to cleanup and should be called when strategy is being destroyed - */ - public void cleanup(); - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IDomainSourceModelType.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IDomainSourceModelType.java deleted file mode 100644 index b2d7fcda4..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IDomainSourceModelType.java +++ /dev/null @@ -1,43 +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.common.metadata.internal; - -import java.util.Set; - -import org.eclipse.core.resources.IProject; - -/** - * Binds a domain of metadata to a source model type which is defined by a {@link IMetaDataLocator} - * and set of {@link IMetaDataTranslator}s - * Not intended to be implemented by clients. Created from ext-pts. - */ -public interface IDomainSourceModelType { - /** - * @return domain id - */ - public String getDomain(); - /** - * @param project - may be null - * @return instance of IMetaDataLocator - may return null if the locator cannot operate in the current context - */ - public IMetaDataLocator getLocator(IProject project); -// public int getOrdinal(); - /** - * @return set of {@link IMetaDataTranslator}s for the domain source model type - */ - public Set<IMetaDataTranslator> getTranslators(); - - /** - * @return oridinal for this type within the domain - */ - public int getOrdinal(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IImageDescriptorProvider.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IImageDescriptorProvider.java deleted file mode 100644 index 9405a6a64..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IImageDescriptorProvider.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.common.metadata.internal; - -import org.eclipse.jface.resource.ImageDescriptor; - -/** - * Provides image descriptors relative to the plugin that provided the image metadata - * - */ -public interface IImageDescriptorProvider { - /** - * @param imagePath - * @return ImageDescriptor - implementers should eat exceptions and return null whenever imageDescriptor cannot be returned - */ - public ImageDescriptor getImageDescriptor(String imagePath); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IMetaDataChangeNotificationEvent.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IMetaDataChangeNotificationEvent.java deleted file mode 100644 index 29c6ce13f..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IMetaDataChangeNotificationEvent.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: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.internal; - -/** - * Experimental and not used at the moment. - * - */ -public interface IMetaDataChangeNotificationEvent { - //change to enums if we do Java5 - /** - * TODO: - */ - public static final int ADDED = 1; - /** - * TODO: - */ - public static final int REMOVED = 2; - /** - * TODO: - */ - public static final int CHANGED = 3; - - /** - * @return the uri - */ - public String getURI(); - /** - * @return when to the event types above - */ - public int getEventType(); - /** - * @return the meta-data locator - */ - public IMetaDataLocator getLocator(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IMetaDataDomainContext.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IMetaDataDomainContext.java deleted file mode 100644 index 83fb2ce77..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IMetaDataDomainContext.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 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 and/or initial documentation - *******************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.internal; - -import org.eclipse.jst.jsf.common.metadata.query.internal.MetaDataQueryContextFactory; -import org.eclipse.jst.jsf.context.IModelContext; - -/** - * Domain context - * <p> - * @noimplement - see {@link MetaDataQueryContextFactory} - * - */ -public interface IMetaDataDomainContext extends IModelContext{ - - /** - * For convenience... - */ - public static final String TAGLIB_DOMAIN_CONTEXT_ID = "TagLibraryDomain"; //$NON-NLS-1$ - - /** - * @return domain identifier for this context. - */ - public String getDomainId(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IMetaDataDomainQueryFactory.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IMetaDataDomainQueryFactory.java deleted file mode 100644 index 85403c8cc..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IMetaDataDomainQueryFactory.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 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 and/or initial documentation - *******************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.internal; - -import org.eclipse.jst.jsf.common.metadata.query.internal.IMetaDataQuery; - -/** - * Produces {@link IMetaDataQuery}s for a metadata domain - * - */ -public interface IMetaDataDomainQueryFactory { - /** - * @param context - * @return {@link IMetaDataQuery} - */ - public IMetaDataQuery createQuery(final IMetaDataDomainContext context); - - /** - * @return the domain id that this factory handles - */ - public String getDomainIdentifier(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IMetaDataLocator.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IMetaDataLocator.java deleted file mode 100644 index c4405566c..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IMetaDataLocator.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.common.metadata.internal; - -import java.util.List; - -/** - * Locates instances of metadata of a specific source model type - */ -public interface IMetaDataLocator { - /** - * @param uri - * @return a list of <code>IMetaDataSourceModelProvider</code>s for the uri located by this instance - */ - public List <IMetaDataSourceModelProvider> locateMetaDataModelProviders(String uri); - - /** - * Opportunity for service to start (add listeners, etc.). - * Framework calls this immediately after construction and all setup should occur at this time. - */ - public void startLocating(); - /** - * Stop looking for instances of metadata model sources. An opportunity to cleanup. - */ - public void stopLocating(); - - /** - * @param observer add a {@link IMetaDataObserver} of this locator - */ - public void addObserver(IMetaDataObserver observer); - /** - * @param observer remove a {@link IMetaDataObserver} of this locator - */ - public void removeObserver(IMetaDataObserver observer); - - /** - * @return IDomainSourceModelType instance that created this locator - */ - public IDomainSourceModelType getDomainSourceModelType(); - /** - * @param domainSourceModelType set the domainSourceModelType instance that created this locator - */ - public void setDomainSourceModelType(IDomainSourceModelType domainSourceModelType); - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IMetaDataModelContext.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IMetaDataModelContext.java deleted file mode 100644 index 024b514e0..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IMetaDataModelContext.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 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 and/or initial documentation - *******************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.internal; - -import org.eclipse.jst.jsf.common.metadata.Model; - -/** - * Context for establishing the metadata model. - * TODO: Should probably be moved to query internal package - * <p> - * @noimplement - not intended to be implemented, users must subclass {@link MetaDataModelContext} if necessary - */ -public interface IMetaDataModelContext extends IMetaDataDomainContext { - - /** - * @return the string that will uniquely identify the {@link Model} within this domain of metadata - */ - public String getModelIdentifier(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IMetaDataModelManager.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IMetaDataModelManager.java deleted file mode 100644 index dc9cc0e10..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IMetaDataModelManager.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 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 and/or initial documentation - *******************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.internal; - -import org.eclipse.jst.jsf.common.internal.managedobject.IManagedObject; -import org.eclipse.jst.jsf.common.metadata.Model; - -/** - * Returns {@link Model}s for a given context which can then be queried. - * <p> - * Responsible for managing all domains of metadata - * <p> - * @noimplement - users must extend AbstractMetaDataModelManager - * @noextend - */ -public interface IMetaDataModelManager extends IManagedObject { - - /** - * Will locate a MetaData Model. Sets the model context in the - * model. - * - * @param modelContext - * @return the {@link Model} for the given model identifier - */ - public Model getModel( - final IMetaDataModelContext modelContext); - - -}
\ No newline at end of file diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IMetaDataModelManagerFactory.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IMetaDataModelManagerFactory.java deleted file mode 100644 index 5c8fa8492..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IMetaDataModelManagerFactory.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 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 and/or initial documentation - *******************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.internal; - -import org.eclipse.core.resources.IResource; - -/** - * A factory that will produce {@link IMetaDataModelManager}s - */ -public interface IMetaDataModelManagerFactory { - /** - * @param projectOrWorkspaceRoot - * @return IMetaDataModelManager for the project, or shared IMetaDataModelManager for the workspace - */ - public IMetaDataModelManager getInstance(IResource projectOrWorkspaceRoot); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IMetaDataModelMergeAssistant.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IMetaDataModelMergeAssistant.java deleted file mode 100644 index 0a6a341be..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IMetaDataModelMergeAssistant.java +++ /dev/null @@ -1,73 +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.common.metadata.internal; - -import org.eclipse.jst.jsf.common.metadata.Entity; -import org.eclipse.jst.jsf.common.metadata.EntityGroup; -import org.eclipse.jst.jsf.common.metadata.Trait; - - -/** - * Helper class interface to merge source models into a single merged model. - * Not intended to be implemented by clients - * - */ -public interface IMetaDataModelMergeAssistant { - /** - * @return merged model - */ - public MetaDataModel getMergedModel(); - /** - * Method that will first check to see if an entity with the same id exists in the merged model. - * If not, it will add it. The entities includeGroups are then also merged. - * @param entity - * @return the merged model entity - * - */ - public Entity addEntity(Entity entity); - /** - * Method will add an entity if not already existing in the merged model, and then check for an existing trait by id on the merged model's entity. - * @param entity - * @param trait - * @return flag indicating whether or not the traits was new and therefore added to the merged model's entity - */ - public boolean addTrait(Entity entity, Trait trait); - - /** - * Method will add an entityGroup to the model if not already exiting in the merged model (by id). - * @param entityGroup - */ - public void addEntityGroup(EntityGroup entityGroup); - /** - * Signal that the merge is complete so that any post-processing may occur. - * This should be the last call made on the merge assistant and should be done before client calls for the merged model result. - * This should signal that entityGroups processing should begin. - */ - public void setMergeComplete(); - - /** - * @param mds - {@link IMetaDataSourceModelProvider} - */ - public void setSourceModelProvider(IMetaDataSourceModelProvider mds); - /** - * @return {@link IMetaDataSourceModelProvider} for current operation - */ - public IMetaDataSourceModelProvider getSourceModelProvider(); - - /** - * @param queryRoot - * @param entityKey - key relative to queryRoot - * @return entity - will return null if not found - */ - public Entity getMergedEntity(Entity queryRoot, String entityKey); - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IMetaDataObservable.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IMetaDataObservable.java deleted file mode 100644 index 69152d34d..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IMetaDataObservable.java +++ /dev/null @@ -1,35 +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.common.metadata.internal; - -/** - * Allows {@link IMetaDataObserver}s to observe changes. - * Experimental. - * - */ -public interface IMetaDataObservable { - /** - * Add the observer to the set of observers. Has no effect if - * the same observer is already registered - * - * @param observer - */ - public void addObserver(IMetaDataObserver observer); - - /** - * Remove the observer from the set of observers. Has no effect - * if observer was not already registered. - * - * @param observer must not be null - */ - public void removeObserver(IMetaDataObserver observer); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IMetaDataObserver.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IMetaDataObserver.java deleted file mode 100644 index 5a138a33a..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IMetaDataObserver.java +++ /dev/null @@ -1,24 +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.common.metadata.internal; - -/** - * Interface for notification when an {@link IMetaDataObservable} changes - * - */ -public interface IMetaDataObserver { - /** - * Callback to observer when an {@link IMetaDataObservable} throws an event - * @param event - */ - public void notifyMetadataChanged(IMetaDataChangeNotificationEvent event); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IMetaDataSourceModelProvider.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IMetaDataSourceModelProvider.java deleted file mode 100644 index 6a19c3bb0..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IMetaDataSourceModelProvider.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.common.metadata.internal; - -import org.eclipse.core.runtime.IAdaptable; - - -/** - * Provides a source of metadata that can be transformed into a merged standard model - * LIKELY TO CHANGE - */ -public interface IMetaDataSourceModelProvider extends IAdaptable{ - /** - * @return the source model - */ - public Object getSourceModel(); - /** - * @return the IMetaDataLocator instance that located this model provider instance - */ - public IMetaDataLocator getLocator(); - /** - * @param locator instance that located this model provider instance - */ - public void setLocator(IMetaDataLocator locator); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IMetaDataTranslator.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IMetaDataTranslator.java deleted file mode 100644 index 2a7f6e2e9..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IMetaDataTranslator.java +++ /dev/null @@ -1,28 +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.common.metadata.internal; - -/** - * Translate from the source model metadata structure into a standard metadata domain of metadata. - * - */ -public interface IMetaDataTranslator { - /** - * @param assistant perform translation using the IMetaDataModelMergeAssistant - */ - public void translate(IMetaDataModelMergeAssistant assistant); - /** - * @param modelProvider - cannot be null - * @return true if this translator can translate this model source - */ - public boolean canTranslate(IMetaDataSourceModelProvider modelProvider); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IPathSensitiveMetaDataLocator.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IPathSensitiveMetaDataLocator.java deleted file mode 100644 index 0f0ed7125..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IPathSensitiveMetaDataLocator.java +++ /dev/null @@ -1,24 +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.common.metadata.internal; - -import org.eclipse.core.resources.IProject; - -/** - * A <code>IMetaDataLocator</code> that is sensitive to the project context - */ -public interface IPathSensitiveMetaDataLocator extends IMetaDataLocator { - /** - * @param project - */ - public void setProjectContext(IProject project); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IResourceBundleProvider.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IResourceBundleProvider.java deleted file mode 100644 index 640da3540..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IResourceBundleProvider.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.common.metadata.internal; - -import java.util.ResourceBundle; - -/** - * Provides the resource bundle from the plugin that defined an item of metadata. - */ -public interface IResourceBundleProvider { - /** - * @return ResourceBundle - implementers should eat exceptions and return null whenever resourceBundle cannot be returned - */ - public ResourceBundle getResourceBundle(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IResourceURLProvider.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IResourceURLProvider.java deleted file mode 100644 index f82d0fbe4..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IResourceURLProvider.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright (c) 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.common.metadata.internal; - -import java.net.URL; - -/** - * Provides absolute URLs from resource path, which is relative to the plug-in - * with the metadata that specified the resource path. - * - * @author Ian Trimble - Oracle - */ -public interface IResourceURLProvider { - - /** - * Get absolute URL for resource path, which is relative to the plug-in that - * specified the resource metadata. - * - * @param resourcePath Path to resource, relative to metadata plug-in. - * @return Absolute URL for resource path. - */ - public URL getResourceURL(String resourcePath); - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IStandardMetaDataSourceInfo.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IStandardMetaDataSourceInfo.java deleted file mode 100644 index 02270a31d..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IStandardMetaDataSourceInfo.java +++ /dev/null @@ -1,32 +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.common.metadata.internal; - - -/** - * Represents the metadata file defined by the StandardMetaDataFile extension-point - * Not intended to be implemented by clients - */ -public interface IStandardMetaDataSourceInfo { - /** - * @return location of metadata file that the locator class will use - */ - public String getLocation(); - /** - * @return bundle id of plugin defining the metadata file - */ - public String getBundleId(); - /** - * @return class name of the locator that will find the the standard metadata file - */ - public String getLocatorClassname(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/JSPTagLibDomainLoadingStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/JSPTagLibDomainLoadingStrategy.java deleted file mode 100644 index 80cbbd961..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/JSPTagLibDomainLoadingStrategy.java +++ /dev/null @@ -1,41 +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.common.metadata.internal; - -import java.util.List; - - -/** - * Strategy for loading tag metadata. Extends and uses the default {@link DomainLoadingStrategy}. - * Mainly exists for illustrative purposes. Could be removed.. - */ -public class JSPTagLibDomainLoadingStrategy extends DomainLoadingStrategy { - - /** - * Constructor - * @param domain - */ - public JSPTagLibDomainLoadingStrategy(String domain) { - super(domain); - } - - /*@Override*/ - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.internal.DomainLoadingStrategy#sortSourceTypes(java.util.List) - */ - protected void sortSourceTypes(List<IDomainSourceModelType> sourceTypes) { - //an opportunity to override the priority of the source types... - } - - - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/Messages.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/Messages.java deleted file mode 100644 index 74fd0a7b2..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/Messages.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: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.internal; - -import org.eclipse.osgi.util.NLS; - -/** - * Externalized strings for Metadata - */ -public class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.jst.jsf.common.metadata.internal.messages"; //$NON-NLS-1$ - - /** - * Property key not found in bundle - */ - public static String Key_not_found; - - /** - * Missing resource - */ - public static String MissingResource_exception; - static { - // initialize resource bundle - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } - - private Messages() { - // no external instantiation - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/MetaDataChangeNotificationEvent.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/MetaDataChangeNotificationEvent.java deleted file mode 100644 index 8ecc17df6..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/MetaDataChangeNotificationEvent.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.common.metadata.internal; - -/** - * Experimental. Subject to change. - * - */ -public class MetaDataChangeNotificationEvent implements - IMetaDataChangeNotificationEvent { - - private String _uri; - private IMetaDataLocator _locator; - private int _type; - - /** - * Constructor - * @param locator - * @param uri - * @param type - */ - public MetaDataChangeNotificationEvent(IMetaDataLocator locator, String uri, int type){ - this._locator = locator; - this._uri = uri; - this._type = type; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.internal.IMetaDataChangeNotificationEvent#getEventType() - */ - public int getEventType() { - return _type; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.internal.IMetaDataChangeNotificationEvent#getLocator() - */ - public IMetaDataLocator getLocator() { - return _locator; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.internal.IMetaDataChangeNotificationEvent#getURI() - */ - public String getURI() { - return _uri; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/MetaDataLocatorFactory.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/MetaDataLocatorFactory.java deleted file mode 100644 index a82cad7ac..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/MetaDataLocatorFactory.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.common.metadata.internal; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.StringTokenizer; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResourceChangeEvent; -import org.eclipse.core.resources.IResourceChangeListener; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; - -/** - * Creates instances of IMetaDataLocators and caches them so that there is only one instance of a particular locator - * when client requests one. - */ -public class MetaDataLocatorFactory - implements IResourceChangeListener { - - private static MetaDataLocatorFactory INSTANCE = null; - private Map<String, IMetaDataLocator> _locators; - - private static final boolean DEBUG = false; - /** - * @return singleton instance of the MetaDataLocatorFactory - */ - public synchronized static MetaDataLocatorFactory getInstance(){ - if (INSTANCE == null){ - INSTANCE = new MetaDataLocatorFactory(); - ResourcesPlugin.getWorkspace().addResourceChangeListener(INSTANCE, - IResourceChangeEvent.PRE_CLOSE | IResourceChangeEvent.PRE_DELETE); - } - return INSTANCE; - } - - - - private Map<String, IMetaDataLocator> getLocators() { - if (_locators == null){ - _locators = new HashMap<String, IMetaDataLocator>(); - } - return _locators; - } - - /** - * @param locatorClassName - may NOT be null - * @param bundleId - may NOT be null - * @param project - may be null - * @return shared instance of IMetaDataLocator - * may return null if is IPathSensitiveMetaDataLocator and there is no project context - */ - public IMetaDataLocator getLocator(final String locatorClassName, final String bundleId, final IProject project){ - final Class klass = JSFCommonPlugin.loadClass(locatorClassName, bundleId); - String key = getKey(locatorClassName, bundleId); - IMetaDataLocator locator = null; - try { - IMetaDataLocator tempLocator = (IMetaDataLocator)klass.newInstance(); - if (tempLocator != null) { - if (tempLocator instanceof IPathSensitiveMetaDataLocator) { - if (project == null) - return null; - - key = getKey(locatorClassName, project.getName()); - } - - locator = getLocators().get(key); - if (locator == null) { - locator = tempLocator; - if (locator instanceof IPathSensitiveMetaDataLocator) - ((IPathSensitiveMetaDataLocator)locator).setProjectContext(project); - - if (DEBUG) - System.out.println("Created locator: "+locator.toString()); //$NON-NLS-1$ - - getLocators().put(key, locator); - locator.startLocating(); - } - } - } catch (InstantiationException e) { - JSFCommonPlugin.log(IStatus.ERROR, "Could not instantiate IMetaDataLocator: "+key, e); //$NON-NLS-1$ - } catch (IllegalAccessException e) { - JSFCommonPlugin.log(IStatus.ERROR, "IllegalAccessException while creating IMetaDataLocator: "+key, e); //$NON-NLS-1$ - } - - return locator; - } - - /** - * @param locatorClassName - * @param contextId - this may be the bundleID or the projectName if it is a path sensitive locator - * @return key - */ - private String getKey(final String locatorClassName, final String contextId) { - StringBuffer buf = new StringBuffer(contextId); - buf.append(":"); //$NON-NLS-1$ - buf.append(locatorClassName); - return buf.toString(); - } - - /** - * Stops and disposes all locators - */ - public void dispose(){ - ResourcesPlugin.getWorkspace().removeResourceChangeListener(this); - for (Iterator it=getLocators().values().iterator();it.hasNext();){ - IMetaDataLocator locator = (IMetaDataLocator)it.next(); - locator.stopLocating(); - } - getLocators().clear(); - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.core.resources.IResourceChangeListener#resourceChanged(org - * .eclipse.core.resources.IResourceChangeEvent) - */ - public void resourceChanged(final IResourceChangeEvent event) { - if (event.getType() == IResourceChangeEvent.PRE_CLOSE - || event.getType() == IResourceChangeEvent.PRE_DELETE) { - // a project is closing - release and cleanup - final IProject aProject = (IProject) event.getResource(); - - if (aProject != null) { - List<String> locatorsToRemove = new ArrayList<String>(); - for (Iterator it=getLocators().keySet().iterator();it.hasNext();){ - String key = (String)it.next(); - if (locatorIsForProject(key, aProject.getName())) { - locatorsToRemove.add(key); - } - } - - if (! locatorsToRemove.isEmpty()) { - for (String key : locatorsToRemove) { - IMetaDataLocator locator = getLocators().get(key); - - if (DEBUG) - System.out.println("Removed locator: "+locator.toString()); //$NON-NLS-1$ - - locator.stopLocating(); - getLocators().remove(key); - } - } - } - } - } - - private boolean locatorIsForProject(final String key, final String projectName) { - StringTokenizer t = new StringTokenizer(key, ":"); //$NON-NLS-1$ - String contextId = t.nextToken(); - if (contextId.equals(projectName)) - return true; - return false; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/MetaDataModel.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/MetaDataModel.java deleted file mode 100644 index 0a477c4dd..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/MetaDataModel.java +++ /dev/null @@ -1,139 +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.common.metadata.internal; - -import org.eclipse.jst.jsf.common.metadata.Model; - -/** - * Responsible for loading and holding onto the standard metadata model using the IDomainLoadingStrategy. - * Wraps the model (root) with the strategy used for loading it, along with the identifying key (modelKeyDescriptor) - */ -public class MetaDataModel { - - private Object root; - private IMetaDataModelContext modelContext; - private ModelKeyDescriptor modelKeyDescriptor; - private IDomainLoadingStrategy strategy; - private boolean refresh; - - - - /** - * Constructor - * @param context - * @param strategy - */ - public MetaDataModel(final IMetaDataModelContext context, final IDomainLoadingStrategy strategy){ - this.modelContext = context; - this.strategy = strategy; - } - - /** - * @return the root of the model. - */ - public Object getRoot(){ - return root; - } - - /** - * @param root - */ - public void setRoot(Object root){ - this.root = root; - if (root != null) { - //setCurrentModelContext has been deprecated... ModelKeyDescriptor can die after that - Model m = (Model)root; - m.setCurrentModelContext(getModelKey()); - } - } - - private ModelKeyDescriptor getModelKey() { - if (modelKeyDescriptor == null) { - modelKeyDescriptor = (ModelKeyDescriptor)modelContext.getAdapter(ModelKeyDescriptor.class); - } - return modelKeyDescriptor; - } - - /** - * @return modelContext - */ - public IMetaDataModelContext getModelContext(){ - return modelContext; - } - -// public void accept(IEntityVisitor visitor){ -// if (getRoot() instanceof Model) -// visitor.visit((Model)getRoot()); -// } - - /** - * @return true if the model is null or is not, in fact, a {@link Model} - */ - public boolean isEmpty() { - if (root == null || !(root instanceof Model)) - return true; - - return false; - } - - /** - * Load the model. Delegates to the strategy. - */ - public synchronized void load(){ - StandardModelFactory.debug("> Begin Loading: "+modelContext.toString(), StandardModelFactory.DEBUG_MD_LOAD); //$NON-NLS-1$ - strategy.load(this); - StandardModelFactory.debug("> End Loading: "+modelContext.toString(),StandardModelFactory.DEBUG_MD_LOAD); //$NON-NLS-1$ - } - - /** - * Reloads the model delegating to strategy reload - * @throws ModelNotSetException - */ - public void reload()throws ModelNotSetException{ - setRoot(null); - refresh = false; - strategy.reload(); - } - - /** - * @return flag indicating that the model is stale - */ - public boolean needsRefresh() { - return refresh; - } - - /** - * Flag that model is stale - */ - public void setNeedsRefresh() { - refresh = true; - } - - /** - * Cleans up the model releasing references. - */ - public void cleanup(){ - if (strategy != null) - strategy.cleanup(); - strategy = null; - root = null; -// modelKeyDescriptor = null; - modelContext = null; - } - - public String toString() { - StringBuffer buf = new StringBuffer("MetaDataModel: "); //$NON-NLS-1$ - buf.append(modelContext.toString()); - return buf.toString(); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/MetaDataModelContext.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/MetaDataModelContext.java deleted file mode 100644 index 742eb3552..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/MetaDataModelContext.java +++ /dev/null @@ -1,78 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 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 and/or initial documentation - *******************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.internal; - -import org.eclipse.core.resources.IProject; - -/** - * Implementation of {@link IMetaDataModelContext} - * - */ -public class MetaDataModelContext implements IMetaDataModelContext { - - private final IProject _project; - private final String _domainId; - private final String _modelId; - - /** - * @param project - * @param domainId - * @param modelId - */ - public MetaDataModelContext(final IProject project, final String domainId, final String modelId) { - _project = project; - _domainId = domainId; - _modelId = fixJSPURIIfNecessary(modelId); //major hack carried forward from ModelKeyDescriptor! - } - - //this is a workaround for issue where jsp "uri" may upper or lower cased - private String fixJSPURIIfNecessary(final String tempuri) { - if (tempuri != null && tempuri.equals("jsp11")) //$NON-NLS-1$ - return tempuri.toUpperCase(); - return tempuri; - } - - public Object getAdapter(Class adapter) { - if (adapter == ModelKeyDescriptor.class) - return new ModelKeyDescriptor(_project, _domainId, _modelId); - if (adapter == IProject.class) - return _project; - return null; - } - -// /** -// * @return project -// */ -// public IProject getProject() { -// return _project; -// } - - public String getDomainId() { - return _domainId; - } - - public String getModelIdentifier() { - return _modelId; - } - - @Override - public String toString() { - final StringBuffer buf = new StringBuffer(); - if (_project != null) { - buf.append(_project.getName()).append(":"); //$NON-NLS-1$ - } - buf.append(getDomainId()).append(":"); //$NON-NLS-1$ - buf.append(getModelIdentifier()).append(":"); //$NON-NLS-1$ - return buf.toString(); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/MetaDataModelContextImpl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/MetaDataModelContextImpl.java deleted file mode 100644 index 668f521ff..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/MetaDataModelContextImpl.java +++ /dev/null @@ -1,46 +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.common.metadata.internal; - -import org.eclipse.jst.jsf.common.metadata.query.IMetaDataModelContext; - -/** - * Simple implementation of {@link IMetaDataModelContext} - * @deprecated - Helios - * - */ -public class MetaDataModelContextImpl implements IMetaDataModelContext, Cloneable { - private final String _domain; - - /** - * Constructor - * @param domain id - */ - public MetaDataModelContextImpl(final String domain){ - _domain = domain; - } - - public String getDomainID() { - return _domain; - } - - public Object getAdapter(final Class adapter) { - if (IMetaDataModelContext.class.equals(adapter)) - return this; - return null; - } - - @Override - protected Object clone() throws CloneNotSupportedException { - return super.clone(); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/MetaDataModelManager.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/MetaDataModelManager.java deleted file mode 100644 index 64a400970..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/MetaDataModelManager.java +++ /dev/null @@ -1,239 +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.common.metadata.internal; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.locks.Lock; -import java.util.concurrent.locks.ReentrantLock; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; -import org.eclipse.jst.jsf.common.metadata.Model; - -/** - * Singleton instance for each IProject used to manage all standard metdata models for that project. - * - * Manager is responsible for loading and caching MetaDataModels. Models are keyed by URI. - * - * The manager listens for project closing resource events so that the resources can be freed up. - */ -public final class MetaDataModelManager extends AbstractMetaDataModelManager { - - private static IMetaDataModelManager SHARED_INSTANCE; - - // used to lock all instance calls for getModel - private static final Lock GLOBAL_INSTANCE_LOCK = new ReentrantLock(); - private final ModelMap models; - - - /** - * @return instance that is project agnostic. - */ - public synchronized static IMetaDataModelManager getSharedInstance(){ - if (SHARED_INSTANCE == null) { - SHARED_INSTANCE = new MetaDataModelManager(null); - } - return SHARED_INSTANCE; - } - - /** - * @param project - */ - MetaDataModelManager(final IProject project) { -// this.project = project; - models = new ModelMap(); - } - - public Model getModel( - final IMetaDataModelContext modelContext) - { - boolean gotLock = false; - try - { - final int maxTries = 6; - int numTries = 0; - final Job currentJob = Job.getJobManager().currentJob(); - while (numTries < maxTries && - !(gotLock = GLOBAL_INSTANCE_LOCK.tryLock(5000, TimeUnit.MILLISECONDS))) - { - numTries++; - if (currentJob != null) - { - currentJob.yieldRule(null); - } - } - - if (!gotLock) - { - return null; - } - StandardModelFactory.debug(">START getModel: "+modelContext, StandardModelFactory.DEBUG_MD_GET); //$NON-NLS-1$ - - MetaDataModel model = models.get(modelContext); - if (model == null) { - // long in = System.currentTimeMillis(); - model = loadMetadata(modelContext); - //System.out.println("Time to load "+modelContext.getURI()+": "+ - // String.valueOf(System.currentTimeMillis() - in)); - } else if (model.needsRefresh()) { - try { - model.reload(); - } catch (ModelNotSetException e) { - // simply load it - should not get here - model = loadMetadata(modelContext); - } - } - -// if (model != null && model.getRoot() != null) -// ((Model) model.getRoot()) -// .setCurrentModelContext(modelContext); - - StandardModelFactory.debug(">END getModel: "+modelContext, StandardModelFactory.DEBUG_MD_GET); //$NON-NLS-1$ - if (model != null && !model.isEmpty()){ - return (Model)model.getRoot(); - } - return null; - } - catch (final InterruptedException e) - { - return null; - } - finally - { - if (gotLock) - { - GLOBAL_INSTANCE_LOCK.unlock(); - } - } - } - - private MetaDataModel loadMetadata(final IMetaDataModelContext context) { -// if (!Thread.holdsLock(GLOBAL_INSTANCE_LOCK.)) { -// JSFCommonPlugin -// .log(IStatus.ERROR, -// "Internal Error: loadMetadata must not be called if class lock not held"); //$NON-NLS-1$ -// return null; -// } - - final IDomainLoadingStrategy strategy = DomainLoadingStrategyRegistry - .getInstance().getLoadingStrategy( - context.getDomainId()); - ; - if (strategy == null) { - JSFCommonPlugin - .log( - IStatus.ERROR, - "Internal Error: Unable to locate metadata loading strategy for: " + context.toString()); //$NON-NLS-1$ - return null; - } - final MetaDataModel model = StandardModelFactory.getInstance().createModel( - context, strategy);// new MetaDataModel(modelKey, - // strategy); - model.load(); - addModel(model); - - return model; - } - - private void addModel(final MetaDataModel model) { - if (model != null) - models.put(model); - } - - @Override - public void dispose() { - super.dispose(); - models.dispose(); - } - - @Override - public void destroy() { - // no persistent data to cleanup. just call dispose - dispose(); - } - - /** - * Map of models keyed by DOMAIN_ID:MODEL_ID from the context. Project is not part of key. - * - */ - private static class ModelMap - { - final Map<String, MetaDataModel> map; - private final AtomicBoolean _isDisposed = new AtomicBoolean(false); - - ModelMap() { - map = new HashMap<String, MetaDataModel>(); - } - - /** - * @param model - * adds model to the map using the given key descriptor - */ - public void put(final MetaDataModel model) { - assert !_isDisposed.get(); - final String key = calculateKey(model); - synchronized (this) { - map.put(key, model); - } - } - - /** - * @param context - * @return MetaDataModel for this context. May return null. - */ - public MetaDataModel get(final IMetaDataModelContext context) { - assert !_isDisposed.get(); - - final String key = calculateKey(context); - - synchronized (this) - { - return map.get(key); - } - } - - public void dispose() { - if (_isDisposed.compareAndSet(false, true)) { - synchronized(this) - { - for (final Iterator<Map.Entry<String, MetaDataModel>> it = map.entrySet().iterator(); it.hasNext();) - { - // System.out.println("kill mmModel: "+model.toString()); - final Map.Entry<String, MetaDataModel> entry = it.next(); - final MetaDataModel model = entry.getValue(); - - if (model != null) - { - model.cleanup(); - } - it.remove(); - } - } - } - } - - private String calculateKey(final MetaDataModel model) { - return calculateKey(model.getModelContext()); - } - - private String calculateKey(final IMetaDataModelContext context) { - final StringBuffer buf = new StringBuffer(context.getDomainId()).append(":").append(context.getModelIdentifier()); //$NON-NLS-1$; - return buf.toString(); - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/MetaDataModelManagerFactory.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/MetaDataModelManagerFactory.java deleted file mode 100644 index 246755b52..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/MetaDataModelManagerFactory.java +++ /dev/null @@ -1,219 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 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 and/or initial documentation - *******************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.internal; - -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IWorkspace; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.QualifiedName; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; -import org.eclipse.jst.jsf.common.internal.pde.AbstractSimpleClassExtensionRegistryReader; -import org.eclipse.jst.jsf.common.internal.resource.ResourceSingletonObjectManager; -import org.eclipse.jst.jsf.common.internal.strategy.AbstractTestableExtensibleDefaultProviderSelectionStrategy; -import org.eclipse.jst.jsf.common.internal.strategy.ISimpleStrategy; -import org.eclipse.jst.jsf.common.internal.strategy.TestableResourceFactoryStrategy; - -/** - * Produces {@link IMetaDataModelManager}s - * - */ -public final class MetaDataModelManagerFactory extends ResourceSingletonObjectManager<IMetaDataModelManager, IResource> { - - private static MetaDataModelManagerFactory INSTANCE; - - private IMetaDataModelManagerFactory EXT_PT_BASED_FACTORY; - - //private constructor - private MetaDataModelManagerFactory(final IWorkspace workspace) { - super(workspace); - } - - /** - * Project property session key for testing. - * Project value should hold the testable {@link IMetaDataModelManagerFactory} instance or null - * NOT API - for testing purposes - */ - public static final QualifiedName TESTABLE_FACTORY_SESSION_KEY = new QualifiedName(JSFCommonPlugin.PLUGIN_ID, "MDModelManagerFactoryInstance"); //$NON-NLS-1$ - - /** - * @param project - * @return IMetaDataModelManager - */ - public static IMetaDataModelManager getMetaDataModelManagerInstance(final IProject project) { - try { - return getMetaDataModelManagerFactoryInstance(project).getInstance(project != null ? project : ResourcesPlugin.getWorkspace().getRoot()); - } catch (ManagedObjectException e) { - if (project != null) - JSFCommonPlugin.log(e, "Cannot create IMetaDataModelManager for "+project.getName()+ " (1)"); //$NON-NLS-1$ //$NON-NLS-2$ - else - JSFCommonPlugin.log(e, "Cannot create workspace shared IMetaDataModelManager (1)"); //$NON-NLS-1$ - } - return null; - } - - private synchronized static MetaDataModelManagerFactory getMetaDataModelManagerFactoryInstance(final IProject project) { - if (INSTANCE == null) { - final IWorkspace workspace = getWorkspace(project); - INSTANCE = new MetaDataModelManagerFactory(workspace); - INSTANCE.init(); - } - return INSTANCE; - } - - private static IWorkspace getWorkspace(final IProject project) { - if (project != null) - return project.getWorkspace(); - - return ResourcesPlugin.getWorkspace(); - } - - - private void init() { - final MetaDataModelManagerFactoryExtensionPointReader reader = new MetaDataModelManagerFactoryExtensionPointReader(); - final List<IMetaDataModelManagerFactory> res = reader.getExtensions(); - if (res != null && res.size() > 0) {//return first - EXT_PT_BASED_FACTORY = res.get(0); - } - } - - @Override - protected IMetaDataModelManager createNewInstance(final IResource resource) { - try { - final IMetaDataModelManagerFactory factory = getMetaDataModelManagerFactoryProviderInstances(resource); - if (factory != null) - return factory.getInstance(resource); - } catch (Exception e) { - if (resource != null) - JSFCommonPlugin.log(e, "Cannot create IMetaDataModelManager for "+resource.getName()+ " (2)"); //$NON-NLS-1$ //$NON-NLS-2$ - else - JSFCommonPlugin.log(e, "Cannot create workspace shared IMetaDataModelManager (2)"); //$NON-NLS-1$ - } - return null; - } - - private IMetaDataModelManagerFactory getMetaDataModelManagerFactoryProviderInstances(final IResource resource) { - final CompositeFactorySelectionStrategyProvider factoryProvider = new CompositeFactorySelectionStrategyProvider(); - return factoryProvider != null ? factoryProvider.getFactoryToUse(resource) : null; - } - - private class CompositeFactorySelectionStrategyProvider - { - public IMetaDataModelManagerFactory getFactoryToUse(final IResource resource) { - final MetaDataModelManagerProviderSelectionStrategy providerSelector = new MetaDataModelManagerProviderSelectionStrategy(); - addStrategies(providerSelector); - - final IMetaDataModelManagerFactory provider = providerSelector.perform(resource); - if (provider != providerSelector.getNoResult()) - { - return provider; - } - return null; - } - - private void addStrategies(final MetaDataModelManagerProviderSelectionStrategy providerSelector) { - providerSelector.addDefaultStrategy(new DefaultManagerProviderStrategy()); - providerSelector.addExtensionStrategy(new ExtensionBasedManagerProviderStrategy()); - providerSelector.addTestableStrategy(new TestableManagerProviderStrategy(TESTABLE_FACTORY_SESSION_KEY)); - } - - } - - private static class MetaDataModelManagerProviderSelectionStrategy - extends - AbstractTestableExtensibleDefaultProviderSelectionStrategy<IResource, IMetaDataModelManagerFactory> { - - private static final IMetaDataModelManagerFactory NO_RESULT = null; - - @Override - public IMetaDataModelManagerFactory getNoResult() { - return NO_RESULT; - } - } - - private abstract class AbstractManagerProviderStrategy - implements ISimpleStrategy<IResource, IMetaDataModelManagerFactory> { - - private final IMetaDataModelManagerFactory NO_RESULT = null; - public IMetaDataModelManagerFactory getNoResult() { - return NO_RESULT; - } - } - - private class DefaultManagerProviderStrategy extends - AbstractManagerProviderStrategy { - - public IMetaDataModelManagerFactory perform(final IResource input) throws Exception { - return new DefaultManagerProvider(); - } - - } - - private static class DefaultManagerProvider - implements IMetaDataModelManagerFactory { - - public IMetaDataModelManager getInstance(final IResource project) { - if (project != null && project instanceof IProject) - return new MetaDataModelManager((IProject)project); - return MetaDataModelManager.getSharedInstance(); - } - - } - - private class ExtensionBasedManagerProviderStrategy - extends AbstractManagerProviderStrategy { - - public IMetaDataModelManagerFactory perform(final IResource input) throws Exception { - return EXT_PT_BASED_FACTORY != null ? EXT_PT_BASED_FACTORY : getNoResult(); - } - } - - private static class TestableManagerProviderStrategy<IMetaDataModelManagerFactory> - extends TestableResourceFactoryStrategy<IMetaDataModelManagerFactory> { - - /** - * @param testableFactorySessionKey - project property session key for property value holding testable instance - */ - public TestableManagerProviderStrategy(final QualifiedName testableFactorySessionKey) { - super(testableFactorySessionKey); - } - - } - - private static class MetaDataModelManagerFactoryExtensionPointReader extends - AbstractSimpleClassExtensionRegistryReader<IMetaDataModelManagerFactory> { - - private static final String EXT_PT_ID = "mdModelManagerFactory"; //$NON-NLS-1$ - private static final String EXT_PT_ELEMENT = "factory"; //$NON-NLS-1$ - private static final String EXT_PT_ATTR = "class"; //$NON-NLS-1$ - - protected MetaDataModelManagerFactoryExtensionPointReader() { - super( - JSFCommonPlugin.PLUGIN_ID, - EXT_PT_ID, EXT_PT_ELEMENT, EXT_PT_ATTR, - new CompareOrgEclipseJstContributorsLastComparator<IMetaDataModelManagerFactory>() - ); - } - - @Override - protected void handleLoadFailure(final CoreException ce) { - JSFCommonPlugin.log(ce, - "Error loading IMetaDataModelManagerFactory from extension"); //$NON-NLS-1$ - - } - - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/MetaDataModelMergeAssistantImpl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/MetaDataModelMergeAssistantImpl.java deleted file mode 100644 index 564d7a854..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/MetaDataModelMergeAssistantImpl.java +++ /dev/null @@ -1,398 +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.common.metadata.internal; - -import java.util.Iterator; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.emf.ecore.util.EcoreUtil.Copier; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; -import org.eclipse.jst.jsf.common.metadata.Entity; -import org.eclipse.jst.jsf.common.metadata.EntityGroup; -import org.eclipse.jst.jsf.common.metadata.IncludeEntityGroup; -import org.eclipse.jst.jsf.common.metadata.Model; -import org.eclipse.jst.jsf.common.metadata.Trait; -import org.eclipse.jst.jsf.common.metadata.query.MetaDataException; -import org.eclipse.jst.jsf.common.metadata.query.internal.HierarchicalSearchControl; -import org.eclipse.jst.jsf.common.metadata.query.internal.IMetaDataQuery; -import org.eclipse.jst.jsf.common.metadata.query.internal.MetaDataQueryFactory; -import org.eclipse.jst.jsf.common.metadata.query.internal.SearchControl; -import org.eclipse.jst.jsf.common.metadata.query.internal.SimpleEntityQueryVisitorImpl; -import org.eclipse.jst.jsf.common.metadata.query.internal.SimpleResultSet; -import org.eclipse.jst.jsf.common.metadata.query.internal.SimpleTraitQueryVisitorImpl; -/** - * Implements {@link IMetaDataModelMergeAssistant} - * - * Responsible for merging source models into one. The first model in has subsequent - * entities and traits added to it. - * - * TODO - make locating of existing entities and traits in the merged model more efficient - * TODO - refactor out Taglibdomain-only aspects of include-group processing - * - */ -public class MetaDataModelMergeAssistantImpl implements - IMetaDataModelMergeAssistant { - - private MetaDataModel mergedModel; - private SimpleEntityQueryVisitorImpl entityVisitor; - private SimpleTraitQueryVisitorImpl traitVisitor; - private IMetaDataSourceModelProvider provider; - - /** - * Constructor. Queries with search control limited to first found. - * @param model - */ - public MetaDataModelMergeAssistantImpl(final MetaDataModel model) { - this.mergedModel = model; - entityVisitor = new SimpleEntityQueryVisitorImpl(new HierarchicalSearchControl(1, - HierarchicalSearchControl.SCOPE_ALL_LEVELS)); - traitVisitor = new SimpleTraitQueryVisitorImpl(new SearchControl(1)); - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.internal.IMetaDataModelMergeAssistant#getMergedModel() - */ - public MetaDataModel getMergedModel() { - return mergedModel; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.internal.IMetaDataModelMergeAssistant#getSourceModel() - */ - public IMetaDataSourceModelProvider getSourceModelProvider() { - return provider; - } - - public void setSourceModelProvider(final IMetaDataSourceModelProvider provider) { - this.provider = provider; - } - - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.internal.IMetaDataModelMergeAssistant#addEntityGroup(org.eclipse.jst.jsf.common.metadata.EntityGroup) - */ - public void addEntityGroup(final EntityGroup entityGroup) { - final Model model = (Model)getMergedModel().getRoot(); - if (!isExistingEntityGroup(model, entityGroup)){ - model.getEntityGroups().add(copyEntityGroup(entityGroup)); - } - } - - private EntityGroup copyEntityGroup(final EntityGroup entityGroup) { - final Copier copier = new Copier(); - final EntityGroup egc =(EntityGroup)copier.copy(entityGroup); - copier.copyReferences(); - return egc; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.internal.IMetaDataModelMergeAssistant#addEntity(org.eclipse.jst.jsf.common.metadata.Entity) - */ - public Entity addEntity(final Entity entity) { - Entity mmEntity = getMergedEntity(entity); - if (mmEntity == null){ - mmEntity = addEntityAsNecessary((Entity)entity.eContainer(), entity); - return mmEntity; - } - addIncludeGroupsAsNecessary(mmEntity, entity); - return mmEntity; - } - - public Entity getMergedEntity(final Entity queryRoot, final String entityKey){ - Entity ret = null; - SimpleResultSet rs = (SimpleResultSet)entityVisitor.findEntities(queryRoot, entityKey); - try { - if (! rs.getResults().isEmpty()) - ret = (Entity)rs.getResults().get(0); - rs.close(); - } catch (MetaDataException e) { - JSFCommonPlugin.log(IStatus.ERROR, "Error in getMergedEntity()", e); //$NON-NLS-1$ - } - return ret; - } - private void addIncludeGroupsAsNecessary(final Entity mmEntity, final Entity entity) { - for (final Iterator it=entity.getIncludeGroups().iterator();it.hasNext();){ - final IncludeEntityGroup grp = (IncludeEntityGroup)it.next(); - boolean found = false; - for (Iterator it2=mmEntity.getIncludeGroups().iterator();it2.hasNext();){ - final IncludeEntityGroup grp2 = (IncludeEntityGroup)it2.next(); - if (grp2.equals(grp)){ - found = true; - break; - } - } - if (!found){//maybe we should clone and add - mmEntity.getIncludeGroups().add(grp); - } - } - } - - /** - * Checks to see if the entity (by id) is present in the mergedModel or not. - * If not, it will perform a copy of the entity and it's attributes using - * EcoreUtil.Copier. - * - * @param parent - * @param entity - * @return - */ - private Entity addEntityAsNecessary(final Entity parent, final Entity entity) { - Entity mmParent = null; - Entity mmEntity = null; - if (parent != null){ - mmParent = getMergedEntity(parent); - if (mmParent == null){ - mmParent = addEntityAsNecessary((Entity)entity.eContainer(), entity); - } - } - if (mmParent != null){ - mmEntity = addEntityInternal(mmParent, entity); - return mmEntity; - } - return mmEntity; - } - - private boolean isExistingEntityGroup(final Model model, final EntityGroup entityGroup) { - boolean found = false; - for(final Iterator it=model.getEntityGroups().iterator();it.hasNext();){ - if (entityGroup.getId().equals(((EntityGroup)it.next()).getId())) - return true; - } - return found; - } - - private Entity getExistingChildEntity(final Entity parent, final Entity entity) { - for(final Iterator it=parent.getChildEntities().iterator();it.hasNext();){ - final Entity foundEntity = (Entity)it.next(); - if (entity.getId().equals(foundEntity.getId())) - return foundEntity; - } - return null; - } - - private /*synchronized*/ Entity addEntityInternal(final Entity parent, final Entity entity) { - final Copier copier = new Copier(); - final Entity mmEntity =(Entity)copier.copy(entity); - copier.copyReferences(); - parent.getChildEntities().add(mmEntity); - return mmEntity; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.internal.IMetaDataModelMergeAssistant#addTrait(org.eclipse.jst.jsf.common.metadata.Entity, org.eclipse.jst.jsf.common.metadata.Trait) - */ - public boolean addTrait(final Entity entity, final Trait trait) { - final Entity returnedEntity = getMergedEntity(entity); - if (returnedEntity != null){ - return addTraitAsNecessary(returnedEntity, trait); - } - return false; - } - - - private boolean addTraitAsNecessary(Entity mergedEntity, Trait trait) { - final Trait mmTrait = getMergedTrait(mergedEntity, trait); - if (mmTrait == null){ - addTraitInternal(mergedEntity, trait); - return true; - - } - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.internal.IMetaDataModelMergeAssistant#setMergeComplete() - */ - public void setMergeComplete() { - final Model model = (Model)getMergedModel().getRoot(); - if (model != null){ - StandardModelFactory.debug(">> Begin processIncludeGroups for: "+getMergedModel().getModelContext(),StandardModelFactory.DEBUG_MD_LOAD); //$NON-NLS-1$ - - processIncludeGroups(model); - - StandardModelFactory.debug(">> End processIncludeGroups for: "+getMergedModel().getModelContext(),StandardModelFactory.DEBUG_MD_LOAD); //$NON-NLS-1$ - } - } - - /** - * Copies the passed trait and adds it to the merged entity. - * The source model provider of the trait is then set on the trait so that - * the trait can know where it came from. - * - * @param parent - * @param trait - * @return merged Trait - */ - private Trait addTraitInternal(final Entity parent, final Trait trait) { - final Copier copier = new Copier(); - final Trait mmTrait =(Trait)copier.copy(trait); - copier.copyReferences(); - parent.getTraits().add(mmTrait); - //set the model key to know from where the trait came - mmTrait.setSourceModelProvider(trait.getSourceModelProvider()); - return mmTrait; - } - - /** - * Locates the entity in the merged model matching by id only. - * If not located, this method returns null; - * - * @param entity - * @return merged entity - */ - private Entity getMergedEntity(final Entity entity){ - if (entity instanceof Model) - return (Entity)mergedModel.getRoot(); - - Entity ret = null; - final String entityKey = getIdRelativeToRoot(entity); - final SimpleResultSet rs = (SimpleResultSet)entityVisitor.findEntities((Entity)mergedModel.getRoot(), entityKey); - try { - if (! rs.getResults().isEmpty()) - ret = (Entity)rs.getResults().get(0); - rs.close(); - } catch (MetaDataException e) { - JSFCommonPlugin.log(IStatus.ERROR, "Error in getMergedEntity()", e); //$NON-NLS-1$ - } - return ret; - } - - private String getIdRelativeToRoot(final Entity entity) { - Entity e = entity; - final StringBuffer buf = new StringBuffer(); - while (e.eContainer() != null){ - buf.insert(0, e.getId()); - if (e.eContainer()!=null && e.eContainer().eContainer() != null) - buf.insert(0,"/"); //$NON-NLS-1$ - e = (Entity)e.eContainer(); - } - return buf.toString(); - } - - /** - * Locates the trait in the merged model matching by id only. - * If not located, this method returns null; - * - * @param entity - * @param trait - * @return merged Trait - */ - public Trait getMergedTrait(final Entity entity, final Trait trait){ - final SimpleResultSet rs = (SimpleResultSet)traitVisitor.findTraits(entity, trait.getId()); - Trait ret = null; - try { - if (! rs.getResults().isEmpty()) - ret = (Trait)rs.getResults().get(0); - rs.close(); - } catch (MetaDataException e) { - JSFCommonPlugin.log(IStatus.ERROR, "Error in getMergedTrait()", e); //$NON-NLS-1$ - } - return ret; - } - - private void processIncludeGroups(final Model root) { - addEntityGroupReferencesRecursively(root); - } - - private void addEntityGroupReferencesRecursively(final Entity entity) { - doIncludes(entity); - for (int i=0, size=entity.getChildEntities().size();i<size;i++){ - addEntityGroupReferencesRecursively((Entity)entity.getChildEntities().get(i)); - } - } - - private void doIncludes(final Entity entity){ - for (int j=0, groupsSize=entity.getIncludeGroups().size();j<groupsSize; j++){ - final IncludeEntityGroup include = (IncludeEntityGroup)entity.getIncludeGroups().get(j); - if (include.getId() != null){ - //is this a local merge? - if (include.getModelUri() == null|| - (include.getModelUri() - .equals(getMergedModel() - .getModelContext().getModelIdentifier())) ){ - final EntityGroup eg = ((Model)getMergedModel().getRoot()).findIncludeGroup(include.getId()); - addIncludeRefs(entity, eg); - } else //external model include - addIncludeRefs(entity, include); - } - } - } - /* - * Adds traits and child entities from an external entity group to the passed entity - * @param entity - * @param include - */ - private void addIncludeRefs(final Entity entity, final IncludeEntityGroup include) { - final IMetaDataModelContext modelContext = getMergedModel().getModelContext(); - final IMetaDataQuery query = MetaDataQueryFactory.getInstance().createQuery(modelContext); - final Model externalModel = query.getQueryHelper().getModel(include.getModelUri()); - if (externalModel != null){ - final EntityGroup entityGroup = externalModel.findIncludeGroup(include.getId()); - addIncludeRefs(entity, entityGroup); - } - else { - JSFCommonPlugin.log(IStatus.ERROR, "Unable to load external metadata model refs for "+modelContext.getModelIdentifier() //$NON-NLS-1$ - + " into "+ include.getModelUri()); //$NON-NLS-1$ - } - } - - /* - * Adds traits and child entities from a local entity group to the passed entity if not already present for the entity. - * First - * @param entity - * @param entityGroup - */ - private void addIncludeRefs(final Entity entity, final EntityGroup entityGroup) { - if (entityGroup == null) - return; - - for (int i=0, size=entityGroup.getTraits().size();i<size;i++){ - addTrait(entity, (Trait)entityGroup.getTraits().get(i)); - } - - for (int i=0, size=entityGroup.getChildEntities().size();i<size;i++){ - traverseAndAddIncludes(entity, (Entity)entityGroup.getChildEntities().get(i)); - } - } - - private void traverseAndAddIncludes(final Entity parent, final Entity entity){ - final Entity mergedEntity = addIncludedEntityAsNecessary(parent, entity); - - for (final Iterator/*<Trait>*/ it=entity.getTraits().iterator();it.hasNext();){ - final Trait trait = (Trait)it.next(); - addTraitAsNecessary(mergedEntity, trait); - } - - for (final Iterator/*<EntityKey>*/ it=entity.getChildEntities().iterator();it.hasNext();){ - final Entity e = (Entity)it.next(); - traverseAndAddIncludes(mergedEntity, e);//add as normal - } - - } - - /* - * Checks to see if the entity (by id) is present as a child entity in the parent or not. - * If not, it will add the entity to the childEntities without copying. - * - * @param parent - * @param entity - * @return Entity - */ - private Entity addIncludedEntityAsNecessary(final Entity parent, final Entity entity) { - Entity mergedEntity = getExistingChildEntity(parent, entity); - if (mergedEntity == null){ - mergedEntity = addEntityInternal(parent, entity); - } - return mergedEntity; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/ModelKeyDescriptor.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/ModelKeyDescriptor.java deleted file mode 100644 index 380d21844..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/ModelKeyDescriptor.java +++ /dev/null @@ -1,80 +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.common.metadata.internal; - -import org.eclipse.core.resources.IProject; - -/** - * Meta data model key descriptor used to lazily load a model when it is required - * - */ -public class ModelKeyDescriptor { - private final IProject project; - private final String domain; - private final String uri; - private final String key; - - /** - * Constructor - * @param project - * @param domain - * @param uri - */ - public ModelKeyDescriptor(final IProject project, final String domain, final String uri){ - this.project = project; - this.domain = domain; - this.uri = fixJSPURIIfNecessary(uri); - final String proj = project != null ? project.getName() : "Null"; //$NON-NLS-1$ - final StringBuffer buf = new StringBuffer(proj); - buf.append(":"); //$NON-NLS-1$ - buf.append(this.domain); - buf.append(":"); //$NON-NLS-1$ - buf.append(this.uri); - key = buf.toString(); - } - - //this is a workaround for issue where jsp "uri" may upper or lower cased - private String fixJSPURIIfNecessary(final String tempuri) { - if (tempuri != null && tempuri.equals("jsp11")) //$NON-NLS-1$ - return tempuri.toUpperCase(); - return tempuri; - } - - /** - * @return domain id - */ - public final String getDomain(){ - return domain; - } - - /** - * @return model uri - */ - public final String getUri(){ - return uri; - } - - /** - * @return project - */ - public final IProject getProject(){ - return project; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - public final String toString(){ - return key; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/ModelNotSetException.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/ModelNotSetException.java deleted file mode 100644 index 34b90b125..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/ModelNotSetException.java +++ /dev/null @@ -1,20 +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.common.metadata.internal; - -/** - * Experimental - * - */ -public class ModelNotSetException extends Exception { - private static final long serialVersionUID = 1L; -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/PluginRelativeStandardMetaDataSourceFileLocator.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/PluginRelativeStandardMetaDataSourceFileLocator.java deleted file mode 100644 index db7ed2a06..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/PluginRelativeStandardMetaDataSourceFileLocator.java +++ /dev/null @@ -1,97 +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.common.metadata.internal; - -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.ResourceBundle; - -import org.eclipse.core.runtime.FileLocator; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Platform; -import org.osgi.framework.Bundle; - -/** - * Default implementation of StandardMetaDataSourceFileLocator that will locate standard metadata files - * and resource bundles relative to the plugin that registered the files using the - * <code>org.eclipse.jst.jsf.common.StandardMetaDataFiles</code> ext-pt. - * - */ -public class PluginRelativeStandardMetaDataSourceFileLocator extends StandardMetaDataSourceFileLocator{ - - private ResourceBundle resourceBundle; - - /* - * Returns InputStream of standard metadata file from plugin relative location. - * - */ - public InputStream getInputStream() throws IOException { - URL url = getURL(); - if (url != null) - return url.openStream(); - - String fileName = Path.fromOSString(fileInfo.getLocation()).toString() + " (Plugin: " + fileInfo.getBundleId()+")" ; //$NON-NLS-1$ //$NON-NLS-2$ - throw new FileNotFoundException("Metadata file not found: "+ fileName); //$NON-NLS-1$ - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.internal.StandardMetaDataSourceFileLocator#getURL() - */ - public URL getURL() { - final Bundle bundle = Platform.getBundle(fileInfo.getBundleId()); - if (bundle == null) - { - return null; - } - final IPath fromOSString = Path.fromOSString(fileInfo.getLocation()); - return FileLocator.find(bundle, fromOSString, null); - } - - - /* - * Returns property resource bundle if it exists. May return null. - * This implementation assumes that the basename of the bundle is the same - * as the source file name and in the same directory. - * - */ - public ResourceBundle getResourceBundle() throws IOException, MalformedURLException { - if (resourceBundle == null){ - URL bundleURL = getStandardMetaDataSourceFileBasenameURL(); - if (bundleURL == null) - return null; - - resourceBundle = ResourceBundleHelper.getResourceBundle(bundleURL); - } - return resourceBundle; - } - - private URL getStandardMetaDataSourceFileBasenameURL() { - IPath annotationPath = Path.fromOSString(fileInfo.getLocation()); - IPath annotationFolder = annotationPath.removeLastSegments(1); - IPath propertiesLocation = annotationPath.removeFirstSegments(annotationPath.segmentCount() - 1).removeFileExtension(); - // append location of properties file - IPath propertiesFile = annotationFolder.append(propertiesLocation); - - // append .properties extension if needed - if (propertiesFile.getFileExtension() == null) - propertiesFile = propertiesFile.addFileExtension("properties"); //$NON-NLS-1$ - // create a URL out of the properties file location - return FileLocator.find(Platform.getBundle(fileInfo.getBundleId()), - propertiesFile, null); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/ResourceBundleHelper.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/ResourceBundleHelper.java deleted file mode 100644 index fc55894db..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/ResourceBundleHelper.java +++ /dev/null @@ -1,80 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM 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: - * IBM Corporation - initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * Gerry Kessler/Oracle - copied from org.eclipse.wst.sse.core.internal.encoding.util and modified heavily - *******************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.internal; - -import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URL; -import java.net.URLClassLoader; -import java.util.Locale; -import java.util.ResourceBundle; - -import org.eclipse.core.runtime.FileLocator; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; - -/** - * ResourceBundleHelper - * - */ -public final class ResourceBundleHelper { - - /** - * @param resourceURL - * @return ResourceBundle - * @throws MalformedURLException - may return null - * @throws IOException - */ - public static ResourceBundle getResourceBundle(final URL resourceURL) throws MalformedURLException, IOException { - return getResourceBundle(resourceURL, Locale.getDefault()); - } - - /** - * @param resourceURL - * @param targetLocale - * @return ResourceBundle - may return null - * @throws MalformedURLException - * @throws IOException - */ - public static ResourceBundle getResourceBundle(final URL resourceURL, final Locale targetLocale) throws MalformedURLException, IOException { - // try to load bundle from the location specified in the resourceURL - // - final String protocol = resourceURL.getProtocol(); - final String host = resourceURL.getHost(); - final String file = resourceURL.getFile(); - final IPath path = new Path(file); - - String dir = "./"; //$NON-NLS-1$ - final String bundleName = path.removeFileExtension().segment(path.segmentCount() - 1); - if (path.segmentCount() > 1) - { - dir = path.removeLastSegments(1).toString(); - } - - // create a class loader with a class path that points to the resource - // bundle's location - // - final URL[] classpath = new URL[1]; - classpath[0] = FileLocator.resolve(new URL(protocol, host, dir)); - // TODO: does this need to be in a doPrivileged block? - final ClassLoader resourceLoader = new URLClassLoader(classpath, null); - - return ResourceBundle.getBundle(bundleName, targetLocale, resourceLoader); - } - - private ResourceBundleHelper() - { - // no instantiation - } -} - diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/StandardMetaDataFileInfo.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/StandardMetaDataFileInfo.java deleted file mode 100644 index 25cc1c208..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/StandardMetaDataFileInfo.java +++ /dev/null @@ -1,75 +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.common.metadata.internal; - -/** - * Contains information about annotation files. - */ -public final class StandardMetaDataFileInfo implements IStandardMetaDataSourceInfo{ - - private final String fileLocation; - private final String fileLocatorClassname; - private final String bundleId; - - /** - * Constructor - * @param fileLocation - * @param bundleId - * @param fileLocatorClassname - */ - public StandardMetaDataFileInfo( String fileLocation, String bundleId, String fileLocatorClassname) { - this.fileLocation = fileLocation.trim(); - this.bundleId = bundleId.trim(); - this.fileLocatorClassname = fileLocatorClassname; - } - - /** - * Get the location of the annotation file as originally specified. - * - * @return String - */ - public String getLocation() { - return fileLocation; - } - - /** - * Get the annotation file locator classname that must implement ICMAnnotationSourceFileLocator. - * Can return null or empty string. Caller should provide default. - * - * @return String - */ - public String getLocatorClassname() { - return fileLocatorClassname != null ? fileLocatorClassname.trim() : null; - } - - /** - * Get the bundle id of the plugin where the annotation file is located. - * - * @return String - */ - public String getBundleId() { - return bundleId; - } - - public String toString(){ - StringBuffer buf = new StringBuffer("StandardMetaDataFileInfo"); //$NON-NLS-1$ - buf.append(": "); //$NON-NLS-1$ - buf.append(bundleId); - buf.append("/"); //$NON-NLS-1$ - buf.append(fileLocation); - if (getLocatorClassname() != null){ - buf.append(": "); //$NON-NLS-1$ - buf.append(getLocatorClassname()); - } - return buf.toString(); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/StandardMetaDataFileRegistry.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/StandardMetaDataFileRegistry.java deleted file mode 100644 index 49d0d4e5b..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/StandardMetaDataFileRegistry.java +++ /dev/null @@ -1,321 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2006, 2007 IBM 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: - * IBM - Initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * Gerry Kessler/Oracle - code borrowed and repurposed for JSF subproject - * - *******************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.internal; - -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.net.URISyntaxException; -import java.net.URL; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -import org.eclipse.core.runtime.FileLocator; -import org.eclipse.core.runtime.IStatus; -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.jface.resource.ImageDescriptor; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; -import org.eclipse.jst.jsf.common.metadata.Model; -import org.eclipse.jst.jsf.common.metadata.Trait; - - -/** - * Registry of standard metadata files - */ -public final class StandardMetaDataFileRegistry { - private Map<String, List<IMetaDataSourceModelProvider>> mdFilesMap = new HashMap<String, List<IMetaDataSourceModelProvider>>(1); - private List<IMetaDataSourceModelProvider> EMPTY_LIST = new ArrayList<IMetaDataSourceModelProvider>(0); - - private static StandardMetaDataFileRegistry reg; - - /** - * @return the singleton instance of the registry - */ - public synchronized static StandardMetaDataFileRegistry getInstance() { - if (reg == null){ - reg = new StandardMetaDataFileRegistry(); - } - return reg; - } - - private StandardMetaDataFileRegistry() { - new StandardMetaDataFileRegistryReader(this).readRegistry(); - } - - /** - * @param uri as String - * @return list of standard metadata sources as <code>IMetaDataSourceModelProvider</code>s. - * Returns empty list of no standard metadata files are registered for the given uri. - */ - public synchronized List<IMetaDataSourceModelProvider> getStandardMetaDataModelProviders(String uri) { - List<IMetaDataSourceModelProvider> theList = mdFilesMap.get(uri); - return theList != null ? theList : EMPTY_LIST ; - } - - /** - * For use by registry reader only - * @param uri - * @param fileInfo - */ - public synchronized void addStandardMetaDataFileInfo(String uri, IStandardMetaDataSourceInfo fileInfo) { - List<IMetaDataSourceModelProvider> providers = mdFilesMap.get(uri); - if (providers == null) { - providers = new ArrayList<IMetaDataSourceModelProvider>(); - mdFilesMap.put(uri, providers); - } - providers.add(new StandardMetaDataFilesProvider(fileInfo)); - } - -/** - * Internal implementation of IMetaDataSourceModelProvider for "standard" metadata sources - * - */ -static class StandardMetaDataFilesProvider implements IMetaDataSourceModelProvider { - - private org.eclipse.jst.jsf.common.metadata.internal.IStandardMetaDataSourceInfo info; - private Object model; - private IMetaDataLocator locator; - private StandardMetaDataSourceFileLocator fileLocator = null; - - /** - * Constructor - * @param info - */ - StandardMetaDataFilesProvider(IStandardMetaDataSourceInfo info){ - this.info = info; - } - - private StandardMetaDataSourceFileLocator getFileLocator(){ - if (fileLocator == null){ - if (info.getLocatorClassname() == null){ - fileLocator = new PluginRelativeStandardMetaDataSourceFileLocator(); - } - else { - Class klass = JSFCommonPlugin.loadClass(info.getLocatorClassname(), info.getBundleId()); - try { - fileLocator = (StandardMetaDataSourceFileLocator)klass.newInstance(); - } catch (InstantiationException e) { - JSFCommonPlugin.log(IStatus.ERROR, "InstantiationException: StandardMetaDataFilesProvider.getFileLocator()", e); //$NON-NLS-1$ - } catch (IllegalAccessException e) { - JSFCommonPlugin.log(IStatus.ERROR, "IllegalAccessException: StandardMetaDataFilesProvider.getFileLocator()", e); //$NON-NLS-1$ - } - } - if (fileLocator != null) - fileLocator.setFileInfo(info); - } - return fileLocator; - } - - private InputStream getInputStream() throws IOException { - if (getFileLocator() != null){ - return getFileLocator().getInputStream(); - } - return null; - - } - - private URI getMDFileURI() - { - try - { - StandardMetaDataSourceFileLocator fileLocator2 = getFileLocator(); - if (fileLocator2 != null) - { - final URL url = fileLocator2.getURL(); - if (url == null) - { - JSFCommonPlugin.log(new RuntimeException(), - "Couldn't locate meta-data file for " //$NON-NLS-1$ - + fileLocator2.getFileInfo() - .getLocation()); - return null; - } - - java.net.URI uri = url.toURI(); - return URI.createURI(uri.toString()); - } - } - catch (URISyntaxException e) - { - JSFCommonPlugin.log(IStatus.ERROR, "Metadata File Load Error: " //$NON-NLS-1$ - + getFileLocator().getFileInfo().toString() - + ": URISyntaxException: " + e.getMessage()); //$NON-NLS-1$ - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.internal.IMetaDataSourceModelProvider#getSourceModel() - */ - public Object getSourceModel() { - if (model != null) - return model; - - InputStream inputStream = null; - try { - URI uri = getMDFileURI(); - inputStream = getInputStream(); - if (inputStream != null && uri != null){ - EList contents = StandardModelFactory.getInstance().loadStandardFileResource(inputStream, this, uri); - //check to see if this is a Model - if (contents != null && !contents.isEmpty() && - contents.get(0) instanceof Model){ - model = contents.get(0); - ((Model)model).setSourceModelProvider(this); - } - } - } catch (FileNotFoundException e){ - JSFCommonPlugin.log(IStatus.ERROR, e.getLocalizedMessage()); - } catch (IOException e) { - JSFCommonPlugin.log(IStatus.ERROR,"IOException(1): StandardMetaDataFilesProvider.getSourceModel():"+getModelName(), e); //$NON-NLS-1$ - } finally { - if (inputStream != null){ - try { - inputStream.close(); - } catch (IOException e) { - JSFCommonPlugin.log( IStatus.ERROR,"IOException (2): StandardMetaDataFilesProvider.getSourceModel():"+getModelName(), e); //$NON-NLS-1$ - } - } - } - return model; - } - - private String getModelName() { - return info.toString(); - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.internal.IMetaDataSourceModelProvider#getLocator() - */ - public IMetaDataLocator getLocator() { - return locator; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.internal.IMetaDataSourceModelProvider#setLocator(org.eclipse.jst.jsf.common.metadata.internal.IMetaDataLocator) - */ - public void setLocator(IMetaDataLocator locator) { - this.locator = locator; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.internal.IMetaDataSourceModelProvider#getResourceBundle() - */ - private ResourceBundle internalGetResourceBundle() { - if (getFileLocator() != null){ - try { - return fileLocator.getResourceBundle(); - } catch (MissingResourceException e) { - JSFCommonPlugin.log(IStatus.ERROR, "InternalGetResourceBundle1", e); //$NON-NLS-1$ - } catch (IOException e) { - JSFCommonPlugin.log(IStatus.ERROR, "InternalGetResourceBundle2", e); //$NON-NLS-1$ - } - } - return null; - } - - public Object getAdapter(Class klass) { - final StandardMetaDataFilesProvider mdp = this; - if (klass == IImageDescriptorProvider.class){ - return new IImageDescriptorProvider(){ - String imageBase; - public ImageDescriptor getImageDescriptor(String imagePath) { - imagePath = appendImageBase(imagePath); - String bundleID = mdp.getFileLocator().getFileInfo().getBundleId(); - URL url = FileLocator.find(Platform.getBundle(bundleID), new Path(imagePath), null); - return ImageDescriptor.createFromURL(url); - } - private String appendImageBase(String imagePath) { - return getImageBase() + imagePath; - } - - private String getImageBase(){ - if (imageBase == null){ - final Model aModel = (Model)getSourceModel(); - final Trait t = getImageBasePath(aModel); - if (t == null){ - imageBase = ""; //$NON-NLS-1$ - } else { - imageBase = TraitValueHelper.getValueAsString(t); - if (imageBase != null && imageBase.length() > 0){ - imageBase = imageBase +"/"; //$NON-NLS-1$ - } - } - } - return imageBase; - } - - private Trait getImageBasePath(final Model aModel) { - for (final Iterator it= aModel.getTraits().iterator(); it.hasNext();) { - Trait t = (Trait)it.next(); - if (t.getId().equals("images-base-path")){ //$NON-NLS-1$ - return t; - } - } - return null; - } - - }; - - } else if (klass == IResourceBundleProvider.class) { - return new IResourceBundleProvider(){ - - public ResourceBundle getResourceBundle() { - return mdp.internalGetResourceBundle(); - } - - }; - - } else if (klass == IClassLoaderProvider.class){ - return new IClassLoaderProvider(){ - - public Class loadClass(String className) { - String bundleID = mdp.getFileLocator().getFileInfo().getBundleId(); - try { - return Platform.getBundle(bundleID).loadClass(className); - } catch (ClassNotFoundException e) { - return null; - } - } - - }; - } else if (klass == IResourceURLProvider.class) { - return new IResourceURLProvider() { - - public URL getResourceURL(String resourcePath) { - URL resourceURL = null; - String bundleID = mdp.getFileLocator().getFileInfo().getBundleId(); - try { - resourceURL = FileLocator.resolve(Platform.getBundle(bundleID).getResource(resourcePath)); - } catch (IOException ioe) { - //do nothing, will return null resourceURL - } - return resourceURL; - } - - }; - } - return null; - } - -} -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/StandardMetaDataFileRegistryReader.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/StandardMetaDataFileRegistryReader.java deleted file mode 100644 index 802481b3c..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/StandardMetaDataFileRegistryReader.java +++ /dev/null @@ -1,95 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2006, 2007 IBM 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: - * IBM - Initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * Gerry Kessler/Oracle - code borrowed and repurposed for JSF subproject - * - *******************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.internal; - -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtensionPoint; -import org.eclipse.core.runtime.IExtensionRegistry; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; - - -/** - * This class reads the standardMetaDataFiles extensions adds each specified standard metadata - * file to the StandardMetaDataFileRegistry. - * - * @see StandardMetaDataFileRegistry - * also see StandardMetaDataFile extension-point - */ -public class StandardMetaDataFileRegistryReader { - /** - * EXTENSION POINT ID - */ - protected static final String EXTENSION_POINT_ID = "standardMetaDataFiles"; //$NON-NLS-1$ - /** - * IConfigurationElement element name - */ - protected static final String TAG_NAME = "StandardMetaDataFile"; //$NON-NLS-1$ - /** - * Uri attribute name for IConfigurationElement - */ - protected static final String ATT_URI = "uri"; //$NON-NLS-1$ - /** - * Location attribute name for IConfigurationElement - */ - protected static final String ATT_LOCATION = "location"; //$NON-NLS-1$ - /** - * Locator attribute name for IConfigurationElement - */ - protected static final String ATT_LOCATOR = "locator"; //$NON-NLS-1$ - - private StandardMetaDataFileRegistry annotationFileRegistry; - - /** - * Constructor - * @param registry - */ - public StandardMetaDataFileRegistryReader(StandardMetaDataFileRegistry registry) { - this.annotationFileRegistry = registry; - } - - /** - * read the registery - */ - public void readRegistry() { - IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry(); - IExtensionPoint point = extensionRegistry.getExtensionPoint(JSFCommonPlugin.PLUGIN_ID, EXTENSION_POINT_ID); - if (point != null) { - IConfigurationElement[] elements = point.getConfigurationElements(); - for (int i = 0; i < elements.length; i++) { - readElement(elements[i]); - } - } - } - - private void readElement(IConfigurationElement element) { - if (element.getName().equalsIgnoreCase(TAG_NAME)) { - String uri = element.getAttribute(ATT_URI); - String location = element.getAttribute(ATT_LOCATION); - String locator = element.getAttribute(ATT_LOCATOR); - String bundleId = null; - if (uri != null && location != null) { - try { - bundleId = element.getContributor().getName(); - StandardMetaDataFileInfo fileInfo = new StandardMetaDataFileInfo(location, bundleId, locator); - annotationFileRegistry.addStandardMetaDataFileInfo(uri, fileInfo); - } - catch (Exception e) { - JSFCommonPlugin.log(IStatus.ERROR, "Internal Error: exception occurred while reading StandardMetaDataFile ext-pt: "+location + ":"+uri, e); //$NON-NLS-1$ //$NON-NLS-2$ } - } - } - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/StandardMetaDataFilesTranslator.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/StandardMetaDataFilesTranslator.java deleted file mode 100644 index 6695ec5a1..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/StandardMetaDataFilesTranslator.java +++ /dev/null @@ -1,91 +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.common.metadata.internal; - -import java.util.Iterator; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.emf.ecore.util.EcoreUtil.Copier; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; -import org.eclipse.jst.jsf.common.metadata.Entity; -import org.eclipse.jst.jsf.common.metadata.EntityGroup; -import org.eclipse.jst.jsf.common.metadata.Model; -import org.eclipse.jst.jsf.common.metadata.Trait; -import org.eclipse.jst.jsf.common.metadata.internal.StandardMetaDataFileRegistry.StandardMetaDataFilesProvider; - - -/** - * A 'null' translation of a metadata file. Entities and traits are not transformed. - * - */ -public class StandardMetaDataFilesTranslator implements IMetaDataTranslator { - - public boolean canTranslate(final IMetaDataSourceModelProvider modelProvider) { - if (modelProvider instanceof StandardMetaDataFilesProvider) - return true; - return false; - } - - public void translate(final IMetaDataModelMergeAssistant assistant) {//TODO: throw proper errors - //null translate - sourceModel object are already Entities and traits - //traverse the tree and add to model - - //temp - throw proper errors - //assert assistant.getSourceModel() instanceof ModelKeyDescriptor; - - final MetaDataModel mm = assistant.getMergedModel(); - final Model mk = (Model)assistant.getSourceModelProvider().getSourceModel(); - if (mm.getRoot() == null) { - //create copy, otherwise source model becomes merged model because of reference - final Copier copier = new Copier(); - final Model newModel = (Model)copier.copy(mk.getModel()); - copier.copyReferences(); - mm.setRoot(newModel); - } - else { - //for each entity and trait call "add". assistant will handle merge. - if (mk != null) {//possible that model was not loaded - traverseAndAdd(assistant, mk); - } else if (StandardModelFactory.DEBUG_MD_LOAD) { - JSFCommonPlugin.log(IStatus.ERROR,"Unable to load source model: "+assistant.getSourceModelProvider()); //$NON-NLS-1$ - } - } - } - - /** - * Add entity and any children - * @param assistant - * @param entity - */ - protected void traverseAndAdd(final IMetaDataModelMergeAssistant assistant, final Entity entity){ - final Entity mmEntity = assistant.addEntity(entity); - - if (entity instanceof Model){ - final Model model = (Model)entity; - for (final Iterator/*EntityGroup*/ it=model.getEntityGroups().iterator();it.hasNext();){ - assistant.addEntityGroup((EntityGroup)it.next()); - } - } - - for (final Iterator/*<Trait>*/ it=entity.getTraits().iterator();it.hasNext();){ - final Trait trait = (Trait)it.next(); - assistant.addTrait(mmEntity, trait); - } - - for (final Iterator/*<EntityKey>*/ it=entity.getChildEntities().iterator();it.hasNext();){ - final Entity e = (Entity)it.next(); - traverseAndAdd(assistant, e); - } - - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/StandardMetaDataLocator.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/StandardMetaDataLocator.java deleted file mode 100644 index 331717055..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/StandardMetaDataLocator.java +++ /dev/null @@ -1,43 +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.common.metadata.internal; - -import java.util.List; - - -/** - * Implementation of IMetaDataLocator for standard metadata sources. - * Uses StandardMetaDataFileRegistry to locate instances. - * - */ -public class StandardMetaDataLocator extends AbstractMetaDataLocator { - - public List<IMetaDataSourceModelProvider> locateMetaDataModelProviders(String uri) { - return StandardMetaDataFileRegistry.getInstance().getStandardMetaDataModelProviders(uri); - } - - /* - * Does nothing. - */ - public void startLocating() { - //do nothing - } - - /* - * Does nothing. - */ - public void stopLocating() { - //do nothing - } - - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/StandardMetaDataSourceFileLocator.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/StandardMetaDataSourceFileLocator.java deleted file mode 100644 index e65d0dab2..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/StandardMetaDataSourceFileLocator.java +++ /dev/null @@ -1,74 +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.common.metadata.internal; - -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.util.MissingResourceException; -import java.util.ResourceBundle; - - -/** - * Used to supply an InputStream to the parser of an annotation - * meta-data file and the URL to the resource bundle for a properties file, if any. - * - * Implementors must provide a zero-argument constructor. - * - * CURRENTLY INTERNAL... WILL BE MADE API AT SOME POINT - * - */ -public abstract class StandardMetaDataSourceFileLocator { - /** - * metadata file to locate - */ - protected IStandardMetaDataSourceInfo fileInfo; - - /** - * Set the <code>IStandardMetaDataSourceInfo</code> for this locator - * @param fileInfo - */ - public final void setFileInfo(IStandardMetaDataSourceInfo fileInfo){ - this.fileInfo = fileInfo; - } - - /** - * @return the <code>IStandardMetaDataSourceInfo</code> for this locator - */ - protected final IStandardMetaDataSourceInfo getFileInfo(){ - return fileInfo; - } - /** - * Return InputStream to the meta-data source file. - * Callers are responsible for closing the stream. - * @return InputStream - * @throws IOException - */ - public abstract InputStream getInputStream() throws IOException; - - /** - * Return URL to the meta-data source file. - - * @return URL or null if cannot find a the file for getFileInfo - */ - public abstract URL getURL(); - - /** - * Return ResourceBundle for the property files if there are any. Return null if not. - * - * @return java.util.ResourceBundle - * @throws IOException - * @throws MissingResourceException - */ - public abstract ResourceBundle getResourceBundle() throws IOException, MissingResourceException; -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/StandardModelFactory.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/StandardModelFactory.java deleted file mode 100644 index fa24bb8c5..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/StandardModelFactory.java +++ /dev/null @@ -1,304 +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.common.metadata.internal; - -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.StringTokenizer; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Platform; -import org.eclipse.emf.common.util.EList; -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.ClassNotFoundException; -import org.eclipse.emf.ecore.xmi.FeatureNotFoundException; -import org.eclipse.emf.ecore.xmi.IllegalValueException; -import org.eclipse.emf.ecore.xmi.PackageNotFoundException; -import org.eclipse.emf.ecore.xmi.UnresolvedReferenceException; -import org.eclipse.emf.ecore.xmi.XMIException; -import org.eclipse.emf.ecore.xmi.XMLResource; -import org.eclipse.emf.ecore.xmi.impl.XMLResourceFactoryImpl; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; -import org.eclipse.jst.jsf.common.metadata.Model; -import org.eclipse.jst.jsf.common.metadata.internal.util.MetadataResourceImpl; - -/** - * Singleton that produces and loads standard metadata models. - * All models are loaded into the same ResourceSet. - * <p> - * All metadata extension models must be registered with org.eclipse.emf.ecore.generated_package extension-point. - * No other mechanism is provided for model uri resolution. - * <p> - * Debug tracing for model loading is available: <code>org.eclipse.jst.jsf.common/debug/metadataload=true</code> - * <p> - * When the /debug/metadataload trace flag is set, and in case extension models are known not to be available, - * and metadata is referencing those models, error logging can be suppressed by launching with the following properties set:<br> - * metadata.package.ignores<br> - * metadata.classname.ignores - * <p> - * eg. Usage for when WPE is not present<p> - * <code> - -Dmetadata.package.ignores=http://org.eclipse.jsf.pagedesigner/dtinfo.ecore,<br>http://org.eclipse.jsf.pagedesigner/QuickEditTabSections.ecore<br> - -Dmetadata.classname.ignores=DTInfo,QuickEditTabSections<br> - * </code> - * <p> - * see {@link Model} - */ -public class StandardModelFactory { - private static StandardModelFactory INSTANCE; - static boolean DEBUG_MD_LOAD = false; - static boolean DEBUG_MD_GET = false; - private ExtendedMetaData extendedMetaData; - private ResourceSet resourceSet; - - - /** - * @return singleton instance of the metadata model factory - */ - public synchronized static StandardModelFactory getInstance(){ - if (INSTANCE == null){ - INSTANCE = new StandardModelFactory(); - INSTANCE.init(); - - if (JSFCommonPlugin.getPlugin().isDebugging()){ - DEBUG_MD_LOAD = Boolean.valueOf(Platform.getDebugOption(JSFCommonPlugin.PLUGIN_ID+"/debug/metadataload")).booleanValue();//$NON-NLS-1$ - DEBUG_MD_GET = Boolean.valueOf(Platform.getDebugOption(JSFCommonPlugin.PLUGIN_ID+"/debug/metadataget")).booleanValue();//$NON-NLS-1$ - } - } - return INSTANCE; - } - - private void init() { - resourceSet = new ResourceSetImpl(); - - 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()); - - //relying on the org.eclipse.emf.ecore.generated_package ext-pt to register traits - } - - private StandardModelFactory() { - super(); - } - -// /** -// * Factory method that probably belongs somewhere else! -// * @param key -// * @param strategy -// * @return an empty MetaDataModel -// * @deprecated -// */ -// public MetaDataModel createModel(ModelKeyDescriptor key, IDomainLoadingStrategy strategy){ -// return new MetaDataModel(key, strategy); -// } - - /** - * @param context - * @param strategy - * @return MetaDataModel - */ - public MetaDataModel createModel(final IMetaDataModelContext context, final IDomainLoadingStrategy strategy) { - return new MetaDataModel(context, strategy); - } -// -// /** -// * Factory method that probably belongs somewhere else! -// * @param modelContext -// * @return a ModelKeyDescriptor for the context -// * @deprecated -// */ -// public ModelKeyDescriptor createModelKeyDescriptor(final ITaglibDomainMetaDataModelContext modelContext) { -// return new ModelKeyDescriptor(modelContext.getProject(), modelContext.getDomainID(), modelContext.getURI()); -// } - - /** - * @param inputStream - * @param provider - * @param uri - * @return the root of the standard model from the resource as an EList - * @throws IOException - */ - public EList loadStandardFileResource(final InputStream inputStream, - final IMetaDataSourceModelProvider provider, - final org.eclipse.emf.common.util.URI uri) throws IOException - { - final XMLResource res = new MetadataResourceImpl(provider); - - debug(String.format( - ">>> Loading standard meta-data file for uri %s", uri), DEBUG_MD_LOAD); //$NON-NLS-1$ - - res.setURI(uri); - resourceSet.getResources().add(res); - setLoadOptions(res); - res.load(inputStream, null); - if (DEBUG_MD_LOAD) - { - reportErrors(res); - } - final EList root = res.getContents(); - return root; - } - - private void reportErrors(Resource res) { - EList<Resource.Diagnostic> errs = res.getErrors(); - if (! errs.isEmpty()){ - for (Iterator<Resource.Diagnostic> it= errs.iterator();it.hasNext();){ - StandardModelErrorMessageFactory.logErrorMessage(it.next()); - } - } - } - - /** - * Sets default load options for the resource - * @param resource - */ - protected void setLoadOptions(XMLResource resource) { - Map options = resource.getDefaultLoadOptions(); -// options.put(XMLResource.OPTION_SAVE_TYPE_INFORMATION, true); - options.put(XMLResource.OPTION_SCHEMA_LOCATION, Boolean.TRUE); - options.put(XMLResource.OPTION_EXTENDED_META_DATA, extendedMetaData); - options.put(XMLResource.OPTION_RESOURCE_HANDLER, resource); - 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. -// options.put(XMLResource.OPTION_DOM_USE_NAMESPACES_IN_SCOPE, Boolean.TRUE); - -// if (DEBUG_MD_LOAD) -// { -// System.out.println("Using load options: "+options); -// } - } - - - static class StandardModelErrorMessageFactory { - private static List<String> _missingPackageURIs; - private static List<String> _missingClassnames; - - /** - * Simply logs all messages against JSFCommonPlugin, for now. - * @param diagnostic - */ - public static void logErrorMessage(Resource.Diagnostic diagnostic) { - //should be XMIException - if (diagnostic instanceof XMIException) { - XMIException ex = (XMIException)diagnostic; - String msg = createMessage(ex); - if (msg != null) - JSFCommonPlugin.log(IStatus.ERROR, msg); - } - else { - JSFCommonPlugin.log(IStatus.ERROR, diagnostic.toString());//do better??? - } - } - - private static String createMessage(XMIException ex) { - - StringBuffer buf = new StringBuffer("Metadata Load Error: ") //$NON-NLS-1$ - .append(ex.getClass().getSimpleName()).append(": "); //$NON-NLS-1$ - - if (ex instanceof PackageNotFoundException) { - if (shouldIgnore(ex)) - return null; - - buf.append(((PackageNotFoundException)ex).uri()); - } - else if (ex instanceof ClassNotFoundException) { - if (shouldIgnore(ex)) - return null; - - buf.append(((ClassNotFoundException)ex).getName()); - } - else if (ex instanceof FeatureNotFoundException) - buf.append(((FeatureNotFoundException)ex).getName()); - else if (ex instanceof IllegalValueException) - buf.append(((IllegalValueException)ex).getValue().toString()); - else if (ex instanceof UnresolvedReferenceException) - buf.append(((UnresolvedReferenceException)ex).getReference()); - else - buf.append(ex.getMessage()); - - buf.append(" in ").append(ex.getLocation()).append(": Line = ") //$NON-NLS-1$ //$NON-NLS-2$ - .append(ex.getLine()).append(": Column = ").append(ex.getColumn()); //$NON-NLS-1$ - return buf.toString(); - } - - private static boolean shouldIgnore(XMIException ex) { - if (ex instanceof PackageNotFoundException) { - String uri = ((PackageNotFoundException)ex).uri(); - return getMissingPackageURIs().contains(uri); - } - else if (ex instanceof ClassNotFoundException) { - String className = ((ClassNotFoundException)ex).getName(); - return getMissingClassnames().contains(className); - } - return false; - } - - private static List<String> getMissingPackageURIs() { - if (_missingPackageURIs == null) { - _missingPackageURIs = buildList("metadata.package.ignores"); //$NON-NLS-1$ - - } - return _missingPackageURIs; - } - - private static List<String> getMissingClassnames() { - if (_missingClassnames == null) { - _missingClassnames = buildList("metadata.classname.ignores"); //$NON-NLS-1$ - } - return _missingClassnames; - } - - private static List<String> buildList(String propertyName) { - List<String> ret = new ArrayList<String>(); - String ignoreSet = System.getProperty(propertyName); - if (ignoreSet == null )//try env - ignoreSet = System.getenv(propertyName); - - if (ignoreSet != null && !(ignoreSet.equals(""))){ //$NON-NLS-1$ - StringTokenizer st = new StringTokenizer(ignoreSet, ","); //$NON-NLS-1$ - while(st.hasMoreTokens()){ - String uri = st.nextToken(); - if (!(uri.equals(""))) //$NON-NLS-1$ - ret.add(uri); - } - } - - return ret; - } - - } - - /** - * Debug output. The parenthesis shows thread id. - * @param msg - * @param debugFlag - */ - public static void debug(String msg, boolean debugFlag) { - if (debugFlag) - System.out.println(msg + "["+Thread.currentThread().getId()+"]"); //$NON-NLS-1$ //$NON-NLS-2$ - } - - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/TaglibDomainMetaDataModelContextImpl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/TaglibDomainMetaDataModelContextImpl.java deleted file mode 100644 index 4f8f4ad99..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/TaglibDomainMetaDataModelContextImpl.java +++ /dev/null @@ -1,74 +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.common.metadata.internal; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.jsf.common.metadata.query.ITaglibDomainMetaDataModelContext; - -/** - * Simple implementation of {@link ITaglibDomainMetaDataModelContext} - * @deprecated - Helios - */ -public class TaglibDomainMetaDataModelContextImpl extends MetaDataModelContextImpl implements IMetaDataModelContext, ITaglibDomainMetaDataModelContext, Cloneable -{ - private final IProject _project; - private final String _uri; - - /** - * Constructor - * @param project - * @param domain - * @param uri - */ - public TaglibDomainMetaDataModelContextImpl(final String domain, final IProject project, final String uri){ - super(domain); - this._project = project; - this._uri = uri; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.query.ITaglibDomainMetaDataModelContext#getProject() - */ - public IProject getProject() { - return _project; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.query.ITaglibDomainMetaDataModelContext#getURI() - */ - public String getURI() { - return _uri; - } - - public Object getAdapter(Class adapter) { - if (adapter.equals(ITaglibDomainMetaDataModelContext.class)) - return this; - if (adapter.equals(IProject.class)) - return _project; - - return super.getAdapter(adapter); - } - - @Override - public Object clone() throws CloneNotSupportedException { - return super.clone(); - } - - - public String getDomainId() { - return getDomainID(); - } - - public String getModelIdentifier() { - return getURI(); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/TraitValueHelper.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/TraitValueHelper.java deleted file mode 100644 index a0812fe9e..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/TraitValueHelper.java +++ /dev/null @@ -1,213 +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.common.metadata.internal; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.impl.BasicEObjectImpl; -import org.eclipse.emf.ecore.util.FeatureMap; -import org.eclipse.emf.ecore.xml.type.AnyType; -import org.eclipse.emf.ecore.xml.type.SimpleAnyType; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; -import org.eclipse.jst.jsf.common.metadata.Trait; -import org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.BooleanValue; -import org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.ListOfValues; -import org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.StringValue; -import org.eclipse.osgi.util.NLS; - -/** - * Experimental/prototype class to assist with decoding trait values. - * This could/should be made API at some point after "hardening". (https://bugs.eclipse.org/bugs/show_bug.cgi?id=192052) - */ -public class TraitValueHelper { - private static final String KEY_NOT_FOUND = Messages.Key_not_found; - /** - * @param trait - * @return EClass of trait value - */ - public static EClass getValueType(final Trait trait){ - if (trait == null) - return null; - if (trait.getValue() != null) - return trait.getValue().eClass(); - return null; - } - - /** - * @param trait - * @return value of trait as String Object. - */ - public static Object getValue(final Trait trait){ - if (trait == null) - return null; - - if (trait.getValue() == null) - return null; - - if (trait.getValue() instanceof StringValue) { - return ((StringValue)trait.getValue()).getValue(); - } - else if (trait.getValue() instanceof SimpleAnyType){ - return ((SimpleAnyType)trait.getValue()).getRawValue(); - } - else if (trait.getValue() instanceof AnyType){ - AnyType any = (AnyType)trait.getValue(); - FeatureMap map = any.getMixed(); - return getTextValueFromFeatureMap(map); - } - else if ( trait.getValue().eIsProxy() && trait.getValue() instanceof BasicEObjectImpl){ - BasicEObjectImpl o = (BasicEObjectImpl)trait.getValue(); - return o.eProxyURI().toString(); - } - return trait.getValue(); - } - - private static String getTextValueFromFeatureMap(final FeatureMap map) { - for (final Iterator it=map.iterator();it.hasNext();){ - final FeatureMap.Entry entry = (FeatureMap.Entry)it.next(); - if (entry.getEStructuralFeature().getName().equals("text")) //$NON-NLS-1$ - return (String)entry.getValue(); - } - return null; - } - - /** - * @param trait - * @return value of trait as String. If externalized, will resolve from resource bundle. - */ - public static String getValueAsString(final Trait trait){ - final Object val = getValue(trait); - if (val instanceof String){ - return getNLSValue(trait, (String)val); - } - else if (val instanceof BooleanValue) - return String.valueOf(((BooleanValue)val).isTrue()); - - return null; - } - - /** - * - * @param trait whose value a {@link ListOfValues} or is a single string - * @return List of Strings. If externalized, will resolve from resource bundle - * using getNLSValue(Trait trait, String rawValue) - */ - public synchronized static List getValueAsListOfStrings(final Trait trait){ - //PROTO ONLY!!! Need to make WAY more robust! - final List ret = new ArrayList(); - if (trait.getValue() instanceof ListOfValues) { - for(final Iterator it=trait.getValue().eContents().iterator();it.hasNext();){ - final Object o = it.next(); - if (o instanceof SimpleAnyType){ - final SimpleAnyType sat = (SimpleAnyType)o; - final String rawValue = getTextValueFromFeatureMap(sat.getMixed()); - final String nlsValue = getNLSValue(trait, rawValue); - - ret.add(nlsValue); - } - } - } - else { - //may be single value - String o = getValueAsString(trait); - if (o != null) - ret.add(o); - } - return ret; - } - - /** - * Looks for '%' (and not '%%') at beginning of rawValue. If found, looks to the - * traits sourceModelProvider for resource bundle to resolve the key after - * stripping the '%' sign. - * @param trait - * @param rawValue of string in from metadata - * @return the NLS Value or rawValue if it cannot be located - */ - public static String getNLSValue(final Trait trait, final String rawValue) { - String result = rawValue; - if (rawValue.startsWith("%") && !rawValue.startsWith("%%")){ //$NON-NLS-1$//$NON-NLS-2$ - final String key = rawValue.substring(1); - result = getNLSPropertyValue(trait, key); - if (result == null){ - result = rawValue; - } - } - return result == null ? null : result.trim(); - } - - //will return null if there is an IOException with ResourceBundle - private static String getNLSPropertyValue(final Trait trait, final String key){ - try{ - IMetaDataSourceModelProvider provider = trait.getSourceModelProvider(); - IResourceBundleProvider resourceBundleProvider = (IResourceBundleProvider)provider.getAdapter(IResourceBundleProvider.class); - if (resourceBundleProvider != null){ - ResourceBundle resourceBundle_ = resourceBundleProvider.getResourceBundle(); - if (resourceBundle_ != null){ - String replVal = resourceBundle_.getString(key); - return replVal; - } - } - //return original string - return key; - - } catch (MissingResourceException e){ - //fall thru - JSFCommonPlugin.log(e, NLS.bind(Messages.MissingResource_exception, new String[]{key})); - } - return key + KEY_NOT_FOUND; - } - - /** - * If trait type is {@link BooleanValue} returns value, otherwise - * it will get the value as a String and attempt to coerce to boolean. - * Will return 'false' if coercion fails, or value was null. - * @param trait - * @return true or false - */ - public static boolean getValueAsBoolean(final Trait trait) { - if (trait != null && trait.getValue() instanceof BooleanValue) { - return ((BooleanValue)trait.getValue()).isTrue(); - } - final String val = getValueAsString(trait); - if (val == null) - return false; - - return Boolean.valueOf(val).booleanValue(); - } - -// /** -// * @param trait -// * @return name of class or primitive datatype that the value is defined as. -// * For SimpleAnyTypes, the getInstanceType().getInstanceClassName() is returned. -// * For AnyType, java.lang.String is always returned. -// * For all others, the class.getName() is returned. -// */ -// public static String getValueInstanceClassName(Trait trait) {String.class.getName(); -// if (trait.getValue() instanceof SimpleAnyType) { -// return ((SimpleAnyType)trait.getValue()).getInstanceType().getInstanceClassName(); -// } -// else if (trait.getValue() instanceof AnyType) { -// return String.class.getName(); -// } -// else { -// return trait.getValue().getClass().getName(); -// } -// -// } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/TraitValueHelper2.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/TraitValueHelper2.java deleted file mode 100644 index 64238d775..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/TraitValueHelper2.java +++ /dev/null @@ -1,226 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 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.common.metadata.internal; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.impl.BasicEObjectImpl; -import org.eclipse.emf.ecore.util.FeatureMap; -import org.eclipse.emf.ecore.xml.type.AnyType; -import org.eclipse.emf.ecore.xml.type.SimpleAnyType; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; -import org.eclipse.jst.jsf.common.metadata.Trait; -import org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.BooleanValue; -import org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.ListOfValues; -import org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.StringValue; -import org.eclipse.osgi.util.NLS; - -/** - * Experimental/prototype class to assist with decoding trait values. - * This could/should be made API at some point after "hardening". (https://bugs.eclipse.org/bugs/show_bug.cgi?id=192052) - * <p> - * May be subclassed - * <p> - * Note: non-static copy of TraitValueHelper - */ -public class TraitValueHelper2 { - private static final String KEY_NOT_FOUND = Messages.Key_not_found; - - /** - * @param trait - * @return EClass of trait value - */ - public EClass getValueType(final Trait trait){ - if (trait == null) - return null; - if (trait.getValue() != null) - return trait.getValue().eClass(); - return null; - } - - /** - * @param trait - * @return value of trait as String Object. - */ - public Object getValue(final Trait trait){ - if (trait == null) - return null; - - if (trait.getValue() == null) - return null; - - if (trait.getValue() instanceof StringValue) { - return ((StringValue)trait.getValue()).getValue(); - } - else if (trait.getValue() instanceof SimpleAnyType){ - return ((SimpleAnyType)trait.getValue()).getRawValue(); - } - else if (trait.getValue() instanceof AnyType){ - AnyType any = (AnyType)trait.getValue(); - FeatureMap map = any.getMixed(); - return getTextValueFromFeatureMap(map); - } - else if ( trait.getValue().eIsProxy() && trait.getValue() instanceof BasicEObjectImpl){ - BasicEObjectImpl o = (BasicEObjectImpl)trait.getValue(); - return o.eProxyURI().toString(); - } - return trait.getValue(); - } - - /** - * @param map - * @return String - */ - protected String getTextValueFromFeatureMap(final FeatureMap map) { - for (final Iterator it=map.iterator();it.hasNext();){ - final FeatureMap.Entry entry = (FeatureMap.Entry)it.next(); - if (entry.getEStructuralFeature().getName().equals("text")) //$NON-NLS-1$ - return (String)entry.getValue(); - } - return null; - } - - /** - * @param trait - * @return value of trait as String. If externalized, will resolve from resource bundle. - */ - public String getValueAsString(final Trait trait){ - final Object val = getValue(trait); - if (val instanceof String){ - return getNLSValue(trait, (String)val); - } - else if (val instanceof BooleanValue) - return String.valueOf(((BooleanValue)val).isTrue()); - - return null; - } - - /** - * @param trait whose value a {@link ListOfValues} or is a single string - * @return List of Strings. If externalized, will resolve from resource bundle - * using getNLSValue(Trait trait, String rawValue) - */ - public synchronized List getValueAsListOfStrings(final Trait trait){ - //PROTO ONLY!!! Need to make WAY more robust! - final List ret = new ArrayList(); - if (trait.getValue() instanceof ListOfValues) { - for(final Iterator it=trait.getValue().eContents().iterator();it.hasNext();){ - final Object o = it.next(); - if (o instanceof SimpleAnyType){ - final SimpleAnyType sat = (SimpleAnyType)o; - final String rawValue = getTextValueFromFeatureMap(sat.getMixed()); - final String nlsValue = getNLSValue(trait, rawValue); - - ret.add(nlsValue); - } - } - } - else { - //may be single value - String o = getValueAsString(trait); - if (o != null) - ret.add(o); - } - return ret; - } - - /** - * Looks for '%' (and not '%%') at beginning of rawValue. If found, looks to the - * traits sourceModelProvider for resource bundle to resolve the key after - * stripping the '%' sign. - * @param trait - * @param rawValue of string in from metadata - * @return the NLS Value or rawValue if it cannot be located - */ - public String getNLSValue(final Trait trait, final String rawValue) { - String result = rawValue; - if (rawValue.startsWith("%") && !rawValue.startsWith("%%")){ //$NON-NLS-1$//$NON-NLS-2$ - final String key = rawValue.substring(1); - result = getNLSPropertyValue(trait, key); - if (result == null){ - result = rawValue; - } - } - return result == null ? null : result.trim(); - } - - /** - * @param trait - * @param key - * @return String - */ - //will return null if there is an IOException with ResourceBundle - protected String getNLSPropertyValue(final Trait trait, final String key){ - try{ - IMetaDataSourceModelProvider provider = trait.getSourceModelProvider(); - IResourceBundleProvider resourceBundleProvider = (IResourceBundleProvider)provider.getAdapter(IResourceBundleProvider.class); - if (resourceBundleProvider != null){ - ResourceBundle resourceBundle_ = resourceBundleProvider.getResourceBundle(); - if (resourceBundle_ != null){ - String replVal = resourceBundle_.getString(key); - return replVal; - } - } - //return original string - return key; - - } catch (MissingResourceException e){ - //fall thru - JSFCommonPlugin.log(e, NLS.bind(Messages.MissingResource_exception, new String[]{key})); - } - return key + KEY_NOT_FOUND; - } - - /** - * If trait type is {@link BooleanValue} returns value, otherwise - * it will get the value as a String and attempt to coerce to boolean. - * Will return 'false' if coercion fails, or value was null. - * @param trait - * @return true or false - */ - public boolean getValueAsBoolean(final Trait trait) { - if (trait != null && trait.getValue() instanceof BooleanValue) { - return ((BooleanValue)trait.getValue()).isTrue(); - } - final String val = getValueAsString(trait); - if (val == null) - return false; - - return Boolean.valueOf(val).booleanValue(); - } - -// /** -// * @param trait -// * @return name of class or primitive datatype that the value is defined as. -// * For SimpleAnyTypes, the getInstanceType().getInstanceClassName() is returned. -// * For AnyType, java.lang.String is always returned. -// * For all others, the class.getName() is returned. -// */ -// public String getValueInstanceClassName(Trait trait) {String.class.getName(); -// if (trait.getValue() instanceof SimpleAnyType) { -// return ((SimpleAnyType)trait.getValue()).getInstanceType().getInstanceClassName(); -// } -// else if (trait.getValue() instanceof AnyType) { -// return String.class.getName(); -// } -// else { -// return trait.getValue().getClass().getName(); -// } -// -// } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/impl/EntityGroupImpl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/impl/EntityGroupImpl.java deleted file mode 100644 index 18fd3c5b2..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/impl/EntityGroupImpl.java +++ /dev/null @@ -1,50 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: EntityGroupImpl.java,v 1.7 2011/03/16 21:14:13 gkessler Exp $ - */ -package org.eclipse.jst.jsf.common.metadata.internal.impl; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.jst.jsf.common.metadata.EntityGroup; -import org.eclipse.jst.jsf.common.metadata.MetadataPackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Entity Group</b></em>'. - * <!-- end-user-doc --> - * <p> - * </p> - * - * @generated - */ -@SuppressWarnings("hiding") -public class EntityGroupImpl extends EntityImpl implements EntityGroup { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EntityGroupImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() { - return MetadataPackage.Literals.ENTITY_GROUP; - } - -} //EntityGroupImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/impl/EntityImpl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/impl/EntityImpl.java deleted file mode 100644 index 74d9ea3cf..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/impl/EntityImpl.java +++ /dev/null @@ -1,439 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: EntityImpl.java,v 1.9 2011/03/16 21:14:13 gkessler Exp $ - */ -package org.eclipse.jst.jsf.common.metadata.internal.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.EObject; -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.EObjectResolvingEList; -import org.eclipse.emf.ecore.util.InternalEList; -import org.eclipse.jst.jsf.common.metadata.Entity; -import org.eclipse.jst.jsf.common.metadata.IncludeEntityGroup; -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.metadata.query.IEntityVisitor; -import org.eclipse.jst.jsf.common.metadata.query.internal.IHierarchicalEntityVisitor; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Entity</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.jst.jsf.common.metadata.internal.impl.EntityImpl#getChildEntities <em>Child Entities</em>}</li> - * <li>{@link org.eclipse.jst.jsf.common.metadata.internal.impl.EntityImpl#getTraits <em>Traits</em>}</li> - * <li>{@link org.eclipse.jst.jsf.common.metadata.internal.impl.EntityImpl#getId <em>Id</em>}</li> - * <li>{@link org.eclipse.jst.jsf.common.metadata.internal.impl.EntityImpl#getType <em>Type</em>}</li> - * <li>{@link org.eclipse.jst.jsf.common.metadata.internal.impl.EntityImpl#getIncludeGroups <em>Include Groups</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class EntityImpl extends EObjectImpl implements Entity { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - /** - * The cached value of the '{@link #getChildEntities() <em>Child Entities</em>}' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getChildEntities() - * @generated - * @ordered - */ - protected EList<Entity> childEntities; - - /** - * The cached value of the '{@link #getTraits() <em>Traits</em>}' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getTraits() - * @generated - * @ordered - */ - protected EList<Trait> traits; - - /** - * 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 #getType() <em>Type</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getType() - * @generated - * @ordered - */ - protected static final String TYPE_EDEFAULT = null; - - /** - * The cached value of the '{@link #getType() <em>Type</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getType() - * @generated - * @ordered - */ - protected String type = TYPE_EDEFAULT; - - /** - * The cached value of the '{@link #getIncludeGroups() <em>Include Groups</em>}' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getIncludeGroups() - * @generated - * @ordered - */ - protected EList<IncludeEntityGroup> includeGroups; - - /** - * The cached value of the Model - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - private Model _model; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EntityImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() { - return MetadataPackage.Literals.ENTITY; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EList<Entity> getChildEntities() { - if (childEntities == null) { - childEntities = new EObjectContainmentEList<Entity>(Entity.class, this, MetadataPackage.ENTITY__CHILD_ENTITIES); - } - return childEntities; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EList<Trait> getTraits() { - if (traits == null) { - traits = new EObjectContainmentEList<Trait>(Trait.class, this, MetadataPackage.ENTITY__TRAITS); - } - return traits; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EList<IncludeEntityGroup> getIncludeGroups() { - if (includeGroups == null) { - includeGroups = new EObjectResolvingEList<IncludeEntityGroup>(IncludeEntityGroup.class, this, MetadataPackage.ENTITY__INCLUDE_GROUPS); - } - return includeGroups; - } - - /** - * <!-- 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, MetadataPackage.ENTITY__ID, oldId, id)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getType() { - return type; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setType(String newType) { - String oldType = type; - type = newType; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, MetadataPackage.ENTITY__TYPE, oldType, type)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - private boolean accept(final IHierarchicalEntityVisitor visitor) { - if (visitor.visitEnter( this )) { - acceptChildren(visitor); - } - return visitor.visitLeave(this); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - public void accept(final IEntityVisitor visitor) { - if (visitor instanceof IHierarchicalEntityVisitor) { - accept((IHierarchicalEntityVisitor)visitor); - } - else { - if (visitor.stopVisiting()) - return; - - visitor.visit(this); - if (visitor.stopVisiting()) - return; - - acceptChildren(visitor); - - visitor.visitCompleted(this); - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - private void acceptChildren(final IEntityVisitor visitor) { - if (!getChildEntities().isEmpty()){ - for (final Iterator/*<Entity>*/ it = getChildEntities().iterator(); it.hasNext();){ - final Entity k = (Entity)it.next(); - k.accept(visitor); - if (visitor.stopVisiting()) - return; - } - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - public Model getModel() { - if (_model == null){ - EObject parent = this.eContainer(); - while (true){ - if (parent instanceof Model){ - _model = (Model)parent; - break; - } - if (parent != null) - parent = parent.eContainer(); - else - break; - } - } - return _model; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { - switch (featureID) { - case MetadataPackage.ENTITY__CHILD_ENTITIES: - return ((InternalEList<?>)getChildEntities()).basicRemove(otherEnd, msgs); - case MetadataPackage.ENTITY__TRAITS: - return ((InternalEList<?>)getTraits()).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 MetadataPackage.ENTITY__CHILD_ENTITIES: - return getChildEntities(); - case MetadataPackage.ENTITY__TRAITS: - return getTraits(); - case MetadataPackage.ENTITY__ID: - return getId(); - case MetadataPackage.ENTITY__TYPE: - return getType(); - case MetadataPackage.ENTITY__INCLUDE_GROUPS: - return getIncludeGroups(); - } - 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 MetadataPackage.ENTITY__CHILD_ENTITIES: - getChildEntities().clear(); - getChildEntities().addAll((Collection<? extends Entity>)newValue); - return; - case MetadataPackage.ENTITY__TRAITS: - getTraits().clear(); - getTraits().addAll((Collection<? extends Trait>)newValue); - return; - case MetadataPackage.ENTITY__ID: - setId((String)newValue); - return; - case MetadataPackage.ENTITY__TYPE: - setType((String)newValue); - return; - case MetadataPackage.ENTITY__INCLUDE_GROUPS: - getIncludeGroups().clear(); - getIncludeGroups().addAll((Collection<? extends IncludeEntityGroup>)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case MetadataPackage.ENTITY__CHILD_ENTITIES: - getChildEntities().clear(); - return; - case MetadataPackage.ENTITY__TRAITS: - getTraits().clear(); - return; - case MetadataPackage.ENTITY__ID: - setId(ID_EDEFAULT); - return; - case MetadataPackage.ENTITY__TYPE: - setType(TYPE_EDEFAULT); - return; - case MetadataPackage.ENTITY__INCLUDE_GROUPS: - getIncludeGroups().clear(); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case MetadataPackage.ENTITY__CHILD_ENTITIES: - return childEntities != null && !childEntities.isEmpty(); - case MetadataPackage.ENTITY__TRAITS: - return traits != null && !traits.isEmpty(); - case MetadataPackage.ENTITY__ID: - return ID_EDEFAULT == null ? id != null : !ID_EDEFAULT.equals(id); - case MetadataPackage.ENTITY__TYPE: - return TYPE_EDEFAULT == null ? type != null : !TYPE_EDEFAULT.equals(type); - case MetadataPackage.ENTITY__INCLUDE_GROUPS: - return includeGroups != null && !includeGroups.isEmpty(); - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - public String toString() { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (id: "); //$NON-NLS-1$ - result.append(id); - result.append(", type: "); //$NON-NLS-1$ - result.append(type); - result.append(')'); - return result.toString(); - } - -} //EntityImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/impl/IncludeEntityGroupImpl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/impl/IncludeEntityGroupImpl.java deleted file mode 100644 index 089dbbd1b..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/impl/IncludeEntityGroupImpl.java +++ /dev/null @@ -1,224 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: IncludeEntityGroupImpl.java,v 1.4 2011/03/16 21:14:13 gkessler Exp $ - */ -package org.eclipse.jst.jsf.common.metadata.internal.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.common.metadata.IncludeEntityGroup; -import org.eclipse.jst.jsf.common.metadata.MetadataPackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Include Entity Group</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.jst.jsf.common.metadata.internal.impl.IncludeEntityGroupImpl#getId <em>Id</em>}</li> - * <li>{@link org.eclipse.jst.jsf.common.metadata.internal.impl.IncludeEntityGroupImpl#getModelUri <em>Model Uri</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class IncludeEntityGroupImpl extends EObjectImpl implements IncludeEntityGroup { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - /** - * 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 #getModelUri() <em>Model Uri</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getModelUri() - * @generated - * @ordered - */ - protected static final String MODEL_URI_EDEFAULT = null; - - /** - * The cached value of the '{@link #getModelUri() <em>Model Uri</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getModelUri() - * @generated - * @ordered - */ - protected String modelUri = MODEL_URI_EDEFAULT; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IncludeEntityGroupImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() { - return MetadataPackage.Literals.INCLUDE_ENTITY_GROUP; - } - - /** - * <!-- 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, MetadataPackage.INCLUDE_ENTITY_GROUP__ID, oldId, id)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getModelUri() { - return modelUri; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setModelUri(String newModelUri) { - String oldModelUri = modelUri; - modelUri = newModelUri; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, MetadataPackage.INCLUDE_ENTITY_GROUP__MODEL_URI, oldModelUri, modelUri)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case MetadataPackage.INCLUDE_ENTITY_GROUP__ID: - return getId(); - case MetadataPackage.INCLUDE_ENTITY_GROUP__MODEL_URI: - return getModelUri(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case MetadataPackage.INCLUDE_ENTITY_GROUP__ID: - setId((String)newValue); - return; - case MetadataPackage.INCLUDE_ENTITY_GROUP__MODEL_URI: - setModelUri((String)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case MetadataPackage.INCLUDE_ENTITY_GROUP__ID: - setId(ID_EDEFAULT); - return; - case MetadataPackage.INCLUDE_ENTITY_GROUP__MODEL_URI: - setModelUri(MODEL_URI_EDEFAULT); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case MetadataPackage.INCLUDE_ENTITY_GROUP__ID: - return ID_EDEFAULT == null ? id != null : !ID_EDEFAULT.equals(id); - case MetadataPackage.INCLUDE_ENTITY_GROUP__MODEL_URI: - return MODEL_URI_EDEFAULT == null ? modelUri != null : !MODEL_URI_EDEFAULT.equals(modelUri); - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - public String toString() { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (id: "); //$NON-NLS-1$ - result.append(id); - result.append(", modelUri: "); //$NON-NLS-1$ - result.append(modelUri); - result.append(')'); - return result.toString(); - } - -} //IncludeEntityGroupImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/impl/MetadataFactoryImpl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/impl/MetadataFactoryImpl.java deleted file mode 100644 index fce3aa79b..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/impl/MetadataFactoryImpl.java +++ /dev/null @@ -1,229 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: MetadataFactoryImpl.java,v 1.6 2011/03/16 21:14:13 gkessler Exp $ - */ -package org.eclipse.jst.jsf.common.metadata.internal.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.common.metadata.Entity; -import org.eclipse.jst.jsf.common.metadata.EntityGroup; -import org.eclipse.jst.jsf.common.metadata.IncludeEntityGroup; -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.metadata.internal.IMetaDataSourceModelProvider; -import org.eclipse.jst.jsf.common.metadata.internal.ModelKeyDescriptor; - - - -/** - * <!-- begin-user-doc --> - * An implementation of the model <b>Factory</b>. - * <!-- end-user-doc --> - * @generated - */ -public class MetadataFactoryImpl extends EFactoryImpl implements MetadataFactory { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - /** - * Creates the default factory implementation. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - public static MetadataFactory init() { - try { - MetadataFactory theMetadataFactory = (MetadataFactory)EPackage.Registry.INSTANCE.getEFactory("http://org.eclipse.jst.jsf.common.metadata/metadata.ecore"); //$NON-NLS-1$ - if (theMetadataFactory != null) { - return theMetadataFactory; - } - } - catch (Exception exception) { - EcorePlugin.INSTANCE.log(exception); - } - return new MetadataFactoryImpl(); - } - - /** - * Creates an instance of the factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public MetadataFactoryImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public EObject create(EClass eClass) { - switch (eClass.getClassifierID()) { - case MetadataPackage.MODEL: return createModel(); - case MetadataPackage.ENTITY_GROUP: return createEntityGroup(); - case MetadataPackage.ENTITY: return createEntity(); - case MetadataPackage.INCLUDE_ENTITY_GROUP: return createIncludeEntityGroup(); - case MetadataPackage.TRAIT: return createTrait(); - default: - throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); //$NON-NLS-1$//$NON-NLS-2$ - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object createFromString(EDataType eDataType, String initialValue) { - switch (eDataType.getClassifierID()) { - case MetadataPackage.IMETA_DATA_SOURCE_MODEL_PROVIDER: - return createIMetaDataSourceModelProviderFromString(eDataType, initialValue); - case MetadataPackage.MODEL_CONTEXT: - return createModelContextFromString(eDataType, initialValue); - default: - throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); //$NON-NLS-1$//$NON-NLS-2$ - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public String convertToString(EDataType eDataType, Object instanceValue) { - switch (eDataType.getClassifierID()) { - case MetadataPackage.IMETA_DATA_SOURCE_MODEL_PROVIDER: - return convertIMetaDataSourceModelProviderToString(eDataType, instanceValue); - case MetadataPackage.MODEL_CONTEXT: - return convertModelContextToString(eDataType, instanceValue); - default: - throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); //$NON-NLS-1$//$NON-NLS-2$ - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Trait createTrait() { - TraitImpl trait = new TraitImpl(); - return trait; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public IncludeEntityGroup createIncludeEntityGroup() { - IncludeEntityGroupImpl includeEntityGroup = new IncludeEntityGroupImpl(); - return includeEntityGroup; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Model createModel() { - ModelImpl model = new ModelImpl(); - return model; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Entity createEntity() { - EntityImpl entity = new EntityImpl(); - return entity; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EntityGroup createEntityGroup() { - EntityGroupImpl entityGroup = new EntityGroupImpl(); - return entityGroup; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public IMetaDataSourceModelProvider createIMetaDataSourceModelProviderFromString(EDataType eDataType, String initialValue) { - return (IMetaDataSourceModelProvider)super.createFromString(eDataType, initialValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String convertIMetaDataSourceModelProviderToString(EDataType eDataType, Object instanceValue) { - return super.convertToString(eDataType, instanceValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ModelKeyDescriptor createModelContextFromString(EDataType eDataType, String initialValue) { - return (ModelKeyDescriptor)super.createFromString(eDataType, initialValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String convertModelContextToString(EDataType eDataType, Object instanceValue) { - return super.convertToString(eDataType, instanceValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public MetadataPackage getMetadataPackage() { - return (MetadataPackage)getEPackage(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @deprecated - * @generated - */ - @Deprecated - public static MetadataPackage getPackage() { - return MetadataPackage.eINSTANCE; - } - -} //MetadataFactoryImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/impl/MetadataPackageImpl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/impl/MetadataPackageImpl.java deleted file mode 100644 index b4ef529ba..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/impl/MetadataPackageImpl.java +++ /dev/null @@ -1,583 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: MetadataPackageImpl.java,v 1.9 2011/04/04 22:22:38 gkessler Exp $ - */ -package org.eclipse.jst.jsf.common.metadata.internal.impl; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EDataType; -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.common.metadata.Entity; -import org.eclipse.jst.jsf.common.metadata.EntityGroup; -import org.eclipse.jst.jsf.common.metadata.IncludeEntityGroup; -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.metadata.internal.IMetaDataSourceModelProvider; -import org.eclipse.jst.jsf.common.metadata.internal.ModelKeyDescriptor; -import org.eclipse.jst.jsf.common.metadata.query.IEntityVisitor; -import org.eclipse.jst.jsf.common.metadata.query.ITraitVisitor; - - -/** - * <!-- begin-user-doc --> - * An implementation of the model <b>Package</b>. - * <!-- end-user-doc --> - * @generated - */ -@SuppressWarnings("nls") -public class MetadataPackageImpl extends EPackageImpl implements MetadataPackage { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass traitEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass includeEntityGroupEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass modelEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass entityEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass entityGroupEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EDataType iTraitVisitorEDataType = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EDataType iEntityVisitorEDataType = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EDataType iMetaDataSourceModelProviderEDataType = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EDataType modelContextEDataType = 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.common.metadata.MetadataPackage#eNS_URI - * @see #init() - * @generated - */ - private MetadataPackageImpl() { - super(eNS_URI, MetadataFactory.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. - * - * <p>This method is used to initialize {@link MetadataPackage#eINSTANCE} when that field is accessed. - * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #eNS_URI - * @see #createPackageContents() - * @see #initializePackageContents() - * @generated - */ - public static MetadataPackage init() { - if (isInited) return (MetadataPackage)EPackage.Registry.INSTANCE.getEPackage(MetadataPackage.eNS_URI); - - // Obtain or create and register package - MetadataPackageImpl theMetadataPackage = (MetadataPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof MetadataPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new MetadataPackageImpl()); - - isInited = true; - - // Create package meta-data objects - theMetadataPackage.createPackageContents(); - - // Initialize created meta-data - theMetadataPackage.initializePackageContents(); - - // Mark meta-data to indicate it can't be changed - theMetadataPackage.freeze(); - - - // Update the registry and return the package - EPackage.Registry.INSTANCE.put(MetadataPackage.eNS_URI, theMetadataPackage); - return theMetadataPackage; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getTrait() { - return traitEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getTrait_Value() { - return (EReference)traitEClass.getEStructuralFeatures().get(1); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getTrait_SourceModelProvider() { - return (EAttribute)traitEClass.getEStructuralFeatures().get(2); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getIncludeEntityGroup() { - return includeEntityGroupEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getIncludeEntityGroup_Id() { - return (EAttribute)includeEntityGroupEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getIncludeEntityGroup_ModelUri() { - return (EAttribute)includeEntityGroupEClass.getEStructuralFeatures().get(1); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getTrait_Id() { - return (EAttribute)traitEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getModel() { - return modelEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getModel_SourceModelProvider() { - return (EAttribute)modelEClass.getEStructuralFeatures().get(1); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getModel_CurrentModelContext() { - return (EAttribute)modelEClass.getEStructuralFeatures().get(2); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getModel_EntityGroups() { - return (EReference)modelEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getEntity() { - return entityEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getEntity_ChildEntities() { - return (EReference)entityEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getEntity_Traits() { - return (EReference)entityEClass.getEStructuralFeatures().get(1); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getEntity_Id() { - return (EAttribute)entityEClass.getEStructuralFeatures().get(2); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getEntity_Type() { - return (EAttribute)entityEClass.getEStructuralFeatures().get(3); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getEntity_IncludeGroups() { - return (EReference)entityEClass.getEStructuralFeatures().get(4); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getEntityGroup() { - return entityGroupEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EDataType getITraitVisitor() { - return iTraitVisitorEDataType; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EDataType getIEntityVisitor() { - return iEntityVisitorEDataType; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EDataType getIMetaDataSourceModelProvider() { - return iMetaDataSourceModelProviderEDataType; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EDataType getModelContext() { - return modelContextEDataType; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public MetadataFactory getMetadataFactory() { - return (MetadataFactory)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 - modelEClass = createEClass(MODEL); - createEReference(modelEClass, MODEL__ENTITY_GROUPS); - createEAttribute(modelEClass, MODEL__SOURCE_MODEL_PROVIDER); - createEAttribute(modelEClass, MODEL__CURRENT_MODEL_CONTEXT); - - entityGroupEClass = createEClass(ENTITY_GROUP); - - entityEClass = createEClass(ENTITY); - createEReference(entityEClass, ENTITY__CHILD_ENTITIES); - createEReference(entityEClass, ENTITY__TRAITS); - createEAttribute(entityEClass, ENTITY__ID); - createEAttribute(entityEClass, ENTITY__TYPE); - createEReference(entityEClass, ENTITY__INCLUDE_GROUPS); - - includeEntityGroupEClass = createEClass(INCLUDE_ENTITY_GROUP); - createEAttribute(includeEntityGroupEClass, INCLUDE_ENTITY_GROUP__ID); - createEAttribute(includeEntityGroupEClass, INCLUDE_ENTITY_GROUP__MODEL_URI); - - traitEClass = createEClass(TRAIT); - createEAttribute(traitEClass, TRAIT__ID); - createEReference(traitEClass, TRAIT__VALUE); - createEAttribute(traitEClass, TRAIT__SOURCE_MODEL_PROVIDER); - - // Create data types - iTraitVisitorEDataType = createEDataType(ITRAIT_VISITOR); - iEntityVisitorEDataType = createEDataType(IENTITY_VISITOR); - iMetaDataSourceModelProviderEDataType = createEDataType(IMETA_DATA_SOURCE_MODEL_PROVIDER); - modelContextEDataType = createEDataType(MODEL_CONTEXT); - } - - /** - * <!-- 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 - modelEClass.getESuperTypes().add(this.getEntity()); - entityGroupEClass.getESuperTypes().add(this.getEntity()); - - // Initialize classes and features; add operations and parameters - initEClass(modelEClass, Model.class, "Model", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEReference(getModel_EntityGroups(), this.getEntityGroup(), null, "entityGroups", null, 0, -1, Model.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - getModel_EntityGroups().getEKeys().add(this.getEntity_Id()); - getModel_EntityGroups().getEKeys().add(this.getEntity_Type()); - initEAttribute(getModel_SourceModelProvider(), this.getIMetaDataSourceModelProvider(), "sourceModelProvider", null, 0, 1, Model.class, IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEAttribute(getModel_CurrentModelContext(), this.getModelContext(), "currentModelContext", null, 0, 1, Model.class, IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - - EOperation op = addEOperation(modelEClass, this.getEntityGroup(), "findIncludeGroup", 0, 1, IS_UNIQUE, IS_ORDERED); //$NON-NLS-1$ - addEParameter(op, ecorePackage.getEString(), "groupId", 0, 1, IS_UNIQUE, IS_ORDERED); //$NON-NLS-1$ - - op = addEOperation(modelEClass, null, "accept", 0, 1, IS_UNIQUE, IS_ORDERED); //$NON-NLS-1$ - addEParameter(op, this.getIEntityVisitor(), "visitor", 0, 1, IS_UNIQUE, IS_ORDERED); //$NON-NLS-1$ - - initEClass(entityGroupEClass, EntityGroup.class, "EntityGroup", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - - initEClass(entityEClass, Entity.class, "Entity", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEReference(getEntity_ChildEntities(), this.getEntity(), null, "childEntities", null, 0, -1, Entity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - getEntity_ChildEntities().getEKeys().add(this.getEntity_Id()); - getEntity_ChildEntities().getEKeys().add(this.getEntity_Type()); - initEReference(getEntity_Traits(), this.getTrait(), null, "traits", null, 0, -1, Entity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - getEntity_Traits().getEKeys().add(this.getTrait_Id()); - initEAttribute(getEntity_Id(), ecorePackage.getEString(), "id", null, 1, 1, Entity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEAttribute(getEntity_Type(), ecorePackage.getEString(), "type", null, 0, 1, Entity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEReference(getEntity_IncludeGroups(), this.getIncludeEntityGroup(), null, "includeGroups", null, 0, -1, Entity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - - op = addEOperation(entityEClass, null, "accept", 0, 1, IS_UNIQUE, IS_ORDERED); //$NON-NLS-1$ - addEParameter(op, this.getIEntityVisitor(), "visitor", 0, 1, IS_UNIQUE, IS_ORDERED); //$NON-NLS-1$ - - addEOperation(entityEClass, this.getModel(), "getModel", 0, 1, IS_UNIQUE, IS_ORDERED); //$NON-NLS-1$ - - initEClass(includeEntityGroupEClass, IncludeEntityGroup.class, "IncludeEntityGroup", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEAttribute(getIncludeEntityGroup_Id(), ecorePackage.getEString(), "id", null, 1, 1, IncludeEntityGroup.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEAttribute(getIncludeEntityGroup_ModelUri(), ecorePackage.getEString(), "modelUri", null, 0, 1, IncludeEntityGroup.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - - initEClass(traitEClass, Trait.class, "Trait", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEAttribute(getTrait_Id(), ecorePackage.getEString(), "id", null, 1, 1, Trait.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEReference(getTrait_Value(), ecorePackage.getEObject(), null, "value", null, 1, 1, Trait.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEAttribute(getTrait_SourceModelProvider(), this.getIMetaDataSourceModelProvider(), "sourceModelProvider", null, 0, 1, Trait.class, IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - - op = addEOperation(traitEClass, null, "accept", 0, 1, IS_UNIQUE, IS_ORDERED); //$NON-NLS-1$ - addEParameter(op, this.getITraitVisitor(), "visitor", 0, 1, IS_UNIQUE, IS_ORDERED); //$NON-NLS-1$ - - // Initialize data types - initEDataType(iTraitVisitorEDataType, ITraitVisitor.class, "ITraitVisitor", !IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEDataType(iEntityVisitorEDataType, IEntityVisitor.class, "IEntityVisitor", !IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEDataType(iMetaDataSourceModelProviderEDataType, IMetaDataSourceModelProvider.class, "IMetaDataSourceModelProvider", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEDataType(modelContextEDataType, ModelKeyDescriptor.class, "ModelContext", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - - // 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"; //$NON-NLS-1$ - addAnnotation - (modelEClass, - source, - new String[] { - "kind", "element", //$NON-NLS-1$ //$NON-NLS-2$ - "name", "metadatamodel" //$NON-NLS-1$ //$NON-NLS-2$ - }); - addAnnotation - (getModel_EntityGroups(), - source, - new String[] { - "kind", "element", //$NON-NLS-1$ //$NON-NLS-2$ - "name", "entityGroup" //$NON-NLS-1$ //$NON-NLS-2$ - }); - addAnnotation - (entityEClass, - source, - new String[] { - "kind", "element", //$NON-NLS-1$ //$NON-NLS-2$ - "name", "entity" //$NON-NLS-1$ //$NON-NLS-2$ - }); - addAnnotation - (getEntity_ChildEntities(), - source, - new String[] { - "kind", "element", //$NON-NLS-1$ //$NON-NLS-2$ - "name", "entity" //$NON-NLS-1$ //$NON-NLS-2$ - }); - addAnnotation - (getEntity_Traits(), - source, - new String[] { - "kind", "element", //$NON-NLS-1$ //$NON-NLS-2$ - "name", "trait" //$NON-NLS-1$ //$NON-NLS-2$ - }); - addAnnotation - (getEntity_IncludeGroups(), - source, - new String[] { - "kind", "element", //$NON-NLS-1$ //$NON-NLS-2$ - "name", "include-entity-group" //$NON-NLS-1$ //$NON-NLS-2$ - }); - addAnnotation - (getIncludeEntityGroup_ModelUri(), - source, - new String[] { - "name", "uri" //$NON-NLS-1$ //$NON-NLS-2$ - }); - addAnnotation - (traitEClass, - source, - new String[] { - "kind", "element", //$NON-NLS-1$ //$NON-NLS-2$ - "name", "trait" //$NON-NLS-1$ //$NON-NLS-2$ - }); - addAnnotation - (getTrait_Value(), - source, - new String[] { - "kind", "element" //$NON-NLS-1$ //$NON-NLS-2$ - }); - } - -} //MetadataPackageImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/impl/ModelImpl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/impl/ModelImpl.java deleted file mode 100644 index b7f78d906..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/impl/ModelImpl.java +++ /dev/null @@ -1,281 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: ModelImpl.java,v 1.10 2011/04/04 22:22:38 gkessler Exp $ - */ -package org.eclipse.jst.jsf.common.metadata.internal.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.util.EObjectContainmentEList; -import org.eclipse.emf.ecore.util.InternalEList; -import org.eclipse.jst.jsf.common.metadata.EntityGroup; -import org.eclipse.jst.jsf.common.metadata.MetadataPackage; -import org.eclipse.jst.jsf.common.metadata.Model; -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataSourceModelProvider; -import org.eclipse.jst.jsf.common.metadata.internal.ModelKeyDescriptor; -import org.eclipse.jst.jsf.common.metadata.query.IEntityVisitor; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Model</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.jst.jsf.common.metadata.internal.impl.ModelImpl#getEntityGroups <em>Entity Groups</em>}</li> - * <li>{@link org.eclipse.jst.jsf.common.metadata.internal.impl.ModelImpl#getSourceModelProvider <em>Source Model Provider</em>}</li> - * <li>{@link org.eclipse.jst.jsf.common.metadata.internal.impl.ModelImpl#getCurrentModelContext <em>Current Model Context</em>}</li> - * </ul> - * </p> - * - * @generated - */ -@SuppressWarnings("hiding") -public class ModelImpl extends EntityImpl implements Model { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - /** - * The cached value of the '{@link #getEntityGroups() <em>Entity Groups</em>}' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getEntityGroups() - * @generated - * @ordered - */ - protected EList<EntityGroup> entityGroups; - - /** - * The default value of the '{@link #getSourceModelProvider() <em>Source Model Provider</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getSourceModelProvider() - * @generated - * @ordered - */ - protected static final IMetaDataSourceModelProvider SOURCE_MODEL_PROVIDER_EDEFAULT = null; - - /** - * The default value of the '{@link #getCurrentModelContext() <em>Current Model Context</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getCurrentModelContext() - * @generated - * @ordered - */ - protected static final ModelKeyDescriptor CURRENT_MODEL_CONTEXT_EDEFAULT = null; - - private IMetaDataSourceModelProvider sourceModelProvider; - - private ModelKeyDescriptor _modelContext; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ModelImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() { - return MetadataPackage.Literals.MODEL; - } - - /** - * <!-- begin-user-doc --> - * May return null. - * <!-- end-user-doc --> - * @generated NOT - */ - public IMetaDataSourceModelProvider getSourceModelProvider() { - return sourceModelProvider; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - public void setSourceModelProvider(IMetaDataSourceModelProvider newSourceModelProvider) { - sourceModelProvider = newSourceModelProvider; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - public ModelKeyDescriptor getCurrentModelContext() { - return _modelContext; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - public void setCurrentModelContext(ModelKeyDescriptor newCurrentModelContext) { - _modelContext = newCurrentModelContext; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EList<EntityGroup> getEntityGroups() { - if (entityGroups == null) { - entityGroups = new EObjectContainmentEList<EntityGroup>(EntityGroup.class, this, MetadataPackage.MODEL__ENTITY_GROUPS); - } - return entityGroups; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case MetadataPackage.MODEL__ENTITY_GROUPS: - return getEntityGroups(); - case MetadataPackage.MODEL__SOURCE_MODEL_PROVIDER: - return getSourceModelProvider(); - case MetadataPackage.MODEL__CURRENT_MODEL_CONTEXT: - return getCurrentModelContext(); - } - 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 MetadataPackage.MODEL__ENTITY_GROUPS: - getEntityGroups().clear(); - getEntityGroups().addAll((Collection<? extends EntityGroup>)newValue); - return; - case MetadataPackage.MODEL__SOURCE_MODEL_PROVIDER: - setSourceModelProvider((IMetaDataSourceModelProvider)newValue); - return; - case MetadataPackage.MODEL__CURRENT_MODEL_CONTEXT: - setCurrentModelContext((ModelKeyDescriptor)newValue); - return; - } - super.eSet(featureID, newValue); - } - - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - public EntityGroup findIncludeGroup(String groupId){ - EntityGroup ret = null; - for (Iterator it=getEntityGroups().iterator();it.hasNext();){ - EntityGroup entityGroup = (EntityGroup)it.next(); - if (entityGroup.getId().equals(groupId)){ - ret = entityGroup; - break; - } - } - return ret; - } - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { - switch (featureID) { - case MetadataPackage.MODEL__ENTITY_GROUPS: - return ((InternalEList<?>)getEntityGroups()).basicRemove(otherEnd, msgs); - } - return super.eInverseRemove(otherEnd, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case MetadataPackage.MODEL__ENTITY_GROUPS: - getEntityGroups().clear(); - return; - case MetadataPackage.MODEL__SOURCE_MODEL_PROVIDER: - setSourceModelProvider(SOURCE_MODEL_PROVIDER_EDEFAULT); - return; - case MetadataPackage.MODEL__CURRENT_MODEL_CONTEXT: - setCurrentModelContext(CURRENT_MODEL_CONTEXT_EDEFAULT); - return; - } - super.eUnset(featureID); - } - /** - * <!-- begin-user-doc --> - * Due to a mistake in the EMF model, Model is not inheriting accept method from Entity. This should be fixed. - * <!-- end-user-doc --> - * @generated NOT - */ - - public void accept(IEntityVisitor visitor) { - super.accept(visitor); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - public Model getModel() { - return this; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case MetadataPackage.MODEL__ENTITY_GROUPS: - return entityGroups != null && !entityGroups.isEmpty(); - case MetadataPackage.MODEL__SOURCE_MODEL_PROVIDER: - return SOURCE_MODEL_PROVIDER_EDEFAULT == null ? getSourceModelProvider() != null : !SOURCE_MODEL_PROVIDER_EDEFAULT.equals(getSourceModelProvider()); - case MetadataPackage.MODEL__CURRENT_MODEL_CONTEXT: - return CURRENT_MODEL_CONTEXT_EDEFAULT == null ? getCurrentModelContext() != null : !CURRENT_MODEL_CONTEXT_EDEFAULT.equals(getCurrentModelContext()); - } - return super.eIsSet(featureID); - } - -} //ModelImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/impl/TraitImpl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/impl/TraitImpl.java deleted file mode 100644 index 33e546c3b..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/impl/TraitImpl.java +++ /dev/null @@ -1,339 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: TraitImpl.java,v 1.10 2011/03/16 21:14:13 gkessler Exp $ - */ -package org.eclipse.jst.jsf.common.metadata.internal.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.common.metadata.MetadataPackage; -import org.eclipse.jst.jsf.common.metadata.Trait; -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataSourceModelProvider; -import org.eclipse.jst.jsf.common.metadata.query.ITraitVisitor; - - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Trait</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.jst.jsf.common.metadata.internal.impl.TraitImpl#getId <em>Id</em>}</li> - * <li>{@link org.eclipse.jst.jsf.common.metadata.internal.impl.TraitImpl#getValue <em>Value</em>}</li> - * <li>{@link org.eclipse.jst.jsf.common.metadata.internal.impl.TraitImpl#getSourceModelProvider <em>Source Model Provider</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class TraitImpl extends EObjectImpl implements Trait { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - /** - * 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 cached value of the '{@link #getValue() <em>Value</em>}' containment reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getValue() - * @generated - * @ordered - */ - protected EObject value; - - /** - * The default value of the '{@link #getSourceModelProvider() <em>Source Model Provider</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getSourceModelProvider() - * @generated - * @ordered - */ - protected static final IMetaDataSourceModelProvider SOURCE_MODEL_PROVIDER_EDEFAULT = null; - - /** - * The cached value of the '{@link #getSourceModelProvider() <em>Source Model Provider</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getSourceModelProvider() - * @generated - * @ordered - */ - protected IMetaDataSourceModelProvider sourceModelProvider = SOURCE_MODEL_PROVIDER_EDEFAULT; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TraitImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() { - return MetadataPackage.Literals.TRAIT; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EObject getValue() { - return value; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param newValue - * @param msgs - * @return NotificationChain - * @generated - */ - public NotificationChain basicSetValue(EObject newValue, NotificationChain msgs) { - EObject oldValue = value; - value = newValue; - if (eNotificationRequired()) { - ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, MetadataPackage.TRAIT__VALUE, oldValue, newValue); - if (msgs == null) msgs = notification; else msgs.add(notification); - } - return msgs; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setValue(EObject newValue) { - if (newValue != value) { - NotificationChain msgs = null; - if (value != null) - msgs = ((InternalEObject)value).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - MetadataPackage.TRAIT__VALUE, null, msgs); - if (newValue != null) - msgs = ((InternalEObject)newValue).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - MetadataPackage.TRAIT__VALUE, null, msgs); - msgs = basicSetValue(newValue, msgs); - if (msgs != null) msgs.dispatch(); - } - else if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, MetadataPackage.TRAIT__VALUE, newValue, newValue)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public IMetaDataSourceModelProvider getSourceModelProvider() { - return sourceModelProvider; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setSourceModelProvider(IMetaDataSourceModelProvider newSourceModelProvider) { - IMetaDataSourceModelProvider oldSourceModelProvider = sourceModelProvider; - sourceModelProvider = newSourceModelProvider; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, MetadataPackage.TRAIT__SOURCE_MODEL_PROVIDER, oldSourceModelProvider, sourceModelProvider)); - } - - /** - * <!-- 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, MetadataPackage.TRAIT__ID, oldId, id)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - public void accept(ITraitVisitor visitor) { - visitor.visit(this); - visitor.visitCompleted(this); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { - switch (featureID) { - case MetadataPackage.TRAIT__VALUE: - return basicSetValue(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 MetadataPackage.TRAIT__ID: - return getId(); - case MetadataPackage.TRAIT__VALUE: - return getValue(); - case MetadataPackage.TRAIT__SOURCE_MODEL_PROVIDER: - return getSourceModelProvider(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case MetadataPackage.TRAIT__ID: - setId((String)newValue); - return; - case MetadataPackage.TRAIT__VALUE: - setValue((EObject)newValue); - return; - case MetadataPackage.TRAIT__SOURCE_MODEL_PROVIDER: - setSourceModelProvider((IMetaDataSourceModelProvider)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case MetadataPackage.TRAIT__ID: - setId(ID_EDEFAULT); - return; - case MetadataPackage.TRAIT__VALUE: - setValue((EObject)null); - return; - case MetadataPackage.TRAIT__SOURCE_MODEL_PROVIDER: - setSourceModelProvider(SOURCE_MODEL_PROVIDER_EDEFAULT); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case MetadataPackage.TRAIT__ID: - return ID_EDEFAULT == null ? id != null : !ID_EDEFAULT.equals(id); - case MetadataPackage.TRAIT__VALUE: - return value != null; - case MetadataPackage.TRAIT__SOURCE_MODEL_PROVIDER: - return SOURCE_MODEL_PROVIDER_EDEFAULT == null ? sourceModelProvider != null : !SOURCE_MODEL_PROVIDER_EDEFAULT.equals(sourceModelProvider); - } - 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(" (id: "); //$NON-NLS-1$ - result.append(id); - result.append(", sourceModelProvider: "); //$NON-NLS-1$ - result.append(sourceModelProvider); - result.append(')'); - return result.toString(); - } - - public boolean equals(Object value_){ - if (!(value_ instanceof String)) - return super.equals(value_); - - String key = (String)value_; - if (key.equals(getId())) - return true; - - return false; - } - - @Override - public int hashCode() - { - // try to match convention x.equals(y) => x.hashCode() == y.hashCode() - return getId() != null ? getId().hashCode() : 0xDEADBEEF; - } -} //TraitImpl
\ No newline at end of file diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/messages.properties b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/messages.properties deleted file mode 100644 index 5e9fd47a8..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/messages.properties +++ /dev/null @@ -1,13 +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 Corporation - initial API and implementation -############################################################################### - -MissingResource_exception=MissingResourceException for NLSPropertyValue: {0} -Key_not_found=(key not found) diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/util/MetadataAdapterFactory.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/util/MetadataAdapterFactory.java deleted file mode 100644 index 58ce7a24a..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/util/MetadataAdapterFactory.java +++ /dev/null @@ -1,208 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: MetadataAdapterFactory.java,v 1.6 2011/03/16 21:14:13 gkessler Exp $ - */ -package org.eclipse.jst.jsf.common.metadata.internal.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.common.metadata.Entity; -import org.eclipse.jst.jsf.common.metadata.EntityGroup; -import org.eclipse.jst.jsf.common.metadata.IncludeEntityGroup; -import org.eclipse.jst.jsf.common.metadata.MetadataPackage; -import org.eclipse.jst.jsf.common.metadata.Model; -import org.eclipse.jst.jsf.common.metadata.Trait; - - - -/** - * <!-- 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.common.metadata.MetadataPackage - * @generated - */ -public class MetadataAdapterFactory extends AdapterFactoryImpl { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - /** - * The cached model package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected static MetadataPackage modelPackage; - - /** - * Creates an instance of the adapter factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public MetadataAdapterFactory() { - if (modelPackage == null) { - modelPackage = MetadataPackage.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 MetadataSwitch<Adapter> modelSwitch = - new MetadataSwitch<Adapter>() { - @Override - public Adapter caseModel(Model object) { - return createModelAdapter(); - } - @Override - public Adapter caseEntityGroup(EntityGroup object) { - return createEntityGroupAdapter(); - } - @Override - public Adapter caseEntity(Entity object) { - return createEntityAdapter(); - } - @Override - public Adapter caseIncludeEntityGroup(IncludeEntityGroup object) { - return createIncludeEntityGroupAdapter(); - } - @Override - public Adapter caseTrait(Trait object) { - return createTraitAdapter(); - } - @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.common.metadata.Trait <em>Trait</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.common.metadata.Trait - * @generated - */ - public Adapter createTraitAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.common.metadata.IncludeEntityGroup <em>Include Entity Group</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.common.metadata.IncludeEntityGroup - * @generated - */ - public Adapter createIncludeEntityGroupAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.common.metadata.Model <em>Model</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.common.metadata.Model - * @generated - */ - public Adapter createModelAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.common.metadata.Entity <em>Entity</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.common.metadata.Entity - * @generated - */ - public Adapter createEntityAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.common.metadata.EntityGroup <em>Entity Group</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.common.metadata.EntityGroup - * @generated - */ - public Adapter createEntityGroupAdapter() { - 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; - } - -} //MetadataAdapterFactory diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/util/MetadataResourceFactoryImpl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/util/MetadataResourceFactoryImpl.java deleted file mode 100644 index 708b72f1e..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/util/MetadataResourceFactoryImpl.java +++ /dev/null @@ -1,59 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: MetadataResourceFactoryImpl.java,v 1.3 2008/11/18 22:24:36 gkessler Exp $ - */ -package org.eclipse.jst.jsf.common.metadata.internal.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.common.metadata.internal.util.MetadataResourceImpl - * @generated - */ -public class MetadataResourceFactoryImpl extends ResourceFactoryImpl { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - /** - * Creates an instance of the resource factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public MetadataResourceFactoryImpl() { - super(); - } - - /** - * Creates an instance of the resource. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - public Resource createResource(URI uri) { - XMLResource result = new MetadataResourceImpl(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; - } - -} //MetadataResourceFactoryImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/util/MetadataResourceImpl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/util/MetadataResourceImpl.java deleted file mode 100644 index 2db23d2b8..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/util/MetadataResourceImpl.java +++ /dev/null @@ -1,222 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: MetadataResourceImpl.java,v 1.12 2008/11/18 22:24:36 gkessler Exp $ - */ -package org.eclipse.jst.jsf.common.metadata.internal.util; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.xmi.PackageNotFoundException; -import org.eclipse.emf.ecore.xmi.XMLHelper; -import org.eclipse.emf.ecore.xmi.XMLLoad; -import org.eclipse.emf.ecore.xmi.XMLResource; -import org.eclipse.emf.ecore.xmi.impl.SAXXMLHandler; -import org.eclipse.emf.ecore.xmi.impl.XMLHelperImpl; -import org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl; -import org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; -import org.eclipse.jst.jsf.common.metadata.Entity; -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.metadata.internal.IMetaDataSourceModelProvider; -import org.xml.sax.helpers.DefaultHandler; - -/** - * <!-- begin-user-doc --> - * The <b>Resource </b> associated with the package. - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.internal.util.MetadataResourceFactoryImpl - * @generated NOT - */ -public class MetadataResourceImpl extends XMLResourceImpl implements XMLResource.ResourceHandler { - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Oracle inc."; //$NON-NLS-1$ - - /** - * IMetaDataSourceModelProvider - */ - protected IMetaDataSourceModelProvider _provider; - /** - * Creates an instance of the resource. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param uri the URI of the new resource. - * @generated - */ - public MetadataResourceImpl(URI uri) { - super(uri); - } - - /** - * Constructor - */ - public MetadataResourceImpl() { - super(); - } - - - /** - * Constructor - * @param provider - */ - public MetadataResourceImpl(IMetaDataSourceModelProvider provider){ - super(); - _provider = provider; - } - - /** - * @generated NOT - */ - protected XMLLoad createXMLLoad() { - return new MetadataXMLLoad(createXMLHelper()); - } - /** - * Override createXMLHelper so that MetadataPackage.eINSTANCE is used for the NoNamespace package - * @generated NOT - */ - protected XMLHelper createXMLHelper() { - return new XMLHelperImpl(){ - @Override - public EPackage getNoNamespacePackage() { - return MetadataPackage.eINSTANCE; - } - }; - } - - public void postLoad(XMLResource resource, InputStream inputStream, - Map options) - { - final List<EObject> resContents = resource.getContents(); - - if (resContents.size() > 0) - { - final Object aRoot = resContents.get(0); - if (aRoot instanceof Model) - { - setModelKeyInTraits((Model) aRoot, (Model) aRoot); - } - } - else - { - JSFCommonPlugin.log(IStatus.WARNING, - "No model loaded for "+getURI()); //$NON-NLS-1$ - } - } - - private void setModelKeyInTraits(Model root, Entity currentEntity) { - // TODO: does this have side effect that we care about? nothing is done with the return value - MetadataPackage.eINSTANCE.getTrait_SourceModelProvider(); - for (int i=0;i < currentEntity.getTraits().size();i++){ - ((Trait)currentEntity.getTraits().get(i)).setSourceModelProvider(_provider); - } - for (int j=0;j < currentEntity.getChildEntities().size();j++){ - setModelKeyInTraits(root,(Entity)currentEntity.getChildEntities().get(j)); - } - - if (currentEntity == root){ - for (int k=0;k < root.getEntityGroups().size();k++){ - setModelKeyInTraits(root,(Entity)root.getEntityGroups().get(k)); - } - } - } - - - public void postSave(XMLResource resource, OutputStream outputStream, - Map options) { - // do nothing - } - - public void preLoad(XMLResource resource, InputStream inputStream, - Map options) { - // do nothing - } - - public void preSave(XMLResource resource, OutputStream outputStream, - Map options) { - // do nothing - } - - /** - * Override the handleErrors() method so that resource will load gracefully, and errors reported later - * when appropriate - * - * @generated NOT - */ - private static class MetadataXMLLoad extends XMLLoadImpl { - - public MetadataXMLLoad(XMLHelper helper) { - super(helper); - } - - @Override - protected void handleErrors() throws IOException { - //by doing nothing here, this allows the list of non-fatal errors (res.getErrors()) to be returned - } - - @Override - protected DefaultHandler makeDefaultHandler() { - return new MetadataXMLHandler(resource, helper, options); - } - } - - /** - * Ensures that only EMF extension models registered with the EMF Package Registry are considered. - * @generated NOT - */ - private static class MetadataXMLHandler extends SAXXMLHandler { - - public MetadataXMLHandler(XMLResource xmiResource, XMLHelper helper, - Map<?, ?> options) { - super(xmiResource, helper, options); - } - - @Override - protected EPackage getPackageForURI(String uriString) { - //code taken from super and modified so that only package registry is considered - if (uriString == null) - { - return null; - } - - EPackage ePackage = packageRegistry.getEPackage(uriString); - - if (ePackage != null && ePackage.eIsProxy()) - { - ePackage = null; - } - - if (ePackage == null) - { - ePackage = handleMissingPackage(uriString); - } - - if (ePackage == null) - { - error - (new PackageNotFoundException - (uriString, - getLocation(), - getLineNumber(), - getColumnNumber())); - } - - return ePackage; - } - } -} //MetadataResourceImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/util/MetadataSwitch.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/util/MetadataSwitch.java deleted file mode 100644 index aa6204175..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/util/MetadataSwitch.java +++ /dev/null @@ -1,213 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: MetadataSwitch.java,v 1.9 2011/04/04 22:22:38 gkessler Exp $ - */ -package org.eclipse.jst.jsf.common.metadata.internal.util; - - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.util.Switch; -import org.eclipse.jst.jsf.common.metadata.Entity; -import org.eclipse.jst.jsf.common.metadata.EntityGroup; -import org.eclipse.jst.jsf.common.metadata.IncludeEntityGroup; -import org.eclipse.jst.jsf.common.metadata.MetadataPackage; -import org.eclipse.jst.jsf.common.metadata.Model; -import org.eclipse.jst.jsf.common.metadata.Trait; - - - -/** - * <!-- 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.common.metadata.MetadataPackage - * @generated - */ -public class MetadataSwitch<T> extends Switch<T> { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - /** - * The cached model package - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected static MetadataPackage modelPackage; - - /** - * Creates an instance of the switch. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public MetadataSwitch() { - if (modelPackage == null) { - modelPackage = MetadataPackage.eINSTANCE; - } - } - - /** - * Checks whether this is a switch for the given package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @parameter ePackage the package in question. - * @return whether this is a switch for the given package. - * @generated - */ - @Override - protected boolean isSwitchFor(EPackage ePackage) { - return ePackage == modelPackage; - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - @Override - protected T doSwitch(int classifierID, EObject theEObject) { - switch (classifierID) { - case MetadataPackage.MODEL: { - Model model = (Model)theEObject; - T result = caseModel(model); - if (result == null) result = caseEntity(model); - if (result == null) result = defaultCase(theEObject); - return result; - } - case MetadataPackage.ENTITY_GROUP: { - EntityGroup entityGroup = (EntityGroup)theEObject; - T result = caseEntityGroup(entityGroup); - if (result == null) result = caseEntity(entityGroup); - if (result == null) result = defaultCase(theEObject); - return result; - } - case MetadataPackage.ENTITY: { - Entity entity = (Entity)theEObject; - T result = caseEntity(entity); - if (result == null) result = defaultCase(theEObject); - return result; - } - case MetadataPackage.INCLUDE_ENTITY_GROUP: { - IncludeEntityGroup includeEntityGroup = (IncludeEntityGroup)theEObject; - T result = caseIncludeEntityGroup(includeEntityGroup); - if (result == null) result = defaultCase(theEObject); - return result; - } - case MetadataPackage.TRAIT: { - Trait trait = (Trait)theEObject; - T result = caseTrait(trait); - if (result == null) result = defaultCase(theEObject); - return result; - } - default: return defaultCase(theEObject); - } - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Trait</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>Trait</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseTrait(Trait object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Include Entity Group</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>Include Entity Group</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseIncludeEntityGroup(IncludeEntityGroup object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Model</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>Model</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseModel(Model object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Entity</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>Entity</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseEntity(Entity object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Entity Group</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>Entity Group</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseEntityGroup(EntityGroup 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 - */ - @Override - public T defaultCase(EObject object) { - return null; - } - -} //MetadataSwitch diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/util/MetadataXMLProcessor.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/util/MetadataXMLProcessor.java deleted file mode 100644 index cc5fdbb33..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/util/MetadataXMLProcessor.java +++ /dev/null @@ -1,59 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: MetadataXMLProcessor.java,v 1.5 2011/03/16 21:14:13 gkessler Exp $ - */ -package org.eclipse.jst.jsf.common.metadata.internal.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.common.metadata.MetadataPackage; - - -/** - * This class contains helper methods to serialize and deserialize XML documents - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -public class MetadataXMLProcessor extends XMLProcessor { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - - /** - * Public constructor to instantiate the helper. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public MetadataXMLProcessor() { - super((EPackage.Registry.INSTANCE)); - MetadataPackage.eINSTANCE.eClass(); - } - - /** - * Register for "*" and "xml" file extensions the MetadataResourceFactoryImpl 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 MetadataResourceFactoryImpl()); - registrations.put(STAR_EXTENSION, new MetadataResourceFactoryImpl()); - } - return registrations; - } - -} //MetadataXMLProcessor diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/package-info.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/package-info.java deleted file mode 100644 index 836883f01..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/package-info.java +++ /dev/null @@ -1,17 +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 - * - ********************************************************************************/ - -/** - * EMF interface objects for design-time metadata. - * <p><b>Provisional API - subject to change</b></p> - */ -package org.eclipse.jst.jsf.common.metadata; diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/AbstractEntityQueryVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/AbstractEntityQueryVisitor.java deleted file mode 100644 index fd3d6ff9d..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/AbstractEntityQueryVisitor.java +++ /dev/null @@ -1,47 +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.common.metadata.query; - -import org.eclipse.jst.jsf.common.metadata.Entity; - -/** - * Abstract class implementing {@link IEntityQueryVisitor} that concrete subclasses should provide implementations - * <p><b>Provisional API - subject to change</b></p> - */ -public abstract class AbstractEntityQueryVisitor extends AbstractEntityVisitor - implements IEntityQueryVisitor { - - private String _delimiter = "/"; //$NON-NLS-1$ - - /** - * @return EmptyResultSet. Subclasses should override. - */ - public IResultSet<Entity> findEntities(final Entity initialEntityContext, final String entityKey) { - return new EmptyResultSet(); - } - - /** - * @return String delimiting levels in the hierarchy. Defaults to "/" - */ - protected String getLevelDelimiter() { - return _delimiter; - } - - /** - * Sets the string used to delimit the levels in an entityKey - * @param delimiter - */ - protected void setLevelDelimiter(final String delimiter) { - _delimiter = delimiter; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/AbstractEntityVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/AbstractEntityVisitor.java deleted file mode 100644 index 54e6f0165..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/AbstractEntityVisitor.java +++ /dev/null @@ -1,30 +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.common.metadata.query; - -import org.eclipse.jst.jsf.common.metadata.Entity; - -/** - * Abstract implementation that concrete subclasses should ovveride - * <p><b>Provisional API - subject to change</b></p> - */ -public abstract class AbstractEntityVisitor extends AbstractMetaDataVisitor - implements IEntityVisitor { - - public abstract void visit(Entity entity); - - public void visitCompleted(Entity entity){ - //subclasses should override if needed - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/AbstractMetaDataVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/AbstractMetaDataVisitor.java deleted file mode 100644 index 15443e5d5..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/AbstractMetaDataVisitor.java +++ /dev/null @@ -1,28 +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.common.metadata.query; - -/** - * Abstract class implementing {@link IMetaDataVisitor} - * <p><b>Provisional API - subject to change</b></p> - */ -public abstract class AbstractMetaDataVisitor implements IMetaDataVisitor { - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.query.IMetaDataVisitor#stopVisiting() - */ - public boolean stopVisiting() { - return false; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/AbstractResultSet.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/AbstractResultSet.java deleted file mode 100644 index 4c795b12c..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/AbstractResultSet.java +++ /dev/null @@ -1,69 +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.common.metadata.query; - -import java.util.Collections; -import java.util.List; - -/** - * Abstract implementation of {@link IResultSet} that developers may subclass. - * Users should assume that the results are only valid at the time of the query. This may change in the future. - * <p><b>Provisional API - subject to change</b></p> - * @param <T> - */ -public abstract class AbstractResultSet<T> implements IResultSet<T> { - private List _results; - private boolean _isClosed = false; - - public List<T> getResults() throws MetaDataException { - initIfNecessary(); - return _results; - } - - public final void close() throws MetaDataException { - doClose(); - _isClosed = true; - _results = null; - } - - /** - * Overridable method to close resultset. This is called by close() - * @throws MetaDataException - */ - protected void doClose() throws MetaDataException { - //subclasses to provide override - } - - public final boolean isClosed() { - return _isClosed; - } - - /** - * @return List of results. Null is tolerated. - */ - protected abstract List<T> getInternalResults(); - - private void initIfNecessary() throws MetaDataException { - if (_isClosed) - throw new MetaDataException("Attempt to access a closed resultset."); //$NON-NLS-1$ - - if (_results == null) { - List<T> checkNullResults = getInternalResults(); - if (checkNullResults == null){ - checkNullResults = Collections.EMPTY_LIST; - } - _results = Collections.unmodifiableList(checkNullResults); - } - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/AbstractTraitQueryVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/AbstractTraitQueryVisitor.java deleted file mode 100644 index 2a6e35aac..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/AbstractTraitQueryVisitor.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.common.metadata.query; - -import org.eclipse.jst.jsf.common.metadata.Entity; - -/** - * Abstract implmentation of {@link ITraitQueryVisitor} that subclasses should use to provide implementation - * <p><b>Provisional API - subject to change</b></p> - */ -public abstract class AbstractTraitQueryVisitor extends AbstractTraitVisitor implements - ITraitQueryVisitor { - - /** - * @return EmptyResultSet. Subclasses should override. - */ - public IResultSet findTraits(Entity entity, String traitKey) { - return new EmptyResultSet(); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/AbstractTraitVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/AbstractTraitVisitor.java deleted file mode 100644 index 795a473e1..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/AbstractTraitVisitor.java +++ /dev/null @@ -1,29 +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.common.metadata.query; - -import org.eclipse.jst.jsf.common.metadata.Trait; - -/** - * Abstract Trait visitor - * <p><b>Provisional API - subject to change</b></p> - */ -public abstract class AbstractTraitVisitor extends AbstractMetaDataVisitor implements ITraitVisitor{ - - public abstract void visit(final Trait trait); - - public void visitCompleted(final Trait trait) { - //subclasses should override if needed - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/EmptyResultSet.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/EmptyResultSet.java deleted file mode 100644 index 26a1c7653..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/EmptyResultSet.java +++ /dev/null @@ -1,39 +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.common.metadata.query; - -import java.util.Collections; -import java.util.List; - -/** - * Implementation of an empty result set - * <p><b>Provisional API - subject to change</b></p> - */ -public final class EmptyResultSet implements IResultSet { - private boolean _isClosed = false; - public void close() { - _isClosed = true; - } - - public List getResults() throws MetaDataException{ - if (_isClosed) - throw new MetaDataException("Resultset is closed"); //$NON-NLS-1$ - - return Collections.EMPTY_LIST; - } - - public boolean isClosed() { - return _isClosed; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/IEntityQueryVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/IEntityQueryVisitor.java deleted file mode 100644 index d5a2780d2..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/IEntityQueryVisitor.java +++ /dev/null @@ -1,30 +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.common.metadata.query; - -import org.eclipse.jst.jsf.common.metadata.Entity; - -/** - * Entity querying interface - * <p>NOT to implemented by clients directly. Clients should subclass AbstractEntityQueryVisitor instead. - * <p><b>Provisional API - subject to change</b></p> - */ -public interface IEntityQueryVisitor extends IEntityVisitor{ - /** - * @param initialEntityContext - * @param entityKey to find relative to the passed intialEntityContext - * @return IResultSet of Entities matching the key. IResultSet must NOT be null. Implementers may return {@link EmptyResultSet}. - */ - public IResultSet<Entity> findEntities(final Entity initialEntityContext, - final String entityKey); - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/IEntityVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/IEntityVisitor.java deleted file mode 100644 index fcc178381..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/IEntityVisitor.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.common.metadata.query; - -import org.eclipse.jst.jsf.common.metadata.Entity; - -/** - * Visitor interface for Entities - * <p>NOT to implemented by clients directly. Clients should subclass AbstractEntityVisitor instead. - * <p><b>Provisional API - subject to change</b></p> - */ -public interface IEntityVisitor extends IMetaDataVisitor { - /** - * Visit the entity. - * The entity and then it's children are visited - * @param entity - must not be NULL - */ - public void visit(final Entity entity); - /** - * Signal that the entity and all it's children is now completely 'visited'. - * The entity will call this method at the end of the accept method. - * @param entity - must not be NULL - */ - public void visitCompleted(Entity entity); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/IMetaDataModelContext.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/IMetaDataModelContext.java deleted file mode 100644 index 3ffb57496..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/IMetaDataModelContext.java +++ /dev/null @@ -1,26 +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.common.metadata.query; - -import org.eclipse.jst.jsf.context.IModelContext; - -/** - * <p><b>Provisional API - subject to change</b></p> - * @deprecated - Helios - */ -public interface IMetaDataModelContext extends IModelContext { - /** - * @return domain identifier for this context. - * <p>This must match the domain id from the org.eclipse.jst.jsf.common.DomainLoadingStrategies - */ - public String getDomainID(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/IMetaDataVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/IMetaDataVisitor.java deleted file mode 100644 index 35a3652a3..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/IMetaDataVisitor.java +++ /dev/null @@ -1,24 +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.common.metadata.query; - -/** - * Common interface for Entity and Trait visitors - * <p>NOT to implemented by clients directly. Clients should subclass AbstractMetaDataVisitor instead. - * <p><b>Provisional API - subject to change</b></p> - */ -public interface IMetaDataVisitor { - /** - * @return true if visitor has recognized that visiting should stop - */ - public boolean stopVisiting(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/IResultSet.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/IResultSet.java deleted file mode 100644 index 591fdd75d..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/IResultSet.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: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.query; - -import java.util.List; - - - -/** - * Results from a metadata query. The resultset should be considered valid only at the time that the query is performed. - * Once "closed", the resultset should not be accessed again. - * - * <p>Not intended to be implemented directly by clients. Developers should extend {@link AbstractResultSet} instead. - * <p><b>Provisional API - subject to change</b></p> - * @param <T> - */ -public interface IResultSet<T> { - - /** - * @return unmodifiable List of results. May NOT be null. Implementer must return Collections.EMPTY_LIST instead. - * @throws MetaDataException - */ - public List<T> getResults() throws MetaDataException; - - /** - * Signal that the query results are no longer required allowing for any cleanup that may be required - * Once a resultset is closed, a MetaDataException should be thrown if the next() or hasNext() is called. Clients can check isClosed() first. - * @throws MetaDataException - */ - public void close() throws MetaDataException; - - /** - * @return true if this resultset has been closed. - */ - public boolean isClosed(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/ITaglibDomainMetaDataModelContext.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/ITaglibDomainMetaDataModelContext.java deleted file mode 100644 index f5962e749..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/ITaglibDomainMetaDataModelContext.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.common.metadata.query; - -import org.eclipse.core.resources.IProject; - -/** - * Context for determining the Model to locate in the MetaDataManager - * <p>Should NOT be implemented by clients - * <p><b>Provisional API - subject to change</b></p> - * @deprecated - Helios - */ -public interface ITaglibDomainMetaDataModelContext extends IMetaDataModelContext { - /** - * @return project - */ - public IProject getProject(); - /** - * @return the namespace URI as String - */ - public String getURI(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/ITraitQueryVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/ITraitQueryVisitor.java deleted file mode 100644 index a8631f97b..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/ITraitQueryVisitor.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.common.metadata.query; - -import org.eclipse.jst.jsf.common.metadata.Entity; -import org.eclipse.jst.jsf.common.metadata.Trait; - -/** - * Trait querying interface - * <p>NOT to implemented by clients directly. Clients should subclass AbstractTraitQueryVisitor instead. - * <p><b>Provisional API - subject to change</b></p> - */ -public interface ITraitQueryVisitor extends ITraitVisitor{ - /** - * @param entity - * @param traitKey - * @return IResultSet of Traits. IResultSet must NOT be null. Implementers may return {@link EmptyResultSet}. - */ - public IResultSet<Trait> findTraits(final Entity entity, - final String traitKey); - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/ITraitVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/ITraitVisitor.java deleted file mode 100644 index 9b39a101d..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/ITraitVisitor.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.common.metadata.query; - -import org.eclipse.jst.jsf.common.metadata.Trait; - -/** - * Visitor interface for Traits - * <p>NOT to implemented by clients directly. Clients should subclass AbstractTraitVisitor instead. - * <p><b>Provisional API - subject to change</b></p> - */ -public interface ITraitVisitor extends IMetaDataVisitor { - /** - * Visit the Trait. - * Implementer cannot assume ordering of trait visiting. - * @param trait - must not be null - */ - public void visit(final Trait trait); - - /** - * Signal that the the trait has been completely visited - * @param trait - */ - public void visitCompleted(final Trait trait); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/MetaDataException.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/MetaDataException.java deleted file mode 100644 index 50b314fbe..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/MetaDataException.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.common.metadata.query; - -/** - * Exception intended to be superclass of all exceptions thrown while handling metadata during query - * <p><b>Provisional API - subject to change</b></p> - */ -public class MetaDataException extends Exception { - - /** - * - */ - private static final long serialVersionUID = 1L; - - /** - * Constructor - */ - public MetaDataException(){ - super(); - } - /** - * Constructor - * @param msg - */ - public MetaDataException(String msg){ - super(msg); - } - - /** - * Constructor - * @param msg - * @param cause - */ - public MetaDataException(String msg, Throwable cause){ - super(msg, cause); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/TaglibDomainMetaDataQueryHelper.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/TaglibDomainMetaDataQueryHelper.java deleted file mode 100644 index 16e579f82..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/TaglibDomainMetaDataQueryHelper.java +++ /dev/null @@ -1,270 +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.common.metadata.query; - -import javax.xml.namespace.QName; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.Assert; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; -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.IMetaDataModelContext; -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataModelManager; -import org.eclipse.jst.jsf.common.metadata.internal.MetaDataModelManagerFactory; -import org.eclipse.jst.jsf.common.metadata.internal.ModelKeyDescriptor; -import org.eclipse.jst.jsf.common.metadata.internal.TaglibDomainMetaDataModelContextImpl; -import org.eclipse.jst.jsf.common.metadata.query.internal.HierarchicalSearchControl; -import org.eclipse.jst.jsf.common.metadata.query.internal.SimpleEntityQueryVisitorImpl; -import org.eclipse.jst.jsf.common.metadata.query.internal.SimpleTraitQueryVisitorImpl; - - -/** - * Helper class with static methods to simplify querying of a metadata model. - * - * <p>Steps for use: - * <br>1) Get the ITaglibDomainMetaDataModelContext using createMetaDataModelContext or createTagLibraryDomainMetaDataModelContext - * <br>2) Use appropriate getXXX methods using the ITaglibDomainMetaDataModelContext. - * <p><b>Provisional API - subject to change</b></p> - * - * @deprecated - Helios <p> - * use ITaglibMetaDataQuery:<p> - * <code> - * IMetaDataDomainContext context = MetaDataQueryContextFactory.getInstance().createTaglibDomainModelContext(project);<br/> - * ITaglibMetaDataQuery query = MetaDataQueryFactory.getInstance().createQuery(context); - * </code> - * <p> - * @see IResultSet - * @see IEntityQueryVisitor - * @see ITraitQueryVisitor - * @see ITaglibDomainMetaDataModelContext - * @see Model - * @see Entity - * @see Trait - * - - */ -public final class TaglibDomainMetaDataQueryHelper{ - /** - * Domain id for Tag library domain of metatdata - */ - public static final String TAGLIB_DOMAIN = "TagLibraryDomain"; //need better place for this //$NON-NLS-1$ - - /** - * private constructor - */ - private TaglibDomainMetaDataQueryHelper (){ - super(); - } - - /** - * Convenience method for creating {@link ITaglibDomainMetaDataModelContext}s for TAGLIB_DOMAIN - * @param project - * @param uri - * @return ITaglibDomainMetaDataModelContext - */ - public static ITaglibDomainMetaDataModelContext createMetaDataModelContext(IProject project, String uri){ - return new TaglibDomainMetaDataModelContextImpl(TAGLIB_DOMAIN, project, uri); - } - /** - * @param modelContext - * @return Model object for given context. May return null if not located. - */ - public static Model getModel(final ITaglibDomainMetaDataModelContext modelContext) { -// MetaDataModel model = getMDModel(modelContext); -// //we may want to throw error that model is empty -// if (model != null && !model.isEmpty()){ -// return (Model)model.getRoot(); -// } - return getMDModel(modelContext); - } - - /** - * @param modelContext - * @param entityKey relative to root of the model - * @return the first entity match from the root of the model. May return null. - */ - public static Entity getEntity(final ITaglibDomainMetaDataModelContext modelContext, - final String entityKey) { - IEntityQueryVisitor visitor = new SimpleEntityQueryVisitorImpl(new HierarchicalSearchControl(1, HierarchicalSearchControl.SCOPE_ALL_LEVELS)); - IResultSet/*<Entity>*/ rs = getEntities(modelContext,entityKey, visitor); - Entity e = null; - try { - if (! rs.getResults().isEmpty()){ - e = (Entity)rs.getResults().get(0); - } - rs.close(); - } catch (MetaDataException ex) { - JSFCommonPlugin.log(IStatus.ERROR, "Error in Helper.getEntity() - 1", ex); //$NON-NLS-1$ - } - - return e; - } - - /** - * @param modelContext - * @param entityKey relative to root of model - * @param visitor - * @return an IResultSet of entity objects - */ - public static IResultSet/*<Entity>*/ getEntities(final ITaglibDomainMetaDataModelContext modelContext, - final String entityKey, final IEntityQueryVisitor visitor){ - Model model = getModel(modelContext); - //we may want to throw error that model is empty - return getEntities(model, entityKey, visitor); - - } - - /** - * @param entity - * @param traitKey - * @return a trait or null for the given entity and traitKey using a SimpleEntityQueryVisitorImpl - */ - public static Trait getTrait(final Entity entity, final String traitKey){ - ITraitQueryVisitor visitor = new SimpleTraitQueryVisitorImpl(); - Trait t= null; - IResultSet/*<Trait>*/ rs = getTraits(entity, traitKey, visitor); - try { - if (! rs.getResults().isEmpty()){ - t = (Trait)rs.getResults().get(0); - } - rs.close(); - } catch (MetaDataException ex) { - JSFCommonPlugin.log(IStatus.ERROR, "Error in Helper.getTrait()", ex); //$NON-NLS-1$ - } - - return t; - } - - /** - * @param entity - * @param traitKey - * @param traitQueryVisitor - * @return an IResultSet of trait objects using supplied traitQueryVisitor. IResultSet should NOT be null. - */ - public static IResultSet/*<Trait>*/ getTraits(Entity entity, String traitKey, - ITraitQueryVisitor traitQueryVisitor) { - IResultSet/*<Trait>*/ rs = traitQueryVisitor.findTraits(entity, traitKey); - return rs; - } - - /** - * @param initialEntityContext - * @param entityKey relative to initial passed entity - * @return the first entity located by key using SimpleEntityQueryVisitorImpl - */ - public static Entity getEntity(Entity initialEntityContext, String entityKey) { - IEntityQueryVisitor visitor = new SimpleEntityQueryVisitorImpl(new HierarchicalSearchControl(1, HierarchicalSearchControl.SCOPE_ALL_LEVELS)); - Entity e= null; - IResultSet/*<Entity>*/ rs = getEntities(initialEntityContext, entityKey, visitor); - try { - if (! rs.getResults().isEmpty()){ - e = (Entity)rs.getResults().get(0); - } - rs.close(); - } catch (MetaDataException ex) { - JSFCommonPlugin.log(IStatus.ERROR, "Error in Helper.getEntity() - 0", ex); //$NON-NLS-1$ - } - - return e; - } - - /** - * @param initialEntityContext - * @param entityQuery relative to initial passed entity - * @param entityKeyQueryVisitor - * @return IResultSet of entities located by key using entityQueryVisitor. IResultSet should NOT be null. - */ - public static IResultSet/*<Entity>*/ getEntities(Entity initialEntityContext, String entityQuery, - IEntityQueryVisitor entityKeyQueryVisitor) { - - return entityKeyQueryVisitor.findEntities(initialEntityContext, entityQuery); - } - - - /** - * Retrieve the MetaDataModel from the ModelManager for given key - * @param modelContext - * @return Model - */ - private static Model getMDModel(final ITaglibDomainMetaDataModelContext modelContext){ - final IMetaDataModelContext context = getContextAdapter(modelContext); - final IMetaDataModelManager mgr = MetaDataModelManagerFactory.getMetaDataModelManagerInstance(modelContext.getProject()); - if (mgr != null) - return mgr.getModel(context); - -// MetaDataModelManager mgr = null; -// if (modelContext.getProject() != null) -// mgr = MetaDataModelManager.getInstance(modelContext.getProject()); -// else //temp(?) -// mgr = MetaDataModelManager.getSharedInstance(); -// -// if (mgr != null) -// return mgr.getModel(modelContext); - - return null; - } - - private static IMetaDataModelContext getContextAdapter( - final ITaglibDomainMetaDataModelContext modelContext) { - return new IMetaDataModelContext() { - - public Object getAdapter(Class adapter) { - if (adapter == IProject.class) - return getProject(); - else if (adapter == ModelKeyDescriptor.class) - return new ModelKeyDescriptor(modelContext.getProject(), modelContext.getDomainID(), modelContext.getURI()); - return null; - } - - public String getDomainId() { - return modelContext.getDomainID(); - } - - public IProject getProject() { - return modelContext.getProject(); - } - - public String getModelIdentifier() { - //doing below for "fixing" the jsp11 uri - return ((ModelKeyDescriptor)getAdapter(ModelKeyDescriptor.class)).getUri(); - } - }; - } - - /** - * @param modelContext - * @param entityKey - * @param traitKey - * @return first trait found for entity and trait key starting from root of the model using SimpleMetaDataQueryImpl - */ - public static Trait getTrait(final ITaglibDomainMetaDataModelContext modelContext, - final String entityKey, final String traitKey) { - Entity entity = getEntity(modelContext, entityKey); - Trait t = null; - if (entity != null){ - t = getTrait(entity, traitKey); - } - return t; - } - - /** - * @param tagEntity - * @return QName for tag entity - */ - public static QName getQNameForTagEntity(Entity tagEntity) { - Assert.isTrue(tagEntity != null); - return new QName(tagEntity.getModel().getCurrentModelContext().getUri(), tagEntity.getId()); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/AbstractMetaDataDomainQueryFactory.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/AbstractMetaDataDomainQueryFactory.java deleted file mode 100644 index 630846a40..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/AbstractMetaDataDomainQueryFactory.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 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 and/or initial documentation - *******************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query.internal; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataDomainContext; -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataDomainQueryFactory; -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataModelManager; -import org.eclipse.jst.jsf.common.metadata.internal.MetaDataModelManagerFactory; - -/** - * Abstract query factory for a domain of metadata that all implementers of - * {@link IMetaDataDomainQueryFactory} must extend - * - */ -public abstract class AbstractMetaDataDomainQueryFactory implements - IMetaDataDomainQueryFactory { - - private final String _domainId; - - /** - * Constructor - * @param domainId - */ - public AbstractMetaDataDomainQueryFactory(final String domainId) { - _domainId = domainId; - } - - public final String getDomainIdentifier() { - return _domainId; - } - - /** - * @param context - * @return IMetaDataModelManager - */ - protected IMetaDataModelManager getManager(final IMetaDataDomainContext context) { - final IProject project = (IProject) context.getAdapter(IProject.class); - return MetaDataModelManagerFactory.getMetaDataModelManagerInstance(project); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/AbstractMetaDataQuery.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/AbstractMetaDataQuery.java deleted file mode 100644 index 32f8ca4db..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/AbstractMetaDataQuery.java +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 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 and/or initial documentation - *******************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query.internal; - -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataDomainContext; -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataModelManager; - - -/** - * Abstract {@link IMetaDataQuery} that all implementers must extend. - * <p> - * Provides a default {@link IMetaDataQueryHelper} that can be overridden. - */ -public abstract class AbstractMetaDataQuery implements IMetaDataQuery{ - - private final IMetaDataModelManager _manager; - private final IMetaDataDomainContext _managerContext; - private IMetaDataQueryHelper _helper; - - /** - * @param manager - * @param managerContext - */ - public AbstractMetaDataQuery(final IMetaDataModelManager manager, final IMetaDataDomainContext managerContext) { - _manager = manager; - _managerContext = managerContext; - } - - public IMetaDataQueryHelper getQueryHelper() { - if (_helper == null) { - _helper = new MetaDataQueryHelper(getManager(), getDomainContext()); - } - return _helper; - } - - public void setQueryHelper(final IMetaDataQueryHelper helper) { - _helper = helper; - } - - /** - * NOT API - * @return IMetaDataModelManager - */ - public final IMetaDataModelManager getManager() { - return _manager; - } - - /** - * NOT API - * @return IMetaDataModelManagerContext - */ - public final IMetaDataDomainContext getDomainContext() { - return _managerContext; - } - - /** - * Convenience method - * @return domain id - */ - protected final String getDomainId() { - return getDomainContext().getDomainId(); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/HierarchicalSearchControl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/HierarchicalSearchControl.java deleted file mode 100644 index 36d446e56..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/HierarchicalSearchControl.java +++ /dev/null @@ -1,65 +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.common.metadata.query.internal; - -/** - * Sets controls on how a tree of nodes can be searched - */ -public class HierarchicalSearchControl extends SearchControl { - //scope levels - /** - * Do not recurse. - */ - public static final int SCOPE_CURRENT_LEVEL = 0; - /** - * Allow for one level of children to be visited from initial context - */ - public static final int SCOPE_ONE_LEVEL = 1; - /** - * Allow unlimited recursion of children - */ - public static final int SCOPE_ALL_LEVELS = 2; - - private int scope = SCOPE_ALL_LEVELS; - - /** - * Constructor using defaults of COUNT_LIMIT_NONE and SCOPE_ALL_LEVELS - */ - public HierarchicalSearchControl(){ - super(); - } - /** - * Constructor - * @param countLimit - * @param scope - */ - public HierarchicalSearchControl(int countLimit, int scope){ - super(countLimit); - this.scope = scope; - } - - - /** - * @param scope - */ - public void setScope(int scope){ - this.scope= scope; - } - - /** - * @return scope - */ - public int getScope(){ - return scope; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/IEntityPredicateMatcher.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/IEntityPredicateMatcher.java deleted file mode 100644 index 2271e7ab7..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/IEntityPredicateMatcher.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 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 and/or initial documentation - *******************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query.internal; - -import org.eclipse.jst.jsf.common.metadata.Entity; - -/** - * Matches entities - */ -public interface IEntityPredicateMatcher extends IPredicateMatcher<Entity> { - /** - * Signals to matcher that you are moving down the hierarchy by one - */ - public void pushLevel(); - /** - * Signals to matcher that you are moving up the hierarchy by one - */ - public void popLevel(); - - /** - * @return the deepest level in the hierarchy that is being matched - */ - public int getMaxLevel(); - - /** - * @return current level being matched in the hierarchy - */ - public int getCurrentLevel(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/IHierarchicalEntityVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/IHierarchicalEntityVisitor.java deleted file mode 100644 index b91fd9e42..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/IHierarchicalEntityVisitor.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.eclipse.jst.jsf.common.metadata.query.internal; - -import org.eclipse.jst.jsf.common.metadata.Entity; -import org.eclipse.jst.jsf.common.metadata.query.IEntityVisitor; - -/** - * Provides the necessary hierarchical visitor interface methods to - * provide conditional navigation of the entity hierarchy - * - */ -public interface IHierarchicalEntityVisitor extends IEntityVisitor { - /** - * @param entity - * @return true if children should be traversed - */ - boolean visitEnter(Entity entity); - /** - * @param entity - * @return true when coming out of a branch - */ - boolean visitLeave(Entity entity); - - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/IMetaDataModelManagerContext.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/IMetaDataModelManagerContext.java deleted file mode 100644 index 737625e9e..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/IMetaDataModelManagerContext.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.eclipse.jst.jsf.common.metadata.query.internal; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataDomainContext; - -/** - * Context for the meta data model manager - * - */ -public interface IMetaDataModelManagerContext extends IMetaDataDomainContext { - /** - * @return project - may be null - */ - public IProject getProject(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/IMetaDataQuery.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/IMetaDataQuery.java deleted file mode 100644 index b650613c7..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/IMetaDataQuery.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 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 and/or initial documentation - *******************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query.internal; - -/** - * Interface to be used when querying metadata - * <p> - * @noextend - * @noimplement - */ -public interface IMetaDataQuery { - /** - * @return {@link IMetaDataQueryHelper} - */ - public IMetaDataQueryHelper getQueryHelper(); - - /** - * @param helper - */ - public void setQueryHelper(final IMetaDataQueryHelper helper); - - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/IMetaDataQueryHelper.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/IMetaDataQueryHelper.java deleted file mode 100644 index 47ca31dca..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/IMetaDataQueryHelper.java +++ /dev/null @@ -1,106 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 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 and/or initial documentation - *******************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query.internal; - -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.query.IEntityQueryVisitor; -import org.eclipse.jst.jsf.common.metadata.query.IResultSet; -import org.eclipse.jst.jsf.common.metadata.query.ITraitQueryVisitor; - -/** - * Interface for accessing 'raw' meta data query capabilities. - * <p> - * May be subclassed, but implementers must extend {@link MetaDataQueryHelper} - * - */ -public interface IMetaDataQueryHelper { - - /** - * @param modelId - * @return Model object for given context. May return null if not located. - */ - public Model getModel(final String modelId); - - /** - * @param modelId - * @param entityKey relative to root of the model - * @return the first entity match from the root of the model. May return null. - */ - public Entity getEntity(final String modelId, - final String entityKey); - - /** - * @param modelId - * @param entityKey relative to root of model - * @param visitor - * @return an IResultSet of entity objects - */ - public IResultSet<Entity> getEntities( - final String modelId, final String entityKey, - final IEntityQueryVisitor visitor); - - /** - * @param entity - * @param traitKey - * @return a trait or null for the given entity and traitKey using a SimpleEntityQueryVisitorImpl - */ - public Trait getTrait(final Entity entity, final String traitKey); - - /** - * @param entity - * @param traitKey - * @param traitQueryVisitor - * @return an IResultSet of trait objects using supplied traitQueryVisitor. IResultSet should NOT be null. - */ - public IResultSet<Trait> getTraits(Entity entity, String traitKey, - ITraitQueryVisitor traitQueryVisitor); - - /** - * @param initialEntityContext - * @param entityKey relative to initial passed entity - * @return the first entity located by key using SimpleEntityQueryVisitorImpl - */ - public Entity getEntity(Entity initialEntityContext, String entityKey); - - /** - * @param initialEntityContext - * @param entityQuery relative to initial passed entity - * @param entityKeyQueryVisitor - * @return IResultSet of entities located by key using entityQueryVisitor. IResultSet should NOT be null. - */ - public IResultSet<Entity> getEntities(Entity initialEntityContext, - String entityQuery, IEntityQueryVisitor entityKeyQueryVisitor); - - /** - * @param modelId - * @param entityKey - * @param traitKey - * @return first trait found for entity and trait key starting from root of the model using SimpleMetaDataQueryImpl - */ - public Trait getTrait(final String modelId, - final String entityKey, final String traitKey); - - /** - * @param <T> - * @param results - * @return first <T> from result set. May return null. - */ - public <T> T getFirstFromResultSet(final IResultSet<T> results); -// /** -// * @param tagEntity -// * @return QName for entity -// */ -// public QName getQNameForEntity(final Entity tagEntity); - -}
\ No newline at end of file diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/IPredicateMatcher.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/IPredicateMatcher.java deleted file mode 100644 index e8a4331d5..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/IPredicateMatcher.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 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 and/or initial documentation - *******************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query.internal; - -/** - * Matches predicates - * - * @param <T> - */ -public interface IPredicateMatcher<T> { - /** - * @param object - * @return MATCH - */ - public MATCH matches(T object); - - /** - * Reset the matcher - */ - public void reset(); - /** - * Enumeration of match results - * - */ - public enum MATCH { - /** - * Does not match - */ - NOT, - /** - * Partial match thru the hierarchy... continue - */ - PARTIALLY, - /** - * Full match - leaf most predicate satisfied - */ - FULLY; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/IPredicateMatcherFactory.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/IPredicateMatcherFactory.java deleted file mode 100644 index 4e017de2f..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/IPredicateMatcherFactory.java +++ /dev/null @@ -1,22 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 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 and/or initial documentation - *******************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query.internal; - -import org.eclipse.core.runtime.IAdaptable; - -/** - * Factory for producing {@link IPredicateMatcher}s - * - */ -public interface IPredicateMatcherFactory extends IAdaptable { - //marker interface -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/IQuerySpec.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/IQuerySpec.java deleted file mode 100644 index c9183e947..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/IQuerySpec.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 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 and/or initial documentation - *******************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query.internal; - -/** - * Interface for specifying the key for querying - * <p> - * @noimplement - */ -public interface IQuerySpec { - - /** - * @return key - */ - public Key getKey(); - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/ITraitPredicateMatcher.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/ITraitPredicateMatcher.java deleted file mode 100644 index b0b77d0d1..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/ITraitPredicateMatcher.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 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 and/or initial documentation - *******************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query.internal; - -import org.eclipse.jst.jsf.common.metadata.Trait; - -/** - * Matches entities using TraitQuerySpec - * - */ -public interface ITraitPredicateMatcher { - /** - * @param trait - * @return true if matched - */ - public boolean matches (final Trait trait); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/InvalidQuerySpecificationException.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/InvalidQuerySpecificationException.java deleted file mode 100644 index 49a693c8d..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/InvalidQuerySpecificationException.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 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 and/or initial documentation - *******************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query.internal; - -/** - * Thrown when query specification does not meet the criteria for the domain or the query - * - */ -public class InvalidQuerySpecificationException extends Exception { - /** - * serializaion id - */ - private static final long serialVersionUID = -2835106570357619405L; - - /** - * @param message - */ - public InvalidQuerySpecificationException(final String message) { - super(message); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/Key.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/Key.java deleted file mode 100644 index 367592aef..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/Key.java +++ /dev/null @@ -1,21 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 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 and/or initial documentation - *******************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query.internal; - -import org.eclipse.jst.jsf.context.IModelContext; - -/** - * Abstract class defining a metadata filter - */ -public abstract class Key implements IModelContext{ - // -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/MetaDataDomainContext.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/MetaDataDomainContext.java deleted file mode 100644 index 8b75bb858..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/MetaDataDomainContext.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 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 and/or initial documentation - *******************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query.internal; - -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataDomainContext; - -/** - * Implements {@link IMetaDataDomainContext} - * - */ -public class MetaDataDomainContext implements IMetaDataDomainContext { - - private final String _domainId; - - /** - * Constructor - * @param domainId - */ - public MetaDataDomainContext(final String domainId) { - _domainId = domainId; - } - public Object getAdapter(final Class adapter) { - return null; - } - - public final String getDomainId() { - return _domainId; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/MetaDataModelContext.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/MetaDataModelContext.java deleted file mode 100644 index b45b0fe5b..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/MetaDataModelContext.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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 and/or initial documentation - *******************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query.internal; - -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataDomainContext; -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataModelContext; - -/** - * Simple implementation of {@link IMetaDataModelContext} - * - */ -public class MetaDataModelContext implements IMetaDataModelContext { - - private String _id; - private IMetaDataDomainContext _domainContext; - - /** - * @param identifier - * @param domainContext - */ - public MetaDataModelContext(final String identifier, final IMetaDataDomainContext domainContext) { - _id = identifier; - _domainContext = domainContext; - } - - public String getDomainId() { - return _domainContext.getDomainId(); - } - - public Object getAdapter(Class adapter) { - return _domainContext.getAdapter(adapter); - } - - public String getModelIdentifier() { - return _id; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/MetaDataQueryContextFactory.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/MetaDataQueryContextFactory.java deleted file mode 100644 index 35dd28ad4..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/MetaDataQueryContextFactory.java +++ /dev/null @@ -1,169 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 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 and/or initial documentation - *******************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query.internal; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.jsf.common.internal.strategy.AbstractTestableExtensibleDefaultProviderSelectionStrategy; -import org.eclipse.jst.jsf.common.metadata.Trait; -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataDomainContext; -import org.eclipse.jst.jsf.common.metadata.query.internal.taglib.ITaglibDomainPredicateMatcherFactory; -import org.eclipse.jst.jsf.common.metadata.query.internal.taglib.TaglibDomainContextImpl; -import org.eclipse.jst.jsf.common.metadata.query.internal.taglib.TaglibDomainEntityIdRegexPredicateMatcher; -import org.eclipse.jst.jsf.common.metadata.query.internal.taglib.TaglibDomainEntityQuerySpec; -import org.eclipse.jst.jsf.common.metadata.query.internal.taglib.TaglibDomainTraitIdRegexPredicateMatcher; -import org.eclipse.jst.jsf.common.metadata.query.internal.taglib.TaglibDomainTraitQuerySpec; - -/** - * Factory for producing {@link IMetaDataDomainContext}s and {@link IPredicateMatcherFactory}s - * TODO: Consider using {@link AbstractTestableExtensibleDefaultProviderSelectionStrategy} - */ -public final class MetaDataQueryContextFactory { - - private static MetaDataQueryContextFactory INSTANCE = new MetaDataQueryContextFactory(); - //private static DomainModelContextFactoryReader DOMAIN_FACTORY_READER; - - private MetaDataQueryContextFactory(){ - //DOMAIN_FACTORY_READER = new DomainModelContextFactoryReader(); - } - - /** - * @return singleton instance of {@link MetaDataQueryContextFactory} - */ - public static MetaDataQueryContextFactory getInstance() { - synchronized (INSTANCE) { - return INSTANCE; - } - } - - /** - * Creates a context for querying the tag library domain - * @param project - must not be null - * @return ITaglibDomainModelContext - */ - public IMetaDataDomainContext createTaglibDomainModelContext(final IProject project) { - assert project != null; - return new TaglibDomainContextImpl(project); - } - - /** - * Creates a context for querying the tag library domain - * @param file - must not be null - * @return ITaglibDomainModelContext - */ - public IMetaDataDomainContext createTaglibDomainModelContext(final IFile file) { - assert file != null; - return new TaglibDomainContextImpl(file); - } - -// /** -// * Creates a context for querying the tag library domain -// * @param file - must not be null -// * @return ITaglibDomainModelContext -// */ -// public IMetaDataDomainContext createTaglibDomainModelContext(final IFile file) { -// assert file != null; -// IMetaDataDomainContext context = createDomainModelContext(file, IMetaDataDomainContext.TAGLIB_DOMAIN_CONTEXT_ID); -// if (context == null) -// context = new TaglibDomainContextImpl(file); -// -// return context; -// } -// -// /** -// * @param file -// * @param domainId -// * @return IMetaDataDomainContext -// */ -// public IMetaDataDomainContext createDomainModelContext(final IFile file, final String domainId) { -// //given domain id, get the query factory -// final IMetaDataDomainModelContextFactory factory = DOMAIN_FACTORY_READER.getFactoryFor(domainId); -// if (factory != null) -// return factory.createDomainModelContext(file); -// -//// JSFCommonPlugin.log(new UnsupportedOperationException(), "Unknown domain model context factory for domain id: "+domainId); //$NON-NLS-1$ -// return null; -// } -// -////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// FIXME!!!!! The ITaglibDomainPredicateMatcherFactory does not belong here! -// - - /** - * @return {@link ITaglibDomainPredicateMatcherFactory} - */ - public ITaglibDomainPredicateMatcherFactory getTaglibDomainPredicateMatcherFactory() { - //currently only produces one kind of factory - return new TaglibDomainRegexQueryMatcherFactory(); - } - - private static class TaglibDomainRegexQueryMatcherFactory implements ITaglibDomainPredicateMatcherFactory { - - public TaglibDomainEntityIdRegexPredicateMatcher createTagLibraryModelMatcher(final String uri) { - return new TaglibDomainEntityIdRegexPredicateMatcher(new TaglibDomainEntityQuerySpec(uri)); - } - - public TaglibDomainEntityIdRegexPredicateMatcher createTagEntityMatcher(final String uri, - final String tagName) { - return new TaglibDomainEntityIdRegexPredicateMatcher(new TaglibDomainEntityQuerySpec(uri, tagName)); - } - - public TaglibDomainEntityIdRegexPredicateMatcher createTagAttributeEntityMatcher(final String uri, - final String tagName, final String tagAttributeName) { - return new TaglibDomainEntityIdRegexPredicateMatcher(new TaglibDomainEntityQuerySpec(uri, tagName, tagAttributeName)); - } - - public IPredicateMatcher<Trait> createTraitMatcher(final String traitId) { - return new TaglibDomainTraitIdRegexPredicateMatcher(new TaglibDomainTraitQuerySpec(traitId)); - } - - public Object getAdapter(final Class adapter) { - return null; - } - - } - -// private static class DomainModelContextFactoryReader -// extends -// AbstractSimpleClassExtensionRegistryReader<IMetaDataDomainModelContextFactory> { -// -// private static final String EXT_PT_ID = "domainModelContextFactory"; //$NON-NLS-1$ -// private static final String EXT_PT_ELEMENT = "factory"; //$NON-NLS-1$ -// private static final String EXT_PT_ATTR = "class"; //$NON-NLS-1$ -// -// /** -// * Constructor -// */ -// protected DomainModelContextFactoryReader() { -// super(JSFCommonPlugin.PLUGIN_ID, -// EXT_PT_ID, EXT_PT_ELEMENT, EXT_PT_ATTR, -// new CompareOrgEclipseJstContributorsLastComparator<IMetaDataDomainModelContextFactory>() -// ); -// } -// -// @Override -// protected void handleLoadFailure(final CoreException ce) { -// JSFCommonPlugin.log(ce, -// "Error loading IMetaDataDomainModelContextFactory from extension"); //$NON-NLS-1$ -// -// } -// -// public IMetaDataDomainModelContextFactory getFactoryFor(final String domainId) { -// for (final IMetaDataDomainModelContextFactory factory : getExtensions()) { -// if (factory.getDomainIdentifierFor().equals(domainId)){ -// return factory; -// } -// } -// return null; -// } -// } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/MetaDataQueryFactory.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/MetaDataQueryFactory.java deleted file mode 100644 index c1676deb9..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/MetaDataQueryFactory.java +++ /dev/null @@ -1,94 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 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 and/or initial documentation - *******************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query.internal; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; -import org.eclipse.jst.jsf.common.internal.pde.AbstractSimpleClassExtensionRegistryReader; -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataDomainContext; -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataDomainQueryFactory; - -/** - * Entry point for querying metadata. Delegates query creation to the domainQueryFactory registered for the domain. - * <p> - * Usage Ex.: - * IMetaDataDomainContext context = MetaDataQueryContextFactory.getInstance().createTaglibDomainContext(project, uri); - * ITaglibMetaDataQuery query = MetaDataQueryFactory.getInstance().createQuery(context); - */ -public final class MetaDataQueryFactory { - private static MetaDataQueryFactory INSTANCE = new MetaDataQueryFactory(); - private static DomainQueryFactoryReader DOMAIN_QUERY_FACTORY_READER; - /** - * @return the singleton instance of the MetaDataQueryFactory - */ - public static MetaDataQueryFactory getInstance() { - synchronized(INSTANCE) { - return INSTANCE; - } - } - - private MetaDataQueryFactory() { - DOMAIN_QUERY_FACTORY_READER = new DomainQueryFactoryReader(); - } - - /** - * Create a query for against a domain of metadata - * - * @param <T> - * @param context - * @return {@link IMetaDataQuery} - */ - public <T extends IMetaDataQuery> T createQuery(final IMetaDataDomainContext context) { - //given domain id, get the query factory - final IMetaDataDomainQueryFactory factory = DOMAIN_QUERY_FACTORY_READER.getFactoryFor(context.getDomainId()); - if (factory != null) - return (T)factory.createQuery(context); - - JSFCommonPlugin.log(new UnsupportedOperationException(), "Unknown query factory for domain id: "+context.getDomainId()); //$NON-NLS-1$ - return null; - } - - private static class DomainQueryFactoryReader - extends - AbstractSimpleClassExtensionRegistryReader<IMetaDataDomainQueryFactory> { - - private static final String EXT_PT_ID = "domainQueryFactory"; //$NON-NLS-1$ - private static final String EXT_PT_ELEMENT = "factory"; //$NON-NLS-1$ - private static final String EXT_PT_ATTR = "class"; //$NON-NLS-1$ - - /** - * Constructor - */ - protected DomainQueryFactoryReader() { - super(JSFCommonPlugin.PLUGIN_ID, - EXT_PT_ID, EXT_PT_ELEMENT, EXT_PT_ATTR, - new CompareOrgEclipseJstContributorsLastComparator<IMetaDataDomainQueryFactory>() - ); - } - - @Override - protected void handleLoadFailure(final CoreException ce) { - JSFCommonPlugin.log(ce, - "Error loading IMetaDataDomainQueryFactory from extension"); //$NON-NLS-1$ - - } - - public IMetaDataDomainQueryFactory getFactoryFor(final String domainId) { - for (final IMetaDataDomainQueryFactory factory : getExtensions()) { - if (factory.getDomainIdentifier().equals(domainId)){ - return factory; - } - } - return null; - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/MetaDataQueryHelper.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/MetaDataQueryHelper.java deleted file mode 100644 index eb09aa956..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/MetaDataQueryHelper.java +++ /dev/null @@ -1,143 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 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.common.metadata.query.internal; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; -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.IMetaDataDomainContext; -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataModelContext; -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataModelManager; -import org.eclipse.jst.jsf.common.metadata.internal.MetaDataModelContext; -import org.eclipse.jst.jsf.common.metadata.query.IEntityQueryVisitor; -import org.eclipse.jst.jsf.common.metadata.query.IResultSet; -import org.eclipse.jst.jsf.common.metadata.query.ITraitQueryVisitor; -import org.eclipse.jst.jsf.common.metadata.query.MetaDataException; - - -/** - * Helper class with static methods to simplify querying of a metadata model. - * - * @see IResultSet - * @see IEntityQueryVisitor - * @see ITraitQueryVisitor - * @see Model - * @see Entity - * @see Trait - * <p> - * May be subclassed. - * - */ -public class MetaDataQueryHelper implements IMetaDataQueryHelper{ - - private IMetaDataModelManager _manager; - private IMetaDataDomainContext _managerContext; - - /** - * Constructor - * @param manager - * @param managerContext - */ - public MetaDataQueryHelper (final IMetaDataModelManager manager,final IMetaDataDomainContext managerContext){ - _manager = manager; - _managerContext = managerContext; - } - - public Model getModel(final String modelId) { - return getMDModel(modelId); - } - - public Entity getEntity(final String modelId, final String entityKey) { - final IEntityQueryVisitor visitor = new SimpleEntityQueryVisitorImpl(new HierarchicalSearchControl(1, HierarchicalSearchControl.SCOPE_ALL_LEVELS)); - final IResultSet<Entity> rs = getEntities(modelId,entityKey, visitor); - return getFirstFromResultSet(rs); - } - - public IResultSet<Entity> getEntities(final String modelId, final String entityKey, final IEntityQueryVisitor visitor){ - final Model model = getModel(modelId); - //we may want to throw error that model is empty - return getEntities(model, entityKey, visitor); - } - - public Trait getTrait(final Entity entity, final String traitKey){ - final ITraitQueryVisitor visitor = new SimpleTraitQueryVisitorImpl(); - final IResultSet<Trait> rs = getTraits(entity, traitKey, visitor); - return getFirstFromResultSet(rs); - } - - public IResultSet<Trait> getTraits(final Entity entity, final String traitKey, final ITraitQueryVisitor traitQueryVisitor) { - final IResultSet<Trait> rs = traitQueryVisitor.findTraits(entity, traitKey); - return rs; - } - - public Entity getEntity(final Entity initialEntityContext, final String entityKey) { - final IEntityQueryVisitor visitor = new SimpleEntityQueryVisitorImpl(new HierarchicalSearchControl(1, HierarchicalSearchControl.SCOPE_ALL_LEVELS)); - final IResultSet<Entity> rs = getEntities(initialEntityContext, entityKey, visitor); - return getFirstFromResultSet(rs); - } - - public IResultSet<Entity> getEntities(final Entity initialEntityContext, final String entityQuery, final IEntityQueryVisitor entityKeyQueryVisitor) { - return entityKeyQueryVisitor.findEntities(initialEntityContext, entityQuery); - } - - public Trait getTrait(final String modelId, final String entityKey, final String traitKey) { - final Entity entity = getEntity(modelId, entityKey); - Trait t = null; - if (entity != null){ - t = getTrait(entity, traitKey); - } - return t; - } - - public <T> T getFirstFromResultSet(final IResultSet<T> results) { - T result = null; - try { - if (! results.getResults().isEmpty()){ - result = results.getResults().get(0); - } - results.close(); - } catch (MetaDataException ex) { - JSFCommonPlugin.log(IStatus.ERROR, "Error in getFirstFromResultSet()", ex); //$NON-NLS-1$ - } - return result; - } - - /** - * Retrieve Model from the ModelManager for given key - * @param modelId - * @return Model - */ - private Model getMDModel(final String modelId){ - if (_manager != null) - return _manager.getModel(getModelContext(modelId)); - - return null; - } - - /** - * @param modelId - * @return IMetaDataModelContext2 - */ - protected IMetaDataModelContext getModelContext(final String modelId) { - return new MetaDataModelContext(( - IProject)_managerContext.getAdapter(IProject.class), - _managerContext.getDomainId(), - modelId); - } -// public QName getQNameForEntity(final Entity tagEntity) { -// Assert.isTrue(tagEntity != null); -// return new QName(tagEntity.getModel().getId(), tagEntity.getId()); -// } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/SearchControl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/SearchControl.java deleted file mode 100644 index 43e131752..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/SearchControl.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.common.metadata.query.internal; - -/** - * Simple class used by {@link SimpleEntityQueryVisitorImpl} allowing some control of a metadata query. - * A query visitor can use this to optimize the query results and signal completion. - */ -public class SearchControl { - - /** - * No limit on query results - */ - public static final int COUNT_LIMIT_NONE = -1; - - //default settings - private int countLimit = COUNT_LIMIT_NONE; - - - /** - * Constructor using defaults of COUNT_LIMIT_NONE - */ - public SearchControl(){ - //use default settings - } - - /** - * Constructor - * @param countLimit - */ - public SearchControl(int countLimit){ - this.countLimit = countLimit; - } - - /** - * @param limit results count limit - */ - public void setCountLimit(int limit){ - this.countLimit = limit; - } - - /** - * @return query results count limit - */ - public int getCountLimit(){ - return countLimit; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/SimpleEntityQueryVisitorImpl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/SimpleEntityQueryVisitorImpl.java deleted file mode 100644 index c67f4e53c..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/SimpleEntityQueryVisitorImpl.java +++ /dev/null @@ -1,205 +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.common.metadata.query.internal; - -import java.util.ArrayList; -import java.util.List; -import java.util.StringTokenizer; - -import org.eclipse.jst.jsf.common.metadata.Entity; -import org.eclipse.jst.jsf.common.metadata.query.AbstractEntityQueryVisitor; -import org.eclipse.jst.jsf.common.metadata.query.IResultSet; - - -/** - * A simple metadata query visitor implementing {@link org.eclipse.jst.jsf.common.metadata.query.IEntityQueryVisitor} and {@link org.eclipse.jst.jsf.common.metadata.query.ITraitQueryVisitor}.<p> - * - simple find entity and traits by id only <br> - * - does not allow for wild card searchs<br> - * <p> - * TODO - fix for case-sensitivity https://bugs.eclipse.org/bugs/show_bug.cgi?id=212794 - * - */ -public class SimpleEntityQueryVisitorImpl extends AbstractEntityQueryVisitor implements IHierarchicalEntityVisitor { - private HierarchicalSearchControl control; - private boolean _stop; - - private EntityQueryFilterVisitor entityQuery; - private List<Entity> _entityResults; - private Entity initialEntityContext; - - /** - * Constructor that also creates a default SearchControl - */ - public SimpleEntityQueryVisitorImpl() { - super(); - control = new HierarchicalSearchControl(); - } - - /** - * Constructor - * @param control - */ - public SimpleEntityQueryVisitorImpl(final HierarchicalSearchControl control) { - super(); - this.control = control; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.query.IEntityQueryVisitor#findEntities(org.eclipse.jst.jsf.common.metadata.Entity, java.lang.String) - */ - public IResultSet<Entity> findEntities(final Entity initialEntity, - final String entityKey) { - - resetQuery(); - - if (initialEntity != null){ - this.initialEntityContext = initialEntity; - entityQuery = new EntityQueryFilterVisitor(initialEntity.getId(), entityKey); - initialEntity.accept(this); - } - - return new SimpleResultSet(getInternalEntityResults()); - } - - private void resetQuery() { - _stop = false; - _entityResults = null; - } - - private List<Entity> getInternalEntityResults(){ - if (_entityResults == null){ - _entityResults = new ArrayList<Entity>(); - } - return _entityResults; - } - - - public boolean visitEnter(final Entity entity) { - - if (entity == initialEntityContext) - return true; - - entityQuery.pushLevel(); - if (entityQuery.canVisit(entity)) - return entityQuery.visit(entity); - - return false; - } - - public boolean visitLeave(Entity entity) { - checkShouldStopVisitingEntities(); - if (entity != initialEntityContext) - entityQuery.popLevel(); - return true; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.query.IEntityVisitor#visit(org.eclipse.jst.jsf.common.metadata.Entity) - */ - public void visit(final Entity key) { - //do nothing... all work now done in visitEnter/visitLeave - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.query.IMetaDataVisitor#stopVisiting() - */ - public boolean stopVisiting() { - return _stop; - } - - private void checkShouldStopVisitingEntities(){ - //implement how to set stop to signal to the entity accept() to skip visiting - if (_stop == false - && control.getCountLimit()== getInternalEntityResults().size() - && control.getCountLimit() != SearchControl.COUNT_LIMIT_NONE ) - - _stop = true; - } - - /** - * Visitor that filters and acts upon hierarchical data that compares that an entity's id for with another with case-insensitive compare - */ - private class EntityQueryFilterVisitor { - - private String entityId; - private List<String> entityQueue; - private int curLevel = 0; - - /** - * Constructor - * @param initialContextId - Entity id from which the query is rooted - * @param queryKey - query key which may be compound ("A/B/C" - assuming "/" is the delimiter) - */ - public EntityQueryFilterVisitor(final String initialContextId, final String queryKey){ - init(initialContextId, queryKey); - } - - private void init(final String initialContextId, final String key) { - entityQueue = new ArrayList<String>(3); - addLevel(initialContextId); - if (key == null || key.trim().equals("") || key.trim().equals(getLevelDelimiter())){ //$NON-NLS-1$ - addLevel(""); //$NON-NLS-1$ - } - else { - final StringTokenizer st = new StringTokenizer(key, getLevelDelimiter()); - String partialKey = st.nextToken(); - addLevel(partialKey); - while (st.hasMoreElements()){ - partialKey = st.nextToken(); - addLevel(partialKey); - } - } - } - - /** - * @param entity - * @return flag indicating that filter was passed and children may be visited - */ - public boolean canVisit(final Entity entity) { - // only one filter rule... does this entity id match the current level's entity id (case-insensitive) - return entityId.compareTo(entity.getId().toUpperCase()) == 0; - } - - /** - * Operates on passed entity and determines if it should be part of the query results - * @param entity - * @return true if children of entity should be visited - */ - public boolean visit(final Entity entity) { - //one operation... if we have found the leaf-most entity in the query, add it to the results and go no deeper - if (curLevel == entityQueue.size() - 1) { - getInternalEntityResults().add(entity); - return false; - } - return true; - } - - private void addLevel(final String key) { - entityQueue.add(key.toUpperCase()); - } - - /** - * Move up one level in the query - */ - public void popLevel(){ - entityId = entityQueue.get(--curLevel); - } - - /** - * Move down one level in the query - */ - public void pushLevel() { - entityId = entityQueue.get(++curLevel); - } - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/SimpleResultSet.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/SimpleResultSet.java deleted file mode 100644 index 059bed134..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/SimpleResultSet.java +++ /dev/null @@ -1,46 +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.common.metadata.query.internal; - - -import java.util.Collections; -import java.util.List; - -import org.eclipse.jst.jsf.common.metadata.query.AbstractResultSet; - -/** - * Simple implementation of {@link org.eclipse.jst.jsf.common.metadata.query.IResultSet} by extending AbstractResultSet - * @param <T> - * - */ -public final class SimpleResultSet<T> extends AbstractResultSet<T> { - private List<T> results; - - /** - * Constructor passing a list to hold the results - * @param results - */ - public SimpleResultSet(List<T> results){ - super(); - this.results = results; - } - - protected List<T> getInternalResults(){ - if (results == null){ - results = Collections.EMPTY_LIST; - } - return results; - } - - -} - diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/SimpleTraitQueryVisitorImpl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/SimpleTraitQueryVisitorImpl.java deleted file mode 100644 index 6b7491c09..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/SimpleTraitQueryVisitorImpl.java +++ /dev/null @@ -1,111 +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.common.metadata.query.internal; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.jst.jsf.common.metadata.Entity; -import org.eclipse.jst.jsf.common.metadata.Trait; -import org.eclipse.jst.jsf.common.metadata.query.AbstractTraitQueryVisitor; -import org.eclipse.jst.jsf.common.metadata.query.IResultSet; - - -/** - * A simple metadata query visitor implementing {@link org.eclipse.jst.jsf.common.metadata.query.ITraitQueryVisitor}. - * - simple find traits by id only - * - Does not allow for wild card searchs - */ -public class SimpleTraitQueryVisitorImpl extends AbstractTraitQueryVisitor { - - private String _traitQuery; - private SearchControl _control; - private boolean _stop; - private List<Trait> _traitResults; - - /** - * Constructor that also creates a default SearchControl - */ - public SimpleTraitQueryVisitorImpl() { - super(); - _control = new SearchControl(); - } - - /** - * Constructor - * @param control - */ - public SimpleTraitQueryVisitorImpl(SearchControl control) { - super(); - this._control = control; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.query.ITraitQueryVisitor#findTraits(org.eclipse.jst.jsf.common.metadata.Entity, java.lang.String) - */ - public IResultSet<Trait> findTraits(final Entity entity, final String traitQuery){ - - resetQuery(); - if (entity != null){ - this._traitQuery = traitQuery; - for (Iterator<Trait> it=entity.getTraits().iterator();it.hasNext();){ - Trait t = it.next(); - t.accept(this); - if (stopVisiting()) - break; - } - } - return new SimpleResultSet(getInternalTraitResults()); - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.query.ITraitVisitor#visit(org.eclipse.jst.jsf.common.metadata.Trait) - */ - public void visit(Trait trait) { - if (trait.getId().equals(_traitQuery)) - getInternalTraitResults().add(trait); - - checkShouldStopVisitingTraits(); - } - - /** - * - */ - private void resetQuery() { - _stop = false; - _traitResults = null; - } - - /** - * @return lazy init of a SimpleResultSet of Traits - */ - private List<Trait> getInternalTraitResults(){ - if (_traitResults == null){ - _traitResults = new ArrayList<Trait>(); - } - return _traitResults; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.query.IMetaDataVisitor#stopVisiting() - */ - public boolean stopVisiting() { - return _stop; - } - - private void checkShouldStopVisitingTraits(){ - if (_control.getCountLimit()== getInternalTraitResults().size() && _control.getCountLimit() != SearchControl.COUNT_LIMIT_NONE) - _stop = true; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/TraitQuerySpec.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/TraitQuerySpec.java deleted file mode 100644 index 5b0ccc8a0..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/TraitQuerySpec.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 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 and/or initial documentation - *******************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query.internal; - - -/** - * Implements a query spec for querying traits matching using equality for the id - */ -public class TraitQuerySpec implements IQuerySpec { - - private final String _traitId; - /** - * @param traitId - */ - public TraitQuerySpec(final String traitId) { - _traitId = traitId; - } - public TraitKey getKey() { - return null; - } - - class TraitKey extends Key { - - public Object getAdapter(Class adapter) { - // TODO Auto-generated method stub - return null; - } - - public String getId() { - return _traitId; - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/TraitQuerySpecVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/TraitQuerySpecVisitor.java deleted file mode 100644 index db80e77fa..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/TraitQuerySpecVisitor.java +++ /dev/null @@ -1,107 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 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 and/or initial documentation - *******************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query.internal; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.jst.jsf.common.metadata.Entity; -import org.eclipse.jst.jsf.common.metadata.Trait; -import org.eclipse.jst.jsf.common.metadata.query.AbstractTraitQueryVisitor; -import org.eclipse.jst.jsf.common.metadata.query.IResultSet; -import org.eclipse.jst.jsf.common.metadata.query.MetaDataException; -import org.eclipse.jst.jsf.common.metadata.query.internal.IPredicateMatcher.MATCH; - -/** - * Visits a set of entities matching by trait predicate matcher - * - */ -public class TraitQuerySpecVisitor extends AbstractTraitQueryVisitor { - - private List<Trait> _traitResults; - private Collection<Entity> _entities; - private IPredicateMatcher<Trait> _matcher; - private SearchControl _control; - private boolean _stop; - - - /** - * Constructor using default search control - * @param entities - * @param traitMatcher - */ - public TraitQuerySpecVisitor(final Collection<Entity> entities, final IPredicateMatcher<Trait> traitMatcher) { - this(entities, traitMatcher, new SearchControl()); - } - - /** - * Constructor using search control for a single match - * @param entities - * @param traitMatcher - * @param control - */ - public TraitQuerySpecVisitor(final Collection<Entity> entities, final IPredicateMatcher<Trait> traitMatcher, final SearchControl control) { - super(); - _entities = entities; - _matcher = traitMatcher; - _traitResults = new ArrayList<Trait>(); - _control = control; - } - - /** - * @return IResultSet<Trait> - will not be null - * @throws MetaDataException - */ - public IResultSet<Trait> findTraits() throws MetaDataException { - - _matcher.reset(); - - if (_entities != null && _entities.size() > 0){ - ENTITIES_LOOP: for (final Entity entity : _entities) { - final Iterator<Trait> it = entity.getTraits().iterator(); - while (it.hasNext()) { - Trait trait = it.next(); - trait.accept(this); - checkShouldStopVisiting(); - if (stopVisiting()) - break ENTITIES_LOOP; - } - } - } - - return new SimpleResultSet(_traitResults); - } - - public boolean stopVisiting() { - return _stop; - } - - private void checkShouldStopVisiting(){ - //implement how to set stop to signal to the entity accept() to skip visiting - if (_stop == false - && _control.getCountLimit()== _traitResults.size() - && _control.getCountLimit() != SearchControl.COUNT_LIMIT_NONE ) - - _stop = true; - } - - @Override - public void visit(final Trait trait) { - final MATCH match = _matcher.matches(trait); - if (match == MATCH.FULLY) { - _traitResults.add(trait); - } - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/ITaglibDomainEntityPredicateMatcher.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/ITaglibDomainEntityPredicateMatcher.java deleted file mode 100644 index c4fa78922..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/ITaglibDomainEntityPredicateMatcher.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 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 and/or initial documentation - *******************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query.internal.taglib; - -import org.eclipse.jst.jsf.common.metadata.query.internal.IEntityPredicateMatcher; - -/** - * Matches tag library entities - */ -public interface ITaglibDomainEntityPredicateMatcher extends IEntityPredicateMatcher { - - /** - * @return uri of the tag library - need this to determine model. - * In the future, this may change if we allow for wild card search of models of a given domain - */ - public String getUri(); - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/ITaglibDomainMetaDataQuery.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/ITaglibDomainMetaDataQuery.java deleted file mode 100644 index 21c417c57..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/ITaglibDomainMetaDataQuery.java +++ /dev/null @@ -1,87 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 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 and/or initial documentation - *******************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query.internal.taglib; - -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.query.IResultSet; -import org.eclipse.jst.jsf.common.metadata.query.MetaDataException; -import org.eclipse.jst.jsf.common.metadata.query.internal.IMetaDataQuery; -import org.eclipse.jst.jsf.common.metadata.query.internal.IPredicateMatcher; - -/** - * Interface for querying in a tag library domain context - * <p> - * @noimplement - not intended to be implemented by clients - * - */ -public interface ITaglibDomainMetaDataQuery extends IMetaDataQuery { - - /** - * Find the tag library model for the passed uri which may be different from the one from the initial context - * @param uri - may not be null - * @return {@link Model} for this tag library's uri. May be null. - */ - public Model findTagLibraryModel(final String uri); - - - /** - * @param tagLib - may not be null - * @param tagName - may not be null - * @return {@link Entity} for the tag name in the library. May be null - */ - public Entity findTagEntity(final Model tagLib, final String tagName); - - /** - * @param tagEntity - may not be null - * @param attributeName - may not be null - * @return {@link Entity} for the tag attribute name of this tag. May be null. - */ - public Entity findTagAttributeEntity(final Entity tagEntity, final String attributeName); - - /** - * @param entityMatcher - * @return Set of {@link Entity}s matching the query specification - */ - public IResultSet<Entity> findEntities(final ITaglibDomainEntityPredicateMatcher entityMatcher); - - /** - * @param entityMatcher - * @return First {@link Entity} matching the query specification. May be null. - */ - public Entity findEntity(final ITaglibDomainEntityPredicateMatcher entityMatcher); - - /** - * @param entity - may not be null - * @param traitId - may not be null - * @return {@link Trait} - may be null - */ - public Trait findTrait(final Entity entity, final String traitId); - - /** - * @param entityMatcher - * @param traitMatcher - * @return Set of {@link Trait}s matching both the entity and trait query specifications. Will not be null. - * @throws MetaDataException - */ - public IResultSet<Trait> findTraits(final ITaglibDomainEntityPredicateMatcher entityMatcher, final IPredicateMatcher<Trait> traitMatcher) throws MetaDataException; - - - /** - * @param entityMatcher - * @param traitMatcher - * @return First {@link Trait} matching both the entity and trait query specifications. May return null. - */ - public Trait findTrait(final ITaglibDomainEntityPredicateMatcher entityMatcher, final IPredicateMatcher<Trait> traitMatcher); - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/ITaglibDomainPredicateMatcherFactory.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/ITaglibDomainPredicateMatcherFactory.java deleted file mode 100644 index c1868656e..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/ITaglibDomainPredicateMatcherFactory.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 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 and/or initial documentation - *******************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query.internal.taglib; - -import org.eclipse.jst.jsf.common.metadata.Trait; -import org.eclipse.jst.jsf.common.metadata.query.internal.IPredicateMatcher; -import org.eclipse.jst.jsf.common.metadata.query.internal.IPredicateMatcherFactory; - - -/** - * Interface for creating {@link IPredicateMatcher}s for the tag library domain. - * <p> - * @noextend - */ -public interface ITaglibDomainPredicateMatcherFactory extends IPredicateMatcherFactory { - - /** - * Returns a matcher that will match a tag library specification - * @param uri - may not be null - * @return {@link ITaglibDomainEntityPredicateMatcher} - */ - public ITaglibDomainEntityPredicateMatcher createTagLibraryModelMatcher(final String uri); - /** - * Returns a matcher that will match a tag specification - * @param uri - may not be null - * @param tagName - may not be null - * @return {@link ITaglibDomainEntityPredicateMatcher} - */ - public ITaglibDomainEntityPredicateMatcher createTagEntityMatcher(final String uri, final String tagName); - - /** - * Returns a matcher that will match a tag attribute specification - * @param uri - may not be null - * @param tagName - may not be null - * @param tagAttributeName - may not be null - * @return {@link ITaglibDomainEntityPredicateMatcher} - */ - public ITaglibDomainEntityPredicateMatcher createTagAttributeEntityMatcher(final String uri, final String tagName, final String tagAttributeName) ; - - /** - * Returns a matcher that will match the trait id - * @param traitId - may not be null - * @return {@link IPredicateMatcher} for {@link Trait} - */ - public IPredicateMatcher<Trait> createTraitMatcher(final String traitId); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/TaglibDomainContextImpl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/TaglibDomainContextImpl.java deleted file mode 100644 index 4f8091ea2..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/TaglibDomainContextImpl.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 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 and/or initial documentation - *******************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query.internal.taglib; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataModelContext; -import org.eclipse.jst.jsf.common.metadata.query.internal.IMetaDataModelManagerContext; -import org.eclipse.jst.jsf.common.metadata.query.internal.MetaDataDomainContext; - -/** - * Implements {@link IMetaDataModelManagerContext} for tag library domain - * - */ -public class TaglibDomainContextImpl - extends MetaDataDomainContext - implements IMetaDataModelManagerContext { - - - private final IProject _project; - private final IFile _file; - - /** - * Constructor - * @param project - */ - public TaglibDomainContextImpl(final IProject project) { - super(IMetaDataModelContext.TAGLIB_DOMAIN_CONTEXT_ID); - _project = project; - _file = null; - } - - /** - * Constructor - * @param file - */ - public TaglibDomainContextImpl(final IFile file) { - super(IMetaDataModelContext.TAGLIB_DOMAIN_CONTEXT_ID); - _project = file.getProject(); - _file = file; - } - - public Object getAdapter(Class adapter) { - if (adapter == IProject.class) - return _project; - if (adapter == IFile.class) - return _file; - return null; - } - - public IProject getProject() { - return _project; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/TaglibDomainEntityIdRegexPredicateMatcher.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/TaglibDomainEntityIdRegexPredicateMatcher.java deleted file mode 100644 index 444e9eb90..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/TaglibDomainEntityIdRegexPredicateMatcher.java +++ /dev/null @@ -1,103 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 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 and/or initial documentation - *******************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query.internal.taglib; - -import java.util.regex.Pattern; -import java.util.regex.PatternSyntaxException; - -import org.eclipse.jst.jsf.common.metadata.Entity; - -/** - * Entity id regex matcher used by the IEntityQueryVisitor - * - */ -public class TaglibDomainEntityIdRegexPredicateMatcher implements ITaglibDomainEntityPredicateMatcher { - - private static final int LEVEL_UNSET = 0; - private static final int LEVEL_MODEL = 1; - private static final int LEVEL_TAG = 2; - private static final int LEVEL_TAGATTR = 3; - - private final Pattern _modelKey; - private final Pattern _tagKey; - private final Pattern _tagAttrKey; - private final int _leafLevel; - private int _currentLevel; - - /** - * @param spec - * @throws PatternSyntaxException - */ - public TaglibDomainEntityIdRegexPredicateMatcher(final TaglibDomainEntityQuerySpec spec) throws PatternSyntaxException { - _modelKey = spec.getKey().getUri() != null ? java.util.regex.Pattern.compile(spec.getKey().getUri()) : null; - _tagKey = spec.getKey().getTagName() != null ? java.util.regex.Pattern.compile(spec.getKey().getTagName()) : null; - _tagAttrKey = spec.getKey().getTagAttributeName() != null ? java.util.regex.Pattern.compile(spec.getKey().getTagAttributeName()) : null;; - _leafLevel = _tagAttrKey != null ? LEVEL_TAGATTR : (_tagKey != null ? LEVEL_TAG : LEVEL_MODEL); - _currentLevel = LEVEL_UNSET; - } - - public MATCH matches(final Entity entity) { - if (_currentLevel == LEVEL_MODEL && matches(entity, _modelKey)) { - return isFullMatch(entity); - } - else if (_currentLevel == LEVEL_TAG && matches(entity, _tagKey)){ - return isFullMatch(entity); - } - else if (_currentLevel == LEVEL_TAGATTR && matches(entity, _tagAttrKey)){ - return isFullMatch(entity); - } - return MATCH.NOT; - } - - private boolean matches(final Entity entity, final Pattern _key) { - if (_key.matcher(entity.getId()).find()) - return true; - return false; - } - - private MATCH isFullMatch(final Entity entity) { - if (_currentLevel == _leafLevel) - return MATCH.FULLY; - return MATCH.PARTIALLY; - } - - /** - * Move up one level in the hierarchy - */ - public void popLevel() { - _currentLevel--; - } - - /** - * Move down one level in the hierarchy - */ - public void pushLevel() { - _currentLevel++; - } - - public String getUri() { - return _modelKey.pattern().toString(); - } - - public void reset() { - _currentLevel = LEVEL_UNSET; - } - - public int getMaxLevel() { - return _leafLevel; - } - - public int getCurrentLevel() { - return _currentLevel; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/TaglibDomainEntityQuerySpec.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/TaglibDomainEntityQuerySpec.java deleted file mode 100644 index f53f67119..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/TaglibDomainEntityQuerySpec.java +++ /dev/null @@ -1,87 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 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 and/or initial documentation - *******************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query.internal.taglib; - -import org.eclipse.jst.jsf.common.metadata.query.internal.IQuerySpec; -import org.eclipse.jst.jsf.common.metadata.query.internal.Key; - -/** - * Implements a tag entity query spec where the entity's id's are matched. - * <p> - * The PredicateMatcher will use this class to do an regex match of the id to the value - * - */ -public final class TaglibDomainEntityQuerySpec implements IQuerySpec { - - private final String _uri; - private final String _tagName; - private final String _tagAttrName; - - /** - * Construct a query spec for a tag library model - * @param uri - may not be null - */ - public TaglibDomainEntityQuerySpec(final String uri) { - _uri = uri; - _tagName = null; - _tagAttrName = null; - } - - /** - * Construct a query spec for a tag - * @param uri - may not be null - * @param tagName - may not be null - */ - public TaglibDomainEntityQuerySpec (final String uri, final String tagName) { - _uri = uri; - _tagName = tagName; - _tagAttrName = null; - } - - /** - * Construct a query spec for a tag attribute - * @param uri - may not be null - * @param tagName - may not be null - * @param tagAttributeName - may not be null - */ - public TaglibDomainEntityQuerySpec (final String uri, final String tagName, final String tagAttributeName) { - _uri = uri; - _tagName = tagName; - _tagAttrName = tagAttributeName; - } - public TagDomainEntityKey getKey() { - return new TagDomainEntityKey(); - } - - class TagDomainEntityKey extends Key { - - /** - * @return model uri - */ - public String getUri() { - return _uri; - } - - public String getTagName() { - return _tagName; - } - - public String getTagAttributeName() { - return _tagAttrName; - } - public Object getAdapter(Class adapter) { - return null; - } - - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/TaglibDomainEntityQuerySpecVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/TaglibDomainEntityQuerySpecVisitor.java deleted file mode 100644 index 30f53e458..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/TaglibDomainEntityQuerySpecVisitor.java +++ /dev/null @@ -1,156 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 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 and/or initial documentation - *******************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query.internal.taglib; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.jsf.common.metadata.Entity; -import org.eclipse.jst.jsf.common.metadata.Model; -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataDomainContext; -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataModelContext; -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataModelManager; -import org.eclipse.jst.jsf.common.metadata.internal.MetaDataModelContext; -import org.eclipse.jst.jsf.common.metadata.internal.MetaDataModelManagerFactory; -import org.eclipse.jst.jsf.common.metadata.query.AbstractEntityQueryVisitor; -import org.eclipse.jst.jsf.common.metadata.query.IResultSet; -import org.eclipse.jst.jsf.common.metadata.query.internal.HierarchicalSearchControl; -import org.eclipse.jst.jsf.common.metadata.query.internal.IHierarchicalEntityVisitor; -import org.eclipse.jst.jsf.common.metadata.query.internal.IPredicateMatcher.MATCH; -import org.eclipse.jst.jsf.common.metadata.query.internal.SearchControl; -import org.eclipse.jst.jsf.common.metadata.query.internal.SimpleResultSet; - -/** - * @author gekessle - * - */ -public class TaglibDomainEntityQuerySpecVisitor extends AbstractEntityQueryVisitor implements IHierarchicalEntityVisitor { - private HierarchicalSearchControl _control; - private ITaglibDomainEntityPredicateMatcher _matcher; - private IMetaDataDomainContext _context; - private List<Entity> _entityResults; - private Model _initialEntity; - private boolean _stop; - - /** - * Constructor with default SearchControl - * @param context - * @param matcher - */ - public TaglibDomainEntityQuerySpecVisitor(final IMetaDataDomainContext context, final ITaglibDomainEntityPredicateMatcher matcher) { - this(context, matcher, new HierarchicalSearchControl()); - } - - /** - * Constructor - * @param context - * @param matcher - * @param control - */ - public TaglibDomainEntityQuerySpecVisitor(final IMetaDataDomainContext context, final ITaglibDomainEntityPredicateMatcher matcher, final HierarchicalSearchControl control) { - _matcher = matcher; - _context = context; - _control = control; - } - - /** - * @return Set of {@link Entity}s matching the entity query spec - * Note: does not support wild card match of models yet. - */ - public IResultSet<Entity> findEntities() {// throws InvalidQuerySpecification, MetaDataException { - _matcher.reset(); - - //first find model according to matcher... - //DOES NOT SUPPORT WILD CARDS FOR MODEL URI YET!!! - //we cannot support wild cards because models are loaded lazily; even their id's. - final IMetaDataModelManager mgr = MetaDataModelManagerFactory.getMetaDataModelManagerInstance(getProject()); - if (mgr != null) { - final Model model= mgr.getModel(getModelContext()); - findEntities(model); - } else { - //throw err? - } - return new SimpleResultSet<Entity>(getInternalEntityResults()); - } - - private void findEntities(final Model model) { - - if (model != null){ - _initialEntity = model; - _initialEntity.accept(this); - } - - } - - private List<Entity> getInternalEntityResults(){ - if (_entityResults == null){ - _entityResults = new ArrayList<Entity>(); - } - return _entityResults; - } - - private IMetaDataModelContext getModelContext() { - return new MetaDataModelContext(getProject(), _context.getDomainId(), _matcher.getUri()); - } - - private IProject getProject() { - return (IProject)_context.getAdapter(IProject.class); - } - - public boolean visitEnter(final Entity entity) { - _matcher.pushLevel(); - if (_matcher.getCurrentLevel() <= _matcher.getMaxLevel()) { - final MATCH match = _matcher.matches(entity); - if (match == MATCH.FULLY) { - getInternalEntityResults().add(entity); - checkShouldStopVisitingEntities(); - return false; - } - else if (match == MATCH.PARTIALLY) { - return true; - } - } - return false; - } - - public boolean stopVisiting() { - return _stop; - } - - private void checkShouldStopVisitingEntities(){ - //implement how to set stop to signal to the entity accept() to skip visiting - if (_stop == false - && _control.getCountLimit()== getInternalEntityResults().size() - && _control.getCountLimit() != SearchControl.COUNT_LIMIT_NONE ) - - _stop = true; - } - - public boolean visitLeave(Entity entity) { -// _stop = _matcher.checkShouldStopVisitingEntities(); -// if (entity != _initialEntity) -// _entityQuery.popLevel(); - if (entity != _initialEntity) - _matcher.popLevel(); - return true; - } - - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.query.IEntityVisitor#visit(org.eclipse.jst.jsf.common.metadata.Entity) - */ - public void visit(final Entity key) { - //do nothing... all work now done in visitEnter/visitLeave - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/TaglibDomainMetaDataQuery.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/TaglibDomainMetaDataQuery.java deleted file mode 100644 index dc3248cf0..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/TaglibDomainMetaDataQuery.java +++ /dev/null @@ -1,94 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 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 and/or initial documentation - *******************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query.internal.taglib; - -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.IMetaDataDomainContext; -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataModelManager; -import org.eclipse.jst.jsf.common.metadata.query.IResultSet; -import org.eclipse.jst.jsf.common.metadata.query.MetaDataException; -import org.eclipse.jst.jsf.common.metadata.query.internal.AbstractMetaDataQuery; -import org.eclipse.jst.jsf.common.metadata.query.internal.HierarchicalSearchControl; -import org.eclipse.jst.jsf.common.metadata.query.internal.IPredicateMatcher; -import org.eclipse.jst.jsf.common.metadata.query.internal.SearchControl; -import org.eclipse.jst.jsf.common.metadata.query.internal.TraitQuerySpecVisitor; - -/** - * Implements {@link ITaglibDomainMetaDataQuery} - * - */ -public class TaglibDomainMetaDataQuery - extends AbstractMetaDataQuery - implements ITaglibDomainMetaDataQuery { - - /** - * Constructor - * @param manager - * @param managerContext - */ - public TaglibDomainMetaDataQuery(final IMetaDataModelManager manager, final IMetaDataDomainContext managerContext) { - super(manager, managerContext); - } - - public Model findTagLibraryModel(final String uri) { - return getQueryHelper().getModel(uri); - } - - public Entity findTagEntity(final Model tagLib, final String tagName) { - return getQueryHelper().getEntity(tagLib, tagName); - } - - public Entity findTagAttributeEntity(final Entity tagEntity, final String attributeName) { - return getQueryHelper().getEntity(tagEntity, attributeName); - } - - public Trait findTrait(final Entity entity, final String traitId) { - return getQueryHelper().getTrait(entity, traitId); - } - - public IResultSet<Entity> findEntities(final ITaglibDomainEntityPredicateMatcher matcher) { - final TaglibDomainEntityQuerySpecVisitor visitor = new TaglibDomainEntityQuerySpecVisitor(getDomainContext(), matcher); - return visitor.findEntities(); - } - - public IResultSet<Trait> findTraits(final ITaglibDomainEntityPredicateMatcher entityMatcher, final IPredicateMatcher<Trait> traitMatcher) throws MetaDataException { - final TraitQuerySpecVisitor visitor = new TraitQuerySpecVisitor(findEntities(entityMatcher).getResults(), traitMatcher); - return visitor.findTraits(); - } - - public Entity findEntity(final ITaglibDomainEntityPredicateMatcher entityMatcher) { - final HierarchicalSearchControl control = new HierarchicalSearchControl(); - control.setCountLimit(1); - final TaglibDomainEntityQuerySpecVisitor visitor = new TaglibDomainEntityQuerySpecVisitor(getDomainContext(), entityMatcher, control); - final IResultSet<Entity> results = visitor.findEntities(); - return getQueryHelper().getFirstFromResultSet(results); - } - - public Trait findTrait(final ITaglibDomainEntityPredicateMatcher entityMatcher, final IPredicateMatcher<Trait> traitMatcher) { - TraitQuerySpecVisitor visitor; - try { - final SearchControl control = new SearchControl(); - control.setCountLimit(1); - visitor = new TraitQuerySpecVisitor(findEntities(entityMatcher).getResults(), traitMatcher, control); - IResultSet<Trait> results = visitor.findTraits(); - return getQueryHelper().getFirstFromResultSet(results); - } catch (MetaDataException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - return null; - - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/TaglibDomainMetaDataQueryFactory.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/TaglibDomainMetaDataQueryFactory.java deleted file mode 100644 index d7f08aeef..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/TaglibDomainMetaDataQueryFactory.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 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 and/or initial documentation - *******************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query.internal.taglib; - -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataDomainContext; -import org.eclipse.jst.jsf.common.metadata.query.internal.AbstractMetaDataDomainQueryFactory; -import org.eclipse.jst.jsf.common.metadata.query.internal.IMetaDataQuery; - -/** - * Factory for producing TagLibraryDomain {@link IMetaDataQuery}s. - * ({@link ITaglibDomainMetaDataQuery} specifically) - */ -public class TaglibDomainMetaDataQueryFactory - extends - AbstractMetaDataDomainQueryFactory { - - /** - * Constructor - */ - public TaglibDomainMetaDataQueryFactory() { - super("TagLibraryDomain"); //$NON-NLS-1$ - } - - public ITaglibDomainMetaDataQuery createQuery(final IMetaDataDomainContext context) { - return new TaglibDomainMetaDataQuery(getManager(context), context); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/TaglibDomainTraitIdRegexPredicateMatcher.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/TaglibDomainTraitIdRegexPredicateMatcher.java deleted file mode 100644 index dfa710462..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/TaglibDomainTraitIdRegexPredicateMatcher.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 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 and/or initial documentation - *******************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query.internal.taglib; - -import java.util.regex.Pattern; -import java.util.regex.PatternSyntaxException; - -import org.eclipse.jst.jsf.common.metadata.Trait; -import org.eclipse.jst.jsf.common.metadata.query.internal.IPredicateMatcher; - -/** - * - * - */ -public class TaglibDomainTraitIdRegexPredicateMatcher implements IPredicateMatcher<Trait> { - - /** - * id - */ - protected final Pattern _idPattern; - - /** - * Constructor - * @param traitSpec - * @throws PatternSyntaxException - */ - public TaglibDomainTraitIdRegexPredicateMatcher(final TaglibDomainTraitQuerySpec traitSpec) throws PatternSyntaxException { - _idPattern = Pattern.compile(traitSpec.getKey().getTraitId()); - } - - public MATCH matches(final Trait trait) { - if (_idPattern.matcher(trait.getId()).find()) - return MATCH.FULLY; - return MATCH.NOT; - } - - public void reset() { - //nothing to do - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/TaglibDomainTraitQuerySpec.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/TaglibDomainTraitQuerySpec.java deleted file mode 100644 index 5a934cbd1..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/TaglibDomainTraitQuerySpec.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 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 and/or initial documentation - *******************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query.internal.taglib; - -import org.eclipse.jst.jsf.common.metadata.query.internal.IQuerySpec; -import org.eclipse.jst.jsf.common.metadata.query.internal.Key; - -/** - * Implements a tag trait query spec where the trait id's are matched. - * <p> - * The PredicateMatcher will use this class to do an regex match of the id to the value - * - */ -public final class TaglibDomainTraitQuerySpec implements IQuerySpec { - - private final String _traidId; - - /** - * Construct a query spec for a tag library model - * @param traidId - may not be null - */ - public TaglibDomainTraitQuerySpec(final String traidId) { - _traidId = traidId; - } - - public TagDomainTraitKey getKey() { - return new TagDomainTraitKey(); - } - - class TagDomainTraitKey extends Key { - - /** - * @return model traidId - */ - public String getTraitId() { - return _traidId; - } - - public Object getAdapter(Class adapter) { - return null; - } - - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/package-info.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/package-info.java deleted file mode 100644 index bb9019ece..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/package-info.java +++ /dev/null @@ -1,17 +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 - * - ********************************************************************************/ - -/** - * Meta-data query interface. - * <p><b>Provisional API - subject to change</b></p> - */ -package org.eclipse.jst.jsf.common.metadata.query; diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/BooleanValue.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/BooleanValue.java deleted file mode 100644 index 9a658b861..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/BooleanValue.java +++ /dev/null @@ -1,64 +0,0 @@ -/** - * Copyright (c) 2007 Oracle Corporation - * - * $Id: BooleanValue.java,v 1.1 2010/01/21 00:01:44 gkessler Exp $ - */ -package org.eclipse.jst.jsf.common.metadata.traittypes.traittypes; - -import org.eclipse.emf.ecore.EObject; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Boolean Value</b></em>'. - * - * Only String value of 'true' in xml will result in isTrue() being true. - * All other String values will result in false. - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.BooleanValue#isTrue <em>True</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.TraitTypesPackage#getBooleanValue() - * @model extendedMetaData="kind='simple'" - * @generated - */ -public interface BooleanValue extends EObject { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - /** - * Returns the value of the '<em><b>True</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>True</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>True</em>' attribute. - * @see #setTrue(boolean) - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.TraitTypesPackage#getBooleanValue_True() - * @model required="true" - * extendedMetaData="kind='simple'" - * @generated - */ - boolean isTrue(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.BooleanValue#isTrue <em>True</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>True</em>' attribute. - * @see #isTrue() - * @generated - */ - void setTrue(boolean value); - -} // BooleanValue diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/ListOfValues.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/ListOfValues.java deleted file mode 100644 index 12e92a411..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/ListOfValues.java +++ /dev/null @@ -1,55 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id$ - */ -package org.eclipse.jst.jsf.common.metadata.traittypes.traittypes; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>List Of Values</b></em>'. - * - * <p><b>Provisional API - subject to change</b></p> - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.ListOfValues#getEntries <em>Entries</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.TraitTypesPackage#getListOfValues() - * @model - * @generated - */ -public interface ListOfValues extends EObject { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - /** - * Returns the value of the '<em><b>Entries</b></em>' containment reference list. - * The list contents are of type {@link org.eclipse.emf.ecore.xml.type.SimpleAnyType}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Entries</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>Entries</em>' containment reference list. - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.TraitTypesPackage#getListOfValues_Entries() - * @model type="org.eclipse.emf.ecore.xml.type.SimpleAnyType" containment="true" - * extendedMetaData="kind='element' name='item'" - * @generated - */ - EList getEntries(); - -} // ListOfValues diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/SetGenerator.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/SetGenerator.java deleted file mode 100644 index 023ae6f4a..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/SetGenerator.java +++ /dev/null @@ -1,83 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id$ - */ -package org.eclipse.jst.jsf.common.metadata.traittypes.traittypes; - -import org.eclipse.emf.ecore.EObject; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Set Generator</b></em>'. - * - * <p><b>Provisional API - subject to change</b></p> - * <!-- end-user-doc --> - * - * - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.TraitTypesPackage#getSetGenerator() - * @model - * @generated - */ -public interface SetGenerator extends EObject { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - /** - * Returns the value of the '<em><b>Algorithm</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Algorithm</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Algorithm</em>' attribute. - * @see #setAlgorithm(String) - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.TraitTypesPackage#getSetGenerator_Algorithm() - * @model extendedMetaData="kind='element'" - * @generated - */ - String getAlgorithm(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.SetGenerator#getAlgorithm <em>Algorithm</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Algorithm</em>' attribute. - * @see #getAlgorithm() - * @generated - */ - void setAlgorithm(String value); - - /** - * Returns the value of the '<em><b>Expression</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Expression</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Expression</em>' attribute. - * @see #setExpression(String) - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.TraitTypesPackage#getSetGenerator_Expression() - * @model extendedMetaData="kind='element'" - * @generated - */ - String getExpression(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.SetGenerator#getExpression <em>Expression</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Expression</em>' attribute. - * @see #getExpression() - * @generated - */ - void setExpression(String value); - -} // SetGenerator diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/StringValue.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/StringValue.java deleted file mode 100644 index b978ad871..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/StringValue.java +++ /dev/null @@ -1,61 +0,0 @@ -/** - * Copyright (c) 2007 Oracle Corporation - * - * $Id: StringValue.java,v 1.1 2010/01/21 00:01:44 gkessler Exp $ - */ -package org.eclipse.jst.jsf.common.metadata.traittypes.traittypes; - -import org.eclipse.emf.ecore.EObject; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>String Value</b></em>'. - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.StringValue#getValue <em>Value</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.TraitTypesPackage#getStringValue() - * @model extendedMetaData="kind='simple'" - * @generated - */ -public interface StringValue extends EObject { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - String copyright = "Copyright (c) 2007 Oracle Corporation";//$NON-NLS-1$ - - /** - * 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.common.metadata.traittypes.traittypes.TraitTypesPackage#getStringValue_Value() - * @model required="true" - * extendedMetaData="kind='simple'" - * @generated - */ - String getValue(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.StringValue#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); - -} // StringValue diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/TraitTypesFactory.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/TraitTypesFactory.java deleted file mode 100644 index af30b04c7..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/TraitTypesFactory.java +++ /dev/null @@ -1,82 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id$ - */ -package org.eclipse.jst.jsf.common.metadata.traittypes.traittypes; - -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. - * - * <p><b>Provisional API - subject to change</b></p> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.TraitTypesPackage - * @generated - */ -public interface TraitTypesFactory extends EFactory { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - /** - * The singleton instance of the factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - TraitTypesFactory eINSTANCE = org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl.TraitTypesFactoryImpl.init(); - - /** - * Returns a new object of class '<em>List Of Values</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>List Of Values</em>'. - * @generated - */ - ListOfValues createListOfValues(); - - /** - * Returns a new object of class '<em>Set Generator</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Set Generator</em>'. - * @generated - */ - SetGenerator createSetGenerator(); - - /** - * Returns a new object of class '<em>String Value</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>String Value</em>'. - * @generated - */ - StringValue createStringValue(); - - /** - * Returns a new object of class '<em>Boolean Value</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Boolean Value</em>'. - * @generated - */ - BooleanValue createBooleanValue(); - - /** - * Returns the package supported by this factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the package supported by this factory. - * @generated - */ - TraitTypesPackage getTraitTypesPackage(); - -} //TraitTypesFactory diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/TraitTypesPackage.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/TraitTypesPackage.java deleted file mode 100644 index 81b82fb5a..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/TraitTypesPackage.java +++ /dev/null @@ -1,395 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id$ - */ -package org.eclipse.jst.jsf.common.metadata.traittypes.traittypes; - -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> - * - * <p><b>Provisional API - subject to change</b></p> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.TraitTypesFactory - * @model kind="package" - * @generated - */ -@SuppressWarnings("hiding") -public interface TraitTypesPackage extends EPackage { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - /** - * The package name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNAME = "traittypes"; //$NON-NLS-1$ - - /** - * The package namespace URI. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNS_URI = "http://org.eclipse.jst.jsf.common.metadata/metadataTraitTypes.ecore"; //$NON-NLS-1$ - - /** - * The package namespace name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNS_PREFIX = "mdt"; //$NON-NLS-1$ - - /** - * The singleton instance of the package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - TraitTypesPackage eINSTANCE = org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl.TraitTypesPackageImpl.init(); - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl.ListOfValuesImpl <em>List Of Values</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl.ListOfValuesImpl - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl.TraitTypesPackageImpl#getListOfValues() - * @generated - */ - int LIST_OF_VALUES = 0; - - /** - * The feature id for the '<em><b>Entries</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int LIST_OF_VALUES__ENTRIES = 0; - - /** - * The number of structural features of the '<em>List Of Values</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int LIST_OF_VALUES_FEATURE_COUNT = 1; - - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl.SetGeneratorImpl <em>Set Generator</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl.SetGeneratorImpl - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl.TraitTypesPackageImpl#getSetGenerator() - * @generated - */ - int SET_GENERATOR = 1; - - /** - * The feature id for the '<em><b>Algorithm</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int SET_GENERATOR__ALGORITHM = 0; - - /** - * The feature id for the '<em><b>Expression</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int SET_GENERATOR__EXPRESSION = 1; - - /** - * The number of structural features of the '<em>Set Generator</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int SET_GENERATOR_FEATURE_COUNT = 2; - - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl.StringValueImpl <em>String Value</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl.StringValueImpl - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl.TraitTypesPackageImpl#getStringValue() - * @generated - */ - int STRING_VALUE = 2; - - /** - * The feature id for the '<em><b>Value</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int STRING_VALUE__VALUE = 0; - - /** - * The number of structural features of the '<em>String Value</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int STRING_VALUE_FEATURE_COUNT = 1; - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl.BooleanValueImpl <em>Boolean Value</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl.BooleanValueImpl - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl.TraitTypesPackageImpl#getBooleanValue() - * @generated - */ - int BOOLEAN_VALUE = 3; - - /** - * The feature id for the '<em><b>True</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int BOOLEAN_VALUE__TRUE = 0; - - /** - * The number of structural features of the '<em>Boolean Value</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int BOOLEAN_VALUE_FEATURE_COUNT = 1; - - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.ListOfValues <em>List Of Values</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>List Of Values</em>'. - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.ListOfValues - * @generated - */ - EClass getListOfValues(); - - /** - * Returns the meta object for the containment reference list '{@link org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.ListOfValues#getEntries <em>Entries</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the containment reference list '<em>Entries</em>'. - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.ListOfValues#getEntries() - * @see #getListOfValues() - * @generated - */ - EReference getListOfValues_Entries(); - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.SetGenerator <em>Set Generator</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Set Generator</em>'. - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.SetGenerator - * @generated - */ - EClass getSetGenerator(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.SetGenerator#getAlgorithm <em>Algorithm</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Algorithm</em>'. - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.SetGenerator#getAlgorithm() - * @see #getSetGenerator() - * @generated - */ - EAttribute getSetGenerator_Algorithm(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.SetGenerator#getExpression <em>Expression</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Expression</em>'. - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.SetGenerator#getExpression() - * @see #getSetGenerator() - * @generated - */ - EAttribute getSetGenerator_Expression(); - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.StringValue <em>String Value</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>String Value</em>'. - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.StringValue - * @generated - */ - EClass getStringValue(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.StringValue#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.common.metadata.traittypes.traittypes.StringValue#getValue() - * @see #getStringValue() - * @generated - */ - EAttribute getStringValue_Value(); - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.BooleanValue <em>Boolean Value</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Boolean Value</em>'. - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.BooleanValue - * @generated - */ - EClass getBooleanValue(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.BooleanValue#isTrue <em>True</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>True</em>'. - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.BooleanValue#isTrue() - * @see #getBooleanValue() - * @generated - */ - EAttribute getBooleanValue_True(); - - /** - * 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 - */ - TraitTypesFactory getTraitTypesFactory(); - - /** - * <!-- 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.common.metadata.traittypes.traittypes.internal.impl.ListOfValuesImpl <em>List Of Values</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl.ListOfValuesImpl - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl.TraitTypesPackageImpl#getListOfValues() - * @generated - */ - EClass LIST_OF_VALUES = eINSTANCE.getListOfValues(); - - /** - * The meta object literal for the '<em><b>Entries</b></em>' containment reference list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference LIST_OF_VALUES__ENTRIES = eINSTANCE.getListOfValues_Entries(); - - /** - * The meta object literal for the '{@link org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl.SetGeneratorImpl <em>Set Generator</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl.SetGeneratorImpl - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl.TraitTypesPackageImpl#getSetGenerator() - * @generated - */ - EClass SET_GENERATOR = eINSTANCE.getSetGenerator(); - - /** - * The meta object literal for the '<em><b>Algorithm</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute SET_GENERATOR__ALGORITHM = eINSTANCE.getSetGenerator_Algorithm(); - - /** - * The meta object literal for the '<em><b>Expression</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute SET_GENERATOR__EXPRESSION = eINSTANCE.getSetGenerator_Expression(); - - /** - * The meta object literal for the '{@link org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl.StringValueImpl <em>String Value</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl.StringValueImpl - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl.TraitTypesPackageImpl#getStringValue() - * @generated - */ - EClass STRING_VALUE = eINSTANCE.getStringValue(); - - /** - * The meta object literal for the '<em><b>Value</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute STRING_VALUE__VALUE = eINSTANCE.getStringValue_Value(); - - /** - * The meta object literal for the '{@link org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl.BooleanValueImpl <em>Boolean Value</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl.BooleanValueImpl - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl.TraitTypesPackageImpl#getBooleanValue() - * @generated - */ - EClass BOOLEAN_VALUE = eINSTANCE.getBooleanValue(); - - /** - * The meta object literal for the '<em><b>True</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute BOOLEAN_VALUE__TRUE = eINSTANCE.getBooleanValue_True(); - - } - -} //TraitTypesPackage diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/impl/BooleanValueImpl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/impl/BooleanValueImpl.java deleted file mode 100644 index 85d4a9077..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/impl/BooleanValueImpl.java +++ /dev/null @@ -1,167 +0,0 @@ -/** - * Copyright (c) 2007 Oracle Corporation - * - * $Id: BooleanValueImpl.java,v 1.2 2010/04/27 17:40:10 gkessler Exp $ - */ -package org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.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.common.metadata.traittypes.traittypes.BooleanValue; -import org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.TraitTypesPackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Boolean Value</b></em>'. - * - * Only String value of 'true' in xml will result in isTrue() being true. - * All other String values will result in false. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl.BooleanValueImpl#isTrue <em>True</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class BooleanValueImpl extends EObjectImpl implements BooleanValue { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - /** - * The default value of the '{@link #isTrue() <em>True</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isTrue() - * @generated - * @ordered - */ - protected static final boolean TRUE_EDEFAULT = false; - - /** - * The cached value of the '{@link #isTrue() <em>True</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isTrue() - * @generated - * @ordered - */ - protected boolean true_ = TRUE_EDEFAULT; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected BooleanValueImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EClass eStaticClass() { - return TraitTypesPackage.Literals.BOOLEAN_VALUE; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean isTrue() { - return true_; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setTrue(boolean newTrue) { - boolean oldTrue = true_; - true_ = newTrue; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, TraitTypesPackage.BOOLEAN_VALUE__TRUE, oldTrue, true_)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case TraitTypesPackage.BOOLEAN_VALUE__TRUE: - return isTrue() ? Boolean.TRUE : Boolean.FALSE; - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case TraitTypesPackage.BOOLEAN_VALUE__TRUE: - setTrue(((Boolean)newValue).booleanValue()); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eUnset(int featureID) { - switch (featureID) { - case TraitTypesPackage.BOOLEAN_VALUE__TRUE: - setTrue(TRUE_EDEFAULT); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean eIsSet(int featureID) { - switch (featureID) { - case TraitTypesPackage.BOOLEAN_VALUE__TRUE: - return true_ != TRUE_EDEFAULT; - } - 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(" (isTrue(): "); //$NON-NLS-1$ - result.append(true_); - result.append(')'); - return result.toString(); - } - -} //BooleanValueImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/impl/ListOfValuesImpl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/impl/ListOfValuesImpl.java deleted file mode 100644 index 4cbfe03dc..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/impl/ListOfValuesImpl.java +++ /dev/null @@ -1,157 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: ListOfValuesImpl.java,v 1.4 2008/11/18 22:24:38 gkessler Exp $ - */ -package org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl; - -import java.util.Collection; - -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.emf.ecore.xml.type.SimpleAnyType; - -import org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.ListOfValues; -import org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.TraitTypesPackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>List Of Values</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl.ListOfValuesImpl#getEntries <em>Entries</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class ListOfValuesImpl extends EObjectImpl implements ListOfValues { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - /** - * The cached value of the '{@link #getEntries() <em>Entries</em>}' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getEntries() - * @generated - * @ordered - */ - protected EList entries = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ListOfValuesImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EClass eStaticClass() { - return TraitTypesPackage.Literals.LIST_OF_VALUES; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EList getEntries() { - if (entries == null) { - entries = new EObjectContainmentEList(SimpleAnyType.class, this, TraitTypesPackage.LIST_OF_VALUES__ENTRIES); - } - return entries; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { - switch (featureID) { - case TraitTypesPackage.LIST_OF_VALUES__ENTRIES: - return ((InternalEList)getEntries()).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 TraitTypesPackage.LIST_OF_VALUES__ENTRIES: - return getEntries(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case TraitTypesPackage.LIST_OF_VALUES__ENTRIES: - getEntries().clear(); - getEntries().addAll((Collection)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eUnset(int featureID) { - switch (featureID) { - case TraitTypesPackage.LIST_OF_VALUES__ENTRIES: - getEntries().clear(); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean eIsSet(int featureID) { - switch (featureID) { - case TraitTypesPackage.LIST_OF_VALUES__ENTRIES: - return entries != null && !entries.isEmpty(); - } - return super.eIsSet(featureID); - } - -} //ListOfValuesImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/impl/SetGeneratorImpl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/impl/SetGeneratorImpl.java deleted file mode 100644 index 5435dc33f..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/impl/SetGeneratorImpl.java +++ /dev/null @@ -1,219 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: SetGeneratorImpl.java,v 1.4 2010/04/27 17:40:10 gkessler Exp $ - */ -package org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.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.common.metadata.traittypes.traittypes.SetGenerator; -import org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.TraitTypesPackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Set Generator</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl.SetGeneratorImpl#getAlgorithm <em>Algorithm</em>}</li> - * <li>{@link org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl.SetGeneratorImpl#getExpression <em>Expression</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class SetGeneratorImpl extends EObjectImpl implements SetGenerator { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - /** - * The default value of the '{@link #getAlgorithm() <em>Algorithm</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getAlgorithm() - * @generated - * @ordered - */ - protected static final String ALGORITHM_EDEFAULT = null; - - /** - * The cached value of the '{@link #getAlgorithm() <em>Algorithm</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getAlgorithm() - * @generated - * @ordered - */ - protected String algorithm = ALGORITHM_EDEFAULT; - - /** - * The default value of the '{@link #getExpression() <em>Expression</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getExpression() - * @generated - * @ordered - */ - protected static final String EXPRESSION_EDEFAULT = null; - - /** - * The cached value of the '{@link #getExpression() <em>Expression</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getExpression() - * @generated - * @ordered - */ - protected String expression = EXPRESSION_EDEFAULT; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected SetGeneratorImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EClass eStaticClass() { - return TraitTypesPackage.Literals.SET_GENERATOR; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getAlgorithm() { - return algorithm; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setAlgorithm(String newAlgorithm) { - String oldAlgorithm = algorithm; - algorithm = newAlgorithm; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, TraitTypesPackage.SET_GENERATOR__ALGORITHM, oldAlgorithm, algorithm)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getExpression() { - return expression; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setExpression(String newExpression) { - String oldExpression = expression; - expression = newExpression; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, TraitTypesPackage.SET_GENERATOR__EXPRESSION, oldExpression, expression)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case TraitTypesPackage.SET_GENERATOR__ALGORITHM: - return getAlgorithm(); - case TraitTypesPackage.SET_GENERATOR__EXPRESSION: - return getExpression(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case TraitTypesPackage.SET_GENERATOR__ALGORITHM: - setAlgorithm((String)newValue); - return; - case TraitTypesPackage.SET_GENERATOR__EXPRESSION: - setExpression((String)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eUnset(int featureID) { - switch (featureID) { - case TraitTypesPackage.SET_GENERATOR__ALGORITHM: - setAlgorithm(ALGORITHM_EDEFAULT); - return; - case TraitTypesPackage.SET_GENERATOR__EXPRESSION: - setExpression(EXPRESSION_EDEFAULT); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean eIsSet(int featureID) { - switch (featureID) { - case TraitTypesPackage.SET_GENERATOR__ALGORITHM: - return ALGORITHM_EDEFAULT == null ? algorithm != null : !ALGORITHM_EDEFAULT.equals(algorithm); - case TraitTypesPackage.SET_GENERATOR__EXPRESSION: - return EXPRESSION_EDEFAULT == null ? expression != null : !EXPRESSION_EDEFAULT.equals(expression); - } - 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(" (algorithm: "); //$NON-NLS-1$ - result.append(algorithm); - result.append(", expression: "); //$NON-NLS-1$ - result.append(expression); - result.append(')'); - return result.toString(); - } - -} //SetGeneratorImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/impl/StringValueImpl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/impl/StringValueImpl.java deleted file mode 100644 index 89f502664..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/impl/StringValueImpl.java +++ /dev/null @@ -1,167 +0,0 @@ -/** - * Copyright (c) 2007 Oracle Corporation - * - * $Id: StringValueImpl.java,v 1.1 2010/01/21 00:01:44 gkessler Exp $ - */ -package org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.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.common.metadata.traittypes.traittypes.StringValue; -import org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.TraitTypesPackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>String Value</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl.StringValueImpl#getValue <em>Value</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class StringValueImpl extends EObjectImpl implements StringValue { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - public static final String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - /** - * 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 StringValueImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EClass eStaticClass() { - return TraitTypesPackage.Literals.STRING_VALUE; - } - - /** - * <!-- 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, TraitTypesPackage.STRING_VALUE__VALUE, oldValue, value)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case TraitTypesPackage.STRING_VALUE__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 TraitTypesPackage.STRING_VALUE__VALUE: - setValue((String)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eUnset(int featureID) { - switch (featureID) { - case TraitTypesPackage.STRING_VALUE__VALUE: - setValue(VALUE_EDEFAULT); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean eIsSet(int featureID) { - switch (featureID) { - case TraitTypesPackage.STRING_VALUE__VALUE: - return VALUE_EDEFAULT == null ? value != null : !VALUE_EDEFAULT.equals(value); - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - public String toString() { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (value: "); //$NON-NLS-1$ - result.append(value); - result.append(')'); - return result.toString(); - } - -} //StringValueImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/impl/TraitTypesFactoryImpl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/impl/TraitTypesFactoryImpl.java deleted file mode 100644 index d67b816bc..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/impl/TraitTypesFactoryImpl.java +++ /dev/null @@ -1,141 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: TraitTypesFactoryImpl.java,v 1.9 2010/04/27 17:40:10 gkessler Exp $ - */ -package org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.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.common.metadata.traittypes.traittypes.BooleanValue; -import org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.ListOfValues; -import org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.SetGenerator; -import org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.StringValue; -import org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.TraitTypesFactory; -import org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.TraitTypesPackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model <b>Factory</b>. - * <!-- end-user-doc --> - * @generated - */ -public class TraitTypesFactoryImpl extends EFactoryImpl implements TraitTypesFactory { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - /** - * Creates the default factory implementation. - * <!-- begin-user-doc --> - * @return the factory - * <!-- end-user-doc --> - * @generated NOT - */ - public static TraitTypesFactory init() { - try { - TraitTypesFactory theTraitTypesFactory = (TraitTypesFactory)EPackage.Registry.INSTANCE.getEFactory("http://org.eclipse.jst.jsf.common.metadata/metadataTraitTypes.ecore"); //$NON-NLS-1$ - if (theTraitTypesFactory != null) { - return theTraitTypesFactory; - } - } - catch (Exception exception) { - EcorePlugin.INSTANCE.log(exception); - } - return new TraitTypesFactoryImpl(); - } - - /** - * Creates an instance of the factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public TraitTypesFactoryImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EObject create(EClass eClass) { - switch (eClass.getClassifierID()) { - case TraitTypesPackage.LIST_OF_VALUES: return createListOfValues(); - case TraitTypesPackage.SET_GENERATOR: return createSetGenerator(); - case TraitTypesPackage.STRING_VALUE: return createStringValue(); - case TraitTypesPackage.BOOLEAN_VALUE: return createBooleanValue(); - default: - throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ListOfValues createListOfValues() { - ListOfValuesImpl listOfValues = new ListOfValuesImpl(); - return listOfValues; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public SetGenerator createSetGenerator() { - SetGeneratorImpl setGenerator = new SetGeneratorImpl(); - return setGenerator; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public StringValue createStringValue() { - StringValueImpl stringValue = new StringValueImpl(); - return stringValue; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public BooleanValue createBooleanValue() { - BooleanValueImpl booleanValue = new BooleanValueImpl(); - return booleanValue; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public TraitTypesPackage getTraitTypesPackage() { - return (TraitTypesPackage)getEPackage(); - } - - /** - * <!-- begin-user-doc --> - * @return the package - * <!-- end-user-doc --> - * @deprecated - * @generated - */ - public static TraitTypesPackage getPackage() { - return TraitTypesPackage.eINSTANCE; - } - -} //TraitTypesFactoryImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/impl/TraitTypesPackageImpl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/impl/TraitTypesPackageImpl.java deleted file mode 100644 index 37db29551..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/impl/TraitTypesPackageImpl.java +++ /dev/null @@ -1,355 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: TraitTypesPackageImpl.java,v 1.9 2010/04/27 17:40:10 gkessler Exp $ - */ -package org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.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.emf.ecore.xml.type.XMLTypePackage; -import org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.BooleanValue; -import org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.ListOfValues; -import org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.SetGenerator; -import org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.StringValue; -import org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.TraitTypesFactory; -import org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.TraitTypesPackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model <b>Package</b>. - * <!-- end-user-doc --> - * @generated - */ -public class TraitTypesPackageImpl extends EPackageImpl implements TraitTypesPackage { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass listOfValuesEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass setGeneratorEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass stringValueEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass booleanValueEClass = 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.common.metadata.traittypes.traittypes.TraitTypesPackage#eNS_URI - * @see #init() - * @generated - */ - private TraitTypesPackageImpl() { - super(eNS_URI, TraitTypesFactory.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. - * - * <p>This method is used to initialize {@link TraitTypesPackage#eINSTANCE} when that field is accessed. - * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. - * <!-- begin-user-doc --> - * @return the package - * <!-- end-user-doc --> - * @see #eNS_URI - * @see #createPackageContents() - * @see #initializePackageContents() - * @generated - */ - public static TraitTypesPackage init() { - if (isInited) return (TraitTypesPackage)EPackage.Registry.INSTANCE.getEPackage(TraitTypesPackage.eNS_URI); - - // Obtain or create and register package - TraitTypesPackageImpl theTraitTypesPackage = (TraitTypesPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof TraitTypesPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new TraitTypesPackageImpl()); - - isInited = true; - - // Initialize simple dependencies - XMLTypePackage.eINSTANCE.eClass(); - - // Create package meta-data objects - theTraitTypesPackage.createPackageContents(); - - // Initialize created meta-data - theTraitTypesPackage.initializePackageContents(); - - // Mark meta-data to indicate it can't be changed - theTraitTypesPackage.freeze(); - - - // Update the registry and return the package - EPackage.Registry.INSTANCE.put(TraitTypesPackage.eNS_URI, theTraitTypesPackage); - return theTraitTypesPackage; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getListOfValues() { - return listOfValuesEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getListOfValues_Entries() { - return (EReference)listOfValuesEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getSetGenerator() { - return setGeneratorEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getSetGenerator_Algorithm() { - return (EAttribute)setGeneratorEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getSetGenerator_Expression() { - return (EAttribute)setGeneratorEClass.getEStructuralFeatures().get(1); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getStringValue() { - return stringValueEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getStringValue_Value() { - return (EAttribute)stringValueEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getBooleanValue() { - return booleanValueEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getBooleanValue_True() { - return (EAttribute)booleanValueEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public TraitTypesFactory getTraitTypesFactory() { - return (TraitTypesFactory)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 - listOfValuesEClass = createEClass(LIST_OF_VALUES); - createEReference(listOfValuesEClass, LIST_OF_VALUES__ENTRIES); - - setGeneratorEClass = createEClass(SET_GENERATOR); - createEAttribute(setGeneratorEClass, SET_GENERATOR__ALGORITHM); - createEAttribute(setGeneratorEClass, SET_GENERATOR__EXPRESSION); - - stringValueEClass = createEClass(STRING_VALUE); - createEAttribute(stringValueEClass, STRING_VALUE__VALUE); - - booleanValueEClass = createEClass(BOOLEAN_VALUE); - createEAttribute(booleanValueEClass, BOOLEAN_VALUE__TRUE); - } - - /** - * <!-- 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(listOfValuesEClass, ListOfValues.class, "ListOfValues", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEReference(getListOfValues_Entries(), theXMLTypePackage.getSimpleAnyType(), null, "entries", null, 0, -1, ListOfValues.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - - initEClass(setGeneratorEClass, SetGenerator.class, "SetGenerator", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEAttribute(getSetGenerator_Algorithm(), ecorePackage.getEString(), "algorithm", null, 0, 1, SetGenerator.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEAttribute(getSetGenerator_Expression(), ecorePackage.getEString(), "expression", null, 0, 1, SetGenerator.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - - initEClass(stringValueEClass, StringValue.class, "StringValue", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEAttribute(getStringValue_Value(), ecorePackage.getEString(), "value", null, 1, 1, StringValue.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - - initEClass(booleanValueEClass, BooleanValue.class, "BooleanValue", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEAttribute(getBooleanValue_True(), ecorePackage.getEBoolean(), "true", null, 1, 1, BooleanValue.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - - // 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"; //$NON-NLS-1$ - addAnnotation - (getListOfValues_Entries(), - source, - new String[] { - "kind", "element", //$NON-NLS-1$ //$NON-NLS-2$ - "name", "item" //$NON-NLS-1$ //$NON-NLS-2$ - }); - addAnnotation - (getSetGenerator_Algorithm(), - source, - new String[] { - "kind", "element" //$NON-NLS-1$ //$NON-NLS-2$ - }); - addAnnotation - (getSetGenerator_Expression(), - source, - new String[] { - "kind", "element" //$NON-NLS-1$ //$NON-NLS-2$ - }); - addAnnotation - (stringValueEClass, - source, - new String[] { - "kind", "simple" //$NON-NLS-1$ //$NON-NLS-2$ - }); - addAnnotation - (getStringValue_Value(), - source, - new String[] { - "kind", "simple" //$NON-NLS-1$ //$NON-NLS-2$ - }); - addAnnotation - (booleanValueEClass, - source, - new String[] { - "kind", "simple" //$NON-NLS-1$ //$NON-NLS-2$ - }); - addAnnotation - (getBooleanValue_True(), - source, - new String[] { - "kind", "simple" //$NON-NLS-1$ //$NON-NLS-2$ - }); - } - -} //TraitTypesPackageImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/util/TraitTypesAdapterFactory.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/util/TraitTypesAdapterFactory.java deleted file mode 100644 index 34b63d0e4..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/util/TraitTypesAdapterFactory.java +++ /dev/null @@ -1,179 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: TraitTypesAdapterFactory.java,v 1.7 2010/04/27 17:40:11 gkessler Exp $ - */ -package org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.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.common.metadata.traittypes.traittypes.BooleanValue; -import org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.ListOfValues; -import org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.SetGenerator; -import org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.StringValue; -import org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.TraitTypesPackage; - -/** - * <!-- 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.common.metadata.traittypes.traittypes.TraitTypesPackage - * @generated - */ -public class TraitTypesAdapterFactory extends AdapterFactoryImpl { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - /** - * The cached model package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected static TraitTypesPackage modelPackage; - - /** - * Creates an instance of the adapter factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public TraitTypesAdapterFactory() { - if (modelPackage == null) { - modelPackage = TraitTypesPackage.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 TraitTypesSwitch modelSwitch = - new TraitTypesSwitch() { - public Object caseListOfValues(ListOfValues object) { - return createListOfValuesAdapter(); - } - public Object caseSetGenerator(SetGenerator object) { - return createSetGeneratorAdapter(); - } - public Object caseStringValue(StringValue object) { - return createStringValueAdapter(); - } - public Object caseBooleanValue(BooleanValue object) { - return createBooleanValueAdapter(); - } - 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.common.metadata.traittypes.traittypes.ListOfValues <em>List Of Values</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.common.metadata.traittypes.traittypes.ListOfValues - * @generated - */ - public Adapter createListOfValuesAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.SetGenerator <em>Set Generator</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.common.metadata.traittypes.traittypes.SetGenerator - * @generated - */ - public Adapter createSetGeneratorAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.StringValue <em>String Value</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.common.metadata.traittypes.traittypes.StringValue - * @generated - */ - public Adapter createStringValueAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.BooleanValue <em>Boolean Value</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.common.metadata.traittypes.traittypes.BooleanValue - * @generated - */ - public Adapter createBooleanValueAdapter() { - 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; - } - -} //TraitTypesAdapterFactory diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/util/TraitTypesResourceFactoryImpl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/util/TraitTypesResourceFactoryImpl.java deleted file mode 100644 index a7deeae46..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/util/TraitTypesResourceFactoryImpl.java +++ /dev/null @@ -1,59 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: TraitTypesResourceFactoryImpl.java,v 1.5 2010/04/27 17:40:11 gkessler Exp $ - */ -package org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.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.common.metadata.traittypes.traittypes.internal.util.TraitTypesResourceImpl - * @generated - */ -public class TraitTypesResourceFactoryImpl extends ResourceFactoryImpl { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - /** - * Creates an instance of the resource factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public TraitTypesResourceFactoryImpl() { - super(); - } - - /** - * Creates an instance of the resource. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Resource createResource(URI uri) { - XMLResource result = new TraitTypesResourceImpl(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; - } - -} //TraitTypesResourceFactoryImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/util/TraitTypesResourceImpl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/util/TraitTypesResourceImpl.java deleted file mode 100644 index 149899688..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/util/TraitTypesResourceImpl.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: TraitTypesResourceImpl.java,v 1.5 2010/04/27 17:40:11 gkessler Exp $ - */ -package org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.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.common.metadata.traittypes.traittypes.internal.util.TraitTypesResourceFactoryImpl - * @generated - */ -public class TraitTypesResourceImpl extends XMLResourceImpl { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - /** - * Creates an instance of the resource. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param uri the URI of the new resource. - * @generated - */ - public TraitTypesResourceImpl(URI uri) { - super(uri); - } - -} //TraitTypesResourceImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/util/TraitTypesSwitch.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/util/TraitTypesSwitch.java deleted file mode 100644 index a3548f12c..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/util/TraitTypesSwitch.java +++ /dev/null @@ -1,206 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: TraitTypesSwitch.java,v 1.10 2010/04/27 17:40:11 gkessler Exp $ - */ -package org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.util; - -import java.util.List; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.BooleanValue; -import org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.ListOfValues; -import org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.SetGenerator; -import org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.StringValue; -import org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.TraitTypesPackage; - -/** - * <!-- 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.common.metadata.traittypes.traittypes.TraitTypesPackage - * @generated - */ -public class TraitTypesSwitch { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - /** - * The cached model package - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected static TraitTypesPackage modelPackage; - - /** - * Creates an instance of the switch. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public TraitTypesSwitch() { - if (modelPackage == null) { - modelPackage = TraitTypesPackage.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 TraitTypesPackage.LIST_OF_VALUES: { - ListOfValues listOfValues = (ListOfValues)theEObject; - Object result = caseListOfValues(listOfValues); - if (result == null) result = defaultCase(theEObject); - return result; - } - case TraitTypesPackage.SET_GENERATOR: { - SetGenerator setGenerator = (SetGenerator)theEObject; - Object result = caseSetGenerator(setGenerator); - if (result == null) result = defaultCase(theEObject); - return result; - } - case TraitTypesPackage.STRING_VALUE: { - StringValue stringValue = (StringValue)theEObject; - Object result = caseStringValue(stringValue); - if (result == null) result = defaultCase(theEObject); - return result; - } - case TraitTypesPackage.BOOLEAN_VALUE: { - BooleanValue booleanValue = (BooleanValue)theEObject; - Object result = caseBooleanValue(booleanValue); - if (result == null) result = defaultCase(theEObject); - return result; - } - default: return defaultCase(theEObject); - } - } - - /** - * Returns the result of interpreting the object as an instance of '<em>List Of Values</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>List Of Values</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object caseListOfValues(ListOfValues object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Set Generator</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>Set Generator</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object caseSetGenerator(SetGenerator object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>String Value</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>String Value</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object caseStringValue(StringValue object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Boolean Value</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>Boolean Value</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object caseBooleanValue(BooleanValue 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; - } - -} //TraitTypesSwitch diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/util/TraitTypesXMLProcessor.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/util/TraitTypesXMLProcessor.java deleted file mode 100644 index f65ad6be6..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/util/TraitTypesXMLProcessor.java +++ /dev/null @@ -1,56 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: TraitTypesXMLProcessor.java,v 1.6 2010/04/27 17:40:11 gkessler Exp $ - */ -package org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.util; - -import java.util.Map; - -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.xmi.util.XMLProcessor; -import org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.TraitTypesPackage; - -/** - * This class contains helper methods to serialize and deserialize XML documents - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -public class TraitTypesXMLProcessor extends XMLProcessor { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - - /** - * Public constructor to instantiate the helper. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public TraitTypesXMLProcessor() { - super((EPackage.Registry.INSTANCE)); - TraitTypesPackage.eINSTANCE.eClass(); - } - - /** - * Register for "*" and "xml" file extensions the TraitTypesResourceFactoryImpl factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Map getRegistrations() { - if (registrations == null) { - super.getRegistrations(); - registrations.put(XML_EXTENSION, new TraitTypesResourceFactoryImpl()); - registrations.put(STAR_EXTENSION, new TraitTypesResourceFactoryImpl()); - } - return registrations; - } - -} //TraitTypesXMLProcessor diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/package-info.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/package-info.java deleted file mode 100644 index 76e224562..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/package-info.java +++ /dev/null @@ -1,17 +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 - * - ********************************************************************************/ - -/** - * Common meta-data traits. - * <p><b>Provisional API - subject to change</b></p> - */ -package org.eclipse.jst.jsf.common.metadata.traittypes.traittypes; diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/sets/AxiomaticSet.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/sets/AxiomaticSet.java deleted file mode 100644 index 8bc288141..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/sets/AxiomaticSet.java +++ /dev/null @@ -1,88 +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.common.sets; - -import java.util.Set; - -/** - * A java.util.Set with the basic mathematic set axioms of - * extensionality (equality), union, intersection, - * relative complement (set subtraction) and empty (already - * supported by Set). - * - * <p><b>Provisional API - subject to change</b></p> - * - * @author cbateman - * - */ -public interface AxiomaticSet extends Set -{ - /** - * Implementations should aim to provide O(mn) time cost - * where n is the number of elements in this set and - * m is the cost to check membership of an element in this - * set in toSet. When a set is itself a member of a set, - * the implementation must call isEquivalent on those subsets - * recursively. - * - * @param toSet - * - * @return true iff this set is equivalent toSet. Note - * that extensionality holds that two sets are equivalent - * if and only if they contain exactly the same elements. - * - * - */ - boolean isEquivalent(AxiomaticSet toSet); - - /** - * @param set - * @return the axiomatic union of this set with set - */ - AxiomaticSet union(AxiomaticSet set); - - - /** - * @param set - * @return the axiomatic intersection of this set with set - */ - AxiomaticSet intersect(AxiomaticSet set); - - /** - * @param set - * @return convenience method that must be equivalent to - * (this.intersect(set).isEmpty()) - */ - boolean isDisjoint(AxiomaticSet set); - - /** - * The set constructed by the removing the intersection - * of this with set from this. The set will contain all - * elements in this that are not in set. - * - * Eqivalence: this - set - * - * @param set - * @return the relative complement or theoretic difference of - * set from this - */ - AxiomaticSet subtract(AxiomaticSet set); - - /** - * @return the first element in the set. There is no guarantee which element - * will be chosen, but the call should always return the same element of the set - * for multiple invocations on the same set. Generally this is a convience method - * for when the set only contains one element. - * - * @throws java.util.NoSuchElementException if the set is empty. - */ - Object getFirstElement(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/sets/AxiomaticSetUtil.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/sets/AxiomaticSetUtil.java deleted file mode 100644 index baf9f8d7a..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/sets/AxiomaticSetUtil.java +++ /dev/null @@ -1,109 +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.common.sets; - -import java.util.Iterator; -import java.util.Set; - -/** - * Generic (unoptimized) utilities for doing set operations. - * - * <p><b>Provisional API - subject to change</b></p> - * - * @author cbateman - * - */ -public class AxiomaticSetUtil -{ - /** - * Creates the union of firstSet and secondSet in newSet. - * @param newSet - * @param firstSet - * @param secondSet - */ - public static void union(AxiomaticSet newSet, AxiomaticSet firstSet, AxiomaticSet secondSet) - { - newSet.addAll(firstSet); - newSet.addAll(secondSet); - } - - /** - * Creates an intersection of firstSet and secondSet in newSet - * @param newSet - * @param firstSet - * @param secondSet - */ - public static void intersect(AxiomaticSet newSet, AxiomaticSet firstSet, AxiomaticSet secondSet) - { - // minor optimization: always iterate through the smaller of the - // two sets. This way we iterate through the smallest number - // of elements - Iterator it = null; - Set testSet = null; - // if other set smaller, get its iterator - if (secondSet.size() < firstSet.size()) - { - it = secondSet.iterator(); - // test set is other set - testSet = firstSet; - } - // first set is smaller or same - else - { - it = firstSet.iterator(); - testSet = secondSet; - } - - while (it.hasNext()) - { - Object member = it.next(); - if (testSet.contains(member)) - { - newSet.add(member); - } - } - } - - /** - * @param firstSet - * @param secondSet - * @return true firstSet and secondSet have no common elements (their intersection is empty) - */ - public static boolean isDisjoint(AxiomaticSet firstSet, AxiomaticSet secondSet) - { - return firstSet.intersect(secondSet).isEmpty(); - } - - /** - * @param firstOperand - * @param secondOperand - * @return the set formed by removing the intersection of firstOperand and secondOperand - * from firstOperand, leaving only those elements in firstOperand that are not in secondOperand - */ - public static AxiomaticSet subtract( - AxiomaticSet firstOperand, AxiomaticSet secondOperand) - { - ConcreteAxiomaticSet relativeComplement = new ConcreteAxiomaticSet(); - - // iterate through firstOperand and add each element to the result - // set that is not in secondOperand - for (final Iterator it = firstOperand.iterator(); it.hasNext();) - { - Object member = it.next(); - if (!secondOperand.contains(member)) - { - relativeComplement.add(member); - } - } - - return relativeComplement; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/sets/ConcreteAxiomaticSet.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/sets/ConcreteAxiomaticSet.java deleted file mode 100644 index b82c03fd6..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/sets/ConcreteAxiomaticSet.java +++ /dev/null @@ -1,58 +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.common.sets; - -import java.util.HashSet; - -/** - * Implements a simple axiomatic set based on a hashset - * - * <p><b>Provisional API - subject to change</b></p> - * - * @author cbateman - * - */ -public class ConcreteAxiomaticSet extends HashSet implements AxiomaticSet { - - /** - * serial version id - */ - private static final long serialVersionUID = 7094728081135008203L; - - public AxiomaticSet intersect(AxiomaticSet set) { - AxiomaticSet intersection = new ConcreteAxiomaticSet(); - AxiomaticSetUtil.intersect(intersection, this, set); - return intersection; - } - - public boolean isEquivalent(AxiomaticSet toSet) { - return equals(toSet); - } - - public AxiomaticSet union(AxiomaticSet set) { - AxiomaticSet union = new ConcreteAxiomaticSet(); - AxiomaticSetUtil.union(union, this, set); - return union; - } - - public boolean isDisjoint(AxiomaticSet set) { - return AxiomaticSetUtil.isDisjoint(this, set); - } - - public Object getFirstElement() { - return iterator().next(); - } - - public AxiomaticSet subtract(AxiomaticSet set) { - return AxiomaticSetUtil.subtract(this, set); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/sets/NodeSet.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/sets/NodeSet.java deleted file mode 100644 index 146b83360..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/sets/NodeSet.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.common.sets; - -import java.util.AbstractSet; -import java.util.Iterator; -import java.util.NoSuchElementException; - -import org.w3c.dom.NodeList; - -/** - * A set backed by a W3C NodeList so as to avoid copying. Note that operations - * that return new sets still invoke a copy. Also, membership operations - * require O(n) time. This should generally used for sets that are assumed to be - * small where O(n) search time will be small compared to doing a full copy. - * - * This set is immutable (mutation methods throw exceptions) - * - * <p><b>Provisional API - subject to change</b></p> - * - * @author cbateman - * - */ -public class NodeSet extends AbstractSet implements AxiomaticSet -{ - private NodeList _data; - - /** - * @param data -- wrap the actual data source - */ - public NodeSet(NodeList data) - { - _data = data; - } - - public Iterator iterator() { - return new Iterator() - { - private int pos = 0; - - public boolean hasNext() { - return pos < _data.getLength(); - } - - public Object next() { - return _data.item(pos++); - } - - public void remove() { - throw new UnsupportedOperationException(); - } - - }; - } - - public int size() { - return _data.getLength(); - } - - public AxiomaticSet intersect(AxiomaticSet set) { - ConcreteAxiomaticSet newSet = new ConcreteAxiomaticSet(); - AxiomaticSetUtil.intersect(newSet, this, set); - return newSet; - } - - public boolean isEquivalent(AxiomaticSet toSet) { - if (this == toSet) - { - return true; - } - - if (toSet instanceof NodeSet - && ((NodeSet)toSet)._data == this._data) - { - return true; - } - - // if different sizes, false - if (toSet.size() != size()) - { - return false; - } - - // otherwise, compare item by item - // Iterator through me with the hope that look ups - // are more efficent in toSet - for (Iterator it = iterator(); it.hasNext();) - { - Object obj = it.next(); - - if (!toSet.contains(obj)) - { - // fail fase on membership mismatch - return false; - } - } - - // if we get to here then the item by item match succeeded - return true; - } - - public AxiomaticSet union(AxiomaticSet set) { - ConcreteAxiomaticSet newSet = new ConcreteAxiomaticSet(); - AxiomaticSetUtil.union(newSet, this, set); - return newSet; - } - - public boolean isDisjoint(AxiomaticSet set) { - return AxiomaticSetUtil.isDisjoint(this, set); - } - - public Object getFirstElement() { - if (_data.getLength()>0) - { - return _data.item(0); - } - throw new NoSuchElementException("Set is empty"); //$NON-NLS-1$ - } - - public AxiomaticSet subtract(AxiomaticSet set) { - return AxiomaticSetUtil.subtract(this, set); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/sets/constraint/AbstractMemberConstraint.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/sets/constraint/AbstractMemberConstraint.java deleted file mode 100644 index d71ebf020..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/sets/constraint/AbstractMemberConstraint.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.common.sets.constraint; - -import org.eclipse.emf.common.util.Diagnostic; -import org.eclipse.jst.jsf.common.sets.AxiomaticSet; - -/** - * A set constraint that is specific to members of the set. - * - * <p><b>Provisional API - subject to change</b></p> - * - * @author cbateman - * - */ -public class AbstractMemberConstraint extends AbstractSetConstraint { - - public Diagnostic isSatisfied(AxiomaticSet set) { - return null; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/sets/constraint/AbstractSetConstraint.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/sets/constraint/AbstractSetConstraint.java deleted file mode 100644 index f176a3775..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/sets/constraint/AbstractSetConstraint.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.common.sets.constraint; - -import org.eclipse.emf.common.util.Diagnostic; -import org.eclipse.jst.jsf.common.sets.AxiomaticSet; - -/** - * Super-class of all axiomatic set constraints. - * - * A set constraint applies one or more pre-conditions on a set - * and returns a diagnostic that flags whether or not the set - * satisfies that constraint or not. - * - * <p><b>Provisional API - subject to change</b></p> - * - * @author cbateman - * - */ -public abstract class AbstractSetConstraint -{ - /** - * The following post-conditions must hold: - * - * 1) if the set satisfies the constraint with no caveats, - * the returned diagnostic must in turn satisfy - * Diagnostic.getSeverity() == Diagnostic.OK - * - * 2) if the set does not satisfy the constraint, the returned diagnostic - * must satisfy Diagnostic.getSeverity() == Diagnostic.ERROR - * - * 3) if the set strictly satisfies the constraint but the constraint includes - * parameters that can only be heuristically applied, the constraint may choose - * to return a diagnostic where Diagnostic.getSeverity() == Diagnostic.WARNING - * - * The diagnostic returned should _never_ have any other severity but OK, ERROR or WARNING - * - * Algorithmically: - * - * Constraint is satisfied can be tested by Diagnostic.getSeverity() != ERROR - * Constraint is not satisfied can be tested by Diagnostic.getSeverity() == ERROR - * - * @param set - * @return a diagnostic object that contains information about whether - * or not the constraint is satisfied for set. - * <b>MUST NOT RETURN NULL</b> - */ - public abstract Diagnostic isSatisfied(AxiomaticSet set); - - /** - * Convenience method - * - * @param set - * @return true if the constraint is satisfied for set - */ - public final boolean passesConstraint(AxiomaticSet set) - { - return isSatisfied(set).getSeverity() != Diagnostic.ERROR; - } - - /** - * Convenience method - * - * @param set - * @return true if the constraint is <b>not</b> satisfied for set - */ - public final boolean failsConstraint(AxiomaticSet set) - { - return !passesConstraint(set); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/sets/constraint/package-info.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/sets/constraint/package-info.java deleted file mode 100644 index 94a901681..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/sets/constraint/package-info.java +++ /dev/null @@ -1,17 +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 - * - ********************************************************************************/ - -/** - * Classes for creating validation constraints on sets. - * <p><b>Provisional API - subject to change</b></p> - */ -package org.eclipse.jst.jsf.common.sets.constraint; diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/sets/mapping/AbstractObjectInjectiveSetMapping.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/sets/mapping/AbstractObjectInjectiveSetMapping.java deleted file mode 100644 index 8c2d5b53a..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/sets/mapping/AbstractObjectInjectiveSetMapping.java +++ /dev/null @@ -1,75 +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.common.sets.mapping; - -import java.util.Iterator; - -import org.eclipse.jst.jsf.common.sets.AxiomaticSet; -import org.eclipse.jst.jsf.common.sets.ConcreteAxiomaticSet; - -/** - * Super-class of all ObjectInjectiveSetMapping. - * - * <p><b>Provisional API - subject to change</b></p> - * - * @author cbateman - * - */ -public abstract class AbstractObjectInjectiveSetMapping implements - ObjectInjectiveSetMapping { - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.sets.mapping.ObjectInjectiveSetMapping#mapIterator(org.eclipse.jst.jsf.common.sets.AxiomaticSet) - */ - public Iterator mapIterator(final AxiomaticSet set) - { - return new Iterator() - { - final Iterator setIterator = set.iterator(); - - public boolean hasNext() - { - return setIterator.hasNext(); - } - - public Object next() - { - return map(setIterator.next()); - } - - public void remove() - { - throw new UnsupportedOperationException("cannot modify iterator"); //$NON-NLS-1$ - } - }; - } - - /** - * @param element - * @return the result object from the mapping on element - */ - public abstract Object map(Object element); - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.sets.mapping.AxiomaticSetMapping#map(org.eclipse.jst.jsf.common.sets.AxiomaticSet) - */ - public final AxiomaticSet map(AxiomaticSet set) { - AxiomaticSet resultSet = new ConcreteAxiomaticSet(); - - for (final Iterator it = mapIterator(set); it.hasNext();) - { - resultSet.add(it.next()); - } - - return resultSet; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/sets/mapping/AxiomaticSetMapping.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/sets/mapping/AxiomaticSetMapping.java deleted file mode 100644 index d6ab1ff51..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/sets/mapping/AxiomaticSetMapping.java +++ /dev/null @@ -1,35 +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.common.sets.mapping; - -import org.eclipse.jst.jsf.common.sets.AxiomaticSet; - -/** - * Defines an axiomatic mapping from set to another. In formal notation, this may - * also be defined as a "function" or a "proposition". - * - * Applying the map method can be seen as being equivalent to: - * - * AxiomaticSetMapping: set -> map(set) - * - * <p><b>Provisional API - subject to change</b></p> - * - * @author cbateman - * - */ -public interface AxiomaticSetMapping -{ - /** - * @param set - * @return the new set resulting from applying the map to set - */ - AxiomaticSet map(AxiomaticSet set); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/sets/mapping/ObjectInjectiveSetMapping.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/sets/mapping/ObjectInjectiveSetMapping.java deleted file mode 100644 index ce33eecc3..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/sets/mapping/ObjectInjectiveSetMapping.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.common.sets.mapping; - -import java.util.Iterator; - -import org.eclipse.jst.jsf.common.sets.AxiomaticSet; - -/** - * A type of axiomatic set mapping that operates injectively on the input - * set to create its result set. Note that the injection (one-to-oneness) - * of the mapping is based on Java objects and not on the value of the object. - * Therefore, the result set is not guaranteed to be injective on the basis - * of value. - * - * For example, consider a set of integers: - * - * X = {new Integer(4), new Integer(6), new Integer(9)} - * - * an ObjectInjectiveSetMapping may be defined that maps this set - * to a result based on: - * - * map(x) = new Boolean(x < 8) for all x in X - * - * An ObjectiveInjectiveSetMapping result set would look like this: - * - * map(X) = {new Boolean(true), new Boolean(true), new Boolean(false)} - * - * Note that boolean TRUE maps twice, so based on the value of the set members, - * the mapping is not injective. However, each Java object in X maps to a - * distinct Java object in map(X) - * - * This interface should not be implemented by clients. Clients should - * sub-class AbstractObjectInjectiveSetMapping to avoid future API breakage. - * - * <p><b>Provisional API - subject to change</b></p> - * - * @author cbateman - * - */ -public interface ObjectInjectiveSetMapping extends AxiomaticSetMapping -{ - /** - * This method optimizes the case where a client wants to apply some - * mapping or constraint to each element of a set until a particular - * condition applies and then stop. - * - * Mapping's that implement this - * interface should generally implement their map(set) method as: - * - * for (Iterator it = mapIterator(set); it.hasNext();) - * { - * result.add(doMapping(it.next)); - * } - * - * @param set - * @return an iterator that allows a client to apply the mapping - * one element of set at a time. The iterator is immutable and should - * throw UnsupportedOperationException if remove() is called. - */ - public Iterator mapIterator(AxiomaticSet set); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/sets/mapping/package-info.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/sets/mapping/package-info.java deleted file mode 100644 index 8a7dacc7d..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/sets/mapping/package-info.java +++ /dev/null @@ -1,17 +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 - * - ********************************************************************************/ - -/** - * Classes for creating member mappings between sets. - * <p><b>Provisional API - subject to change</b></p> - */ -package org.eclipse.jst.jsf.common.sets.mapping; diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/sets/package-info.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/sets/package-info.java deleted file mode 100644 index 744883704..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/sets/package-info.java +++ /dev/null @@ -1,17 +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 - * - ********************************************************************************/ - -/** - * Axiomatic Sets framework. - * <p><b>Provisional API - subject to change</b></p> - */ -package org.eclipse.jst.jsf.common.sets; diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/util/JDTBeanIntrospector.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/util/JDTBeanIntrospector.java deleted file mode 100644 index 5175158cf..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/util/JDTBeanIntrospector.java +++ /dev/null @@ -1,217 +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.common.util; - -import java.beans.Introspector; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.jdt.core.Flags; -import org.eclipse.jdt.core.IMethod; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.ITypeHierarchy; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jdt.core.Signature; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; - -/** - * A class that does bean introspection on a JDT IType - * - * This functionality is not meant to replace runtime bean - * introspection. Rather, it is meant to provide a - * more "lightweight" (in terms of class loading as well as - * error handling of bean instantiation out of context) way - * to determine a bean's properties at design time. - * - * This class may not be sub-classed by clients. - * - * @author cbateman - * - */ -public class JDTBeanIntrospector -{ - private final static String GET_PREFIX = "get"; //$NON-NLS-1$ - private final static String SET_PREFIX = "set"; //$NON-NLS-1$ - private final static String IS_PREFIX = "is"; //$NON-NLS-1$ - - private final IType _type; - private final HashMap<String, String> _resolvedSignatures; - - /** - * @param type - */ - public JDTBeanIntrospector(IType type) - { - _type = type; - _resolvedSignatures = new HashMap<String, String>(); - } - - /** - * @return an map of all properties with the property names - * as keys and the values being JDTBeanProperty objects representing - * the properties. - */ - public Map<String, JDTBeanProperty> getProperties() - { - _resolvedSignatures.clear(); - - final Map<String, JDTBeanProperty> propertiesWorkingCopy = - new HashMap<String, JDTBeanProperty>(); - final IMethod[] methods = getAllMethods(); - - for (int i = 0; i < methods.length; i++) - { - final IMethod method = methods[i]; - - try - { - processPropertyMethod(method, propertiesWorkingCopy); - } - catch (JavaModelException jme) - { - // log and then proceed to next method - JSFCommonPlugin.log(jme, "Error processing IMethod for bean property info"); //$NON-NLS-1$ - } - } - - final Map properties = new HashMap(); - - for (Entry<String, JDTBeanProperty> entry : propertiesWorkingCopy.entrySet()) - { - final String key = entry.getKey(); - JDTBeanPropertyWorkingCopy wcopy = (JDTBeanPropertyWorkingCopy) entry.getValue(); - properties.put(key, wcopy.toValueObject()); - } - - return properties; - } - - private void processPropertyMethod(IMethod method, Map<String, JDTBeanProperty> properties) throws JavaModelException - { - // to be a bean method, it must not a constructor, must be public - // and must not be static - if (!method.isConstructor() - && ( Flags.isPublic(method.getFlags()) - || _type.isInterface()) - && !Flags.isStatic(method.getFlags())) - { - final String methodName = method.getElementName(); - final String returnType = method.getReturnType(); - - // either starts with get or is boolean and starts with is - - // is access must start with 'is', have a boolean return type and no parameters - final boolean startsWithIs = methodName.startsWith(IS_PREFIX) - && Signature.SIG_BOOLEAN.equals(returnType) - && method.getNumberOfParameters() == 0 - && methodName.length() > IS_PREFIX.length(); - - // get accessor must start with 'get', have no parameters and return non-void - final boolean startsWithGet = (methodName.startsWith(GET_PREFIX) - && method.getNumberOfParameters() == 0) - && !Signature.SIG_VOID.equals(returnType) - && methodName.length() > GET_PREFIX.length(); - - // mutator must start with 'set' and have one parameter and a void return type - final boolean startsWithSet = methodName.startsWith(SET_PREFIX) - && method.getNumberOfParameters() == 1 - && Signature.SIG_VOID.equals(returnType) - && methodName.length() > SET_PREFIX.length(); - - if (startsWithGet || startsWithSet || startsWithIs) - { - final String propertyName = - Introspector.decapitalize(methodName.substring(startsWithIs ? 2 : 3)); - - JDTBeanPropertyWorkingCopy workingCopy = - (JDTBeanPropertyWorkingCopy) properties.get(propertyName); - - if (workingCopy == null) - { - workingCopy = new JDTBeanPropertyWorkingCopy(_type, _resolvedSignatures); - properties.put(propertyName, workingCopy); - } - - if (startsWithIs) - { - workingCopy.setIsGetter(method); - } - else if (startsWithGet) - { - workingCopy.setGetter(method); - } - else if (startsWithSet) - { - workingCopy.addSetter(method); - } - } - } - } - - /** - * @return all methods for the type including inherited ones - */ - public IMethod[] getAllMethods() - { - IMethod[] methods = new IMethod[0]; - - try - { - // type not resolved so don't proceed - if (_type != null) - { - // TODO: type hierarchy is potentially expensive, should - // cache once and listen for changes - ITypeHierarchy hierarchy = _type.newSupertypeHierarchy(new NullProgressMonitor()); - - methods = getAllMethods(hierarchy, _type); - } - } - catch(JavaModelException jme) - { - JSFCommonPlugin.log(jme, "Error getting type information for bean"); //$NON-NLS-1$ - } - - return methods; - } - - /** - * @param typeHierarchy - * @param type - * @return all methods of the type and it's super types - */ - private static IMethod[] getAllMethods(final ITypeHierarchy typeHierarchy, final IType type) - { - final List<IMethod> methods = new ArrayList<IMethod>(); - final IType[] superTypes = typeHierarchy.getAllSuperclasses(type); - final IType[] closure = new IType[superTypes.length+1]; - closure[0] = type; - System.arraycopy(superTypes, 0, closure, 1, superTypes.length); - - for (int i = 0; i < closure.length; i++) - { - try { - final IType superType = closure[i]; - methods.addAll(Arrays.asList(superType.getMethods())); - } catch (JavaModelException e) { - JSFCommonPlugin.log(e, "Error getting super type information for bean"); //$NON-NLS-1$ - } - } - - return methods.toArray(new IMethod[methods.size()]); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/util/JDTBeanProperty.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/util/JDTBeanProperty.java deleted file mode 100644 index a43bd72fe..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/util/JDTBeanProperty.java +++ /dev/null @@ -1,253 +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.common.util; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.jdt.core.IMethod; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jdt.core.Signature; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; - -/** - * Represents a single bean property backed by JDT data - * - * This class may not be sub-classed by clients. - * - * @author cbateman - * - */ -public class JDTBeanProperty -{ - /** - * the IMethod for the accessor (either is or get) - */ - private IMethod _getter; - - /** - * the IMethod for a "set" accessor method - */ - private IMethod _setter; - - /** - * The IType that this property belongs to - */ - protected final IType _type; - - /** - * @param type - */ - protected JDTBeanProperty(IType type) - { - _type = type; - } - - /** - * @return true if this property is readable - */ - public boolean isReadable() - { - return _getter != null; - } - - /** - * @return true if this property is writable - */ - public boolean isWritable() - { - return _setter != null; - } - - - /** - * @return the get accessor IMethod or null if none - */ - public IMethod getGetter() { - return _getter; - } - - - - /** - * Set the get accessor IMethod - * @param getter -- may be null to indicate none - */ - void setGetter(IMethod getter) { - _getter = getter; - } - - - /** - * @return the set mutator IMethod or null if none - */ - public IMethod getSetter() { - return _setter; - } - - /** - * @param setter - */ - void setSetter(IMethod setter) { - _setter = setter; - } - - /** - * @return the IType for this property's type or null if it - * cannot determined. Note that null does not necessarily indicate an error - * since some types like arrays of things do not have corresponding JDT IType's - * If typeSignature represents an array, the base element IType is returned - * if possible - */ - public IType getType() - { - final String typeSignature = Signature.getElementType(getTypeSignature()); - return TypeUtil.resolveType(_type, typeSignature); - } - - /** - * @return the number of array nesting levels in typeSignature. - * Returns 0 if not an array. - */ - public int getArrayCount() - { - final String sig = getTypeSignature(); - if (sig == null) - return 0; - return Signature.getArrayCount(sig); - } - - /** - * @return true if property is an enum type, false otherwise or if cannot be resolved - */ - public boolean isEnumType() - { - return TypeUtil.isEnumType(getType()); - } - - /** - * Fully equivalent to: - * - * getTypeSignature(true) - * - * @return the fully resolved (if possible) type signature for - * the property or null if unable to determine. - * - * NOTE: this is the "type erasure" signature, so any type parameters - * will be removed and only the raw type signature will be returned. - */ - public String getTypeSignature() - { - return getTypeSignature(true); - } - - - /** - * @param eraseTypeParameters if true, the returned type has type parameters - * erased. If false, template types are resolved. - * - * @see org.eclipse.jst.jsf.common.util.TypeUtil#resolveTypeSignature(IType, String, boolean) - * for more information on how specific kinds of unresolved generics are resolved - * - * @return the fully resolved (if possible) type signature for - * the property or null if unable to determine. - */ - public String getTypeSignature(boolean eraseTypeParameters) - { - try - { - String unResolvedSig = getUnresolvedType(); - return TypeUtil.resolveTypeSignature(_type, unResolvedSig, eraseTypeParameters); - } - catch (JavaModelException jme) - { - JSFCommonPlugin.log(jme, "Error resolving bean property type signature"); //$NON-NLS-1$ - return null; - } - } - - /** - * For example, if this property was formed from: List<String> getListOfStrings() - * then the list would consist of the signature "Ljava.lang.String;". All - * nested type paramters are resolved - * - * @see org.eclipse.jst.jsf.common.util.TypeUtil#resolveTypeSignature(IType, String, boolean) - * for more information on how specific kinds of unresolved generics are resolved - * - * @return a list of type signatures (fully resolved if possible) - * of this property's bounding type parameters. - */ - public List<String> getTypeParameterSignatures() - { - List<String> signatures = new ArrayList<String>(); - - try - { - final String[] typeParameters = Signature.getTypeArguments(getUnresolvedType()); - //System.err.println(getUnresolvedType()); - for (String parameter : typeParameters) - { - //System.out.println(parameter); - signatures.add(TypeUtil.resolveTypeSignature(_type, parameter, false)); - } - } - catch (JavaModelException jme) - { - JSFCommonPlugin.log(jme, "Error resolving bean property type signature"); //$NON-NLS-1$ - // fall-through and return empty array - } - - return signatures; - } - -// public Map<String, String> getTypeParameterSignatureMap() -// { -// Map<String, String> signatures = new HashMap<String, String>(); -// -// try -// { -// final String[] typeParameters = Signature.getTypeArguments(getUnresolvedType()); -// -// for (String parameter : typeParameters) -// { -// signatures.add(TypeUtil.resolveTypeSignature(_type, parameter, false)); -// } -// } -// catch (JavaModelException jme) -// { -// JSFCommonPlugin.log(jme, "Error resolving bean property type signature"); //$NON-NLS-1$ -// // fall-through and return empty array -// } -// -// return signatures; -// } - - private String getUnresolvedType() throws JavaModelException - { - String typeSig = null; - - // first decide which method to use; getter always gets precendence - if (_getter != null) - { - typeSig = _getter.getReturnType(); - } - // TODO: if no getter or setter could we have been created? - // use setter - else - { - typeSig = _setter.getParameterTypes()[0]; - } - - return typeSig; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/util/JDTBeanPropertyWorkingCopy.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/util/JDTBeanPropertyWorkingCopy.java deleted file mode 100644 index 4179f0901..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/util/JDTBeanPropertyWorkingCopy.java +++ /dev/null @@ -1,193 +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.common.util; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.eclipse.jdt.core.IMethod; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; - -/** - * A writable version of the JDTBeanProperty object - * - * This class may not be sub-classed by clients - * - * @author cbateman - * - */ -public class JDTBeanPropertyWorkingCopy extends JDTBeanProperty -{ - private final List _setters; - - /** - * the IMethod for the boolean "is" accessor method - */ - private IMethod _isGetter; - - private final Map<String, String> _resolvedSignatureMap; - - /** - * @param type - * @param resolvedSignatureMap - */ - public JDTBeanPropertyWorkingCopy(IType type, Map<String, String> resolvedSignatureMap) - { - super(type); - _setters = new ArrayList(); - _resolvedSignatureMap = resolvedSignatureMap; - } - /** - * Constructor - * @param type - */ - public JDTBeanPropertyWorkingCopy(IType type) - { - super(type); - _setters = new ArrayList(); - _resolvedSignatureMap = new HashMap<String, String>(); - } - - /** - * @return the bean properties spawned from this working copy - * Normally, there is only one property in the array, however, - * since this working copy represents all properties with the same - * name, there could be multiple properties since setters can - * be overloaded by name and could result in zero or one readable - * properties plus zero or more write-only properties with the same - * name. I can't see anywhere in the spec that covers this - * boundary case - */ - public JDTBeanProperty toValueObject() - { - // if the isGetter is present that it takes precedence - // over the the normal getter - IMethod getter = getIsGetter() != null ? - getIsGetter() : getGetter(); - IMethod matchedSetter = null; - - if (getter != null) - { - matchedSetter = determineMatchedSetter(getter); - } - // if there's no getter than pick any setter: there - // are bigger problem when there's no getter than - // ambiguous setters - else if (_setters.size() > 0) - { - matchedSetter = (IMethod) _setters.get(0); - } - - JDTBeanProperty beanProp = new JDTBeanProperty(_type); - beanProp.setGetter(getter); - beanProp.setSetter(matchedSetter); - return beanProp; - - } - - private IMethod determineMatchedSetter(IMethod getter) - { - IMethod matchedSetter = null; - - // if there are no setters, there is no point in proceeding - if (_setters.size() < 1) - { - return null; - } - - try - { - final String getterSig = getResolvedSignature(_type, getter.getReturnType()); - FIND_MATCHING_SETTER:for - (final Iterator it = _setters.iterator(); it.hasNext();) - { - final IMethod setter = (IMethod) it.next(); - assert (setter.getNumberOfParameters() == 1); - final String paramSig = - getResolvedSignature - (_type,setter.getParameterTypes()[0]); - - if (paramSig.equals(getterSig)) - { - // we've found our match since only one - // setter with the same name as the getter - // can have the same matching type for a - // single arg method - matchedSetter = setter; - break FIND_MATCHING_SETTER; - } - } - } - catch (JavaModelException jme) - { - JSFCommonPlugin.log(jme, "Error determining getter return type, bean properties analysis may be inaccurate"); //$NON-NLS-1$ - } - - return matchedSetter; - } - - //@Override - public void setGetter(IMethod getter) { - super.setGetter(getter); - } - - /** - * @param isGetter - */ - public void setIsGetter(IMethod isGetter) { - _isGetter = isGetter; - } - - /** - * @param setter - */ - public void addSetter(IMethod setter) { - if (setter != null - && setter.getNumberOfParameters() == 1) - { - _setters.add(setter); - } - } - - /** - * Not supported on working copy. This is synthetically generated - * on toValueObject() - * @return nothing; throws exception - */ - public final IMethod getSetter() - { - throw new UnsupportedOperationException("Setter not calculated in working copy. Call toValueObject().getSetter()"); //$NON-NLS-1$ - } - - /** - * @return the "is" getter method or null if not found - */ - public IMethod getIsGetter() { - return _isGetter; - } - - private String getResolvedSignature(final IType type, final String unresolved) - { - String resolved = _resolvedSignatureMap.get(unresolved); - - if (resolved == null) - { - resolved = TypeUtil.resolveTypeSignature(_type, unresolved); - _resolvedSignatureMap.put(unresolved, resolved); - } - return resolved; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/util/TypeUtil.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/util/TypeUtil.java deleted file mode 100644 index 8a465d8d3..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/util/TypeUtil.java +++ /dev/null @@ -1,597 +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.common.util; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.jdt.core.IField; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.ITypeParameter; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jdt.core.Signature; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; -import org.eclipse.jst.jsf.common.internal.types.TypeConstants; -import org.eclipse.jst.jsf.common.internal.types.TypeInfoCache; - -/** - * Utility for handling IType's and type signatures - * - * Class is static and cannot be extended or instantiated. - * - * @author cbateman - * - */ -public final class TypeUtil -{ - static IType resolveType(final IType owningType, final String typeSignature) - { - // if type signature is already resolved then simply look it up - if (typeSignature.charAt(0) == Signature.C_RESOLVED - || (Signature.getTypeSignatureKind(typeSignature) == Signature.BASE_TYPE_SIGNATURE) - || (Signature.getTypeSignatureKind(typeSignature) == Signature.ARRAY_TYPE_SIGNATURE - && Signature.getElementType(typeSignature).charAt(0) == Signature.C_RESOLVED)) - { - IType type = null; - - try - { - type = owningType.getJavaProject(). - findType(getFullyQualifiedName(typeSignature)); - } - catch (JavaModelException jme) - { - // do nothing; return type == null; - } - - return type; - } - - - return resolveTypeRelative(owningType, typeSignature); - } - - /** - * Fully equivalent to: - * - * #resolveTypeSignature(owningType, typeSignature, true) - * - * If resolved, type signature has generic type parameters erased (absent). - * - * @param owningType - * @param typeSignature - * @return the resolved type signature for typeSignature in owningType or - * typeSignature unchanged if cannot resolve. - */ - public static String resolveTypeSignature(final IType owningType, final String typeSignature) - { - return resolveTypeSignature(owningType, typeSignature, true); - } - - /** - * Resolve typeSignature in the context of owningType. This method will return - * a type erased signture if eraseTypeParameters == true and will attempt to - * resolve and include parameters if eraseTypeParamters == false - * - * NOTE: special rules apply to the way unresolved type parameters and wildcards - * are resolved: - * - * 1) If a fully unresolved type parameter is found, then it will be replaced with Ljava.lang.Object; - * - * i.e. List<T> -> Ljava.util.List<Ljava.lang.Object;>; for any unresolved T. - * - * 2) Any bounded wildcard will be replaced by the bound: - * - * i.e. List<? extends String> -> Ljava.util.List<Ljava.lang.String;>; - * i.e. List<? super String> -> Ljava.util.List<Ljava.lang.String;>; - * - * Note limitation here: bounds that use 'super' will take the "best case" scenario that the list - * type is of that type. - * - * 3) The unbounded wildcard will be replaced by Ljava.lang.Object; - * - * i.e. List<?> -> Ljava.util.List<Ljava.lang.Object;>; - * - * - * The reason for this substition is to return the most accurate reasonable approximation - * of the type within what is known by owningType - * - * @param owningType - * @param typeSignature - * @param eraseTypeParameters if set to false, type parameters are resolved included - * in the signature - * @return the resolved type signature for typeSignature in owningType or - * typeSignature unchanged if cannot resolve. - */ - public static String resolveTypeSignature(final IType owningType, final String typeSignature, boolean eraseTypeParameters) - { - final int sigKind = Signature.getTypeSignatureKind(typeSignature); - - switch (sigKind) - { - case Signature.BASE_TYPE_SIGNATURE: - return typeSignature; - - case Signature.ARRAY_TYPE_SIGNATURE: - { - final String elementType = Signature.getElementType(typeSignature); - - if (Signature.getTypeSignatureKind(elementType) == Signature.BASE_TYPE_SIGNATURE) - { - return typeSignature; - } - - final String resolvedElementType = resolveSignatureRelative(owningType, elementType, eraseTypeParameters); - String resultType = ""; //$NON-NLS-1$ - for (int i = 0; i < Signature.getArrayCount(typeSignature);i++) - { - resultType+=Signature.C_ARRAY; - } - - return resultType+resolvedElementType; - } - - case Signature.TYPE_VARIABLE_SIGNATURE: - return resolveSignatureRelative(owningType, typeSignature, eraseTypeParameters); - - case Signature.CLASS_TYPE_SIGNATURE: - return resolveSignatureRelative(owningType, typeSignature, eraseTypeParameters); - - case Signature.WILDCARD_TYPE_SIGNATURE: - // strip the wildcard and try again. Too bad Signature doesn't seem to have a method - // for this - if (typeSignature.charAt(0) == Signature.C_STAR) - { - return TypeConstants.TYPE_JAVAOBJECT; - } - return resolveTypeSignature(owningType, typeSignature.substring(1), eraseTypeParameters); - - case Signature.CAPTURE_TYPE_SIGNATURE: - // strip the capture and try again - return resolveTypeSignature(owningType, Signature.removeCapture(typeSignature), eraseTypeParameters); -// case Signature.TYPE_VARIABLE_SIGNATURE: -// resolveSignatureRelative(owningType, typeSignature, eraseTypeParameters); - - default: - return typeSignature; - } - } - - /** - * @param owningType -- type relative to which typeSignature will be resolved - * @param typeSignature -- non-array type signature - * @return the resolved type signature if possible or typeSignature if not - */ - private static String resolveSignatureRelative(final IType owningType, final String typeSignature, final boolean eraseTypeParameters) - { - // if already fully resolved, return the input - if (typeSignature.charAt(0) == Signature.C_RESOLVED) - { - return typeSignature; - } - - List<String> typeParameters = new ArrayList<String>(); - - IType resolvedType = resolveTypeRelative(owningType, typeSignature); - - if (resolvedType != null) - { - if (!eraseTypeParameters) - { - // ensure that type parameters are resolved recursively - for (String typeParam : Signature.getTypeArguments(typeSignature)) - { - typeParam = Signature.removeCapture(typeParam); - // check and remove bound wildcarding (extends/super/?) - if (Signature.getTypeSignatureKind(typeParam) == Signature.WILDCARD_TYPE_SIGNATURE) - { - // convert ? to Object, strip extends/super - if (typeParam.charAt(0) == Signature.C_STAR) - { - typeParam = TypeConstants.TYPE_JAVAOBJECT; - } - else - { - typeParam = typeParam.substring(1); - } - } - final String resolvedParameter = - resolveSignatureRelative( - // use the enclosing type, - // *not* the resolved type because - // we need to resolve in that context - owningType, - typeParam, eraseTypeParameters); - typeParameters.add(resolvedParameter); - } - } - - final String resolvedTypeSignature = - Signature.createTypeSignature - (resolvedType.getFullyQualifiedName(), true); - - - if (typeParameters.size() > 0 && !eraseTypeParameters) - { - StringBuffer sb = new StringBuffer(resolvedTypeSignature); - - if (sb.charAt(sb.length()-1) == ';') - { - sb = sb.delete(sb.length()-1, sb.length()); - } - - sb.append("<"); //$NON-NLS-1$ - for(String param : typeParameters) - { - //System.out.println("type param: "+resolvedType.getTypeParameter(param)); - sb.append(param); - } - - // replace the dangling ',' with the closing ">" - sb.append(">;"); //$NON-NLS-1$ - return sb.toString(); - } - - return resolvedTypeSignature; - } - - if (Signature.getTypeSignatureKind(typeSignature) == - Signature.CLASS_TYPE_SIGNATURE - || Signature.getTypeSignatureKind(typeSignature) - == Signature.TYPE_VARIABLE_SIGNATURE) - { - // if we are unable to resolve, check to see if the owning type has - // a parameter by this name - ITypeParameter typeParam = owningType.getTypeParameter(Signature.getSignatureSimpleName(typeSignature)); - - // if we have a type parameter and it hasn't been resolved to a type, - // then assume it is a method template placeholder (i.e. T in ArrayList). - // at runtime these unresolved parameter variables are effectively - // turned into Object's. For example, think List.add(E o). At runtime, - // E will behave exactly like java.lang.Object in that signature - if (typeParam.exists()) - { - return TypeConstants.TYPE_JAVAOBJECT; - } - - // TODO: is there a better way to handle a failure to resolve - // than just garbage out? - //JSFCommonPlugin.log(new Exception("Failed to resolve type: "+typeSignature), "Failed to resolve type: "+typeSignature); //$NON-NLS-1$ //$NON-NLS-2$ - } - - return typeSignature; - } - - private static IType resolveTypeRelative(final IType owningType, final String typeSignature) - { - final String fullName = getFullyQualifiedName(typeSignature); - - IType resolvedType = null; - - try - { - // TODO: this call is only supported on sourceTypes! - String[][] resolved = owningType.resolveType(fullName); - - if (resolved != null && resolved.length > 0) - { - resolvedType = owningType.getJavaProject().findType(resolved[0][0], resolved[0][1]); - } - else - { - resolvedType = resolveInParents(owningType, fullName); - } - } - catch (JavaModelException jme) - { - // do nothing; newType == null - } - - return resolvedType; - } - - /** - * @param type - * @return a type signature for a type - */ - public static String getSignature(IType type) - { - final String fullyQualifiedName = type.getFullyQualifiedName(); - return Signature.createTypeSignature(fullyQualifiedName, true); - } - - - /** - * @param owner - * @param unresolvedSignature - * @return the resolved method signature for unresolvedSignature in owner - */ - public static String resolveMethodSignature(final IType owner, - final String unresolvedSignature) - { - - final String unresolvedSignatureNormalized = - unresolvedSignature.replaceAll("/", "."); //$NON-NLS-1$ //$NON-NLS-2$ - - // get the list of parameters - final String[] parameters = - Signature.getParameterTypes(unresolvedSignatureNormalized); - - for (int i = 0; i < parameters.length; i++) - { - // try to full resolve the type - parameters[i] = resolveTypeSignature(owner, parameters[i]); - } - - // resolve return type - final String resolvedReturn = - resolveTypeSignature(owner, - Signature.getReturnType(unresolvedSignatureNormalized)); - - return Signature.createMethodSignature(parameters, resolvedReturn); - } - - /** - * @param typeSignature - * @return a fully qualified Java class name from a type signature - * i.e. Ljava.lang.String; -> java.lang.String - */ - public static String getFullyQualifiedName(final String typeSignature) - { - final String packageName = Signature.getSignatureQualifier(typeSignature); - final String typeName = Signature.getSignatureSimpleName(typeSignature); - return "".equals(packageName) ? typeName : packageName + "." + typeName; //$NON-NLS-1$//$NON-NLS-2$ - } - - private static IType resolveInParents(IType childType, String fullyQualifiedName) - throws JavaModelException - { - IType resolvedType = null; - - final TypeInfoCache typeInfoCache = TypeInfoCache.getInstance(); - IType[] superTypes = typeInfoCache.getCachedSupertypes(childType); - if (superTypes == null) { - superTypes = typeInfoCache.cacheSupertypesFor(childType); - } - - String[][] resolved; - - LOOP_UNTIL_FIRST_MATCH: - for (int i = 0; i < superTypes.length; i++) - { - final IType type = superTypes[i]; - - resolved = type.resolveType(fullyQualifiedName); - - if (resolved != null && resolved.length > 0) - { - resolvedType = childType.getJavaProject().findType(resolved[0][0], resolved[0][1]); - break LOOP_UNTIL_FIRST_MATCH; - } - } - - return resolvedType; - } - - /** - * Attempts to get a Java IType for a fully qualified signature. Note that - * generic type arguments are generally ignored by JDT when doing such - * look ups. - * - * @param javaProject the project context inside which to resolve the type - * @param fullyResolvedTypeSignature a fully resolved type signature - * @return the IType if resolved, null otherwise - */ - public static IType resolveType(final IJavaProject javaProject, final String fullyResolvedTypeSignature) - { - String fullyQualifiedName = getFullyQualifiedName(fullyResolvedTypeSignature); - fullyQualifiedName = Signature.getTypeErasure(fullyQualifiedName); - try { - return javaProject.findType(fullyQualifiedName); - } catch (JavaModelException e) { - // accessible problem - JSFCommonPlugin.log(e); - return null; - } - } - - /** - * @param type - * @param typeParamSignature -- must be a Type Variable Signature - * @param typeArguments - * @return the signature for the type argument in typeArguments that matches the - * named typeParamSignature in type. - * @throws IllegalArgumentException if typeParamSignature is not valid - * - * For example, given type for java.util.Map, typeParamSignature == "V" and - * typeArguments = {Ljava.util.String;, Lcom.test.Blah;}, the result would be - * the typeArgument that matches "V", which is "Lcom.test.Blah;} - * - * returns null if the match cannot be found. - */ - public static String matchTypeParameterToArgument(final IType type, final String typeParamSignature, final List<String> typeArguments) - { - if (Signature.getTypeSignatureKind(typeParamSignature) != Signature.TYPE_VARIABLE_SIGNATURE) - { - throw new IllegalArgumentException(); - } - - try - { - ITypeParameter[] typeParams = type.getTypeParameters(); - - for (int pos = 0; pos < typeParams.length; pos++) - { - if (typeParams[pos].getElementName().equals(Signature.getSignatureSimpleName(typeParamSignature))) - { - if (pos < typeArguments.size()) - { - // TODO: should typeArguments.size ever != typeParams.length? - return typeArguments.get(pos); - } - } - } - } - catch (JavaModelException e) - { - JSFCommonPlugin.log(e); - } - - return null; - } - - /** - * @param type - * @param fieldName - * @return true if fieldName is a member of type. Note that if type is java.lang.Enum - * then this will always return true since we cannot know what fields the instance has (it could be any enum) - */ - public static boolean isEnumMember(final IType type, final String fieldName) - { - try - { - if (type == null || !isEnumType(type)) - { - throw new IllegalArgumentException("type must be non-null and isEnum()==true"); //$NON-NLS-1$ - } - - if (fieldName == null) - { - throw new IllegalArgumentException("fieldName must be non-null"); //$NON-NLS-1$ - } - - // if type is the java.lang.Enum, always true - if (TypeConstants.TYPE_ENUM_BASE.equals(Signature.createTypeSignature(type.getFullyQualifiedName(), true))) - { - return true; - } - - final IField field = type.getField(fieldName); - - if (field.exists() && field.isEnumConstant()) - { - return true; - } - } - catch (JavaModelException jme) - { - // fall through and return false - } - - return false; - } - - /** - * @param typeSig1 the type signature of the first enum. Must be non-null, fully resolved enum type. - * @param typeSig2 the type signature of the second enum. Must be non-null, fully resolved enum type. - * - * @return true if typeSig1.compareTo(typeSig2) is a legal operation (won't throw a CCE) - */ - public static boolean isEnumsCompareCompatible(final String typeSig1, final String typeSig2) - { - if (typeSig1 == null || typeSig2 == null) - { - throw new IllegalArgumentException("args must not be null"); //$NON-NLS-1$ - } - - if (Signature.getTypeSignatureKind(typeSig1) != Signature.CLASS_TYPE_SIGNATURE - || Signature.getTypeSignatureKind(typeSig2) != Signature.CLASS_TYPE_SIGNATURE) - { - throw new IllegalArgumentException("args must be resolved class types"); //$NON-NLS-1$ - } - - // if one or the other is the raw enum type, then they *may* be comparable; we don't know - if (TypeConstants.TYPE_ENUM_BASE.equals(typeSig1) - || TypeConstants.TYPE_ENUM_BASE.equals(typeSig2)) - { - return true; - } - - // TODO: support the case of enum base type with generic type argument - - // only comparable if is the same class - return typeSig1.equals(typeSig2); - } - - /** - * @param typeSig1 the type signature of the first enum. Must be non-null, fully resolved enum type. - * @param typeSig2 the type signature of the second enum. Must be non-null, fully resolved enum type. - * @return true if instances typeSig1 and typeSig2 can never be equal due - * their being definitively different enum types - */ - public static boolean canNeverBeEqual(final String typeSig1, final String typeSig2) - { - if (typeSig1 == null || typeSig2 == null) - { - throw new IllegalArgumentException("args must not be null"); //$NON-NLS-1$ - } - - if (Signature.getTypeSignatureKind(typeSig1) != Signature.CLASS_TYPE_SIGNATURE - || Signature.getTypeSignatureKind(typeSig2) != Signature.CLASS_TYPE_SIGNATURE) - { - throw new IllegalArgumentException("args must be resolved class types"); //$NON-NLS-1$ - } - - // if either one is the base enum type, then we can't be sure - if (TypeConstants.TYPE_ENUM_BASE.equals(typeSig1) - || TypeConstants.TYPE_ENUM_BASE.equals(typeSig2)) - { - return false; - } - - // if they are definitely not the same enum types, then their values - // can never be equal - return !typeSig1.equals(typeSig2); - } - - - /** - * NOTE: we diverge from IType.isEnum() because we also return true if the base type - * is a java.lang.Enum since we consider this to be "any enumeration type" whereas JDT considers - * it merely a class since it doesn't use an "enum" keyword declaration. - * @param type - * @return true if type is an enum type or is java.lang.Enum - */ - static boolean isEnumType(IType type) - { - if (type == null) - { - return false; - } - - // check if it's the enumeration base type - if (TypeConstants.TYPE_ENUM_BASE.equals(Signature.createTypeSignature(type.getFullyQualifiedName(), true))) - { - return true; - } - - try - { - return type.isEnum(); - } - catch (JavaModelException jme) - { - // log and fallthrough to return false - JSFCommonPlugin.log(jme, "Problem resolving isEnum"); //$NON-NLS-1$ - } - - // if unresolved assume false - return false; - } - - private TypeUtil() - { - // no external instantiation - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/util/package-info.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/util/package-info.java deleted file mode 100644 index 239a12524..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/util/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 - * - ********************************************************************************/ - -/** - * Common utility classes. - */ -package org.eclipse.jst.jsf.common.util; diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/WebXmlUpdater.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/WebXmlUpdater.java deleted file mode 100644 index e3261ead1..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/WebXmlUpdater.java +++ /dev/null @@ -1,251 +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.common.webxml; - - -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jst.j2ee.model.IModelProvider; -import org.eclipse.jst.j2ee.model.ModelProviderManager; -import org.eclipse.jst.javaee.web.WebApp; -import org.eclipse.jst.jsf.common.webxml.internal.AbstractWebXmlUpdater; -import org.eclipse.jst.jsf.common.webxml.internal.WebXmlUpdaterForJ2EE; -import org.eclipse.jst.jsf.common.webxml.internal.WebXmlUpdaterForJavaEE; - - -/** - * Facade for web.xml updater classes WebXmlUpdaterForJavaEE, - * WebXmlUpdaterForJ2EE, and AbstractWebXmlUpdater. Utility class to make - * editing web.xml easy. - * - * @author Debajit Adhikary - * - */ -public class WebXmlUpdater -{ - private final IProject project; - private final IProgressMonitor monitor; - private final AbstractWebXmlUpdater updater; - private final IModelProvider provider; - - /** - * @param project - * @param monitor - */ - public WebXmlUpdater (final IProject project, - final IProgressMonitor monitor) - { - this.project = project; - this.monitor = monitor; - this.provider = ModelProviderManager.getModelProvider(project); - this.updater = initUpdater(); - } - - - /** - * @return WebApp object associated with this WebXmlUpdater object - */ - public WebApp getWebAppForJavaEE () - { - return (WebApp) updater.getWebApp(); - } - - - /** - * @return WebApp object associated with this WebXmlUpdater object - */ - public org.eclipse.jst.j2ee.webapplication.WebApp getWebAppForJ2EE () - { - return (org.eclipse.jst.j2ee.webapplication.WebApp) updater.getWebApp(); - } - - - /** - * @return Provider object for the webapp this WebXmlUpdater is associated - * with. This may be used by clients to perform additional complex - * updates to web.xml using getProvider.modify(new Runnable(), ...) - */ - public IModelProvider getProvider() - { - return provider; - } - - - /** - * @return True if this webapp is a Java EE app. - */ - public boolean isJavaEEWebapp () - { - return updater instanceof WebXmlUpdaterForJavaEE; - } - - - /** - * @return True if this webapp is a J2EE app - */ - public boolean isJ2EEWebapp () - { - return updater instanceof WebXmlUpdaterForJ2EE; - } - - - /** - * @param servletName - * @param servletClass - * @param loadOnStartup - */ - public void addServlet (final String servletName, - final String servletClass, - final String loadOnStartup) - { - updater.addServlet(servletName, servletClass, loadOnStartup); - } - - - /** - * @param servletClassName - */ - public void removeServlet (final String servletClassName) - { - updater.removeServlet(servletClassName); - } - - - /** - * @param servletName - * @param servletClass - * @param urlPattern - */ - public void addServletMapping (final String servletName, - final String servletClass, - final String urlPattern) - { - updater.addServletMapping(servletName, servletClass, urlPattern); - } - - - /** - * @param filterName - * @param filterClass - */ - public void addFilter (final String filterName, - final String filterClass) - { - updater.addFilter(filterName, filterClass); - } - - - /** - * @param filterName - */ - public void removeFilter (final String filterName) - { - updater.removeFilter(filterName); - } - - - /** - * @param filterName - * @param filterClass - * @param servletName - */ - public void addFilterMapping (final String filterName, - final String filterClass, - final String servletName) - { - updater.addFilterMapping(filterName, filterClass, servletName); - } - - - /** - * @param paramName - * Name of context param - * @return Value of given context param. - */ - public String getContextParamValue (final String paramName) - { - return updater.getContextParamValue(paramName); - } - - - /** - * @param paramName - * Name of context param - * @param valuesDelimiterRegex - * Delimiter string for values - * @return Values of given context param as a list. This is useful when the - * multiple values are demarcated by a delimiter string. - * - */ - public List<String> getContextParamValuesAsList (final String paramName, - final String valuesDelimiterRegex) - { - return updater.getContextParamValuesAsList(paramName, valuesDelimiterRegex); - } - - - /** - * Sets the value of the given context param name to the given value. If - * paramName is not found, a new context-param is created with the given - * paramName and paramValue. - * - * @param paramName - * @param paramValue - */ - public void setContextParamValue (final String paramName, - final String paramValue) - { - updater.setContextParamValue(paramName, paramValue); - } - - - /** - * @param paramName - * @param paramValue - * @param description - */ - public void addContextParam (final String paramName, - final String paramValue, - final String description) - { - updater.addContextParam(paramName, paramValue, description); - } - - - /** - * @param listenerClass - */ - public void addListener (final String listenerClass) - { - updater.addListener(listenerClass); - } - - - private AbstractWebXmlUpdater initUpdater() - { - final Object webAppObj = ModelProviderManager.getModelProvider(project).getModelObject(); - - if (webAppObj != null) - { - if (webAppObj instanceof WebApp) // Java EE - return new WebXmlUpdaterForJavaEE(webAppObj, project, getProvider(), monitor); - else if (webAppObj instanceof org.eclipse.jst.j2ee.webapplication.WebApp) // J2EE - return new WebXmlUpdaterForJ2EE(webAppObj, project, getProvider(), monitor); - } - - // Control should never come here - throw new IllegalArgumentException("Unable to resolve WebApp object for updating web.xml"); //$NON-NLS-1$ - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/WebXmlUtils.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/WebXmlUtils.java deleted file mode 100644 index 48d22505e..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/WebXmlUtils.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.common.webxml; - -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; - - -/** - * Web.xml utilities. - * - * @author Debajit Adhikary - * - */ -public class WebXmlUtils -{ - /** - * Path to deployment descriptor of webapp - */ - public static final IPath WEB_XML_PATH = new Path("WEB-INF").append("web.xml"); //$NON-NLS-1$ //$NON-NLS-2$ -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/WebXmlUtilsForJ2EE.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/WebXmlUtilsForJ2EE.java deleted file mode 100644 index 6354dc8e3..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/WebXmlUtilsForJ2EE.java +++ /dev/null @@ -1,615 +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.common.webxml; - - -import java.util.Arrays; -import java.util.List; - -import org.eclipse.jst.j2ee.common.CommonFactory; -import org.eclipse.jst.j2ee.common.Description; -import org.eclipse.jst.j2ee.common.Listener; -import org.eclipse.jst.j2ee.common.ParamValue; -import org.eclipse.jst.j2ee.webapplication.Filter; -import org.eclipse.jst.j2ee.webapplication.FilterMapping; -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.j2ee.webapplication.internal.impl.ServletTypeImpl; - - -/** - * Web.xml editing utilities for J2EE (Servlet 2.4 and lower versions). - * - * @author Debajit Adhikary - * - */ -public class WebXmlUtilsForJ2EE -{ - /** - * @param webapp - * @param servletName - * @param servletClass - * @param loadOnStartup - */ - public static void addServlet (final WebApp webapp, - final String servletName, - final String servletClass, - final String loadOnStartup) - { - if (existsServlet(webapp, servletName, servletClass)) - return; - - // Create new servlet - - final Servlet servlet = WebapplicationFactory.eINSTANCE.createServlet(); - servlet.setServletName(servletName); - servlet.setLoadOnStartup(new Integer(loadOnStartup)); - - final ServletType servletType = WebapplicationFactory.eINSTANCE.createServletType(); - servletType.setClassName(servletClass); - servlet.setWebType(servletType); - - webapp.getServlets().add(servlet); - } - - - /** - * @param webapp - * @param servletName - * @param servletClass - * @return true if the specified servlet is declared for use in webapp - */ - public static boolean existsServlet (final WebApp webapp, - final String servletName, - final String servletClass) - { - return findServlet(webapp, servletName, servletClass) != null; - } - - - /** - * @param webapp - * Webapp in which to look for - * @param servletName - * Servlet name - * @param servletClass - * Servlet class - * - * @return The servlet containing the specified servlet-name and - * servlet-class in web.xml - */ - public static Servlet findServlet (final WebApp webapp, - final String servletName, - final String servletClass) - { - for (final Object s : webapp.getServlets()) - { - final Servlet servlet = (Servlet) s; - if (servlet.getServletName().equals(servletName) - && ((ServletType) servlet.getWebType()).getClassName().equals(servletClass)) - { - return servlet; - } - } - - return null; - } - - - /** - * @param webApp - * @param servletClassName - * @return the servlet or null if not found - */ - public static Servlet findServlet (final WebApp webApp, - final String servletClassName) - { - for (final Object servlet : webApp.getServlets()) - { - final org.eclipse.jst.j2ee.webapplication.Servlet j2eeServlet = (org.eclipse.jst.j2ee.webapplication.Servlet) servlet; - final String servletClass = ((ServletTypeImpl) j2eeServlet.getWebType()).getClassName(); - if (servletClass.equals(servletClassName)) - return j2eeServlet; - } - return null; - } - - - /** - * @param webapp - * @param servletName - * @return the servlet or null if not found - */ - public static Servlet findServletByName (final WebApp webapp, - final String servletName) - { - for (final Object s : webapp.getServlets()) - { - final Servlet servlet = (Servlet) s; - if (servlet.getServletName().trim().equals(servletName)) - return servlet; - } - - return null; - } - - - /** - * @param webApp - * @param servlet - */ - public static void removeServlet (final WebApp webApp, - final Servlet servlet) - { - webApp.getServlets().remove(servlet); - } - - - /** - * @param webapp - * @param servletName - * @param servletClass - * @param urlPattern - */ - public static void addServletMapping (final WebApp webapp, - final String servletName, - final String servletClass, - final String urlPattern) - { - if (existsServletMapping(webapp, servletName, urlPattern)) - return; - - final Servlet servlet = findServlet(webapp, servletName, servletClass); - if (servlet == null) - throw new IllegalArgumentException("Cannot create servlet mapping with servlet name \"" //$NON-NLS-1$ - + servletName + "\" and URL pattern \"" //$NON-NLS-1$ - + urlPattern + "\". No corresponding servlet is defined."); //$NON-NLS-1$ - - final ServletMapping servletMapping = WebapplicationFactory.eINSTANCE.createServletMapping(); - servletMapping.setServlet(servlet); - servletMapping.setName(servletName); - servletMapping.setUrlPattern(urlPattern); - - webapp.getServletMappings().add(servletMapping); - } - - - /** - * @param webapp - * @param servletName - * @param urlPattern - * @return true if the servlet mapping exists - */ - public static boolean existsServletMapping (final WebApp webapp, - final String servletName, - final String urlPattern) - { - return findServletMapping(webapp, servletName, urlPattern) != null; - } - - - /** - * @param webapp - * @param servletName - * @param urlPattern - * @return the servlet mapping - */ - public static ServletMapping findServletMapping (final WebApp webapp, - final String servletName, - final String urlPattern) - { - for (final Object mapping : webapp.getServletMappings()) - { - final ServletMapping servletMapping = (ServletMapping) mapping; - if (servletMapping.getName().equals(servletName) - && servletMapping.getUrlPattern().equals(urlPattern)) - { - return servletMapping; - } - } - - return null; - } - - - /** - * @param webApp - * @param servlet - */ - public static void removeServletMappings (final WebApp webApp, - final Servlet servlet) - { - final List mappings = webApp.getServletMappings(); - String servletName = servlet.getServletName(); - - if (servletName != null) - { - servletName = servletName.trim(); - for (int i = mappings.size() - 1; i >= 0; --i) - { - final ServletMapping mapping = (ServletMapping) mappings.get(i); - if (mapping != null && mapping.getServlet().getServletName() != null - && mapping.getServlet().getServletName().trim().equals(servletName)) - { - mappings.remove(mapping); - } - } - } - } - - - /** - * @param webapp - * @param filterName - * @param filterClass - */ - public static void addFilter (final WebApp webapp, - final String filterName, - final String filterClass) - { - if (existsFilter(webapp, filterName, filterClass)) - return; - - webapp.getFilters().add(createFilter(filterName, filterClass)); - } - - - /** - * @param filterName - * @param filterClass - * @return the filter or null if not found. - */ - public static Filter createFilter (final String filterName, - final String filterClass) - { - final Filter filter = WebapplicationFactory.eINSTANCE.createFilter(); - filter.setName(filterName); - filter.setFilterClassName(filterClass); - return filter; - } - - - /** - * @param webapp - * @param filterName - * @param filterClass - * @return true if the filter exists. - */ - public static boolean existsFilter (final WebApp webapp, - final String filterName, - final String filterClass) - { - return findFilter(webapp, filterName, filterClass) != null; - } - - - /** - * @param webapp - * @param filterName - * @param filterClass - * @return the filter or null if not found. - */ - public static Filter findFilter (final WebApp webapp, - final String filterName, - final String filterClass) - { - for (final Object f : webapp.getFilters()) - { - final Filter filter = (Filter) f; - if (filter.getName().trim().equals(filterName) - && filter.getFilterClassName().trim().equals(filterClass)) - { - return filter; - } - } - - return null; - } - - - /** - * @param webApp - * @param filterClassName - * @return the filter or null if not found. - */ - public static Filter findFilter (final WebApp webApp, - final String filterClassName) - { - for (final Object filter : webApp.getFilters()) - { - if (((Filter) filter).getFilterClassName().trim().equals(filterClassName)) - return (Filter) filter; - } - - return null; - } - - - /** - * @param webapp - * @param filterName - * @param filterClass - * @param servletName - */ - public static void addFilterMapping (final WebApp webapp, - final String filterName, - final String filterClass, - final String servletName) - { - if (existsFilterMapping(webapp, filterName, servletName)) - return; - - - // Find corresponding filter - final Filter filter = findFilter(webapp, filterName, filterClass); - if (filter == null) - throw new IllegalArgumentException("Cannot create filter mapping with filter name \"" //$NON-NLS-1$ - + filterName + "\" and servlet name \"" //$NON-NLS-1$ - + servletName + "\". No corresponding filter is defined."); //$NON-NLS-1$ - - - // Find corresponding servlet - final Servlet servlet = findServletByName(webapp, servletName); - if (servlet == null) - throw new IllegalArgumentException("Cannot create filter mapping with filter name \"" //$NON-NLS-1$ - + filterName + "\" and servlet name \"" //$NON-NLS-1$ - + servletName + "\". No corresponding servlet is defined."); //$NON-NLS-1$ - - - // Create new filter mapping - final FilterMapping filterMapping = WebapplicationFactory.eINSTANCE.createFilterMapping(); - filterMapping.setFilter(filter); - filterMapping.setServlet(servlet); - filterMapping.setServletName(servletName); - - webapp.getFilterMappings().add(filterMapping); - } - - - /** - * @param webapp - * @param filterName - * @param servletName - * @return true if the filter mapping exists - */ - public static boolean existsFilterMapping (final WebApp webapp, - final String filterName, - final String servletName) - { - return findFilterMapping(webapp, filterName, servletName) != null; - } - - - /** - * @param webapp - * @param filterName - * @param servletName - * @return the filter mapping or null if it doesn't exist. - */ - public static FilterMapping findFilterMapping (final WebApp webapp, - final String filterName, - final String servletName) - { - for (final Object fm : webapp.getFilterMappings()) - { - final FilterMapping filterMapping = (FilterMapping) fm; - - if (filterMapping.getFilter().getName().trim().equals(filterName) - && filterMapping.getServletName().equals(servletName)) - { - return filterMapping; - } - } - - return null; - } - - - /** - * @param webApp - * @param paramName - * @param paramValue - * @param description - */ - public static void addContextParam (final WebApp webApp, - final String paramName, - final String paramValue, - final String description) - { - if (existsContextParam(webApp, paramName, paramValue)) - return; - - webApp.getContextParams().add(createContextParam(paramName, paramValue, description)); - } - - - /** - * @param paramName - * @param paramValue - * @param descriptionString - * @return the param value or null if doesn't exist - */ - public static ParamValue createContextParam (final String paramName, - final String paramValue, - final String descriptionString) - { - final ParamValue param = CommonFactory.eINSTANCE.createParamValue(); - param.setName(paramName); - param.setValue(paramValue); - - if (descriptionString != null) - { - final Description description = CommonFactory.eINSTANCE.createDescription(); - description.setValue(descriptionString); - param.getDescriptions().add(description); - } - - return param; - } - - - /** - * @param webApp - * @param paramName - * @param paramValue - * @return true if the context param exists. - */ - public static boolean existsContextParam (final WebApp webApp, - final String paramName, - final String paramValue) - { - return findContextParam(webApp, paramName, paramValue) != null; - } - - - /** - * @param webApp - * @param paramName - * @param paramValue - * @return the param value or null if not found - */ - public static ParamValue findContextParam (final WebApp webApp, - final String paramName, - final String paramValue) - { - for (final Object param : webApp.getContextParams()) - { - final ParamValue contextParam = (ParamValue) param; - if (contextParam.getName().equals(paramName) - && contextParam.getValue().equals(paramValue)) - { - return contextParam; - } - } - - return null; - } - - - /** - * @param webApp - * @param paramName - * @return the param value or null if not found - */ - public static String getContextParamValue (final WebApp webApp, - final String paramName) - { - for (final Object param : webApp.getContextParams()) - { - final ParamValue contextParam = (ParamValue) param; - if (contextParam.getName().equals(paramName)) - { - return contextParam.getValue(); - } - } - - return null; - } - - - /** - * @param webApp - * @param paramName Name of context param - * @param valuesDelimiterRegex - * @return Values of the given context param as a list - */ - public static List<String> getContextParamValuesAsList (final WebApp webApp, - final String paramName, - final String valuesDelimiterRegex) - { - final String valuesString = getContextParamValue(webApp, paramName); - return Arrays.asList(valuesString.split(valuesDelimiterRegex)); - } - - - /** - * Updates the value of a context param if it exists. Otherwise, adds this - * as a new context param. - * - * @param webApp - * @param paramName - * @param paramValue - */ - public static void setContextParamValue (final WebApp webApp, - final String paramName, - final String paramValue) - { - ParamValue contextParam = null; - - for (final Object p : webApp.getContextParams()) - { - final ParamValue param = (ParamValue) p; - if (param.getName().equals(paramName)) - { - contextParam = param; - break; - } - } - - if (contextParam == null) - { - webApp.getContextParams().add(createContextParam(paramName, paramValue, null)); - } - else - { - contextParam.setValue(paramValue); - } - } - - - /** - * @param webapp - * @param listenerClass - */ - public static void addListener (final WebApp webapp, - final String listenerClass) - { - if (existsListener(webapp, listenerClass)) - return; - - // Create new listener - final Listener listener = CommonFactory.eINSTANCE.createListener(); - listener.setListenerClassName(listenerClass); - - webapp.getListeners().add(listener); - } - - - /** - * @param webapp - * @param listenerClass - * @return true if the listener exists - */ - public static boolean existsListener (final WebApp webapp, - final String listenerClass) - { - return findListener(webapp, listenerClass) != null; - } - - - /** - * @param webapp - * @param listenerClass - * @return the listener or null if not found - */ - public static Listener findListener (final WebApp webapp, - final String listenerClass) - { - for (final Object listener : webapp.getListeners()) - if (((Listener) listener).getListenerClassName().equals(listenerClass)) - return (Listener) listener; - - return null; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/WebXmlUtilsForJavaEE.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/WebXmlUtilsForJavaEE.java deleted file mode 100644 index 6a3d59779..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/WebXmlUtilsForJavaEE.java +++ /dev/null @@ -1,610 +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.common.webxml; - -import java.util.Arrays; -import java.util.List; - -import org.eclipse.jst.javaee.core.Description; -import org.eclipse.jst.javaee.core.JavaeeFactory; -import org.eclipse.jst.javaee.core.Listener; -import org.eclipse.jst.javaee.core.ParamValue; -import org.eclipse.jst.javaee.core.UrlPatternType; -import org.eclipse.jst.javaee.web.Filter; -import org.eclipse.jst.javaee.web.FilterMapping; -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.WebFactory; - - -/** - * Web.xml editing utilities for Java EE. - * - * @author Debajit Adhikary - * - */ -public class WebXmlUtilsForJavaEE -{ - /** - * @param webapp - * @param servletName - * @param servletClass - * @param loadOnStartup - */ - public static void addServlet (final WebApp webapp, - final String servletName, - final String servletClass, - final String loadOnStartup) - { - if (existsServlet(webapp, servletName, servletClass)) - return; - - // Create new servlet - final Servlet servlet = WebFactory.eINSTANCE.createServlet(); - servlet.setServletName(servletName); - servlet.setServletClass(servletClass); - servlet.setLoadOnStartup(loadOnStartup); - - webapp.getServlets().add(servlet); - } - - - /** - * @param webapp - * @param servletName - * @param servletClass - * @return true if the servlet exists. - */ - public static boolean existsServlet (final WebApp webapp, - final String servletName, - final String servletClass) - { - return findServlet(webapp, servletName, servletClass) != null; - } - - - /** - * @param webapp - * @param servletName - * @param servletClass - * @return the servlet or null if not found. - */ - public static Servlet findServlet (final WebApp webapp, - final String servletName, - final String servletClass) - { - for (final Object s : webapp.getServlets()) - { - final Servlet servlet = (Servlet) s; - if (servlet.getServletName().equals(servletName) && servlet.getServletClass().equals(servletClass)) - { - return servlet; - } - } - - return null; - } - - - /** - * @param servletName - * @param webApp - * @return the servlet or null if not found. - */ - public static Servlet findServlet (final String servletName, - final WebApp webApp) - { - for (final Object servlet : webApp.getServlets()) - { - if (((Servlet) servlet).getServletClass().trim().equals(servletName)) - return (Servlet) servlet; - } - - return null; - } - - - /** - * @param webApp - * @param servlet - */ - public static void removeServlet (final WebApp webApp, - final Servlet servlet) - { - webApp.getServlets().remove(servlet); - } - - - /** - * @param webApp - * @param servletName - * @param servletClass - * @param urlPatternString - */ - public static void addServletMapping (final WebApp webApp, - final String servletName, - final String servletClass, - final String urlPatternString) - { - if (existsServletMapping(webApp, servletName, urlPatternString)) - return; - - // Create new servlet mapping. - final ServletMapping servletMapping = WebFactory.eINSTANCE.createServletMapping(); - servletMapping.setServletName(servletName); - servletMapping.getUrlPatterns().add(createUrlPattern(urlPatternString)); - - webApp.getServletMappings().add(servletMapping); - } - - - /** - * @param webApp - * @param servletName - * @param urlPatternString - * @return true if the servlet mapping exists. - */ - public static boolean existsServletMapping (final WebApp webApp, - final String servletName, - final String urlPatternString) - { - return findServletMapping(webApp, servletName, urlPatternString) != null; - } - - - /** - * @param webApp - * @param servletName - * @param urlPatternString - * @return the servlet mapping or null if doesn't exist. - */ - public static ServletMapping findServletMapping (final WebApp webApp, - final String servletName, - final String urlPatternString) - { - for (final Object mapping : webApp.getServletMappings()) - { - final ServletMapping servletMappingToCheck = (ServletMapping) mapping; - if (servletMappingToCheck.getServletName().trim().equals(servletName)) - { - // We found a servlet with the same name. Check for urls - for (final Object pattern : servletMappingToCheck.getUrlPatterns()) - if (((UrlPatternType) pattern).getValue().equals(urlPatternString)) - return servletMappingToCheck; - } - } - - return null; - } - - /** - * @param webApp - * @param servlet - */ - public static void removeServletMappings (final WebApp webApp, - final Servlet servlet) - { - final List mappings = webApp.getServletMappings(); - String servletName = servlet.getServletName(); - - if (servletName != null) - { - servletName = servletName.trim(); - for (int i = mappings.size() - 1; i >= 0; --i) - { - final ServletMapping mapping = (ServletMapping) mappings.get(i); - if (mapping != null && mapping.getServletName() != null && mapping.getServletName().trim().equals(servletName)) - { - mappings.remove(mapping); - } - } - } - } - - - /** - * @param webapp - * @param filterName - * @param filterClass - */ - public static void addFilter (final WebApp webapp, - final String filterName, - final String filterClass) - { - if (existsFilter(webapp, filterName, filterClass)) - return; - - webapp.getFilters().add(createFilter(filterName, filterClass)); - } - - - /** - * @param filterName - * @param filterClass - * @return the filter or null if it doesn't exist. - */ - public static Filter createFilter (final String filterName, - final String filterClass) - { - final Filter filter = WebFactory.eINSTANCE.createFilter(); - filter.setFilterName(filterName); - filter.setFilterClass(filterClass); - return filter; - } - - - /** - * @param webapp - * @param filterName - * @param filterClass - * @return true if the filter exists. - */ - public static boolean existsFilter (final WebApp webapp, - final String filterName, - final String filterClass) - { - return findFilter(webapp, filterName, filterClass) != null; - } - - - /** - * @param webapp - * @param filterName - * @param filterClass - * @return the filter or null if not found. - */ - public static Filter findFilter (final WebApp webapp, - final String filterName, - final String filterClass) - { - for (final Object f : webapp.getFilters()) - { - final Filter filter = (Filter) f; - if (filter.getFilterName().trim().equals(filterName) && filter.getFilterClass().trim().equals(filterClass)) - { - return filter; - } - } - - return null; - } - - - /** - * @param webApp - * @param filterClassName - * @return the filter or null if not found. - */ - public static Filter findFilter (final WebApp webApp, - final String filterClassName) - { - for (final Object filter : webApp.getFilters()) - { - if (((Filter) filter).getFilterClass().trim().equals(filterClassName)) - return (Filter) filter; - } - - return null; - } - - - /** - * @param webApp - * @param filter - */ - public static void removeFilter (final WebApp webApp, - final Filter filter) - { - webApp.getFilters().remove(filter); - } - - - /** - * @param webapp - * @param filterName - * @param servletName - */ - public static void addFilterMapping (final WebApp webapp, - final String filterName, - final String servletName) - { - if (existsFilterMapping(webapp, filterName, servletName)) - return; - - webapp.getFilterMappings().add(createFilterMapping(filterName, servletName)); - } - - - /** - * @param filterName - * @param servletName - * @return the filter mapping or null if not found. - */ - public static FilterMapping createFilterMapping (final String filterName, - final String servletName) - { - final FilterMapping filterMapping = WebFactory.eINSTANCE.createFilterMapping(); - filterMapping.setFilterName(filterName); - filterMapping.getServletNames().add(servletName); - - return filterMapping; - } - - - /** - * @param webapp - * @param filterName - * @param servletName - * @return true if the filter mapping exists. - */ - public static boolean existsFilterMapping (final WebApp webapp, - final String filterName, - final String servletName) - { - return findFilterMapping(webapp, filterName, servletName) != null; - } - - - /** - * @param webapp - * @param filterName - * @param servletName - * @return the filter mapping or null. - */ - public static FilterMapping findFilterMapping (final WebApp webapp, - final String filterName, - final String servletName) - { - for (final Object fm : webapp.getFilterMappings()) - { - final FilterMapping filterMapping = (FilterMapping) fm; - - if (filterMapping.getFilterName().trim().equals(filterName) && filterMapping.getServletNames().contains(servletName)) - { - return filterMapping; - } - } - - return null; - } - - - /** - * @param webApp - * @param filter - */ - public static void removeFilterMappings (final WebApp webApp, - final Filter filter) - { - final List mappings = webApp.getFilterMappings(); - String filterName = filter.getFilterName(); - - if (filterName != null) - { - filterName = filterName.trim(); - for (int i = mappings.size() - 1; i >= 0; --i) - { - final FilterMapping mapping = (FilterMapping) mappings.get(i); - if (mapping != null && mapping.getFilterName() != null && mapping.getFilterName().trim().equals(filterName)) - { - mappings.remove(mapping); - } - } - } - } - - - /** - * @param webApp - * @param paramName - * @param paramValue - * @param description - */ - public static void addContextParam (final WebApp webApp, - final String paramName, - final String paramValue, - final String description) - { - if (existsContextParam(webApp, paramName, paramValue)) - return; - - webApp.getContextParams().add(createContextParam(paramName, paramValue, description)); - } - - - /** - * @param paramName - * @param paramValue - * @param descriptionString - * @return the param value or null if not found. - */ - public static ParamValue createContextParam (final String paramName, - final String paramValue, - final String descriptionString) - { - final ParamValue param = JavaeeFactory.eINSTANCE.createParamValue(); - param.setParamName(paramName); - param.setParamValue(paramValue); - - if (descriptionString != null) - { - final Description description = JavaeeFactory.eINSTANCE.createDescription(); - description.setValue(descriptionString); - param.getDescriptions().add(description); - } - - - return param; - } - - - /** - * @param webApp - * @param paramName - * @param paramValue - * @return true if the context param exists. - */ - public static boolean existsContextParam (final WebApp webApp, - final String paramName, - final String paramValue) - { - return findContextParam(webApp, paramName, paramValue) != null; - } - - - /** - * @param webApp - * @param paramName - * @param paramValue - * @return the param value or null if not found. - */ - public static ParamValue findContextParam (final WebApp webApp, - final String paramName, - final String paramValue) - { - for (final Object param : webApp.getContextParams()) - { - final ParamValue contextParam = (ParamValue) param; - if (contextParam.getParamName().equals(paramName) && contextParam.getParamValue().equals(paramValue)) - return contextParam; - } - - return null; - } - - - /** - * @param webApp - * @param paramName Name of context param - * @return Value of the given context param - */ - public static String getContextParamValue (final WebApp webApp, - final String paramName) - { - for (final Object param : webApp.getContextParams()) - { - final ParamValue contextParam = (ParamValue) param; - if (contextParam.getParamName().equals(paramName)) - return contextParam.getParamValue(); - } - - return null; - } - - - /** - * @param webApp - * @param paramName Name of context param - * @param valuesDelimiterRegex - * @return Values of the given context param as a list - */ - public static List<String> getContextParamValuesAsList (final WebApp webApp, - final String paramName, - final String valuesDelimiterRegex) - { - final String valueString = getContextParamValue(webApp, paramName); - return Arrays.asList(valueString.split(valuesDelimiterRegex)); - } - - - /** - * Updates the value of a context param if it exists. Otherwise, adds this - * as a new context param. - * - * @param webApp - * @param paramName - * @param paramValue - */ - public static void setContextParamValue (final WebApp webApp, - final String paramName, - final String paramValue) - { - ParamValue contextParam = null; - - for (final Object p : webApp.getContextParams()) - { - final ParamValue param = (ParamValue) p; - if (param.getParamName().equals(paramName)) - { - contextParam = param; - break; - } - } - - if (contextParam == null) - { - webApp.getContextParams().add(createContextParam(paramName, paramValue, null)); - } - else - { - contextParam.setParamValue(paramValue); - } - } - - - /** - * @param webapp - * @param listenerClass - */ - public static void addListener (final WebApp webapp, - final String listenerClass) - { - if (existsListener(webapp, listenerClass)) - return; - - // Create new listener - final Listener listener = JavaeeFactory.eINSTANCE.createListener(); - listener.setListenerClass(listenerClass); - - webapp.getListeners().add(listener); - } - - - /** - * @param webapp - * @param listenerClass - * @return true if the listener exists. - */ - public static boolean existsListener (final WebApp webapp, - final String listenerClass) - { - return findListener(webapp, listenerClass) != null; - } - - - /** - * @param webapp - * @param listenerClass - * @return the listener or null if not found. - */ - public static Listener findListener (final WebApp webapp, - final String listenerClass) - { - for (final Object listener : webapp.getListeners()) - if (((Listener) listener).getListenerClass().equals(listenerClass)) - return (Listener) listener; - - return null; - } - - - /** - * @param urlPatternString - * @return the UrlPattern or null. - */ - public static UrlPatternType createUrlPattern (final String urlPatternString) - { - final UrlPatternType urlPattern = JavaeeFactory.eINSTANCE.createUrlPatternType(); - urlPattern.setValue(urlPatternString); - return urlPattern; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/internal/AbstractWebXmlUpdater.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/internal/AbstractWebXmlUpdater.java deleted file mode 100644 index b298bb7a5..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/internal/AbstractWebXmlUpdater.java +++ /dev/null @@ -1,174 +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.common.webxml.internal; - - -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jst.j2ee.model.IModelProvider; - - -/** - * Abstract class to define web-xml editing interface. Users may use the - * WebXmlUpdater facade class for convenient web.xml editing. - * - * @author Debajit Adhikary - * - */ -public abstract class AbstractWebXmlUpdater -{ - /** - * the web app object. JavaEE has own type and J2EE has another. They are not object compatible. - */ - protected final Object webAppObj; - /** - * the project - */ - protected final IProject project; - /** - * the model provider used to modify the model - */ - protected final IModelProvider provider; - /** - * the progress monitor - */ - protected final IProgressMonitor monitor; - - - /** - * @param webAppObj - * @param project - * @param provider - * @param monitor - */ - public AbstractWebXmlUpdater (final Object webAppObj, - final IProject project, - final IModelProvider provider, - final IProgressMonitor monitor) - { - this.webAppObj = webAppObj; - this.project = project; - this.provider = provider; - this.monitor = monitor; - } - - - /** - * @param servletName - * @param servletClass - * @param loadOnStartup - */ - public abstract void addServlet (final String servletName, - final String servletClass, - final String loadOnStartup); - - - /** - * @param servletName - * @param servletClass - * @param urlPattern - */ - public abstract void addServletMapping (final String servletName, - final String servletClass, - final String urlPattern); - - - /** - * Removes a servlet and its associated mappings from web.xml. - * - * @param servletClassName - * Fully qualified classname of servlet class to remove. - */ - public abstract void removeServlet (final String servletClassName); - - - /** - * @param filterName - * @param filterClass - */ - public abstract void addFilter (final String filterName, - final String filterClass); - - - /** - * Removes a filter and its associated mappings from web.xml. - * - * @param filterName - */ - public abstract void removeFilter (final String filterName); - - - /** - * @param filterName - * @param filterClass - * @param servletName - */ - public abstract void addFilterMapping (final String filterName, - final String filterClass, - final String servletName); - - /** - * @param paramName - * Name of context param - * @return Value of given context param. - */ - public abstract String getContextParamValue (final String paramName); - - - /** - * @param paramName - * Name of context param - * @param valuesDelimiterRegex - * Delimiter string for values - * @return Values of given context param as a list. This is useful when the - * multiple values are demarcated by a delimiter string. - */ - public abstract List<String> getContextParamValuesAsList (final String paramName, - final String valuesDelimiterRegex); - - - /** - * Sets the value of the given context param name to the given value. If - * paramName is not found, a new context-param is created with the given - * paramName and paramValue. - * - * @param paramName - * @param paramValue - */ - public abstract void setContextParamValue (final String paramName, - final String paramValue); - - - /** - * @param paramName - * @param paramValue - * @param description - */ - public abstract void addContextParam (final String paramName, - final String paramValue, - final String description); - - - /** - * @param listenerClass - */ - public abstract void addListener (final String listenerClass); - - - /** - * @return The WebApp object associated with this updater - */ - public abstract Object getWebApp (); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/internal/WebXmlUpdaterForJ2EE.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/internal/WebXmlUpdaterForJ2EE.java deleted file mode 100644 index 2d4ba290a..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/internal/WebXmlUpdaterForJ2EE.java +++ /dev/null @@ -1,161 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2009 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.common.webxml.internal; - -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jst.j2ee.model.IModelProvider; -import org.eclipse.jst.j2ee.webapplication.Filter; -import org.eclipse.jst.j2ee.webapplication.Servlet; -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.jst.jsf.common.webxml.WebXmlUtils; -import org.eclipse.jst.jsf.common.webxml.WebXmlUtilsForJ2EE; -import org.eclipse.jst.jsf.common.webxml.internal.operations.ContextParamAdderForJ2EE; -import org.eclipse.jst.jsf.common.webxml.internal.operations.FilterAdderForJ2EE; -import org.eclipse.jst.jsf.common.webxml.internal.operations.FilterMapperAdderForJ2EE; -import org.eclipse.jst.jsf.common.webxml.internal.operations.FilterRemoverForJavaEE; -import org.eclipse.jst.jsf.common.webxml.internal.operations.ListenerAdderForJ2EE; -import org.eclipse.jst.jsf.common.webxml.internal.operations.ServletAdderForJ2EE; -import org.eclipse.jst.jsf.common.webxml.internal.operations.ServletMappingAdderForJ2EE; -import org.eclipse.jst.jsf.common.webxml.internal.operations.ServletRemoverForJavaEE; - - -/** - * @author Debajit Adhikary - * - */ -public class WebXmlUpdaterForJ2EE extends AbstractWebXmlUpdater -{ - private final WebApp webApp; - - - /** - * @param webAppObj - * @param project - * @param provider - * @param monitor - */ - public WebXmlUpdaterForJ2EE (final Object webAppObj, - final IProject project, - final IModelProvider provider, - final IProgressMonitor monitor) - { - super(webAppObj, project, provider, monitor); - this.webApp = (WebApp) webAppObj; - } - - - @Override - public void addServlet (final String servletName, - final String servletClass, - final String loadOnStartup) - { - provider.modify(new ServletAdderForJ2EE(project, servletName, servletClass, loadOnStartup), WebXmlUtils.WEB_XML_PATH); - } - - - @Override - public void addServletMapping (final String servletName, - final String servletClass, - final String urlPattern) - { - provider.modify(new ServletMappingAdderForJ2EE(project, servletName, servletClass, urlPattern), WebXmlUtils.WEB_XML_PATH); - } - - // TODO: needs fixing - @Override - public void removeServlet (final String servletClassName) - { - final Servlet servlet = WebXmlUtilsForJ2EE.findServlet(webApp, servletClassName); - if (servlet == null) - throw new IllegalArgumentException("Cannot find servlet named \"" + servletClassName + "\""); //$NON-NLS-1$//$NON-NLS-2$ - - provider.modify(new ServletRemoverForJavaEE(project, servletClassName), WebXmlUtils.WEB_XML_PATH); - } - - - @Override - public void addFilter (final String filterName, - final String filterClass) - { - provider.modify(new FilterAdderForJ2EE(project, filterName, filterClass), WebXmlUtils.WEB_XML_PATH); - } - - - @Override - public void removeFilter (final String filterClassName) - { - final Filter filter = WebXmlUtilsForJ2EE.findFilter(webApp, filterClassName); - if (filter == null) - throw new IllegalArgumentException("Cannot find filter named \"" + filterClassName + "\""); //$NON-NLS-1$//$NON-NLS-2$ - - provider.modify(new FilterRemoverForJavaEE(project, filterClassName), WebXmlUtils.WEB_XML_PATH); - } - - - @Override - public void addFilterMapping (final String filterName, - final String filterClass, - final String servletName) - { - provider.modify(new FilterMapperAdderForJ2EE(project, filterName, filterClass, servletName), WebXmlUtils.WEB_XML_PATH); - } - - - @Override - public String getContextParamValue (final String paramName) - { - return WebXmlUtilsForJ2EE.getContextParamValue(webApp, paramName); - } - - - @Override - public List<String> getContextParamValuesAsList(String paramName, String valuesDelimiterRegex) - { - return WebXmlUtilsForJ2EE.getContextParamValuesAsList(webApp, paramName, valuesDelimiterRegex); - } - - - @Override - public void setContextParamValue(String paramName, String paramValue) - { - WebXmlUtilsForJ2EE.setContextParamValue(webApp, paramName, paramValue); - } - - - @Override - - public void addContextParam (final String paramName, - final String paramValue, - final String description) - { - provider.modify(new ContextParamAdderForJ2EE(project, paramName, paramValue, description), WebXmlUtils.WEB_XML_PATH); - } - - - @Override - public void addListener (final String listenerClass) - { - provider.modify(new ListenerAdderForJ2EE(project, listenerClass), WebXmlUtils.WEB_XML_PATH); - } - - - @Override - public Object getWebApp() - { - return webApp; - } -} - diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/internal/WebXmlUpdaterForJavaEE.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/internal/WebXmlUpdaterForJavaEE.java deleted file mode 100644 index ee79863eb..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/internal/WebXmlUpdaterForJavaEE.java +++ /dev/null @@ -1,163 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2009 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.common.webxml.internal; - -import static org.eclipse.jst.jsf.common.webxml.WebXmlUtilsForJavaEE.findFilter; -import static org.eclipse.jst.jsf.common.webxml.WebXmlUtilsForJavaEE.findServlet; - -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jst.j2ee.model.IModelProvider; -import org.eclipse.jst.javaee.web.Filter; -import org.eclipse.jst.javaee.web.Servlet; -import org.eclipse.jst.javaee.web.WebApp; -import org.eclipse.jst.jsf.common.webxml.WebXmlUtils; -import org.eclipse.jst.jsf.common.webxml.WebXmlUtilsForJavaEE; -import org.eclipse.jst.jsf.common.webxml.internal.operations.ContextParamAdderForJavaEE; -import org.eclipse.jst.jsf.common.webxml.internal.operations.FilterAdderForJavaEE; -import org.eclipse.jst.jsf.common.webxml.internal.operations.FilterMapperAdderForJavaEE; -import org.eclipse.jst.jsf.common.webxml.internal.operations.FilterRemoverForJavaEE; -import org.eclipse.jst.jsf.common.webxml.internal.operations.ListenerAdderForJavaEE; -import org.eclipse.jst.jsf.common.webxml.internal.operations.ServletAdderForJavaEE; -import org.eclipse.jst.jsf.common.webxml.internal.operations.ServletMappingAdderForJavaEE; -import org.eclipse.jst.jsf.common.webxml.internal.operations.ServletRemoverForJavaEE; - - -/** - * @author Debajit Adhikary - * - */ -public class WebXmlUpdaterForJavaEE extends AbstractWebXmlUpdater -{ - private final WebApp webApp; - - - /** - * @param webAppObj - * @param project - * @param provider - * @param monitor - */ - public WebXmlUpdaterForJavaEE (final Object webAppObj, - final IProject project, - final IModelProvider provider, - final IProgressMonitor monitor) - { - super(webAppObj, project, provider, monitor); - this.webApp = (WebApp) webAppObj; - } - - - @Override - public void addServlet (final String servletName, - final String servletClass, - final String loadOnStartup) - { - provider.modify(new ServletAdderForJavaEE(project, servletName, servletClass, loadOnStartup), WebXmlUtils.WEB_XML_PATH); - } - - - @Override - public void removeServlet (final String servletClassName) - { - final Servlet servlet = findServlet(servletClassName, webApp); - if (servlet == null) - throw new IllegalArgumentException("Cannot find servlet named \"" + servletClassName + "\""); //$NON-NLS-1$//$NON-NLS-2$ - - provider.modify(new ServletRemoverForJavaEE(project, servletClassName), WebXmlUtils.WEB_XML_PATH); - } - - - @Override - public void addServletMapping (final String servletName, - final String servletClass, - final String urlPattern) - { - provider.modify(new ServletMappingAdderForJavaEE(project, servletName, servletClass, urlPattern), WebXmlUtils.WEB_XML_PATH); - } - - - @Override - public void addFilter (final String filterName, - final String filterClass) - { - provider.modify(new FilterAdderForJavaEE(project, filterName, filterClass), WebXmlUtils.WEB_XML_PATH); - } - - - @Override - public void removeFilter (final String filterClassName) - { - final Filter filter = findFilter(webApp, filterClassName); - if (filter == null) - throw new IllegalArgumentException("Cannot find filter named \"" + filterClassName + "\""); //$NON-NLS-1$//$NON-NLS-2$ - - provider.modify(new FilterRemoverForJavaEE(project, filterClassName), WebXmlUtils.WEB_XML_PATH); - } - - - @Override - public void addFilterMapping (final String filterName, - final String filterClass, - final String servletName) - { - provider.modify(new FilterMapperAdderForJavaEE(project, filterName, servletName), WebXmlUtils.WEB_XML_PATH); - } - - - @Override - public String getContextParamValue (final String paramName) - { - return WebXmlUtilsForJavaEE.getContextParamValue(webApp, paramName); - } - - - @Override - public List<String> getContextParamValuesAsList (final String paramName, - final String valuesDelimiterRegex) - { - return WebXmlUtilsForJavaEE.getContextParamValuesAsList(webApp, paramName, valuesDelimiterRegex); - } - - - @Override - public void setContextParamValue(String paramName, String paramValue) - { - WebXmlUtilsForJavaEE.setContextParamValue(webApp, paramName, paramValue); - } - - - @Override - public void addContextParam (final String paramName, - final String paramValue, - final String description) - { - provider.modify(new ContextParamAdderForJavaEE(project, paramName, paramValue, description), WebXmlUtils.WEB_XML_PATH); - } - - - @Override - public void addListener (final String listenerClass) - { - provider.modify(new ListenerAdderForJavaEE(project, listenerClass), WebXmlUtils.WEB_XML_PATH); - } - - - @Override - public Object getWebApp() - { - return webApp; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/internal/operations/ContextParamAdderForJ2EE.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/internal/operations/ContextParamAdderForJ2EE.java deleted file mode 100644 index 1ea49e4b3..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/internal/operations/ContextParamAdderForJ2EE.java +++ /dev/null @@ -1,59 +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.common.webxml.internal.operations; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.j2ee.model.ModelProviderManager; -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.jst.jsf.common.webxml.WebXmlUtilsForJ2EE; - - -/** - * Runnable to add a context-param to web.xml. - * - * @author Debajit Adhikary - * - */ -public class ContextParamAdderForJ2EE implements Runnable -{ - private final IProject project; - private final String paramName; - private final String paramValue; - private final String description; - - - /** - * @param project - * @param paramName - * @param paramValue - * @param description - */ - public ContextParamAdderForJ2EE (final IProject project, - final String paramName, - final String paramValue, - final String description) - { - this.project = project; - this.paramName = paramName; - this.paramValue = paramValue; - this.description = description; - } - - - public void run () - { - final WebApp webApp = (WebApp) ModelProviderManager.getModelProvider(project).getModelObject(); - - WebXmlUtilsForJ2EE.addContextParam(webApp, paramName, paramValue, description); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/internal/operations/ContextParamAdderForJavaEE.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/internal/operations/ContextParamAdderForJavaEE.java deleted file mode 100644 index 7b9aae749..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/internal/operations/ContextParamAdderForJavaEE.java +++ /dev/null @@ -1,59 +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.common.webxml.internal.operations; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.j2ee.model.ModelProviderManager; -import org.eclipse.jst.javaee.web.WebApp; -import org.eclipse.jst.jsf.common.webxml.WebXmlUtilsForJavaEE; - - -/** - * Runnable to add a context-param to web.xml. - * - * @author Debajit Adhikary - * - */ -public class ContextParamAdderForJavaEE implements Runnable -{ - private final IProject project; - private final String paramName; - private final String paramValue; - private final String description; - - - /** - * @param project - * @param paramName - * @param paramValue - * @param description - */ - public ContextParamAdderForJavaEE (final IProject project, - final String paramName, - final String paramValue, - final String description) - { - this.project = project; - this.paramName = paramName; - this.paramValue = paramValue; - this.description = description; - } - - - public void run () - { - final WebApp webApp = (WebApp) ModelProviderManager.getModelProvider(project).getModelObject(); - - WebXmlUtilsForJavaEE.addContextParam(webApp, paramName, paramValue, description); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/internal/operations/FilterAdderForJ2EE.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/internal/operations/FilterAdderForJ2EE.java deleted file mode 100644 index d1ad0f995..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/internal/operations/FilterAdderForJ2EE.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.common.webxml.internal.operations; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.j2ee.model.ModelProviderManager; -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.jst.jsf.common.webxml.WebXmlUtilsForJ2EE; - - -/** - * Runnable to add a filter to web.xml. - * - * @author Debajit Adhikary - * - */ -public class FilterAdderForJ2EE implements Runnable -{ - private final IProject project; - private final String filterName; - private final String filterClass; - - - /** - * @param project - * @param filterName - * @param filterClass - */ - public FilterAdderForJ2EE (final IProject project, - final String filterName, - final String filterClass) - { - this.project = project; - this.filterName = filterName; - this.filterClass = filterClass; - } - - - public void run () - { - final WebApp webApp = (WebApp) ModelProviderManager.getModelProvider(project).getModelObject(); - - WebXmlUtilsForJ2EE.addFilter(webApp, filterName, filterClass); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/internal/operations/FilterAdderForJavaEE.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/internal/operations/FilterAdderForJavaEE.java deleted file mode 100644 index 9faa0677a..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/internal/operations/FilterAdderForJavaEE.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.common.webxml.internal.operations; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.j2ee.model.ModelProviderManager; -import org.eclipse.jst.javaee.web.WebApp; -import org.eclipse.jst.jsf.common.webxml.WebXmlUtilsForJavaEE; - - -/** - * Runnable to add a filter to web.xml. - * - * @author Debajit Adhikary - * - */ -public class FilterAdderForJavaEE implements Runnable -{ - private final IProject project; - private final String filterName; - private final String filterClass; - - - /** - * @param project - * @param filterName - * @param filterClass - */ - public FilterAdderForJavaEE (final IProject project, - final String filterName, - final String filterClass) - { - this.project = project; - this.filterName = filterName; - this.filterClass = filterClass; - } - - - public void run () - { - final WebApp webApp = (WebApp) ModelProviderManager.getModelProvider(project).getModelObject(); - - WebXmlUtilsForJavaEE.addFilter(webApp, filterName, filterClass); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/internal/operations/FilterMapperAdderForJ2EE.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/internal/operations/FilterMapperAdderForJ2EE.java deleted file mode 100644 index 7dd02a8c9..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/internal/operations/FilterMapperAdderForJ2EE.java +++ /dev/null @@ -1,60 +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.common.webxml.internal.operations; - - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.j2ee.model.ModelProviderManager; -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.jst.jsf.common.webxml.WebXmlUtilsForJ2EE; - - -/** - * Runnable to add a filter-mapping to web.xml. - * - * @author Debajit Adhikary - * - */ -public class FilterMapperAdderForJ2EE implements Runnable -{ - private final IProject project; - private final String filterName; - private final String filterClass; - private final String servletName; - - - /** - * @param project - * @param filterName - * @param filterClass - * @param servletName - */ - public FilterMapperAdderForJ2EE (final IProject project, - final String filterName, - final String filterClass, - final String servletName) - { - this.project = project; - this.filterName = filterName; - this.filterClass = filterClass; - this.servletName = servletName; - } - - - public void run () - { - final WebApp webApp = (WebApp) ModelProviderManager.getModelProvider(project).getModelObject(); - - WebXmlUtilsForJ2EE.addFilterMapping(webApp, filterName, filterClass, servletName); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/internal/operations/FilterMapperAdderForJavaEE.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/internal/operations/FilterMapperAdderForJavaEE.java deleted file mode 100644 index 5fa9f4978..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/internal/operations/FilterMapperAdderForJavaEE.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.common.webxml.internal.operations; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.j2ee.model.ModelProviderManager; -import org.eclipse.jst.javaee.web.WebApp; -import org.eclipse.jst.jsf.common.webxml.WebXmlUtilsForJavaEE; - - -/** - * Runnable to add a filter-mapping to web.xml. - * - * @author Debajit Adhikary - * - */ -public class FilterMapperAdderForJavaEE implements Runnable -{ - private final IProject project; - private final String filterName; - private final String servletName; - - - /** - * @param project - * @param filterName - * @param servletName - */ - public FilterMapperAdderForJavaEE (final IProject project, - final String filterName, - final String servletName) - { - this.project = project; - this.filterName = filterName; - this.servletName = servletName; - } - - - public void run () - { - final WebApp webApp = (WebApp) ModelProviderManager.getModelProvider(project).getModelObject(); - - WebXmlUtilsForJavaEE.addFilterMapping(webApp, filterName, servletName); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/internal/operations/FilterRemoverForJavaEE.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/internal/operations/FilterRemoverForJavaEE.java deleted file mode 100644 index 68bd2f78e..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/internal/operations/FilterRemoverForJavaEE.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.common.webxml.internal.operations; - - -import static org.eclipse.jst.jsf.common.webxml.WebXmlUtilsForJavaEE.findFilter; -import static org.eclipse.jst.jsf.common.webxml.WebXmlUtilsForJavaEE.removeFilter; -import static org.eclipse.jst.jsf.common.webxml.WebXmlUtilsForJavaEE.removeFilterMappings; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.j2ee.model.ModelProviderManager; -import org.eclipse.jst.javaee.web.Filter; -import org.eclipse.jst.javaee.web.WebApp; - - -/** - * Removes a filter and its associated mappings from web.xml - * - * @author Debajit Adhikary - * - */ -public class FilterRemoverForJavaEE implements Runnable -{ - private final IProject project; - private final String filterClassName; - - - /** - * @param project - * @param filterClassName - */ - public FilterRemoverForJavaEE (final IProject project, - final String filterClassName) - { - this.project = project; - this.filterClassName = filterClassName; - } - - - public void run () - { - final WebApp webApp = (WebApp) ModelProviderManager.getModelProvider(project).getModelObject(); - final Filter filter = findFilter(webApp, filterClassName); - - removeFilterMappings(webApp, filter); - removeFilter(webApp, filter); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/internal/operations/ListenerAdderForJ2EE.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/internal/operations/ListenerAdderForJ2EE.java deleted file mode 100644 index 25c70208d..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/internal/operations/ListenerAdderForJ2EE.java +++ /dev/null @@ -1,51 +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.common.webxml.internal.operations; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.j2ee.model.ModelProviderManager; -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.jst.jsf.common.webxml.WebXmlUtilsForJ2EE; - - -/** - * Runnable to add a listener to web.xml. - * - * @author Debajit Adhikary - * - */ -public class ListenerAdderForJ2EE implements Runnable -{ - private final IProject project; - private final String listenerClass; - - - /** - * @param project - * @param listenerClass - */ - public ListenerAdderForJ2EE (final IProject project, - final String listenerClass) - { - this.project = project; - this.listenerClass = listenerClass; - } - - - public void run () - { - final WebApp webApp = (WebApp) ModelProviderManager.getModelProvider(project).getModelObject(); - - WebXmlUtilsForJ2EE.addListener(webApp, listenerClass); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/internal/operations/ListenerAdderForJavaEE.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/internal/operations/ListenerAdderForJavaEE.java deleted file mode 100644 index ea8c600cd..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/internal/operations/ListenerAdderForJavaEE.java +++ /dev/null @@ -1,51 +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.common.webxml.internal.operations; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.j2ee.model.ModelProviderManager; -import org.eclipse.jst.javaee.web.WebApp; -import org.eclipse.jst.jsf.common.webxml.WebXmlUtilsForJavaEE; - - -/** - * Runnable to add a listener to web.xml. - * - * @author Debajit Adhikary - * - */ -public class ListenerAdderForJavaEE implements Runnable -{ - private final IProject project; - private final String listenerClass; - - - /** - * @param project - * @param listenerClass - */ - public ListenerAdderForJavaEE (final IProject project, - final String listenerClass) - { - this.project = project; - this.listenerClass = listenerClass; - } - - - public void run () - { - final WebApp webApp = (WebApp) ModelProviderManager.getModelProvider(project).getModelObject(); - - WebXmlUtilsForJavaEE.addListener(webApp, listenerClass); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/internal/operations/ServletAdderForJ2EE.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/internal/operations/ServletAdderForJ2EE.java deleted file mode 100644 index 2626fed66..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/internal/operations/ServletAdderForJ2EE.java +++ /dev/null @@ -1,59 +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.common.webxml.internal.operations; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.j2ee.model.ModelProviderManager; -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.jst.jsf.common.webxml.WebXmlUtilsForJ2EE; - - -/** - * Runnable to add a servlet to web.xml. - * - * @author Debajit Adhikary - * - */ -public class ServletAdderForJ2EE implements Runnable -{ - private final IProject project; - private final String servletName; - private final String servletClass; - private final String loadOnStartup; - - - /** - * @param project - * @param servletName - * @param servletClass - * @param loadOnStartup - */ - public ServletAdderForJ2EE (final IProject project, - final String servletName, - final String servletClass, - final String loadOnStartup) - { - this.project = project; - this.servletName = servletName; - this.servletClass = servletClass; - this.loadOnStartup = loadOnStartup; - } - - - public void run () - { - final WebApp webApp = (WebApp) ModelProviderManager.getModelProvider(project).getModelObject(); - - WebXmlUtilsForJ2EE.addServlet(webApp, servletName, servletClass, loadOnStartup); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/internal/operations/ServletAdderForJavaEE.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/internal/operations/ServletAdderForJavaEE.java deleted file mode 100644 index fd324a3bf..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/internal/operations/ServletAdderForJavaEE.java +++ /dev/null @@ -1,59 +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.common.webxml.internal.operations; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.j2ee.model.ModelProviderManager; -import org.eclipse.jst.javaee.web.WebApp; -import org.eclipse.jst.jsf.common.webxml.WebXmlUtilsForJavaEE; - - -/** - * Runnable to add a servlet to web.xml. - * - * @author Debajit Adhikary - * - */ -public class ServletAdderForJavaEE implements Runnable -{ - private final IProject project; - private final String servletName; - private final String servletClass; - private final String loadOnStartup; - - - /** - * @param project - * @param servletName - * @param servletClass - * @param loadOnStartup - */ - public ServletAdderForJavaEE (final IProject project, - final String servletName, - final String servletClass, - final String loadOnStartup) - { - this.project = project; - this.servletName = servletName; - this.servletClass = servletClass; - this.loadOnStartup = loadOnStartup; - } - - - public void run () - { - final WebApp webApp = (WebApp) ModelProviderManager.getModelProvider(project).getModelObject(); - - WebXmlUtilsForJavaEE.addServlet(webApp, servletName, servletClass, loadOnStartup); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/internal/operations/ServletMappingAdderForJ2EE.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/internal/operations/ServletMappingAdderForJ2EE.java deleted file mode 100644 index d5bf7528f..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/internal/operations/ServletMappingAdderForJ2EE.java +++ /dev/null @@ -1,59 +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.common.webxml.internal.operations; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.j2ee.model.ModelProviderManager; -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.jst.jsf.common.webxml.WebXmlUtilsForJ2EE; - - -/** - * Runnable to add a servlet-mapping to web.xml. - * - * @author Debajit Adhikary - * - */ -public class ServletMappingAdderForJ2EE implements Runnable -{ - private final IProject project; - private final String servletName; - private final String servletClass; - private final String urlPatternString; - - - /** - * @param project - * @param servletName - * @param servletClass - * @param urlPatternString - */ - public ServletMappingAdderForJ2EE (final IProject project, - final String servletName, - final String servletClass, - final String urlPatternString) - { - this.project = project; - this.servletName = servletName; - this.servletClass = servletClass; - this.urlPatternString = urlPatternString; - } - - - public void run () - { - final WebApp webApp = (WebApp) ModelProviderManager.getModelProvider(project).getModelObject(); - - WebXmlUtilsForJ2EE.addServletMapping(webApp, servletName, servletClass, urlPatternString); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/internal/operations/ServletMappingAdderForJavaEE.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/internal/operations/ServletMappingAdderForJavaEE.java deleted file mode 100644 index 16fe0848a..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/internal/operations/ServletMappingAdderForJavaEE.java +++ /dev/null @@ -1,59 +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.common.webxml.internal.operations; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.j2ee.model.ModelProviderManager; -import org.eclipse.jst.javaee.web.WebApp; -import org.eclipse.jst.jsf.common.webxml.WebXmlUtilsForJavaEE; - - -/** - * Runnable to add a servlet-mapping to web.xml. - * - * @author Debajit Adhikary - * - */ -public class ServletMappingAdderForJavaEE implements Runnable -{ - private final IProject project; - private final String servletName; - private final String servletClass; - private final String urlPatternString; - - - /** - * @param project - * @param servletName - * @param servletClass - * @param urlPatternString - */ - public ServletMappingAdderForJavaEE (final IProject project, - final String servletName, - final String servletClass, - final String urlPatternString) - { - this.project = project; - this.servletName = servletName; - this.servletClass = servletClass; - this.urlPatternString = urlPatternString; - } - - - public void run () - { - final WebApp webApp = (WebApp) ModelProviderManager.getModelProvider(project).getModelObject(); - - WebXmlUtilsForJavaEE.addServletMapping(webApp, servletName, servletClass, urlPatternString); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/internal/operations/ServletRemoverForJ2EE.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/internal/operations/ServletRemoverForJ2EE.java deleted file mode 100644 index 9134a9a42..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/internal/operations/ServletRemoverForJ2EE.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.common.webxml.internal.operations; - -import static org.eclipse.jst.jsf.common.webxml.WebXmlUtilsForJ2EE.findServlet; -import static org.eclipse.jst.jsf.common.webxml.WebXmlUtilsForJ2EE.removeServlet; -import static org.eclipse.jst.jsf.common.webxml.WebXmlUtilsForJ2EE.removeServletMappings; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.j2ee.model.ModelProviderManager; -import org.eclipse.jst.j2ee.webapplication.Servlet; -import org.eclipse.jst.j2ee.webapplication.WebApp; - - -/** - * Removes a servlet and its associated mappings from web.xml. - * - * @author Debajit Adhikary - * - */ -public class ServletRemoverForJ2EE implements Runnable -{ - private final IProject project; - private final String servletClassName; - - - /** - * @param project - * @param servletClassName - */ - public ServletRemoverForJ2EE (final IProject project, - final String servletClassName) - { - this.project = project; - this.servletClassName = servletClassName; - } - - - public void run () - { - final WebApp webApp = (WebApp) ModelProviderManager.getModelProvider(project).getModelObject(); - final Servlet servlet = findServlet(webApp, servletClassName); - - removeServletMappings(webApp, servlet); - removeServlet(webApp, servlet); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/internal/operations/ServletRemoverForJavaEE.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/internal/operations/ServletRemoverForJavaEE.java deleted file mode 100644 index baf6cd0ae..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/webxml/internal/operations/ServletRemoverForJavaEE.java +++ /dev/null @@ -1,54 +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.common.webxml.internal.operations; - -import org.eclipse.core.resources.IProject; -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.common.webxml.WebXmlUtilsForJavaEE; - - -/** - * Removes a servlet and its associated mappings from web.xml - * - * @author Debajit Adhikary - * - */ -public class ServletRemoverForJavaEE implements Runnable -{ - private final IProject project; - private final String servletClassName; - - - /** - * @param project - * @param servletClassName - */ - public ServletRemoverForJavaEE (final IProject project, - final String servletClassName) - { - this.project = project; - this.servletClassName = servletClassName; - } - - - public void run () - { - final WebApp webApp = (WebApp) ModelProviderManager.getModelProvider(project).getModelObject(); - final Servlet servlet = WebXmlUtilsForJavaEE.findServlet(servletClassName, webApp); - - WebXmlUtilsForJavaEE.removeServletMappings(webApp, servlet); - WebXmlUtilsForJavaEE.removeServlet(webApp, servlet); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/AbstractDelegatingFactory.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/AbstractDelegatingFactory.java deleted file mode 100644 index 69fac24b9..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/AbstractDelegatingFactory.java +++ /dev/null @@ -1,156 +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.context; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Comparator; -import java.util.Iterator; -import java.util.List; -import java.util.concurrent.CopyOnWriteArrayList; - -import org.eclipse.core.runtime.IAdaptable; - -/** - * An abstract implementation of the IDelegatingFactory interface - * - * Clients may extend this class. - * - * @author cbateman - * - */ -public abstract class AbstractDelegatingFactory implements IDelegatingFactory -{ - - /* instance attributes */ - - /** - * the list of registered factory delegates - */ - protected final CopyOnWriteArrayList<IAdaptable> _delegates; - - private final List<Class> _supportedDelegates; - - /** - * @param supportedDelegateTypes - * -- populates the list of classes used by the isValidDelegate - * contract - */ - protected AbstractDelegatingFactory(final Class[] supportedDelegateTypes) - { - _delegates = new CopyOnWriteArrayList<IAdaptable>(); - - final List<Class> supportedTypes = new ArrayList<Class>(); - supportedTypes.addAll(Arrays.asList(supportedDelegateTypes)); - _supportedDelegates = Collections.unmodifiableList(supportedTypes); - } - - /** - * @see org.eclipse.jst.jsf.context.IDelegatingFactory#addFactoryDelegate(org.eclipse.core.runtime.IAdaptable) - */ - public final void addFactoryDelegate(final IAdaptable delegate) - { - if (isValidDelegate(delegate)) - { - synchronized(_delegates) - { - _delegates.addIfAbsent(delegate); - if (_delegates.size() > 1) - { - List<IAdaptable> delegates = new ArrayList<IAdaptable>(_delegates); - - Collections.sort(delegates, new Comparator() - { - public int compare(Object delegate1, Object delegate2) - { - final Class<?> clazz1 = delegate1.getClass(); - final Class<?> clazz2 = delegate2.getClass(); - - Package package1 = clazz1.getPackage(); - Package package2 = clazz2.getPackage(); - boolean package1IsOSS = package1.getName().startsWith("org.eclipse.jst"); //$NON-NLS-1$ - boolean package2IsOSS = package2.getName().startsWith("org.eclipse.jst"); //$NON-NLS-1$ - - if (package1IsOSS && !package2IsOSS) - { - // sort the oss one after the non-oss one - return 1; - } - else if (!package1IsOSS && package2IsOSS) - { - return -1; - } - - // otherwise they are either both oss or both non-oss, so just - // sort canonically by name. - return clazz1.getName().compareTo(clazz2.getName()); - } - }); - _delegates.clear(); - _delegates.addAll(delegates); - } - } - } - } - - /** - * @see org.eclipse.jst.jsf.context.IDelegatingFactory#removeFactoryDelegate(org.eclipse.core.runtime.IAdaptable) - */ - public final boolean removeFactoryDelegate(final IAdaptable delegate) - { - synchronized(_delegates) - { - return _delegates.remove(delegate); - } - } - - /** - * @see org.eclipse.jst.jsf.context.IDelegatingFactory#getValidDelegateTypes() - */ - public final List<Class> getValidDelegateTypes() - { - return _supportedDelegates; - } - - /** - * @see org.eclipse.jst.jsf.context.IDelegatingFactory#isValidDelegate(org.eclipse.core.runtime.IAdaptable) - */ - public final boolean isValidDelegate(final IAdaptable delegate) - { - for (final Class clazz : _supportedDelegates) - { - // if the delegate supports one of the valid delegate classes - // via adaptation, then it is a valid delegate - if (delegate.getAdapter(clazz) != null) - { - return true; - } - } - - // if no found, delegate is not supported - return false; - } - - /** - * @return an iterator to _delegates which is retrieved in a synchronized block to protect against - * access during sorting. - */ - protected final Iterator<IAdaptable> getDelegatesIterator() - { - synchronized(_delegates) - { - return _delegates.iterator(); - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/AbstractDocumentContext.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/AbstractDocumentContext.java deleted file mode 100644 index 9dad3487d..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/AbstractDocumentContext.java +++ /dev/null @@ -1,42 +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.context; - - -/** - * A convenience super-type for all context instances that implement - * IDocumentContext or one of its sub-types. - * - * - * @author cbateman - * - */ -public abstract class AbstractDocumentContext implements IDocumentContext { - - /** - * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class) - */ - public Object getAdapter(Class adapterClass) - { - if (adapterClass.equals(IDocumentContext.class)) - { - return this; - } - else if (adapterClass.equals(IModelContext.class)) - { - return this; - } - - return null; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/IDelegatingFactory.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/IDelegatingFactory.java deleted file mode 100644 index 6e91576ef..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/IDelegatingFactory.java +++ /dev/null @@ -1,81 +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.context; - -import java.util.List; - -import org.eclipse.core.runtime.IAdaptable; - -/** - * Defines a type of factory that can have delegate factories to help it - * create an appropriate instance type. The general contract for implementors - * is: - * - * 1) You must follow the isValidDelegate contract. - * 2) You should try to create an instance yourself and only delegate - * if cannot do it yourself. Deviations from this rule must be - * clearly documented to ensure clients understand how the factory works. - * - * Clients may NOT implement this interface. - * Extend AbstractDelegatingFactory instead. - * - * @author cbateman - * - */ -public interface IDelegatingFactory -{ - /** -- Delegates */ - /** If this factory is asked to construct but does not know how to, - * it will ask each of its registered delegates to do so in the order - * they were added. - */ - - /** - * Adds delgate to the end of the list of factory delegates if the list - * does not already contain it. - * - * @param delegate - * @throws ClassCastException if delegate does not implement an expected - * interface. Each implementor can define what delegates are valid - * based on the isValidDelegate() and getValidDelegates contracts - */ - void addFactoryDelegate(IAdaptable delegate); - - - /** - * @param delegate - * @return true if delegate was removed, false if delegate wasn't in - * the list of delegates - */ - boolean removeFactoryDelegate(IAdaptable delegate); - - /** - * @return a list of Class objects that represent the interfaces - * that may be passed to addFactoryDelegate. Implementor should - * return at least one supported class. - */ - List<Class> getValidDelegateTypes(); - - - /** - * The return value of this method should conform to the following contract: - * - * Let v = getValidDelegates. Then isValidDelegate should return true - * only if the set of v contains a Class for which delegate.getAdapter(Class) - * returns a non-null value. - * - * @param delegate - * @return true if delegate is supported, false otherwise. - */ - boolean isValidDelegate(IAdaptable delegate); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/IDocumentContext.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/IDocumentContext.java deleted file mode 100644 index fe7d03339..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/IDocumentContext.java +++ /dev/null @@ -1,28 +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.context; - -/** - * Encapsulates runtime context in a JFace IDocument model - * - * Clients may NOT implement this interface directly but may sub-class - * Extend AbstractDocumentContext instead. - - * @author cbateman - * - */ -public interface IDocumentContext extends IModelContext -{ - // TODO: might make sense to have a getDocument() accessor here - // currently empty -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/IModelContext.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/IModelContext.java deleted file mode 100644 index 1ace325cd..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/IModelContext.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: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.context; - -import org.eclipse.core.runtime.IAdaptable; - -/** - * Encapsulates the current runtime context in some model. - * - * This interface may be sub-classed but not implemented directly - */ -public interface IModelContext extends IAdaptable -{ - // current empty -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/package-info.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/package-info.java deleted file mode 100644 index f31d0b2ff..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/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 - * - ********************************************************************************/ - -/** - * Model context framework. - */ -package org.eclipse.jst.jsf.context; diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/AbstractContextResolver.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/AbstractContextResolver.java deleted file mode 100644 index d7b8c7cd7..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/AbstractContextResolver.java +++ /dev/null @@ -1,24 +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.context.resolver; - -import org.eclipse.jst.jsf.context.IModelContext; - -/** - * The super-class of all context resolver impls. - * - * @author cbateman - * - */ -public abstract class AbstractContextResolver implements IContextResolver { - - public abstract boolean canResolveContext(IModelContext modelContext); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/AbstractDocumentContextResolver.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/AbstractDocumentContextResolver.java deleted file mode 100644 index 3571dc4d0..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/AbstractDocumentContextResolver.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.context.resolver; - -import org.eclipse.jst.jsf.context.IModelContext; - -/** - * The parent of all IDocumentContextResolver implementations. - * - * @author cbateman - * - */ -public abstract class AbstractDocumentContextResolver implements - IDocumentContextResolver { - - public abstract boolean canResolveContext(IModelContext modelContext); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/IContextResolver.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/IContextResolver.java deleted file mode 100644 index 4471cabf9..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/IContextResolver.java +++ /dev/null @@ -1,33 +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.context.resolver; - -import org.eclipse.jst.jsf.context.IModelContext; - -/** - * Super type of all context resolvers. - * - * May be sub-classed but should not be implemented directly. - * Use AbstractContextResolver to implement. - * - * @author cbateman - * - */ -public interface IContextResolver -{ - /** - * @param modelContext - * @return true if this resolver can resolve context information - * based on this context - */ - boolean canResolveContext(IModelContext modelContext); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/IDocumentContextResolver.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/IDocumentContextResolver.java deleted file mode 100644 index 0191c3f0b..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/IDocumentContextResolver.java +++ /dev/null @@ -1,28 +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.context.resolver; - -/** - * The super-interface for all context resolvers that are related - * to IDocumentContext's. - * - * This interface may NOT be implemented by clients directly but may be sub-classed. - * Use AbstractDocumentContextResolver for implementation. - * - * @author cbateman - * - */ -public interface IDocumentContextResolver extends IContextResolver -{ - // currently empty -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/package-info.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/package-info.java deleted file mode 100644 index 27cb48d37..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/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 - * - ********************************************************************************/ - -/** - * Context resolver framework. - */ -package org.eclipse.jst.jsf.context.resolver; diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/structureddocument/IDOMContextResolver.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/structureddocument/IDOMContextResolver.java deleted file mode 100644 index 4677bc851..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/structureddocument/IDOMContextResolver.java +++ /dev/null @@ -1,41 +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.context.resolver.structureddocument; - -import org.eclipse.jst.jsf.context.resolver.IDocumentContextResolver; -import org.w3c.dom.Document; -import org.w3c.dom.Node; - -/** - * Defines a type of context resolver used to resolve the current context - * in the XML DOM context. - * - * This interface may be sub-classed or implemented by clients - * - * @author cbateman - * - */ -public interface IDOMContextResolver extends IDocumentContextResolver -{ - /** - * @return the complete DOM Document for this context or null if it - * cannot be resolved. - */ - Document getDOMDocument(); - - /** - * @return the node which the current context is pointing to. - * If document context is on an attribute will return that attribute - */ - Node getNode(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/structureddocument/IMetadataContextResolver.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/structureddocument/IMetadataContextResolver.java deleted file mode 100644 index 12e9987cc..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/structureddocument/IMetadataContextResolver.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: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.context.resolver.structureddocument; - -import java.util.List; - -import org.eclipse.jst.jsf.context.resolver.IDocumentContextResolver; - -/** - * Resolves meta-data for a particular context - * - * This interface may sub-classed or implemented by clients - * - * @author cbateman - * - */ -public interface IMetadataContextResolver extends IDocumentContextResolver -{ - /** - * @param key - * @return a list of one or more String values associated with key - * for the current context location. - */ - List getPropertyValue(String key); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/structureddocument/IStructuredDocumentContextResolverFactory.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/structureddocument/IStructuredDocumentContextResolverFactory.java deleted file mode 100644 index 1727b2f39..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/structureddocument/IStructuredDocumentContextResolverFactory.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: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.context.resolver.structureddocument; - -import org.eclipse.jst.jsf.context.resolver.structureddocument.internal.ITextRegionContextResolver; -import org.eclipse.jst.jsf.context.resolver.structureddocument.internal.impl.StructuredDocumentContextResolverFactory; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext; - - -/** - * A factory for creating context resolvers that work with structured - * document contexts - * - * This factory may be used but not implemented or extended by clients. - * TODO: - * Note that getTextRegionResolver() will be moved to to an internal factory - * interface and should not be considered part of the provisional API - * - * @author cbateman - * - */ -public interface IStructuredDocumentContextResolverFactory -{ - - /** - * The global instance of the factory - */ - public static final IStructuredDocumentContextResolverFactory INSTANCE = StructuredDocumentContextResolverFactory.getInstance(); - - /** - * @param context - * @return a resolver capable of resolving information in context or null - * if one cannot be created. - */ - IDOMContextResolver getDOMContextResolver(IStructuredDocumentContext context); - - /** - * **Non-WTP Clients: this method should not be considered API** - * - * @param context - * @return a resolver capable of resolving information in the context or - * null if one cannot be created - */ - ITextRegionContextResolver getTextRegionResolver(IStructuredDocumentContext context); - - /** - * @param context - * @return a resolver capable of resolving information in the context or - * null if one cannot be created - */ - IWorkspaceContextResolver getWorkspaceContextResolver(IStructuredDocumentContext context); - - /** - * @param context - * @return a resolver capable of resolving information in the context - * or null one cannot be created - */ - ITaglibContextResolver getTaglibContextResolver(IStructuredDocumentContext context); - - /** - * @param context - * @return a resolver capable of resolving information in the context - * or null if one cannot be created - */ - IMetadataContextResolver getMetadataContextResolver(IStructuredDocumentContext context); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/structureddocument/ITaglibContextResolver.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/structureddocument/ITaglibContextResolver.java deleted file mode 100644 index 34c4b6f6f..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/structureddocument/ITaglibContextResolver.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: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.context.resolver.structureddocument; - -import org.eclipse.jst.jsf.context.resolver.IDocumentContextResolver; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - -/** - * Defines a context resolver that resolves tag library information - * for a particular context. - * - * This interface may be sub-classed or implemented by clients - * - * @author cbateman - * - */ -public interface ITaglibContextResolver extends IDocumentContextResolver -{ - /** - * @param node - * @return the URI corresponding to the taglib that defines the - * node in the context document or null if it cannot be found - */ - String getTagURIForNodeName(Node node); - - /** - * @param uri - * @return the tag prefix used in the context document for - * the provided uri or null if it cannot be found. - */ - String getTagPrefixForURI(String uri); - - /** - * A list all tags in the document context that are called - * tagName defined in the namespace indicated by uri - * - * @param uri - * @param tagName - * @return a (possibly empty) list of tags -- must never - * be null. Indicate none found with an empty list. - */ - NodeList getTagsByNamespaceURI(String uri, String tagName); - - /** - * @param node - * @return true if node has a tag library associated with it in this context - */ - public boolean hasTag(Node node); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/structureddocument/IWorkspaceContextResolver.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/structureddocument/IWorkspaceContextResolver.java deleted file mode 100644 index 9a9f39994..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/structureddocument/IWorkspaceContextResolver.java +++ /dev/null @@ -1,42 +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.context.resolver.structureddocument; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.jst.jsf.context.resolver.IDocumentContextResolver; - -/** - * A resolver to determine the current context within the Eclipse - * workspace. - * - * This interface may be sub-classed or implemented by clients - * - * @author cbateman - * - */ -public interface IWorkspaceContextResolver extends IDocumentContextResolver -{ - /** - * @return the project that contains the document context - * or null if it cannot be determined - */ - IProject getProject(); - - /** - * @return the resource that contains the document context - * or null if it cannot be determined. - * This should normally be an IFile. - */ - IResource getResource(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/structureddocument/internal/IStructuredDocumentContextResolverFactory2.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/structureddocument/internal/IStructuredDocumentContextResolverFactory2.java deleted file mode 100644 index 4244d33b2..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/structureddocument/internal/IStructuredDocumentContextResolverFactory2.java +++ /dev/null @@ -1,48 +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.context.resolver.structureddocument.internal; - -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; - -/** - * An additional factory interface for context resolvers. - * - * @author cbateman - * - */ -public interface IStructuredDocumentContextResolverFactory2 extends - IStructuredDocumentContextResolverFactory -{ - /** - * The global instance of the factory - */ - public static final IStructuredDocumentContextResolverFactory2 INSTANCE = - (IStructuredDocumentContextResolverFactory2) IStructuredDocumentContextResolverFactory.INSTANCE; - - /** - * Same as getTaglibContextResolver but checks delegate factory first. - * - * @param context - * @return a resolver capable of resolving information in the context - * or null one cannot be created - */ - ITaglibContextResolver getTaglibContextResolverFromDelegates(IStructuredDocumentContext context); - - /** - * @param <T> resolver type - * @param context - * @param clazz - * @return resolver of type T - */ - <T> T getResolver(IStructuredDocumentContext context, Class<T> clazz); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/structureddocument/internal/ITextRegionContextResolver.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/structureddocument/internal/ITextRegionContextResolver.java deleted file mode 100644 index aca84351e..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/structureddocument/internal/ITextRegionContextResolver.java +++ /dev/null @@ -1,128 +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.context.resolver.structureddocument.internal; - -import org.eclipse.jst.jsf.context.resolver.IDocumentContextResolver; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext; - -/** - * Defines a resolver that can resolve context information in the - * structured document region context. - * - * Unless otherwise stated, the context region is the most specific - * region (leaf) in which the current context is contained. - * - * Note: this interface may use internal/provisional types. - * - * @author cbateman - * - */ -public interface ITextRegionContextResolver extends IDocumentContextResolver -{ - /** - * @return the text for the context region - */ - String getRegionText(); - - /** - * @return the document relative offset of the start of the region - * in which the context in is contained or -1 if the offset cannot be determined. - */ - int getStartOffset(); - - /** - * @return the document relative offset of the end of the region - * in which the context is contained or -1 if the offset cannot be determined - */ - int getEndOffset(); - - /** - * @return the length of the most specific region in which the context - * is contained or -1 if the length cannot be determined. - */ - int getLength(); - - /** - * @return the most specific TextRegion type for the current context - */ - String getRegionType(); - - /** - * @return the path to the most specific TextRegtion for the current context - * note that this does not include the actual region for the current region. - * That is returned by getRegionType(). - * - */ - String[] getRegionTypePath(); - - - /** - * The offset into the structured document will be set to be - * the start offset of the previous region - * - * @return a context for the previous sibling of this context's - * text region parent or null if no previous sibling exists - */ - IStructuredDocumentContext getPreviousContext(); - - /** - * The offset into the structured document will be set to be - * the start offset of the next region - * - * @return a context for the next sibling of this context's - * text region parent or null if no next sibling exists - */ - IStructuredDocumentContext getNextContext(); - - /** - * Relative path works backwards from the current context. So if the - * path to current context is /a/b/c/d/e then: - * - * matchesRelative({"e"}) == true - * matchesRelative({"d", "e"}) == true - * matchesRelative({"c", "d", "e"}) == true - * matchesRelative({"b", "c", "d", "e"}) == true - * matchesRelative({"a", "b", "c", "d", "e"}) == true - * - * because in every case the path matches working backward from the current - * context - * - * but - * - * matchesRelative({a}) == false because context/.. == e not a - * - * TODO: what does path = new String[0] mean? - * - * @param path - * @return true if the relative path matches the path to the current context - * working relative to the current context. - */ - boolean matchesRelative(String[] path); - - /** - * Absolute path works forward from the root of the document to the - * current context. So if the path to the current context is /a/b/c/d/e then: - * - * matchesAbsolute({"a", "b", "c", "d", "e"}) == true - * - * but - * - * matchesAbsolute({"b", "c", "d", "e"}) == true because starting from the root - * you cannot follow /b/c/d/e to the context. - * - * @param path - * @return true if the absolute path from the root of the document - * matches the current context - */ - boolean matchesAbsolute(String[] path); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/structureddocument/internal/ResolverUtil.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/structureddocument/internal/ResolverUtil.java deleted file mode 100644 index fda4dbc56..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/structureddocument/internal/ResolverUtil.java +++ /dev/null @@ -1,66 +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.context.resolver.structureddocument.internal; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IResource; -import org.eclipse.jface.text.IDocument; -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.structureddocument.IStructuredDocumentContextFactory; - -/** - * Internal convenience class to simplify regularly repeated tasks - * @author cbateman - * - */ -public final class ResolverUtil -{ - /** - * This method will generally only work if the document is an - * IStructuredDocument. - * - * @param document - * @return the IFile corresponding to document or null if not applicable. - * - */ - public static IFile getFileForDocument(final IDocument document) - { - final IStructuredDocumentContext context = - IStructuredDocumentContextFactory.INSTANCE.getContext(document, - -1); - - if (context != null) - { - final IWorkspaceContextResolver wkResolver = - IStructuredDocumentContextResolverFactory.INSTANCE - .getWorkspaceContextResolver(context); - - if (wkResolver != null) - { - final IResource res = wkResolver.getResource(); - - if (res instanceof IFile) - { - return (IFile) res; - } - } - } - return null; - } - - private ResolverUtil() - { - // no instantiation - throw new UnsupportedOperationException(); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/structureddocument/internal/impl/DOMContextResolver.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/structureddocument/internal/impl/DOMContextResolver.java deleted file mode 100644 index 76d75938c..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/structureddocument/internal/impl/DOMContextResolver.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: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.context.resolver.structureddocument.internal.impl; - -import org.eclipse.jst.jsf.context.IModelContext; -import org.eclipse.jst.jsf.context.resolver.structureddocument.IDOMContextResolver; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext; -import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion; -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument; -import org.w3c.dom.Document; -import org.w3c.dom.Node; - -/** - * Resolves DOM-related information in the provided context - * - * @author cbateman - * - */ -class DOMContextResolver implements IDOMContextResolver -{ - private final IStructuredDocumentContext _context; - //private ITextRegionContextResolver _regionResolver; // null; lazy initialized if needed - - DOMContextResolver(IStructuredDocumentContext context) - { - _context = context; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.context.resolver.structureddocument.IDOMContextResolver#getDOMDocument() - */ - public Document getDOMDocument() - { - return StructuredDocumentResolverUtil.getDOMDocument((IStructuredDocument)_context.getStructuredDocument()); - } - - public Node getNode() - { - IndexedRegion region = StructuredDocumentResolverUtil.getIndexedRegion((IStructuredDocument) _context.getStructuredDocument(), _context.getDocumentPosition()); - - if (region instanceof Node) - { - return (Node) region; - } - - return null; - } - - - public boolean canResolveContext(IModelContext modelContext) - { - return modelContext.getAdapter(IStructuredDocumentContext.class) != null; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/structureddocument/internal/impl/MetadataContextResolver.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/structureddocument/internal/impl/MetadataContextResolver.java deleted file mode 100644 index 52d62f836..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/structureddocument/internal/impl/MetadataContextResolver.java +++ /dev/null @@ -1,114 +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.context.resolver.structureddocument.internal.impl; - -import java.util.Collections; -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IResource; -import org.eclipse.jst.jsf.common.metadata.Trait; -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataDomainContext; -import org.eclipse.jst.jsf.common.metadata.internal.TraitValueHelper; -import org.eclipse.jst.jsf.common.metadata.query.internal.MetaDataQueryContextFactory; -import org.eclipse.jst.jsf.common.metadata.query.internal.MetaDataQueryFactory; -import org.eclipse.jst.jsf.common.metadata.query.internal.taglib.ITaglibDomainMetaDataQuery; -import org.eclipse.jst.jsf.context.IModelContext; -import org.eclipse.jst.jsf.context.resolver.structureddocument.IMetadataContextResolver; -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.w3c.dom.Attr; -import org.w3c.dom.Element; -import org.w3c.dom.Node; - -/** - * A default implementation of meta-data context resolver - * - * @author cbateman - * - */ -class MetadataContextResolver implements IMetadataContextResolver -{ - private final IStructuredDocumentContext _context; - private final IStructuredDocumentContextResolverFactory2 _factory; - - /** - * @param factory - * @param context - */ - public MetadataContextResolver(final IStructuredDocumentContextResolverFactory2 factory, - final IStructuredDocumentContext context) - { - _factory = factory; - _context = context; - } - - public List getPropertyValue(final String key) - { - final DOMContextResolver domResolver = new DOMContextResolver(_context); - final ITaglibContextResolver tagResolver = - _factory.getTaglibContextResolverFromDelegates(_context); - final Node curNode = domResolver.getNode(); - final IMetaDataDomainContext mdContext = getMDContext(_context); - if (curNode instanceof Attr) - { - final Attr attribute = (Attr) curNode; - final Element element = attribute.getOwnerElement(); - final String uri = tagResolver.getTagURIForNodeName(element); - - final ITaglibDomainMetaDataQuery query = (ITaglibDomainMetaDataQuery)MetaDataQueryFactory.getInstance().createQuery(mdContext); - final Trait trait = query.getQueryHelper().getTrait(uri, element.getLocalName()+"/"+attribute.getLocalName(), key); //$NON-NLS-1$ -// final ITaglibDomainMetaDataModelContext mdContext = TaglibDomainMetaDataQueryHelper.createMetaDataModelContext(project, uri); -// Trait trait = TaglibDomainMetaDataQueryHelper.getTrait(mdContext, element.getLocalName()+"/"+attribute.getLocalName(), key); //$NON-NLS-1$ - if( trait != null ) - { - return TraitValueHelper.getValueAsListOfStrings(trait); - } - - } - else if (curNode instanceof Element) - { - final Element element = (Element) curNode; - final String uri = tagResolver.getTagURIForNodeName(element); - - final ITaglibDomainMetaDataQuery query = (ITaglibDomainMetaDataQuery)MetaDataQueryFactory.getInstance().createQuery(mdContext); - final Trait trait = query.getQueryHelper().getTrait(uri, element.getLocalName(), key); -// final ITaglibDomainMetaDataModelContext mdContext = TaglibDomainMetaDataQueryHelper.createMetaDataModelContext(project, uri); -// Trait trait = TaglibDomainMetaDataQueryHelper.getTrait(mdContext, element.getLocalName(), key); - if( trait != null ) - { - return TraitValueHelper.getValueAsListOfStrings(trait); - } - } - - return Collections.EMPTY_LIST; - } - - private IMetaDataDomainContext getMDContext( - final IStructuredDocumentContext context) { - - final WorkspaceContextResolver wsResolver = new WorkspaceContextResolver(context); - final IResource res = wsResolver.getResource(); - if (res instanceof IFile) - return MetaDataQueryContextFactory.getInstance().createTaglibDomainModelContext((IFile)res); - - return MetaDataQueryContextFactory.getInstance().createTaglibDomainModelContext(wsResolver.getProject()); - - } - - public boolean canResolveContext(IModelContext modelContext) { - return (modelContext.getAdapter(IStructuredDocumentContext.class) != null); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/structureddocument/internal/impl/StructuredDocumentContextResolverFactory.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/structureddocument/internal/impl/StructuredDocumentContextResolverFactory.java deleted file mode 100644 index b05e6e628..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/structureddocument/internal/impl/StructuredDocumentContextResolverFactory.java +++ /dev/null @@ -1,345 +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.context.resolver.structureddocument.internal.impl; - - -import java.util.Iterator; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.jst.jsf.context.AbstractDelegatingFactory; -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.IStructuredDocumentContextResolverFactory2; -import org.eclipse.jst.jsf.context.resolver.structureddocument.internal.ITextRegionContextResolver; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext; -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument; - -/** - * Implements a factory for creating context resolvers for structured document - * contexts. - * - * @author cbateman - * - */ -public class StructuredDocumentContextResolverFactory extends -AbstractDelegatingFactory implements -IStructuredDocumentContextResolverFactory, IStructuredDocumentContextResolverFactory2 -{ - /* static attributes */ - private static StructuredDocumentContextResolverFactory INSTANCE; - - /** - * @return an instance (possibly shared) of the this factory - */ - public synchronized static StructuredDocumentContextResolverFactory getInstance() - { - if (INSTANCE == null) - { - INSTANCE = new StructuredDocumentContextResolverFactory(); - } - - return INSTANCE; - } - - /** - * Constructor - */ - protected StructuredDocumentContextResolverFactory() - { - super(new Class[] - { IStructuredDocumentContextResolverFactory.class }); - } - - /** - * @see org.eclipse.jst.jsf.context.resolver.structureddocument.IStructuredDocumentContextResolverFactory#getDOMContextResolver(org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext) - */ - public IDOMContextResolver getDOMContextResolver( - final IStructuredDocumentContext context) - { - IDOMContextResolver resolver = internalGetDOMResolver(context); - - if (resolver == null) - { - resolver = delegateGetDOMResolver(context); - } - - return resolver; - } - - private IDOMContextResolver internalGetDOMResolver( - final IStructuredDocumentContext context) - { - if (context.getStructuredDocument() instanceof IStructuredDocument) - { - return new DOMContextResolver(context); - } - - return null; - } - - private IDOMContextResolver delegateGetDOMResolver( - final IStructuredDocumentContext context) - { - Iterator<IAdaptable> it = getDelegatesIterator(); - while (it.hasNext()) - { - IAdaptable adapter = it.next(); - - final IStructuredDocumentContextResolverFactory delegateFactory = (IStructuredDocumentContextResolverFactory) adapter - .getAdapter(IStructuredDocumentContextResolverFactory.class); - - if (delegateFactory != null) - { - final IDOMContextResolver contextResolver = delegateFactory - .getDOMContextResolver(context); - - if (contextResolver != null) - { - return contextResolver; - } - } - } - - return null; - } - - /** - * @see org.eclipse.jst.jsf.context.resolver.structureddocument.IStructuredDocumentContextResolverFactory#getTextRegionResolver(org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext) - */ - public ITextRegionContextResolver getTextRegionResolver( - final IStructuredDocumentContext context) - { - ITextRegionContextResolver resolver = internalGetTextRegionResolver(context); - - if (resolver == null) - { - resolver = delegateGetTextRegionResolver(context); - } - - return resolver; - } - - private ITextRegionContextResolver internalGetTextRegionResolver( - final IStructuredDocumentContext context) - { - if (context.getStructuredDocument() instanceof IStructuredDocument) - { - return new TextRegionContextResolver(context); - } - - return null; - } - - private ITextRegionContextResolver delegateGetTextRegionResolver( - final IStructuredDocumentContext context) - { - Iterator<IAdaptable> it = getDelegatesIterator(); - while (it.hasNext()) - { - IAdaptable adapter = it.next(); - final IStructuredDocumentContextResolverFactory delegateFactory = (IStructuredDocumentContextResolverFactory) (adapter) - .getAdapter(IStructuredDocumentContextResolverFactory.class); - final ITextRegionContextResolver contextResolver = delegateFactory - .getTextRegionResolver(context); - - if (contextResolver != null) - { - return contextResolver; - } - } - - return null; - } - - public IWorkspaceContextResolver getWorkspaceContextResolver( - final IStructuredDocumentContext context) - { - IWorkspaceContextResolver resolver = internalGetWorkspaceContextResolver(context); - - if (resolver == null) - { - resolver = delegateGetWorkspaceContextResolver(context); - } - - return resolver; - - } - - private IWorkspaceContextResolver internalGetWorkspaceContextResolver( - final IStructuredDocumentContext context) - { - if (context.getStructuredDocument() instanceof IStructuredDocument) - { - return new WorkspaceContextResolver(context); - } - - return null; - } - - private IWorkspaceContextResolver delegateGetWorkspaceContextResolver( - final IStructuredDocumentContext context) - { - Iterator<IAdaptable> it = getDelegatesIterator(); - while (it.hasNext()) - { - IAdaptable adapter = it.next(); - final IStructuredDocumentContextResolverFactory delegateFactory = (IStructuredDocumentContextResolverFactory) (adapter) - .getAdapter(IStructuredDocumentContextResolverFactory.class); - final IWorkspaceContextResolver contextResolver = delegateFactory - .getWorkspaceContextResolver(context); - - if (contextResolver != null) - { - return contextResolver; - } - } - - return null; - } - - public ITaglibContextResolver getTaglibContextResolver( - final IStructuredDocumentContext context) - { - // check the delegats first - ITaglibContextResolver resolver = internalGetTaglibContextResolver(context); - - if (resolver == null) - { - resolver = delegateGetTaglibContextResolver(context); - } - - return resolver; - } - - public ITaglibContextResolver getTaglibContextResolverFromDelegates( - final IStructuredDocumentContext context) - { - // check the delegats first - ITaglibContextResolver resolver = delegateGetTaglibContextResolver(context); - - if (resolver == null) - { - resolver = internalGetTaglibContextResolver(context); - } - - return resolver; - } - - private ITaglibContextResolver internalGetTaglibContextResolver( - final IStructuredDocumentContext context) - { - // always delegate. No defaults. - return null; - } - - private ITaglibContextResolver delegateGetTaglibContextResolver( - final IStructuredDocumentContext context) - { - Iterator<IAdaptable> it = getDelegatesIterator(); - while (it.hasNext()) - { - IAdaptable adapter = it.next(); - final IStructuredDocumentContextResolverFactory delegateFactory = - (IStructuredDocumentContextResolverFactory) adapter - .getAdapter(IStructuredDocumentContextResolverFactory.class); - - if (delegateFactory != null) - { - final ITaglibContextResolver contextResolver = delegateFactory - .getTaglibContextResolver(context); - - if (contextResolver != null) - { - return contextResolver; - } - } - } - - return null; - } - - public IMetadataContextResolver getMetadataContextResolver( - final IStructuredDocumentContext context) - { - IMetadataContextResolver resolver = internalGetMetadataContextResolver(context); - - if (resolver == null) - { - resolver = delegateGetMetadataContextResolver(context); - } - - return resolver; - } - - private IMetadataContextResolver internalGetMetadataContextResolver( - final IStructuredDocumentContext context) - { - if (context.getStructuredDocument() instanceof IStructuredDocument) - { - return new MetadataContextResolver(this, context); - } - - return null; - } - - private IMetadataContextResolver delegateGetMetadataContextResolver( - final IStructuredDocumentContext context) - { - Iterator<IAdaptable> it = getDelegatesIterator(); - while (it.hasNext()) - { - IAdaptable adapter = it.next(); - final IStructuredDocumentContextResolverFactory delegateFactory = (IStructuredDocumentContextResolverFactory) (adapter) - .getAdapter(IStructuredDocumentContextResolverFactory.class); - final IMetadataContextResolver contextResolver = delegateFactory - .getMetadataContextResolver(context); - - if (contextResolver != null) - { - return contextResolver; - } - } - - return null; - } - - public <T> T getResolver(final IStructuredDocumentContext context, final Class<T> clazz) { - - { - Iterator<IAdaptable> it = getDelegatesIterator(); - while (it.hasNext()) - { - IAdaptable adapter = it.next(); - final IStructuredDocumentContextResolverFactory delegateFactory = - (IStructuredDocumentContextResolverFactory) adapter - .getAdapter(IStructuredDocumentContextResolverFactory.class); - - if (delegateFactory != null - && delegateFactory instanceof IStructuredDocumentContextResolverFactory2) - { - final IStructuredDocumentContextResolverFactory2 contextResolverFactory = (IStructuredDocumentContextResolverFactory2)delegateFactory; - final T contextResolver = contextResolverFactory.getResolver(context, clazz); - if (contextResolver != null) - { - return contextResolver; - } - } - } - - return null; - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/structureddocument/internal/impl/StructuredDocumentResolverUtil.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/structureddocument/internal/impl/StructuredDocumentResolverUtil.java deleted file mode 100644 index 9a4a780ac..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/structureddocument/internal/impl/StructuredDocumentResolverUtil.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: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.context.resolver.structureddocument.internal.impl; - -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.sse.core.internal.provisional.IndexedRegion; -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel; -import org.w3c.dom.NamedNodeMap; -import org.w3c.dom.Node; - -/** - * @author cbateman - * - * Defines common utility methods for document resolvers - */ -final class StructuredDocumentResolverUtil -{ - static IDOMDocument getDOMDocument(IStructuredDocument document) - { - IStructuredModel model = getStructuredModel(document); - - try - { - if (model instanceof IDOMModel) - { - return ((IDOMModel)model).getDocument(); - } - } - finally - { - if (model != null) - { - model.releaseFromRead(); - } - } - - return null; - } - - static IndexedRegion getIndexedRegion(final IStructuredDocument document, final int documentOffset) - { - // C.B: most of this logic was copied from ContentAssistUtils.getNodeAt - // I chose to copy rather than just call that because ContentAssistUtils is - // internal - IStructuredModel model = getStructuredModel(document); - IndexedRegion region = null; - if (model != null) - { - try - { - int lastOffset = documentOffset; - region = model.getIndexedRegion(documentOffset); - while (region == null && lastOffset >= 0) { - lastOffset--; - region = model.getIndexedRegion(lastOffset); - } - - // now we assume we have an element. But our context may be - // on an attribute in that node, so we need to check - if (region instanceof IDOMElement) - { - IDOMElement domElement = (IDOMElement) region; - - NamedNodeMap attributes = domElement.getAttributes(); - - for (int i = 0; i < attributes.getLength(); i++) - { - Node attrNode = attributes.item(i); - - if (attrNode instanceof IDOMAttr) - { - IDOMAttr attr = (IDOMAttr) attrNode; - - if (documentOffset >= attr.getStartOffset() - && documentOffset < attr.getEndOffset()) - { - region = attr; - break; - } - } - } - } - } - finally - { - model.releaseFromRead(); - } - } - - return region; - } - - /** - * @param document - * @return a structured model or null if one cannot be opened for document. - * Note: the caller is responsible for releasing the instance of structured - * model that gets returned. - */ - private static IStructuredModel getStructuredModel(IStructuredDocument document) - { - IModelManager modelManager = StructuredModelManager.getModelManager(); - - if (modelManager != null) - { - return StructuredModelManager.getModelManager().getModelForRead(document); - } - - return null; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/structureddocument/internal/impl/TaglibContextResolver.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/structureddocument/internal/impl/TaglibContextResolver.java deleted file mode 100644 index 4b10c020e..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/structureddocument/internal/impl/TaglibContextResolver.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.context.resolver.structureddocument.internal.impl; - -import java.util.Iterator; - -import org.eclipse.jst.jsf.common.internal.JSPUtil; -import org.eclipse.jst.jsf.context.IModelContext; -import org.eclipse.jst.jsf.context.resolver.structureddocument.ITaglibContextResolver; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext; -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.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.w3c.dom.Attr; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - -/** - * TODO: this resolver only applies to structured documents that can have - * taglibs (I think only JSPs). Should we move a different package? - * Default taglib context resolver - * - * @author cbateman - * @deprecated Use ViewBasedTaglibResolver instead. This impl will be removed - * post-Helios. - */ -class TaglibContextResolver implements ITaglibContextResolver -{ - private final IStructuredDocumentContext _context; - - TaglibContextResolver(IStructuredDocumentContext context) - { - _context = context; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.context.resolver.structureddocument.ITaglibContextResolver#getTagPrefixForURI(java.lang.String) - */ - public String getTagPrefixForURI(String uri) - { - return null; - } - - public boolean hasTag(final Node node) - { - Node checkNode = node; - - if (node instanceof Attr) - { - checkNode = ((Attr)node).getOwnerElement(); - } - - return getTracker(checkNode) != null; - } - - private TaglibTracker getTracker(Node node) - { - final String prefix = node.getPrefix(); - - final TLDCMDocumentManager docMgr = - TaglibController.getTLDCMDocumentManager(_context.getStructuredDocument()); - - // if there's no prefix, there's no way to id the tag library - // TODO: is this always true? need to consult spec - // similar problem if couldn't load docMgr - if (prefix == null - || docMgr == null) - { - return null; - } - - for (final Iterator it = docMgr.getTaglibTrackers().iterator(); it.hasNext();) - { - final TaglibTracker tracker = (TaglibTracker) it.next(); - - if (prefix.equals(tracker.getPrefix())) - { - return tracker; - } - } - - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.context.resolver.structureddocument.ITaglibContextResolver#getTagURIForNodeName(org.w3c.dom.Node) - */ - public String getTagURIForNodeName(final Node node) - { - Node checkNode = node; - - if (node instanceof Attr) - { - checkNode = ((Attr)node).getOwnerElement(); - } - - final TaglibTracker tracker = getTracker(checkNode); - - if (tracker != null) - { - return tracker.getURI(); - } - - - return null; - } - - - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.context.resolver.structureddocument.ITaglibContextResolver#getTagsByNamespaceURI(java.lang.String, java.lang.String) - */ - public NodeList getTagsByNamespaceURI(String uri, String tagName) - { - //Document domDoc = new DOMContextResolver(_context).getDOMDocument(); - return null; - - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.context.resolver.IContextResolver#canResolveContext(org.eclipse.jst.jsf.context.IModelContext) - */ - public boolean canResolveContext(IModelContext modelContext) - { - // must be a JSP page - Object adapter = modelContext.getAdapter(IStructuredDocumentContext.class); - - if (adapter instanceof IStructuredDocumentContext) - { - IStructuredDocumentContext context = - (IStructuredDocumentContext) adapter; - IStructuredModel smodel = null; - - try - { - smodel = StructuredModelManager.getModelManager().getModelForRead((IStructuredDocument)context.getStructuredDocument()); - return JSPUtil.isJSPContentType(smodel.getContentTypeIdentifier()); - } - finally - { - if (smodel != null) - { - smodel.releaseFromRead(); - } - } - } - - return false; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/structureddocument/internal/impl/TextRegionContextResolver.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/structureddocument/internal/impl/TextRegionContextResolver.java deleted file mode 100644 index 9cf0f218b..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/structureddocument/internal/impl/TextRegionContextResolver.java +++ /dev/null @@ -1,295 +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.context.resolver.structureddocument.internal.impl; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.jst.jsf.context.IModelContext; -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.wst.sse.core.internal.provisional.text.IStructuredDocument; -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; - -/*package*/ class TextRegionContextResolver implements ITextRegionContextResolver { - - private final IStructuredDocumentContext _context; - - /*package*/ TextRegionContextResolver(IStructuredDocumentContext context) - { - _context = context; - } - - - /** - * @see org.eclipse.jst.jsf.context.resolver.structureddocument.internal.ITextRegionContextResolver#getRegionText() - */ - public String getRegionText() - { - final ITextRegionCollection parent = getParentRegion(); - String text = null; - - if (parent != null) - { - ITextRegion me = parent.getRegionAtCharacterOffset(_context.getDocumentPosition()); - text = parent.getText(me); - } - - return text; - } - - - /** - * @see org.eclipse.jst.jsf.context.resolver.structureddocument.internal.ITextRegionContextResolver#getEndOffset() - */ - public int getEndOffset() { - final ITextRegionCollection parent = getParentRegion(); - int endOffset = -1; - if (parent != null) - { - ITextRegion me = parent.getRegionAtCharacterOffset(_context.getDocumentPosition()); - endOffset = parent.getEndOffset(me); - } - - return endOffset; - } - - - /** - * @see org.eclipse.jst.jsf.context.resolver.structureddocument.internal.ITextRegionContextResolver#getLength() - */ - public int getLength() { - final ITextRegionCollection parent = getParentRegion(); - int length = -1; - if (parent != null) - { - ITextRegion me = parent.getRegionAtCharacterOffset(_context.getDocumentPosition()); - length = me.getLength(); - } - - return length; - - } - - - /** - * @see org.eclipse.jst.jsf.context.resolver.structureddocument.internal.ITextRegionContextResolver#getStartOffset() - */ - public int getStartOffset() - { - final ITextRegionCollection parent = getParentRegion(); - int startOffset = -1; - if (parent != null) - { - ITextRegion me = parent.getRegionAtCharacterOffset(_context.getDocumentPosition()); - startOffset = parent.getStartOffset(me); - } - - return startOffset; - } - - /** - * @see org.eclipse.jst.jsf.context.resolver.structureddocument.internal.ITextRegionContextResolver#getRegionType() - */ - public String getRegionType() - { - final ITextRegionCollection parent = getParentRegion(); - String regionType = null; - - if (parent != null) - { - ITextRegion me = parent.getRegionAtCharacterOffset(_context.getDocumentPosition()); - - if (me != null) - { - regionType = me.getType(); - } - } - - return regionType; - } - - /** - * @see org.eclipse.jst.jsf.context.resolver.structureddocument.internal.ITextRegionContextResolver#getRegionTypePath() - */ - public String[] getRegionTypePath() { - final ITextRegion[] path = createPathToContext(); - final String[] typePath = new String[path.length]; - - for (int i = 0; i < path.length; i++) - { - typePath[i] = path[i].getType(); - } - - return typePath; - } - - /** - * @see org.eclipse.jst.jsf.context.resolver.structureddocument.internal.ITextRegionContextResolver#getNextContext() - */ - public IStructuredDocumentContext getNextContext() - { - ITextRegionCollection parent = getParentRegion(); - IStructuredDocumentContext newContext = null; - - if (parent != null) - { - final ITextRegion me = parent.getRegionAtCharacterOffset(_context.getDocumentPosition()); - ITextRegionList regions = parent.getRegions(); - ITextRegion nextRegion = null; - for (final Iterator it = regions.iterator(); it.hasNext();) - { - if (it.next() == me - && it.hasNext()) - { - nextRegion = (ITextRegion) it.next(); - } - } - - if (nextRegion != null) - { - // use the first position offset in the next region - final int documentPosition = parent.getStartOffset(nextRegion); - newContext = - IStructuredDocumentContextFactory.INSTANCE.getContext(_context.getStructuredDocument(), documentPosition); - } - } - - return newContext; - } - - - /** - * @see org.eclipse.jst.jsf.context.resolver.structureddocument.internal.ITextRegionContextResolver#getPreviousContext() - */ - public IStructuredDocumentContext getPreviousContext() - { - ITextRegionCollection parent = getParentRegion(); - IStructuredDocumentContext newContext = null; - - if (parent != null) - { - final ITextRegion me = parent.getRegionAtCharacterOffset(_context.getDocumentPosition()); - ITextRegionList regions = parent.getRegions(); - final Iterator it = regions.iterator(); - ITextRegion prevRegion = null; - ITextRegion nextRegion = null; - - SEARCH_LOOP: while (it.hasNext()) - { - nextRegion = (ITextRegion) it.next(); - - if (nextRegion == me) - { - break SEARCH_LOOP; - } - - prevRegion = nextRegion; - } - - if (prevRegion != null) - { - // use the last position offset in the prev region - final int documentPosition = parent.getStartOffset(prevRegion); - newContext = - IStructuredDocumentContextFactory.INSTANCE.getContext(_context.getStructuredDocument(), documentPosition); - } - } - - return newContext; - } - - private ITextRegionCollection getParentRegion() - { - final ITextRegion[] path = createPathToContext(); - ITextRegionCollection parent = null; - - if (path.length > 0) - { - parent = (ITextRegionCollection) path[path.length-1]; - } - - return parent; - } - - /** - * @see org.eclipse.jst.jsf.context.resolver.structureddocument.internal.ITextRegionContextResolver#matchesRelative(java.lang.String[]) - */ - public boolean matchesRelative(String[] path) { - final ITextRegion[] myPath = createPathToContext(); - return matchPath(myPath, path); - } - - /** - * @see org.eclipse.jst.jsf.context.resolver.structureddocument.internal.ITextRegionContextResolver#matchesAbsolute(java.lang.String[]) - */ - public boolean matchesAbsolute(String[] path) - { - final ITextRegion[] myPath = createPathToContext(); - // only works if myPath and path are the same length - return (myPath.length == path.length) - && matchPath(myPath, path); - } - - private boolean matchPath(ITextRegion[] myPath, String[] path) - { - boolean matches = false; - - // only makes sense if path is a containing subset of myPath - if (path.length <= myPath.length) - { - matches = true; - SEARCH_LOOP: - for (int i = 1; i <= path.length; i++) - { - if (!path[path.length-i].equals(myPath[myPath.length-i].getType())) - { - matches = false; - break SEARCH_LOOP; - } - } - } - - return matches; - } - - /** - * @see org.eclipse.jst.jsf.context.resolver.IContextResolver#canResolveContext(org.eclipse.jst.jsf.context.IModelContext) - */ - public boolean canResolveContext(IModelContext modelContext) - { - return (modelContext.getAdapter(IStructuredDocumentContext.class) != null); - } - - private ITextRegion[] createPathToContext() - { - final List regionPath = new ArrayList(); - - final IStructuredDocument doc = (IStructuredDocument) _context.getStructuredDocument(); - - ITextRegion container = doc.getRegionAtCharacterOffset(_context.getDocumentPosition()); - - while(container != null - && container instanceof ITextRegionCollection) - { - regionPath.add(container); - container = ((ITextRegionCollection)container).getRegionAtCharacterOffset(_context.getDocumentPosition()); - } - - return (ITextRegion[]) regionPath.toArray(new ITextRegion[0]); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/structureddocument/internal/impl/WorkspaceContextResolver.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/structureddocument/internal/impl/WorkspaceContextResolver.java deleted file mode 100644 index 053ec16da..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/structureddocument/internal/impl/WorkspaceContextResolver.java +++ /dev/null @@ -1,140 +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.context.resolver.structureddocument.internal.impl; - -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.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.jst.jsf.context.IModelContext; -import org.eclipse.jst.jsf.context.resolver.structureddocument.IWorkspaceContextResolver; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext; -import org.eclipse.wst.sse.core.StructuredModelManager; -import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; - -/** - * - * @author cbateman - * - */ -/*package*/ class WorkspaceContextResolver implements IWorkspaceContextResolver -{ - private final IStructuredDocumentContext _context; - - /*package*/WorkspaceContextResolver(IStructuredDocumentContext context) - { - _context = context; - } - - /** - * @see org.eclipse.jst.jsf.context.resolver.structureddocument.IWorkspaceContextResolver#getProject() - */ - public IProject getProject() - { - // copied from ModelManagerImpl (with some rework by C.B.) - final String path = getPath(); - - if (path == null) - { - return null; - } - - return getProject(path); - } - - private IProject getProject(String path) - { - // TOODO needs rework for linked resources - IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); - IPath iPath = new Path(path); - if (iPath.isAbsolute()) - { - String projectName = iPath.segment(0); - - IProject projects[] = root.getProjects(); - - for (int i = 0; i < projects.length; i++) - { - IProject project = projects[i]; - - if (project.isOpen() - && projectName.equals(project.getFullPath().segment(0))) - { - return project; // - } - } - } - - return null; - } - - public IResource getResource() - { - final String path = getPath(); - - if (path != null) - { - IProject project = getProject(path); - - if (project != null) - { - final IPath iPath = new Path(path); - if (iPath.isAbsolute()) - { - return project.getFile(iPath.removeFirstSegments(1)); - } - } - } - return null; - } - - private String getPath() - { - IStructuredModel model = null; - - try - { - model = StructuredModelManager.getModelManager().getExistingModelForRead(_context.getStructuredDocument()); - - if (model == null) - return null; - String path = model.getBaseLocation(); - if (path == null || path.length() == 0) - { - Object id = model.getId(); - if (id == null) - return null; - path = id.toString(); - } - - return path; - } - finally - { - if (model != null) - { - model.releaseFromRead(); - } - } - } - - /** - * @see org.eclipse.jst.jsf.context.resolver.IContextResolver#canResolveContext(org.eclipse.jst.jsf.context.IModelContext) - */ - public boolean canResolveContext(IModelContext modelContext) - { - return (modelContext.getAdapter(IStructuredDocumentContext.class) != null); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/structureddocument/package-info.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/structureddocument/package-info.java deleted file mode 100644 index 538982108..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/structureddocument/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 - * - ********************************************************************************/ - -/** - * Context resolvers for contexts based on SSE structured documents. - */ -package org.eclipse.jst.jsf.context.resolver.structureddocument; diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/structureddocument/AbstractStructuredDocumentContext.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/structureddocument/AbstractStructuredDocumentContext.java deleted file mode 100644 index b431d485f..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/structureddocument/AbstractStructuredDocumentContext.java +++ /dev/null @@ -1,41 +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.context.structureddocument; - -import org.eclipse.jst.jsf.context.AbstractDocumentContext; - -/** - * A convenience abstract super-class for context implementing - * the IStructuredDocumentContext interface - * - * Class may be sub-classed by clients - * - * @author cbateman - * - */ -public abstract class AbstractStructuredDocumentContext extends AbstractDocumentContext - implements IStructuredDocumentContext -{ - /** - * @see org.eclipse.jst.jsf.context.AbstractDocumentContext#getAdapter(java.lang.Class) - */ - public Object getAdapter(Class adapterClass) - { - if (adapterClass.equals(IStructuredDocumentContext.class)) - { - return this; - } - - return super.getAdapter(adapterClass); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/structureddocument/AbstractStructuredDocumentContextFactory.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/structureddocument/AbstractStructuredDocumentContextFactory.java deleted file mode 100644 index 054fc71db..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/structureddocument/AbstractStructuredDocumentContextFactory.java +++ /dev/null @@ -1,31 +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.context.structureddocument; - -import org.eclipse.jst.jsf.context.AbstractDelegatingFactory; - -/** - * Abstract implementation of IStructuredDocumentContextFactory that must be used - * by all implementers of new factories for document contexts. - * - * @author cbateman - * - */ -public abstract class AbstractStructuredDocumentContextFactory extends AbstractDelegatingFactory { - - /** - * @param supportedDelegateTypes - */ - protected AbstractStructuredDocumentContextFactory(Class[] supportedDelegateTypes) - { - super(supportedDelegateTypes); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/structureddocument/IStructuredDocumentContext.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/structureddocument/IStructuredDocumentContext.java deleted file mode 100644 index 2cf532885..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/structureddocument/IStructuredDocumentContext.java +++ /dev/null @@ -1,37 +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.context.structureddocument; - -import org.eclipse.jface.text.IDocument; -import org.eclipse.jst.jsf.context.IDocumentContext; - -/** - * Encapsulates runtime context in an SSE IStructuredDocument - * @author cbateman - * - * Interface must NOT be implemented by clients. - * Implementers should sub-class AbstractStructuredDocumentContext - * - */ -public interface IStructuredDocumentContext extends IDocumentContext -{ - /** - * @return the text viewer whose context we are in - */ - IDocument getStructuredDocument(); - /** - * @return the document position within the text viewer's context - * where we are. - */ - int getDocumentPosition(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/structureddocument/IStructuredDocumentContextFactory.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/structureddocument/IStructuredDocumentContextFactory.java deleted file mode 100644 index d9412dcc5..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/structureddocument/IStructuredDocumentContextFactory.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: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.context.structureddocument; - -import org.eclipse.jface.text.IDocument; -import org.eclipse.jface.text.ITextViewer; -import org.eclipse.jst.jsf.context.structureddocument.internal.impl.StructuredDocumentContextFactory; -import org.w3c.dom.Node; - - -/** - * A factory method for constructing context objects related to - * SSE structured documents. - * - * May be sub-classed or implemented by clients - * - * @author cbateman - * - */ -public interface IStructuredDocumentContextFactory -{ - /** - * The default singleton instance of the factory - */ - public static final IStructuredDocumentContextFactory INSTANCE = - StructuredDocumentContextFactory.getInstance(); - - /** - * - * @param textViewer -- the text viewer where the context exists - * @param documentPosition -- the absolute position of the context relative to textViewer - * @return a context for a given text viewer and document position within the - * document model of that text viewer or null if one cannot be determined. - */ - IStructuredDocumentContext getContext(ITextViewer textViewer, int documentPosition); - - /** - * @param document -- the document - * @param documentPosition -- the absolute position of the context relative to the document - * @return a context for the document model or null if one cannot be determined - */ - IStructuredDocumentContext getContext(IDocument document, int documentPosition); - - /** - * @param document -- the document model - * @param node -- the DOM node within the document - * @return a context for the document model and dom node or null if one cannot - * be determined - */ - IStructuredDocumentContext getContext(IDocument document, Node node); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/structureddocument/IStructuredDocumentContextFactory2.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/structureddocument/IStructuredDocumentContextFactory2.java deleted file mode 100644 index 6e777419d..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/structureddocument/IStructuredDocumentContextFactory2.java +++ /dev/null @@ -1,38 +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 - * - ********************************************************************************/ -package org.eclipse.jst.jsf.context.structureddocument; - -import org.eclipse.jst.jsf.context.structureddocument.internal.impl.StructuredDocumentContextFactory; -import org.w3c.dom.Element; - -/** - * A factory method for constructing context objects related to - * SSE structured documents. - * - * May be sub-classed or implemented by clients - * - */ -public interface IStructuredDocumentContextFactory2 extends - IStructuredDocumentContextFactory { - - /** - * The default singleton instance of the factory - */ - public static final IStructuredDocumentContextFactory2 INSTANCE = - StructuredDocumentContextFactory.getInstance(); - - /** - * @param element -- org.w3c.Element - * @return a context for the element or if null if one cannot be determined. - */ - IStructuredDocumentContext getContext(Element element); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/structureddocument/internal/impl/DefaultStructuredDocumentContext.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/structureddocument/internal/impl/DefaultStructuredDocumentContext.java deleted file mode 100644 index f4526e78c..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/structureddocument/internal/impl/DefaultStructuredDocumentContext.java +++ /dev/null @@ -1,39 +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.context.structureddocument.internal.impl; - -import org.eclipse.jface.text.IDocument; -import org.eclipse.jst.jsf.context.structureddocument.AbstractStructuredDocumentContext; -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument; - -/*package*/ class DefaultStructuredDocumentContext extends AbstractStructuredDocumentContext -{ - private final IStructuredDocument _structuredDocument; - private final int _documentPosition; - - /*package*/ DefaultStructuredDocumentContext(IStructuredDocument structuredDocument, int documentPosition) - { - _structuredDocument = structuredDocument; - _documentPosition = documentPosition; - } - - public int getDocumentPosition() - { - return _documentPosition; - } - - public IDocument getStructuredDocument() - { - return _structuredDocument; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/structureddocument/internal/impl/StructuredDocumentContextFactory.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/structureddocument/internal/impl/StructuredDocumentContextFactory.java deleted file mode 100644 index 989fd8364..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/structureddocument/internal/impl/StructuredDocumentContextFactory.java +++ /dev/null @@ -1,265 +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.context.structureddocument.internal.impl; - -import java.util.Iterator; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.jface.text.IDocument; -import org.eclipse.jface.text.ITextViewer; -import org.eclipse.jst.jsf.context.structureddocument.AbstractStructuredDocumentContextFactory; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContextFactory; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContextFactory2; -import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion; -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument; -import org.eclipse.wst.sse.ui.internal.StructuredTextViewer; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode; -import org.w3c.dom.Element; -import org.w3c.dom.Node; - -/** - * @author cbateman - * - */ -public class StructuredDocumentContextFactory extends AbstractStructuredDocumentContextFactory - implements IStructuredDocumentContextFactory, IStructuredDocumentContextFactory2 -{ - /* static attributes */ - private static StructuredDocumentContextFactory INSTANCE; - - /** - * @param supportedDelegateTypes - */ - public StructuredDocumentContextFactory(Class[] supportedDelegateTypes) - { - super(supportedDelegateTypes); - } - - /** - * @return an instance (possibly shared) of the this factory - */ - public synchronized static StructuredDocumentContextFactory getInstance() - { - if (INSTANCE == null) - { - INSTANCE = new StructuredDocumentContextFactory(); - } - - return INSTANCE; - } - - - /** - * Construct the factory - */ - protected StructuredDocumentContextFactory() - { - super(new Class[] {IStructuredDocumentContextFactory.class}); - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContextFactory#getContext(org.eclipse.jface.text.ITextViewer, int) - */ - public final IStructuredDocumentContext getContext(ITextViewer textViewer, int documentPosition) - { - // first see if I know how to make one - IStructuredDocumentContext context = internalGetContext(textViewer, documentPosition); - - // if I don't know, ask my delegates - if (context == null) - { - context = delegateGetContext(textViewer, documentPosition); - } - - return context; - } - - private IStructuredDocumentContext internalGetContext(ITextViewer textViewer, int documentPosition) - { - if (textViewer instanceof StructuredTextViewer) - { - IDocument document = ((StructuredTextViewer)textViewer).getDocument(); - return internalGetContext(document, documentPosition); - } - - return null; - } - - private IStructuredDocumentContext internalGetContext(IDocument document, int documentPosition) - { - if (document instanceof IStructuredDocument) - { - return new DefaultStructuredDocumentContext((IStructuredDocument)document, documentPosition); - } - - return null; - } - - private IStructuredDocumentContext delegateGetContext(ITextViewer textViewer, int documentPosition) - { - final Iterator it = getDelegatesIterator(); - - while (it.hasNext()) - { - IStructuredDocumentContextFactory delegateFactory = (IStructuredDocumentContextFactory) ((IAdaptable) it.next()).getAdapter(IStructuredDocumentContextFactory.class); - IStructuredDocumentContext context = delegateFactory.getContext(textViewer, documentPosition); - - if (context != null) - { - return context; - } - } - - return null; - } - - /** - * @see org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContextFactory#getContext(org.eclipse.jface.text.IDocument, int) - */ - public IStructuredDocumentContext getContext(IDocument document, int documentPosition) { - // first see if I know how to make one - IStructuredDocumentContext context = internalGetContext(document, documentPosition); - - // if I don't know, ask my delegates - if (context == null) - { - context = delegateGetContext(document, documentPosition); - } - - return context; - } - - private IStructuredDocumentContext delegateGetContext(IDocument document, int documentPosition) - { - final Iterator it = getDelegatesIterator(); - - while (it.hasNext()) - { - IStructuredDocumentContextFactory delegateFactory = (IStructuredDocumentContextFactory) ((IAdaptable) it.next()).getAdapter(IStructuredDocumentContextFactory.class); - IStructuredDocumentContext context = delegateFactory.getContext(document, documentPosition); - - if (context != null) - { - return context; - } - } - - return null; - } - - public IStructuredDocumentContext getContext(IDocument document, Node node) - { - // first see if I know how to make one - IStructuredDocumentContext context = internalGetContext(document, node); - - // if I don't know, ask my delegates - if (context == null) - { - context = delegateGetContext(document, node); - } - - return context; - - } - - - - private IStructuredDocumentContext internalGetContext(IDocument document, Node node) - { - if (document instanceof IStructuredDocument) - { - final IStructuredDocument sDoc = (IStructuredDocument) document; - if (node instanceof IndexedRegion) - { - final int position = ((IndexedRegion)node).getStartOffset(); - return new DefaultStructuredDocumentContext(sDoc, position); - } - else if (node instanceof IDOMAttr) - { - IDOMAttr attr = (IDOMAttr) node; - final int position = attr.getValueRegionStartOffset(); - return new DefaultStructuredDocumentContext(sDoc, position); - } - } - - return null; - } - - private IStructuredDocumentContext delegateGetContext(IDocument document, Node node) - { - final Iterator it = getDelegatesIterator(); - - while (it.hasNext()) - { - IStructuredDocumentContextFactory delegateFactory = (IStructuredDocumentContextFactory) ((IAdaptable) it.next()).getAdapter(IStructuredDocumentContextFactory.class); - IStructuredDocumentContext context = delegateFactory.getContext(document, node); - - if (context != null) - { - return context; - } - } - - return null; - } - - public IStructuredDocumentContext getContext(Element element) - { - // first see if I know how to make one - IStructuredDocumentContext context = internalGetContext(element); - - // if I don't know, ask my delegates - if (context == null) - { - context = delegateGetContext(element); - } - - return context; - - } - - private IStructuredDocumentContext internalGetContext(Element element) { - if (element instanceof IDOMNode){ - final IDOMNode node = (IDOMNode)element; - final IStructuredDocument sDoc = node.getStructuredDocument(); - final int position = node.getStartOffset(); - - return new DefaultStructuredDocumentContext(sDoc, position); - } - - return null; - } - - private IStructuredDocumentContext delegateGetContext(Element element) - { - final Iterator it = getDelegatesIterator(); - - while (it.hasNext()) - { - IStructuredDocumentContextFactory2 delegateFactory = (IStructuredDocumentContextFactory2) ((IAdaptable) it.next()).getAdapter(IStructuredDocumentContextFactory2.class); - if (delegateFactory != null) - { - IStructuredDocumentContext context = delegateFactory.getContext(element); - - if (context != null) - { - return context; - } - } - } - - return null; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/structureddocument/package-info.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/structureddocument/package-info.java deleted file mode 100644 index cc515346f..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/structureddocument/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 for SSE structured documents. - */ -package org.eclipse.jst.jsf.context.structureddocument; diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/ERuntimeSource.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/ERuntimeSource.java deleted file mode 100644 index 902e20d89..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/ERuntimeSource.java +++ /dev/null @@ -1,236 +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.context.symbol; - -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -import org.eclipse.emf.common.util.AbstractEnumerator; - -/** - * <!-- begin-user-doc --> - * Enumerates the possible sources of an instance symbol - * at runtime. In the default implementation these can - * be: from the built-in variables, from the managed bean - * facility, and those defined in tags. This information - * is provided to allow the VariableResolver to resolve - * conflicts when instance symbols come from more than one - * source. - * - * <p><b>Provisional API - subject to change</b></p> - * - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.context.symbol.SymbolPackage#getERuntimeSource() - * @model - * @generated - */ -public final class ERuntimeSource extends AbstractEnumerator { - /** - * @generated NOT - */ - private static final long serialVersionUID = 1L; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright 2006 Oracle"; //$NON-NLS-1$ - - /** - * The '<em><b>BUILT IN SYMBOL</b></em>' literal value. - * <!-- begin-user-doc --> - * <p> - * If the meaning of '<em><b>BUILT IN SYMBOL</b></em>' literal object isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @see #BUILT_IN_SYMBOL_LITERAL - * @model - * @generated - * @ordered - */ - public static final int BUILT_IN_SYMBOL = 0; - - /** - * The '<em><b>MANAGED BEAN SYMBOL</b></em>' literal value. - * <!-- begin-user-doc --> - * <p> - * If the meaning of '<em><b>MANAGED BEAN SYMBOL</b></em>' literal object isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @see #MANAGED_BEAN_SYMBOL_LITERAL - * @model - * @generated - * @ordered - */ - public static final int MANAGED_BEAN_SYMBOL = 1; - - /** - * The '<em><b>TAG INSTANTIATED SYMBOL</b></em>' literal value. - * <!-- begin-user-doc --> - * <p> - * If the meaning of '<em><b>TAG INSTANTIATED SYMBOL</b></em>' literal object isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @see #TAG_INSTANTIATED_SYMBOL_LITERAL - * @model - * @generated - * @ordered - */ - public static final int TAG_INSTANTIATED_SYMBOL = 2; - - /** - * The '<em><b>OTHER</b></em>' literal value. - * <!-- begin-user-doc --> - * <p> - * If the meaning of '<em><b>OTHER</b></em>' literal object isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @see #OTHER_LITERAL - * @model - * @generated - * @ordered - */ - public static final int OTHER = 3; - - /** - * The '<em><b>BUILT IN SYMBOL</b></em>' literal object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #BUILT_IN_SYMBOL - * @generated - * @ordered - */ - public static final ERuntimeSource BUILT_IN_SYMBOL_LITERAL = new ERuntimeSource(BUILT_IN_SYMBOL, "BUILT_IN_SYMBOL", "BUILT_IN_SYMBOL"); //$NON-NLS-1$ //$NON-NLS-2$ - - /** - * The '<em><b>MANAGED BEAN SYMBOL</b></em>' literal object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #MANAGED_BEAN_SYMBOL - * @generated - * @ordered - */ - public static final ERuntimeSource MANAGED_BEAN_SYMBOL_LITERAL = new ERuntimeSource(MANAGED_BEAN_SYMBOL, "MANAGED_BEAN_SYMBOL", "MANAGED_BEAN_SYMBOL"); //$NON-NLS-1$ //$NON-NLS-2$ - - /** - * The '<em><b>TAG INSTANTIATED SYMBOL</b></em>' literal object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #TAG_INSTANTIATED_SYMBOL - * @generated - * @ordered - */ - public static final ERuntimeSource TAG_INSTANTIATED_SYMBOL_LITERAL = new ERuntimeSource(TAG_INSTANTIATED_SYMBOL, "TAG_INSTANTIATED_SYMBOL", "TAG_INSTANTIATED_SYMBOL"); //$NON-NLS-1$ //$NON-NLS-2$ - - /** - * The '<em><b>OTHER</b></em>' literal object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #OTHER - * @generated - * @ordered - */ - public static final ERuntimeSource OTHER_LITERAL = new ERuntimeSource(OTHER, "OTHER", "OTHER"); //$NON-NLS-1$ //$NON-NLS-2$ - - /** - * An array of all the '<em><b>ERuntime Source</b></em>' enumerators. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private static final ERuntimeSource[] VALUES_ARRAY = - new ERuntimeSource[] { - BUILT_IN_SYMBOL_LITERAL, - MANAGED_BEAN_SYMBOL_LITERAL, - TAG_INSTANTIATED_SYMBOL_LITERAL, - OTHER_LITERAL, - }; - - /** - * A public read-only list of all the '<em><b>ERuntime Source</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>ERuntime Source</b></em>' literal with the specified literal value. - * <!-- begin-user-doc --> - * @param literal - * @return the enumeration for a string literal representation - * <!-- end-user-doc --> - * @generated - */ - public static ERuntimeSource get(String literal) { - for (int i = 0; i < VALUES_ARRAY.length; ++i) { - ERuntimeSource result = VALUES_ARRAY[i]; - if (result.toString().equals(literal)) { - return result; - } - } - return null; - } - - /** - * Returns the '<em><b>ERuntime Source</b></em>' literal with the specified name. - * <!-- begin-user-doc --> - * @param name - * @return the enumeration for the name of the literal value - * <!-- end-user-doc --> - * @generated - */ - public static ERuntimeSource getByName(String name) { - for (int i = 0; i < VALUES_ARRAY.length; ++i) { - ERuntimeSource result = VALUES_ARRAY[i]; - if (result.getName().equals(name)) { - return result; - } - } - return null; - } - - /** - * Returns the '<em><b>ERuntime Source</b></em>' literal with the specified integer value. - * <!-- begin-user-doc --> - * @param value - * @return the enumeration for it's integral value - * <!-- end-user-doc --> - * @generated - */ - public static ERuntimeSource get(int value) { - switch (value) { - case BUILT_IN_SYMBOL: return BUILT_IN_SYMBOL_LITERAL; - case MANAGED_BEAN_SYMBOL: return MANAGED_BEAN_SYMBOL_LITERAL; - case TAG_INSTANTIATED_SYMBOL: return TAG_INSTANTIATED_SYMBOL_LITERAL; - case OTHER: return OTHER_LITERAL; - } - return null; - } - - /** - * Only this class can construct instances. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private ERuntimeSource(int value, String name, String literal) { - super(value, name, literal); - } - -} //ERuntimeSource diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/IBeanInstanceSymbol.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/IBeanInstanceSymbol.java deleted file mode 100644 index a1ddd3635..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/IBeanInstanceSymbol.java +++ /dev/null @@ -1,88 +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.context.symbol; - -import org.eclipse.emf.common.util.EList; - -/** - * <!-- begin-user-doc --> - * An instance of a java bean - * - * <p><b>Provisional API - subject to change</b></p> - * <!-- end-user-doc --> - * - * @author cbateman - * @model - */ -public interface IBeanInstanceSymbol extends IInstanceSymbol, IDescribedInDetail { - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String copyright = "Copyright 2006 Oracle"; //$NON-NLS-1$ - - /** - * Returns the value of the '<em><b>Properties</b></em>' reference list. - * The list contents are of type {@link org.eclipse.jst.jsf.context.symbol.IBeanPropertySymbol}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Properties</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>Properties</em>' reference list. - * @see org.eclipse.jst.jsf.context.symbol.SymbolPackage#getIBeanInstanceSymbol_Properties() - * @model type="org.eclipse.jst.jsf.context.symbol.IBeanPropertySymbol" changeable="false" volatile="true" - * @generated - */ - EList getProperties(); - - /** - * Returns the value of the '<em><b>Methods</b></em>' reference list. - * The list contents are of type {@link org.eclipse.jst.jsf.context.symbol.IBeanMethodSymbol}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Methods</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>Methods</em>' reference list. - * @see org.eclipse.jst.jsf.context.symbol.SymbolPackage#getIBeanInstanceSymbol_Methods() - * @model type="org.eclipse.jst.jsf.context.symbol.IBeanMethodSymbol" changeable="false" volatile="true" - * @generated - */ - EList getMethods(); - - /** - * <!-- begin-user-doc --> - * This is a convenience method equivalent to to (IJavaTypeDescriptor2) getTypeDescriptor - * @return the type descriptor cast to a java descriptor - * <!-- end-user-doc --> - * @model kind="operation" - * @generated - */ - IJavaTypeDescriptor2 getJavaTypeDescriptor(); - - /** - * <!-- begin-user-doc --> - * Convenience method equivalent to setTypeDescriptor((IJavaTypeDescriptor2) typeDesc)s - * @param newTypeDescriptor - * <!-- end-user-doc --> - * @model - * @generated - */ - void setJavaTypeDescriptor(IJavaTypeDescriptor2 newTypeDescriptor); - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/IBeanMethodSymbol.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/IBeanMethodSymbol.java deleted file mode 100644 index 271a93613..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/IBeanMethodSymbol.java +++ /dev/null @@ -1,66 +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.context.symbol; - - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>IBean Method Symbol</b></em>'. - * <p><b>Provisional API - subject to change</b></p> - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.jst.jsf.context.symbol.IBeanMethodSymbol#getOwner <em>Owner</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.jst.jsf.context.symbol.SymbolPackage#getIBeanMethodSymbol() - * @model - * @generated - */ -public interface IBeanMethodSymbol extends IDescribedInDetail, IMethodSymbol { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String copyright = "Copyright 2006 Oracle"; //$NON-NLS-1$ - - /** - * Returns the value of the '<em><b>Owner</b></em>' reference. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Owner</em>' reference isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Owner</em>' reference. - * @see #setOwner(IJavaTypeDescriptor2) - * @see org.eclipse.jst.jsf.context.symbol.SymbolPackage#getIBeanMethodSymbol_Owner() - * @model - * @generated - */ - IJavaTypeDescriptor2 getOwner(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.context.symbol.IBeanMethodSymbol#getOwner <em>Owner</em>}' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Owner</em>' reference. - * @see #getOwner() - * @generated - */ - void setOwner(IJavaTypeDescriptor2 value); - -} // IBeanMethodSymbol diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/IBeanPropertySymbol.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/IBeanPropertySymbol.java deleted file mode 100644 index 3fb6f880a..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/IBeanPropertySymbol.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: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.context.symbol; - -/** - * - * <!-- begin-user-doc --> - * A property of a bean - * - * <p><b>Provisional API - subject to change</b></p> - * <!-- end-user-doc --> - * - * @author cbateman - * @model - */ -public interface IBeanPropertySymbol extends IPropertySymbol, IDescribedInDetail { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String copyright = "Copyright 2006 Oracle"; //$NON-NLS-1$ - - /** - * @return the bean that owns this property - * @model - */ - IJavaTypeDescriptor2 getOwner(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.context.symbol.IBeanPropertySymbol#getOwner <em>Owner</em>}' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Owner</em>' reference. - * @see #getOwner() - * @generated - */ - void setOwner(IJavaTypeDescriptor2 value); - - /** - * @return true if the bean has getter for this property - * @model - */ - boolean isReadable(); - - /** - * @return true if the bean has a setter fot this property - * @model - */ - boolean isWritable(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/IBoundedJavaTypeDescriptor.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/IBoundedJavaTypeDescriptor.java deleted file mode 100644 index 7340267cf..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/IBoundedJavaTypeDescriptor.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id$ - */ -package org.eclipse.jst.jsf.context.symbol; - - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>IBounded Java Type Descriptor</b></em>'. - * - * <p><b>Provisional API - subject to change</b></p> - * <!-- end-user-doc --> - * - * - * @see org.eclipse.jst.jsf.context.symbol.SymbolPackage#getIBoundedJavaTypeDescriptor() - * @model - * @generated - */ -public interface IBoundedJavaTypeDescriptor extends IJavaTypeDescriptor2, IBoundedTypeDescriptor { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String copyright = "Copyright 2006 Oracle"; //$NON-NLS-1$ - -} // IBoundedJavaTypeDescriptor
\ No newline at end of file diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/IBoundedListTypeDescriptor.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/IBoundedListTypeDescriptor.java deleted file mode 100644 index ebd153cfe..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/IBoundedListTypeDescriptor.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id$ - */ -package org.eclipse.jst.jsf.context.symbol; - - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>IBounded List Type Descriptor</b></em>'. - * - * <p><b>Provisional API - subject to change</b></p> - * <!-- end-user-doc --> - * - * - * @see org.eclipse.jst.jsf.context.symbol.SymbolPackage#getIBoundedListTypeDescriptor() - * @model - * @generated - */ -public interface IBoundedListTypeDescriptor extends IListTypeDescriptor, IBoundedTypeDescriptor { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String copyright = "Copyright 2006 Oracle"; //$NON-NLS-1$ - -} // IBoundedListTypeDescriptor diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/IBoundedMapTypeDescriptor.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/IBoundedMapTypeDescriptor.java deleted file mode 100644 index f54c12ecb..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/IBoundedMapTypeDescriptor.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id$ - */ -package org.eclipse.jst.jsf.context.symbol; - - -/** - * <!-- begin-user-doc --> - * Describes a IMapTypeDescriptor for which the possible keyed values are - * unbounded for some set of possible value types. For example, a managed - * bean that implements Map, is unconstrained for all values in Java 1.4 and - * for whatever the template value type is in Java5. - * - * <p><b>Provisional API - subject to change</b></p> - * <!-- end-user-doc --> - * - * - * @see org.eclipse.jst.jsf.context.symbol.SymbolPackage#getIBoundedMapTypeDescriptor() - * @model - * @generated - */ -public interface IBoundedMapTypeDescriptor extends IMapTypeDescriptor, IBoundedTypeDescriptor { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String copyright = "Copyright 2006 Oracle"; //$NON-NLS-1$ - -} // IBoundedMapTypeDescriptor
\ No newline at end of file diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/IBoundedTypeDescriptor.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/IBoundedTypeDescriptor.java deleted file mode 100644 index ea92d5a61..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/IBoundedTypeDescriptor.java +++ /dev/null @@ -1,59 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id$ - */ -package org.eclipse.jst.jsf.context.symbol; - - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>IBounded Type Descriptor</b></em>'. - * - * <p><b>Provisional API - subject to change</b></p> - * <!-- end-user-doc --> - * - * - * @see org.eclipse.jst.jsf.context.symbol.SymbolPackage#getIBoundedTypeDescriptor() - * @model interface="true" abstract="true" - * @generated - */ -public interface IBoundedTypeDescriptor extends ITypeDescriptor { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String copyright = "Copyright 2006 Oracle"; //$NON-NLS-1$ - - /** - * <!-- begin-user-doc --> - * @param typeSignature - * @return true if this type can have unbounded property key for the - * indicated type. For example, a Java 1.4 Map could potentially have - * a value of any time for a particular key, so this method would always return - * true. However a Java5 Map<String, String> would only return true if - * typeSignature is-a String. - * <!-- end-user-doc --> - * @model - * @generated - */ - boolean isUnboundedForType(String typeSignature); - - /** - * <!-- begin-user-doc --> - * @param name - * @param typeSignature - * @return a symbol corresponding to the property of this type desc - * with name called 'name' of type 'typeSignature'. Must return null if - * isPropNameUnconstrainedForType returns false for 'typeSignature'. - * Generally should return something meaningful (even if just an - * object) when isPropNameUnconstrainedForType returns true. - * <!-- end-user-doc --> - * @model - * @generated - */ - ISymbol getUnboundedProperty(Object name, String typeSignature); - -} // IBoundedTypeDescriptor
\ No newline at end of file diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/IComponentSymbol.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/IComponentSymbol.java deleted file mode 100644 index 7cad1c9c8..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/IComponentSymbol.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: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.context.symbol; - - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>IComponent Symbol</b></em>'. - * - * <p><b>Provisional API - subject to change</b></p> - * <!-- end-user-doc --> - * - * - * @see org.eclipse.jst.jsf.context.symbol.SymbolPackage#getIComponentSymbol() - * @model - * @generated - */ -public interface IComponentSymbol extends IInstanceSymbol, IDescribedInDetail { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String copyright = "Copyright 2006 Oracle"; //$NON-NLS-1$ - -} // IComponentSymbol diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/IDescribedInDetail.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/IDescribedInDetail.java deleted file mode 100644 index 9fb281870..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/IDescribedInDetail.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.context.symbol; - - -/** - * Tags a symbol that has a detailed, user-readable description - * - * <p><b>Provisional API - subject to change</b></p> - * - * @author cbateman - * - */ -public interface IDescribedInDetail { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc -->s - * @generated - */ - String copyright = "Copyright 2006 Oracle"; //$NON-NLS-1$ - - /** - * @return the detailed description - * @model - */ - String getDetailedDescription(); - - /** - * @param detailedDescription - * @model - */ - void setDetailedDescription(String detailedDescription); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/IInstanceSymbol.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/IInstanceSymbol.java deleted file mode 100644 index d1e883dea..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/IInstanceSymbol.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.context.symbol; - -/** - * <!-- begin-user-doc --> - * A symbol that represents an instance of something, typically - * a variable. - * - * <p><b>Provisional API - subject to change</b></p> - * <!-- end-user-doc --> - * @author cbateman - * @model - */ -public interface IInstanceSymbol extends IObjectSymbol { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String copyright = "Copyright 2006 Oracle"; //$NON-NLS-1$ - - /** - * @return the type descriptor for this instance - * @model - */ - ITypeDescriptor getTypeDescriptor(); - /** - * Returns the value of the '<em><b>Type Resolved</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Type Resolved</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Type Resolved</em>' attribute. - * @see org.eclipse.jst.jsf.context.symbol.SymbolPackage#getIInstanceSymbol_TypeResolved() - * @model changeable="false" volatile="true" - * @generated - */ - boolean isTypeResolved(); - - /** - * Returns the value of the '<em><b>Runtime Source</b></em>' attribute. - * The default value is <code>"TAG_INSTANTIATED_SYMBOL"</code>. - * The literals are from the enumeration {@link org.eclipse.jst.jsf.context.symbol.ERuntimeSource}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Runtime Source</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Runtime Source</em>' attribute. - * @see org.eclipse.jst.jsf.context.symbol.ERuntimeSource - * @see #setRuntimeSource(ERuntimeSource) - * @see org.eclipse.jst.jsf.context.symbol.SymbolPackage#getIInstanceSymbol_RuntimeSource() - * @model default="TAG_INSTANTIATED_SYMBOL" - * @generated - */ - ERuntimeSource getRuntimeSource(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.context.symbol.IInstanceSymbol#getRuntimeSource <em>Runtime Source</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Runtime Source</em>' attribute. - * @see org.eclipse.jst.jsf.context.symbol.ERuntimeSource - * @see #getRuntimeSource() - * @generated - */ - void setRuntimeSource(ERuntimeSource value); - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/IJavaSymbol.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/IJavaSymbol.java deleted file mode 100644 index fa167ada8..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/IJavaSymbol.java +++ /dev/null @@ -1,57 +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.context.symbol; - -import org.eclipse.jdt.core.IJavaElement; - -/** - * <!-- begin-user-doc --> - * Represents a symbol that has meaning within Java's context. This may - * be the name of a type, an instance, method etc. - * - * <p><b>Provisional API - subject to change</b></p> - * <!-- end-user-doc --> - * @author cbateman - * @model - */ -public interface IJavaSymbol extends ISymbol { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String copyright = "Copyright 2006 Oracle"; //$NON-NLS-1$ - - /** - * A IJavaElement may not exist for a symbol if it is synthetic at - * design time but will be bound to a Java symbol at runtime. An - * example is a managed bean instance in JSF. JDT can provide no - * design-time meta-data for the symbol because it won't have - * a Java representation until the containing JSP is compiled. - * - * @return JDT's java element for this symbol or null if one doesn't - * exist. - * @model - */ - IJavaElement getJavaElement(); - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.context.symbol.IJavaSymbol#getJavaElement <em>Java Element</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Java Element</em>' attribute. - * @see #getJavaElement() - * @generated - */ - void setJavaElement(IJavaElement value); - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/IJavaTypeDescriptor2.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/IJavaTypeDescriptor2.java deleted file mode 100644 index 191928973..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/IJavaTypeDescriptor2.java +++ /dev/null @@ -1,144 +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.context.symbol; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.jdt.core.IType; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>IJava Type Descriptor2</b></em>'. - * - * <p><b>Provisional API - subject to change</b></p> - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.jst.jsf.context.symbol.IJavaTypeDescriptor2#getType <em>Type</em>}</li> - * <li>{@link org.eclipse.jst.jsf.context.symbol.IJavaTypeDescriptor2#getBeanProperties <em>Bean Properties</em>}</li> - * <li>{@link org.eclipse.jst.jsf.context.symbol.IJavaTypeDescriptor2#getBeanMethods <em>Bean Methods</em>}</li> - * <li>{@link org.eclipse.jst.jsf.context.symbol.IJavaTypeDescriptor2#getArrayCount <em>Array Count</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.jst.jsf.context.symbol.SymbolPackage#getIJavaTypeDescriptor2() - * @model - * @generated - */ -public interface IJavaTypeDescriptor2 extends ITypeDescriptor { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String copyright = "Copyright 2006 Oracle"; //$NON-NLS-1$ - - /** - * Returns the value of the '<em><b>Type</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>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>Type</em>' attribute. - * @see #setType(IType) - * @see org.eclipse.jst.jsf.context.symbol.SymbolPackage#getIJavaTypeDescriptor2_Type() - * @model dataType="org.eclipse.jst.jsf.context.symbol.IType" - * @generated - */ - IType getType(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.context.symbol.IJavaTypeDescriptor2#getType <em>Type</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Type</em>' attribute. - * @see #getType() - * @generated - */ - void setType(IType value); - - /** - * Returns the value of the '<em><b>Bean Properties</b></em>' reference list. - * The list contents are of type {@link org.eclipse.jst.jsf.context.symbol.IBeanPropertySymbol}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Bean Properties</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>Bean Properties</em>' reference list. - * @see org.eclipse.jst.jsf.context.symbol.SymbolPackage#getIJavaTypeDescriptor2_BeanProperties() - * @model type="org.eclipse.jst.jsf.context.symbol.IBeanPropertySymbol" volatile="true" - * @generated - */ - EList getBeanProperties(); - - /** - * Returns the value of the '<em><b>Bean Methods</b></em>' reference list. - * The list contents are of type {@link org.eclipse.jst.jsf.context.symbol.IBeanPropertySymbol}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Bean Methods</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>Bean Methods</em>' reference list. - * @see org.eclipse.jst.jsf.context.symbol.SymbolPackage#getIJavaTypeDescriptor2_BeanMethods() - * @model type="org.eclipse.jst.jsf.context.symbol.IBeanPropertySymbol" volatile="true" - * @generated - */ - EList getBeanMethods(); - - /** - * Returns the value of the '<em><b>Array Count</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Array Count</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Array Count</em>' attribute. - * @see #setArrayCount(int) - * @see org.eclipse.jst.jsf.context.symbol.SymbolPackage#getIJavaTypeDescriptor2_ArrayCount() - * @model - * @generated - */ - int getArrayCount(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.context.symbol.IJavaTypeDescriptor2#getArrayCount <em>Array Count</em>}' attribute. - * <!-- begin-user-doc --> - * records the array nesting of the type. IType doesn't encapsulate - * array types. So if this type is an array then type will represent - * the base element and this value will be > 0. If not an array, then - * _arrayCount is always 0. - * <!-- end-user-doc --> - * @param value the new value of the '<em>Array Count</em>' attribute. - * @see #getArrayCount() - * @generated - */ - void setArrayCount(int value); - - /** - * <!-- begin-user-doc --> - * @param resolvedTypeSignature - * @return the resolved type or null. - * <!-- end-user-doc --> - * @model dataType="org.eclipse.jst.jsf.context.symbol.IType" - * @generated - */ - IType resolveType(String resolvedTypeSignature); - -} // IJavaTypeDescriptor2 diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/IListTypeDescriptor.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/IListTypeDescriptor.java deleted file mode 100644 index c4b458666..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/IListTypeDescriptor.java +++ /dev/null @@ -1,63 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id$ - */ -package org.eclipse.jst.jsf.context.symbol; - -import org.eclipse.emf.common.util.EList; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>IList Type Descriptor</b></em>'. - * - * <p><b>Provisional API - subject to change</b></p> - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.jst.jsf.context.symbol.IListTypeDescriptor#getListSource <em>List Source</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.jst.jsf.context.symbol.SymbolPackage#getIListTypeDescriptor() - * @model - * @generated - */ -public interface IListTypeDescriptor extends ITypeDescriptor { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String copyright = "Copyright 2006 Oracle"; //$NON-NLS-1$ - - /** - * Returns the value of the '<em><b>List Source</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>List Source</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>List Source</em>' attribute. - * @see #setListSource(EList) - * @see org.eclipse.jst.jsf.context.symbol.SymbolPackage#getIListTypeDescriptor_ListSource() - * @model many="false" - * @generated - */ - EList getListSource(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.context.symbol.IListTypeDescriptor#getListSource <em>List Source</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>List Source</em>' attribute. - * @see #getListSource() - * @generated - */ - void setListSource(EList value); - -} // IListTypeDescriptor diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/IMapTypeDescriptor.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/IMapTypeDescriptor.java deleted file mode 100644 index d991b7212..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/IMapTypeDescriptor.java +++ /dev/null @@ -1,96 +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.context.symbol; - -import java.util.Map; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>IMap Type Descriptor</b></em>'. - * - * <p><b>Provisional API - subject to change</b></p> - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.jst.jsf.context.symbol.IMapTypeDescriptor#getMapSource <em>Map Source</em>}</li> - * <li>{@link org.eclipse.jst.jsf.context.symbol.IMapTypeDescriptor#isImmutable <em>Immutable</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.jst.jsf.context.symbol.SymbolPackage#getIMapTypeDescriptor() - * @model - * @generated - */ -public interface IMapTypeDescriptor extends ITypeDescriptor { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String copyright = "Copyright 2006 Oracle"; //$NON-NLS-1$ - - /** - * Returns the value of the '<em><b>Map Source</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Map Source</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Map Source</em>' attribute. - * @see #setMapSource(Map) - * @see org.eclipse.jst.jsf.context.symbol.SymbolPackage#getIMapTypeDescriptor_MapSource() - * @model - * @generated - */ - Map getMapSource(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.context.symbol.IMapTypeDescriptor#getMapSource <em>Map Source</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Map Source</em>' attribute. - * @see #getMapSource() - * @generated - */ - void setMapSource(Map value); - - /** - * Returns the value of the '<em><b>Immutable</b></em>' attribute. - * The default value is <code>"true"</code>. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Immutable</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Immutable</em>' attribute. - * @see #setImmutable(boolean) - * @see org.eclipse.jst.jsf.context.symbol.SymbolPackage#getIMapTypeDescriptor_Immutable() - * @model default="true" - * @generated - */ - boolean isImmutable(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.context.symbol.IMapTypeDescriptor#isImmutable <em>Immutable</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Immutable</em>' attribute. - * @see #isImmutable() - * @generated - */ - void setImmutable(boolean value); - -} // IMapTypeDescriptor diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/IMethodSymbol.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/IMethodSymbol.java deleted file mode 100644 index 45ee82cee..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/IMethodSymbol.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: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.context.symbol; - - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>IMethod Symbol</b></em>'. - * - * <p><b>Provisional API - subject to change</b></p> - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.jst.jsf.context.symbol.IMethodSymbol#getSignature <em>Signature</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.jst.jsf.context.symbol.SymbolPackage#getIMethodSymbol() - * @model - * @generated - */ -public interface IMethodSymbol extends ISymbol { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String copyright = "Copyright 2006 Oracle"; //$NON-NLS-1$ - - /** - * Returns the value of the '<em><b>Signature</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Signature</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Signature</em>' attribute. - * @see #setSignature(String) - * @see org.eclipse.jst.jsf.context.symbol.SymbolPackage#getIMethodSymbol_Signature() - * @model - * @generated - */ - String getSignature(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.context.symbol.IMethodSymbol#getSignature <em>Signature</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Signature</em>' attribute. - * @see #getSignature() - * @generated - */ - void setSignature(String value); - -} // IMethodSymbol diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/IObjectSymbol.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/IObjectSymbol.java deleted file mode 100644 index 34fee432e..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/IObjectSymbol.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: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.context.symbol; - -import org.eclipse.emf.common.util.EList; - - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>IObject Symbol</b></em>'. - * - * <p><b>Provisional API - subject to change</b></p> - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.jst.jsf.context.symbol.IObjectSymbol#getTypeDescriptor <em>Type Descriptor</em>}</li> - * <li>{@link org.eclipse.jst.jsf.context.symbol.IObjectSymbol#isReadable <em>Readable</em>}</li> - * <li>{@link org.eclipse.jst.jsf.context.symbol.IObjectSymbol#isWritable <em>Writable</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.jst.jsf.context.symbol.SymbolPackage#getIObjectSymbol() - * @model interface="true" abstract="true" - * @generated - */ -public interface IObjectSymbol extends ISymbol { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String copyright = "Copyright 2006 Oracle"; //$NON-NLS-1$ - - /** - * Returns the value of the '<em><b>Type Descriptor</b></em>' reference. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Type Descriptor</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 Descriptor</em>' reference. - * @see #setTypeDescriptor(ITypeDescriptor) - * @see org.eclipse.jst.jsf.context.symbol.SymbolPackage#getIObjectSymbol_TypeDescriptor() - * @model - * @generated - */ - ITypeDescriptor getTypeDescriptor(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.context.symbol.IObjectSymbol#getTypeDescriptor <em>Type Descriptor</em>}' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Type Descriptor</em>' reference. - * @see #getTypeDescriptor() - * @generated - */ - void setTypeDescriptor(ITypeDescriptor value); - - /** - * Returns the value of the '<em><b>Readable</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Readable</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Readable</em>' attribute. - * @see #setReadable(boolean) - * @see org.eclipse.jst.jsf.context.symbol.SymbolPackage#getIObjectSymbol_Readable() - * @model - * @generated - */ - boolean isReadable(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.context.symbol.IObjectSymbol#isReadable <em>Readable</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Readable</em>' attribute. - * @see #isReadable() - * @generated - */ - void setReadable(boolean value); - - /** - * Returns the value of the '<em><b>Writable</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Writable</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Writable</em>' attribute. - * @see #setWritable(boolean) - * @see org.eclipse.jst.jsf.context.symbol.SymbolPackage#getIObjectSymbol_Writable() - * @model - * @generated - */ - boolean isWritable(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.context.symbol.IObjectSymbol#isWritable <em>Writable</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Writable</em>' attribute. - * @see #isWritable() - * @generated - */ - void setWritable(boolean value); - - /** - * <!-- begin-user-doc --> - * @param typeSignature - * @return true if this object can be coerced (is an instanceof) the type - * specified in the fully qualified typeSignature - * <!-- end-user-doc --> - * @model - * @generated - */ - boolean supportsCoercion(String typeSignature); - - /** - * <!-- begin-user-doc --> - * @param typeSignature - * @return a type descriptor supporting a class cast of this object to - * the request typeSignature, or null if such a cast is not supported. - * Returns non-null iff supportsCoercion(typeSignature) == false - * <!-- end-user-doc --> - * @model - * @generated - */ - ITypeDescriptor coerce(String typeSignature); - - /** - * <!-- begin-user-doc --> - * @param methodName - * @param methodArguments - * @param symbolName - * @return a symbol resulting from calling the call or null if can't be determined. - * Generally, the symbolName should be used for the getName() value of the returned - * symbol, although implementers are not bound to this if a more meaningful value - * can be calculated. - * <!-- end-user-doc --> - * @model methodArgumentsType="org.eclipse.jst.jsf.common.internal.types.ValueType" methodArgumentsDataType="org.eclipse.jst.jsf.context.symbol.ValueType" methodArgumentsMany="true" - * @generated - */ - ISymbol call(String methodName, EList methodArguments, String symbolName); - -} // IObjectSymbol diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/IPropertySymbol.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/IPropertySymbol.java deleted file mode 100644 index ea757eed5..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/IPropertySymbol.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: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.context.symbol; - - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>IProperty Symbol</b></em>'. - * - * <p><b>Provisional API - subject to change</b></p> - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.jst.jsf.context.symbol.IPropertySymbol#isIntermediate <em>Intermediate</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.jst.jsf.context.symbol.SymbolPackage#getIPropertySymbol() - * @model - * @generated - */ -public interface IPropertySymbol extends IObjectSymbol { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String copyright = "Copyright 2006 Oracle"; //$NON-NLS-1$ - - /** - * Returns the value of the '<em><b>Intermediate</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Intermediate</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Intermediate</em>' attribute. - * @see #setIntermediate(boolean) - * @see org.eclipse.jst.jsf.context.symbol.SymbolPackage#getIPropertySymbol_Intermediate() - * @model - * @generated - */ - boolean isIntermediate(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.context.symbol.IPropertySymbol#isIntermediate <em>Intermediate</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Intermediate</em>' attribute. - * @see #isIntermediate() - * @generated - */ - void setIntermediate(boolean value); - -} // IPropertySymbol diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/ISymbol.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/ISymbol.java deleted file mode 100644 index 20a56c437..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/ISymbol.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.context.symbol; - -import org.eclipse.emf.ecore.EObject; - -/** - * <!-- begin-user-doc --> - * An entity that represents a meaningful named value in some context. - * Typically these represent programming language variables, properties and methods. - * - * <p><b>Provisional API - subject to change</b></p> - * <!-- end-user-doc --> - * @author cbateman - * @model - */ -public interface ISymbol extends EObject { - /** - * Singleton for an empty array of ISymbols - */ - final ISymbol[] EMPTY_SYMBOL_ARRAY = new ISymbol[0]; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String copyright = "Copyright 2006 Oracle"; //$NON-NLS-1$ - - /** - * @return the symbol's name - * @model - */ - String getName(); - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.context.symbol.ISymbol#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); - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/ITypeDescriptor.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/ITypeDescriptor.java deleted file mode 100644 index 4be180ff8..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/ITypeDescriptor.java +++ /dev/null @@ -1,264 +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.context.symbol; - -import org.eclipse.emf.common.util.EList; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jdt.core.IType; - -/** - * <!-- begin-user-doc --> - * A generic descriptor for symbol information - * - * <p><b>Provisional API - subject to change</b></p> - * <!-- end-user-doc --> - * @author cbateman - * @model - */ -public interface ITypeDescriptor extends EObject { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String copyright = "Copyright 2006 Oracle"; //$NON-NLS-1$ - - /** - * Returns the value of the '<em><b>Properties</b></em>' reference list. - * The list contents are of type {@link org.eclipse.jst.jsf.context.symbol.IPropertySymbol}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Properties</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>Properties</em>' reference list. - * @see org.eclipse.jst.jsf.context.symbol.SymbolPackage#getITypeDescriptor_Properties() - * @model type="org.eclipse.jst.jsf.context.symbol.IPropertySymbol" volatile="true" - * @generated - */ - EList getProperties(); - - /** - * Returns the value of the '<em><b>Type Signature</b></em>' attribute. - * The default value is <code>""</code>. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Type Signature</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Type Signature</em>' attribute. - * @see org.eclipse.jst.jsf.context.symbol.SymbolPackage#getITypeDescriptor_TypeSignature() - * @model default="" changeable="false" volatile="true" - * @generated - */ - String getTypeSignature(); - - /** - * Returns the value of the '<em><b>Super Type Signatures</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 Type Signatures</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 Type Signatures</em>' attribute list. - * @see org.eclipse.jst.jsf.context.symbol.SymbolPackage#getITypeDescriptor_SuperTypeSignatures() - * @model type="java.lang.String" volatile="true" - * @generated - */ - EList getSuperTypeSignatures(); - - /** - * Returns the value of the '<em><b>Interface Type Signatures</b></em>' attribute list. - * The list contents are of type {@link java.lang.String}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Interface Type Signatures</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>Interface Type Signatures</em>' attribute list. - * @see org.eclipse.jst.jsf.context.symbol.SymbolPackage#getITypeDescriptor_InterfaceTypeSignatures() - * @model type="java.lang.String" volatile="true" - * @generated - */ - EList getInterfaceTypeSignatures(); - - /** - * Returns the value of the '<em><b>Type Signature Delegate</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Type Signature Delegate</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Type Signature Delegate</em>' attribute. - * @see #setTypeSignatureDelegate(String) - * @see org.eclipse.jst.jsf.context.symbol.SymbolPackage#getITypeDescriptor_TypeSignatureDelegate() - * @model - * @generated - */ - String getTypeSignatureDelegate(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.context.symbol.ITypeDescriptor#getTypeSignatureDelegate <em>Type Signature Delegate</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Type Signature Delegate</em>' attribute. - * @see #getTypeSignatureDelegate() - * @generated - */ - void setTypeSignatureDelegate(String value); - - /** - * Returns the value of the '<em><b>Methods</b></em>' reference list. - * The list contents are of type {@link org.eclipse.jst.jsf.context.symbol.IMethodSymbol}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Methods</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>Methods</em>' reference list. - * @see org.eclipse.jst.jsf.context.symbol.SymbolPackage#getITypeDescriptor_Methods() - * @model type="org.eclipse.jst.jsf.context.symbol.IMethodSymbol" volatile="true" - * @generated - */ - EList getMethods(); - - /** - * Returns the value of the '<em><b>Type Parameter Signatures</b></em>' attribute list. - * The list contents are of type {@link java.lang.String}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Type Parameter Signatures</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>Type Parameter Signatures</em>' attribute list. - * @see org.eclipse.jst.jsf.context.symbol.SymbolPackage#getITypeDescriptor_TypeParameterSignatures() - * @model type="java.lang.String" unique="false" transient="true" - * @generated - */ - EList getTypeParameterSignatures(); - - /** - * Returns the value of the '<em><b>Jdt Context</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Jdt Context</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Jdt Context</em>' attribute. - * @see #setJdtContext(IJavaElement) - * @see org.eclipse.jst.jsf.context.symbol.SymbolPackage#getITypeDescriptor_JdtContext() - * @model dataType="org.eclipse.jst.jsf.context.symbol.IJavaElement" - * @generated - */ - IJavaElement getJdtContext(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.context.symbol.ITypeDescriptor#getJdtContext <em>Jdt Context</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Jdt Context</em>' attribute. - * @see #getJdtContext() - * @generated - */ - void setJdtContext(IJavaElement value); - - /** - * Returns the value of the '<em><b>Enum Type</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Enum 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>Enum Type</em>' attribute. - * @see #setEnumType(boolean) - * @see org.eclipse.jst.jsf.context.symbol.SymbolPackage#getITypeDescriptor_EnumType() - * @model - * @generated - */ - boolean isEnumType(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.context.symbol.ITypeDescriptor#isEnumType <em>Enum Type</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Enum Type</em>' attribute. - * @see #isEnumType() - * @generated - */ - void setEnumType(boolean value); - - /** - * <!-- begin-user-doc --> - * @param typeSignature - * @return true if the type descriptor's underlying type would resolve true == (type instanceof typeSignature) - * - * <!-- end-user-doc --> - * @model - * @generated - */ - boolean instanceOf(String typeSignature); - - /** - * <!-- begin-user-doc --> - * @return true iff this type is an array of something - * <!-- end-user-doc --> - * @model kind="operation" - * @generated - */ - boolean isArray(); - - /** - * <!-- begin-user-doc --> - * @return a symbol representing an element of this array. May - * throw an exception or return null if isArray() == false - * <!-- end-user-doc --> - * @model kind="operation" - * @generated - */ - IObjectSymbol getArrayElement(); - - /** - * <!-- begin-user-doc --> - * @param resolvedTypeSignature - * @return the IType for resolvedTypeSignature or null if can't be resolved - * <!-- end-user-doc --> - * @model dataType="org.eclipse.jst.jsf.context.symbol.IType" - * @generated - */ - IType resolveType(String resolvedTypeSignature); - - /** - * <!-- begin-user-doc --> - * @param methodName - * @param methodArgs - * @param symbolName - * @return a symbol or null if not handling - * <!-- end-user-doc --> - * @model methodArgsType="java.lang.String" methodArgsMany="true" - * @generated - */ - ISymbol calculateSyntheticCall(String methodName, EList methodArgs, String symbolName); - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/InitializedSymbolFactory.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/InitializedSymbolFactory.java deleted file mode 100644 index 50a30a014..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/InitializedSymbolFactory.java +++ /dev/null @@ -1,241 +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. - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.context.symbol; - -import java.util.Arrays; -import java.util.Collections; - -import org.eclipse.core.resources.IProject; -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.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; - -/** - * Creates purpose-built symbols and descriptors fully initialized (unlike the - * EMF factory that simply creates empty instances. - * - * This class is for convenience only and should not do anything that clients - * could not do by hand (though with more work). - * - * Clients may use or subclass. - * - * @author cbateman - * - */ -public class InitializedSymbolFactory -{ - /** - * If fullyQualifiedClass can be resolved to an IType, then a bean instance - * symbol will be created. If the type cannot be resolved, then - * createUnknownInstanceSymbol is called with the type descriptor on the - * returned symbol forced to fullyQualifiedClass. - * - * @param project - * @param fullyQualifiedClass - * @param symbolName - * @param source - * @return a symbol - */ - public final ISymbol createBeanOrUnknownInstanceSymbol( - final IProject project, final String fullyQualifiedClass, - final String symbolName, final ERuntimeSource source) - { - final IJavaProject javaProject = JavaCore.create(project); - try - { - final IType type = javaProject.findType(fullyQualifiedClass); - - // TODO: this is a high-bred since it consists of a java instance - // but also has properties we can populate at designtime such as - // the maps. Need to add the second part - if (type != null) - { - final IJavaTypeDescriptor2 typeDesc = SymbolFactory.eINSTANCE - .createIJavaTypeDescriptor2(); - typeDesc.setType(type); - final IBeanInstanceSymbol facesContextVar = SymbolFactory.eINSTANCE - .createIBeanInstanceSymbol(); - facesContextVar.setTypeDescriptor(typeDesc); - facesContextVar.setName(symbolName); - facesContextVar.setRuntimeSource(source); - return facesContextVar; - } - } - catch (final JavaModelException jme) - { - // fall-through and fail with unresolved map - } - - final ISymbol symbol = createUnknownInstanceSymbol(symbolName, source); - ((IInstanceSymbol) symbol) - .getTypeDescriptor() - .setTypeSignatureDelegate( - Signature - .createTypeSignature(fullyQualifiedClass, true)); - - return symbol; - } - - /** - * @param symbolName - * @param source - * @return a symbol for a variable of unknown type - */ - public final IComponentSymbol createUnknownComponentSymbol( - final String symbolName, final ERuntimeSource source) - { - final IComponentSymbol symbol = SymbolFactory.eINSTANCE - .createIComponentSymbol(); - populateUnknownInstanceSymbol(symbol, symbolName, source); - return symbol; - } - - /** - * @param symbolName - * @param source - * @return the unknown instance symbol as an IInstanceSymbol - */ - public final IInstanceSymbol createUnknownInstanceSymbol( - final String symbolName, final ERuntimeSource source) - { - final IInstanceSymbol symbol = SymbolFactory.eINSTANCE - .createIInstanceSymbol(); - populateUnknownInstanceSymbol(symbol, symbolName, source); - return symbol; - } - - /** - * @param name - * may NOT be null. - * @param typeDesc - * may NOT be null. - * @param description - * may be null - * @return a component symbol using the java type descriptor - * @throws IllegalArgumentException - * if non-null argument is null - */ - public final IComponentSymbol createJavaComponentSymbol(final String name, - final IJavaTypeDescriptor2 typeDesc, final String description) - { - if (name == null || typeDesc == null) - { - throw new IllegalArgumentException( - "name and typeDesc must not be null"); //$NON-NLS-1$ - } - - final IComponentSymbol symbol = SymbolFactory.eINSTANCE - .createIComponentSymbol(); - symbol.setName(name); - symbol.setTypeDescriptor(typeDesc); - symbol.setRuntimeSource(ERuntimeSource.TAG_INSTANTIATED_SYMBOL_LITERAL); - return symbol; - } - - /** - * @param name - * @param valueType - * @param description - * @param javaProject - * @return an IComponentSymbol that uses valueType to derive the type - * of its type descriptor - */ - public final IComponentSymbol createJavaComponentSymbol(final String name, - final ValueType valueType, final String description, - final IJavaProject javaProject) - { - final IJavaTypeDescriptor2 typeDesc = createTypeDescriptorFromSignature( - valueType.getSignature(), javaProject); - return createJavaComponentSymbol(name, typeDesc, description); - } - - private void populateUnknownInstanceSymbol(final IInstanceSymbol symbol, - final String symbolName, final ERuntimeSource source) - { - final IMapTypeDescriptor typeDesc = SymbolFactory.eINSTANCE - .createIBoundedMapTypeDescriptor(); - // empty map source - typeDesc.setMapSource(Collections.emptyMap()); - symbol.setName(symbolName); - symbol.setTypeDescriptor(typeDesc); - symbol.setRuntimeSource(source); - } - - /** - * @param type - * @return the signature of the element type of a collection/array, - * <code>null</code>, if untyped Collection or no container type - * at all. - */ - public final String getElementSignatureFromContainerType(ValueType type) - { - if (type.isArray()) - { - // TODO full signature - String signature = type.getSignature(); - int arrayCount = Signature.getArrayCount(signature); - String elementSig = Signature.getElementType(signature); - return Signature.createArraySignature(elementSig, arrayCount - 1); - } - if (type.isInstanceOf(TypeConstants.TYPE_COLLECTION)) - { - final String[] typeArguments = type.getTypeArguments(); - if (typeArguments.length > 0) - { - return typeArguments[0]; - } - } - return null; - } - - /** - * @param signature - * @param javaProject - * @return a java type descriptor based on the fully qualified type - * specified by signature using javaProject as the lookup classpath. - * If the IType for signature cannot be found, the descriptor's - * typeSignatureDelegate will be used. - */ - public final IJavaTypeDescriptor2 createTypeDescriptorFromSignature( - final String signature, final IJavaProject javaProject) - { - 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))); - return desc; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/SymbolFactory.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/SymbolFactory.java deleted file mode 100644 index 830b2965e..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/SymbolFactory.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.context.symbol; - -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. - * - * <p><b>Provisional API - subject to change</b></p> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.context.symbol.SymbolPackage - * @generated - */ -public interface SymbolFactory extends EFactory { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String copyright = "Copyright 2006 Oracle"; //$NON-NLS-1$ - - /** - * The singleton instance of the factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - SymbolFactory eINSTANCE = org.eclipse.jst.jsf.context.symbol.internal.impl.SymbolFactoryImpl.init(); - - /** - * Returns a new object of class '<em>IBean Instance Symbol</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>IBean Instance Symbol</em>'. - * @generated - */ - IBeanInstanceSymbol createIBeanInstanceSymbol(); - - /** - * Returns a new object of class '<em>IBean Property Symbol</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>IBean Property Symbol</em>'. - * @generated - */ - IBeanPropertySymbol createIBeanPropertySymbol(); - - /** - * Returns a new object of class '<em>IInstance Symbol</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>IInstance Symbol</em>'. - * @generated - */ - IInstanceSymbol createIInstanceSymbol(); - - /** - * Returns a new object of class '<em>IJava Symbol</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>IJava Symbol</em>'. - * @generated - */ - IJavaSymbol createIJavaSymbol(); - - /** - * Returns a new object of class '<em>IJava Type Descriptor2</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>IJava Type Descriptor2</em>'. - * @generated - */ - IJavaTypeDescriptor2 createIJavaTypeDescriptor2(); - - /** - * Returns a new object of class '<em>IBean Method Symbol</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>IBean Method Symbol</em>'. - * @generated - */ - IBeanMethodSymbol createIBeanMethodSymbol(); - - /** - * Returns a new object of class '<em>IComponent Symbol</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>IComponent Symbol</em>'. - * @generated - */ - IComponentSymbol createIComponentSymbol(); - - /** - * Returns a new object of class '<em>IProperty Symbol</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>IProperty Symbol</em>'. - * @generated - */ - IPropertySymbol createIPropertySymbol(); - - /** - * Returns a new object of class '<em>IMap Type Descriptor</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>IMap Type Descriptor</em>'. - * @generated - */ - IMapTypeDescriptor createIMapTypeDescriptor(); - - /** - * Returns a new object of class '<em>IMethod Symbol</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>IMethod Symbol</em>'. - * @generated - */ - IMethodSymbol createIMethodSymbol(); - - /** - * Returns a new object of class '<em>IBounded Map Type Descriptor</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>IBounded Map Type Descriptor</em>'. - * @generated - */ - IBoundedMapTypeDescriptor createIBoundedMapTypeDescriptor(); - - /** - * Returns a new object of class '<em>IBounded Java Type Descriptor</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>IBounded Java Type Descriptor</em>'. - * @generated - */ - IBoundedJavaTypeDescriptor createIBoundedJavaTypeDescriptor(); - - /** - * Returns a new object of class '<em>IList Type Descriptor</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>IList Type Descriptor</em>'. - * @generated - */ - IListTypeDescriptor createIListTypeDescriptor(); - - /** - * Returns a new object of class '<em>IBounded List Type Descriptor</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>IBounded List Type Descriptor</em>'. - * @generated - */ - IBoundedListTypeDescriptor createIBoundedListTypeDescriptor(); - - /** - * Returns the package supported by this factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the package supported by this factory. - * @generated - */ - SymbolPackage getSymbolPackage(); - -} //SymbolFactory diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/SymbolPackage.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/SymbolPackage.java deleted file mode 100644 index 8f799fc93..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/SymbolPackage.java +++ /dev/null @@ -1,2674 +0,0 @@ -/** - * Copyright 2006 Oracle - * - * $Id: SymbolPackage.java,v 1.10 2008/11/18 22:24:37 gkessler Exp $ - */ -package org.eclipse.jst.jsf.context.symbol; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EDataType; -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> - * - * <p><b>Provisional API - subject to change</b></p> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.context.symbol.SymbolFactory - * @model kind="package" - * @generated - */ -public interface SymbolPackage extends EPackage { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String copyright = "Copyright 2006 Oracle"; //$NON-NLS-1$ - - /** - * The package name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNAME = "symbol"; //$NON-NLS-1$ - - /** - * The package namespace URI. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNS_URI = "http:///org/eclipse/jst/jsf/context/symbol.ecore"; //$NON-NLS-1$ - - /** - * The package namespace name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNS_PREFIX = "org.eclipse.jst.jsf.context.symbol"; //$NON-NLS-1$ - - /** - * The singleton instance of the package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - SymbolPackage eINSTANCE = org.eclipse.jst.jsf.context.symbol.internal.impl.SymbolPackageImpl.init(); - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.context.symbol.ISymbol <em>ISymbol</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.context.symbol.ISymbol - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.SymbolPackageImpl#getISymbol() - * @generated - */ - int ISYMBOL = 4; - - /** - * The feature id for the '<em><b>Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ISYMBOL__NAME = 0; - - /** - * The number of structural features of the '<em>ISymbol</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ISYMBOL_FEATURE_COUNT = 1; - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.context.symbol.IObjectSymbol <em>IObject Symbol</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.context.symbol.IObjectSymbol - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.SymbolPackageImpl#getIObjectSymbol() - * @generated - */ - int IOBJECT_SYMBOL = 13; - - /** - * The feature id for the '<em><b>Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IOBJECT_SYMBOL__NAME = ISYMBOL__NAME; - - /** - * The feature id for the '<em><b>Type Descriptor</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IOBJECT_SYMBOL__TYPE_DESCRIPTOR = ISYMBOL_FEATURE_COUNT + 0; - - /** - * The feature id for the '<em><b>Readable</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IOBJECT_SYMBOL__READABLE = ISYMBOL_FEATURE_COUNT + 1; - - /** - * The feature id for the '<em><b>Writable</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IOBJECT_SYMBOL__WRITABLE = ISYMBOL_FEATURE_COUNT + 2; - - /** - * The number of structural features of the '<em>IObject Symbol</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IOBJECT_SYMBOL_FEATURE_COUNT = ISYMBOL_FEATURE_COUNT + 3; - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.context.symbol.internal.impl.IInstanceSymbolImpl <em>IInstance Symbol</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.IInstanceSymbolImpl - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.SymbolPackageImpl#getIInstanceSymbol() - * @generated - */ - int IINSTANCE_SYMBOL = 2; - - /** - * The feature id for the '<em><b>Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IINSTANCE_SYMBOL__NAME = IOBJECT_SYMBOL__NAME; - - /** - * The feature id for the '<em><b>Type Descriptor</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IINSTANCE_SYMBOL__TYPE_DESCRIPTOR = IOBJECT_SYMBOL__TYPE_DESCRIPTOR; - - /** - * The feature id for the '<em><b>Readable</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IINSTANCE_SYMBOL__READABLE = IOBJECT_SYMBOL__READABLE; - - /** - * The feature id for the '<em><b>Writable</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IINSTANCE_SYMBOL__WRITABLE = IOBJECT_SYMBOL__WRITABLE; - - /** - * The feature id for the '<em><b>Type Resolved</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IINSTANCE_SYMBOL__TYPE_RESOLVED = IOBJECT_SYMBOL_FEATURE_COUNT + 0; - - /** - * The feature id for the '<em><b>Runtime Source</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IINSTANCE_SYMBOL__RUNTIME_SOURCE = IOBJECT_SYMBOL_FEATURE_COUNT + 1; - - /** - * The number of structural features of the '<em>IInstance Symbol</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IINSTANCE_SYMBOL_FEATURE_COUNT = IOBJECT_SYMBOL_FEATURE_COUNT + 2; - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.context.symbol.internal.impl.IBeanInstanceSymbolImpl <em>IBean Instance Symbol</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.IBeanInstanceSymbolImpl - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.SymbolPackageImpl#getIBeanInstanceSymbol() - * @generated - */ - int IBEAN_INSTANCE_SYMBOL = 0; - - /** - * The feature id for the '<em><b>Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBEAN_INSTANCE_SYMBOL__NAME = IINSTANCE_SYMBOL__NAME; - - /** - * The feature id for the '<em><b>Type Descriptor</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBEAN_INSTANCE_SYMBOL__TYPE_DESCRIPTOR = IINSTANCE_SYMBOL__TYPE_DESCRIPTOR; - - /** - * The feature id for the '<em><b>Readable</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBEAN_INSTANCE_SYMBOL__READABLE = IINSTANCE_SYMBOL__READABLE; - - /** - * The feature id for the '<em><b>Writable</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBEAN_INSTANCE_SYMBOL__WRITABLE = IINSTANCE_SYMBOL__WRITABLE; - - /** - * The feature id for the '<em><b>Type Resolved</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBEAN_INSTANCE_SYMBOL__TYPE_RESOLVED = IINSTANCE_SYMBOL__TYPE_RESOLVED; - - /** - * The feature id for the '<em><b>Runtime Source</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBEAN_INSTANCE_SYMBOL__RUNTIME_SOURCE = IINSTANCE_SYMBOL__RUNTIME_SOURCE; - - /** - * The feature id for the '<em><b>Properties</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBEAN_INSTANCE_SYMBOL__PROPERTIES = IINSTANCE_SYMBOL_FEATURE_COUNT + 0; - - /** - * The feature id for the '<em><b>Methods</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBEAN_INSTANCE_SYMBOL__METHODS = IINSTANCE_SYMBOL_FEATURE_COUNT + 1; - - /** - * The number of structural features of the '<em>IBean Instance Symbol</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBEAN_INSTANCE_SYMBOL_FEATURE_COUNT = IINSTANCE_SYMBOL_FEATURE_COUNT + 2; - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.context.symbol.internal.impl.IPropertySymbolImpl <em>IProperty Symbol</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.IPropertySymbolImpl - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.SymbolPackageImpl#getIPropertySymbol() - * @generated - */ - int IPROPERTY_SYMBOL = 10; - - /** - * The feature id for the '<em><b>Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IPROPERTY_SYMBOL__NAME = IOBJECT_SYMBOL__NAME; - - /** - * The feature id for the '<em><b>Type Descriptor</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IPROPERTY_SYMBOL__TYPE_DESCRIPTOR = IOBJECT_SYMBOL__TYPE_DESCRIPTOR; - - /** - * The feature id for the '<em><b>Readable</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IPROPERTY_SYMBOL__READABLE = IOBJECT_SYMBOL__READABLE; - - /** - * The feature id for the '<em><b>Writable</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IPROPERTY_SYMBOL__WRITABLE = IOBJECT_SYMBOL__WRITABLE; - - /** - * The feature id for the '<em><b>Intermediate</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IPROPERTY_SYMBOL__INTERMEDIATE = IOBJECT_SYMBOL_FEATURE_COUNT + 0; - - /** - * The number of structural features of the '<em>IProperty Symbol</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IPROPERTY_SYMBOL_FEATURE_COUNT = IOBJECT_SYMBOL_FEATURE_COUNT + 1; - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.context.symbol.internal.impl.IBeanPropertySymbolImpl <em>IBean Property Symbol</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.IBeanPropertySymbolImpl - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.SymbolPackageImpl#getIBeanPropertySymbol() - * @generated - */ - int IBEAN_PROPERTY_SYMBOL = 1; - - /** - * The feature id for the '<em><b>Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBEAN_PROPERTY_SYMBOL__NAME = IPROPERTY_SYMBOL__NAME; - - /** - * The feature id for the '<em><b>Type Descriptor</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBEAN_PROPERTY_SYMBOL__TYPE_DESCRIPTOR = IPROPERTY_SYMBOL__TYPE_DESCRIPTOR; - - /** - * The feature id for the '<em><b>Readable</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBEAN_PROPERTY_SYMBOL__READABLE = IPROPERTY_SYMBOL__READABLE; - - /** - * The feature id for the '<em><b>Writable</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBEAN_PROPERTY_SYMBOL__WRITABLE = IPROPERTY_SYMBOL__WRITABLE; - - /** - * The feature id for the '<em><b>Intermediate</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBEAN_PROPERTY_SYMBOL__INTERMEDIATE = IPROPERTY_SYMBOL__INTERMEDIATE; - - /** - * The feature id for the '<em><b>Owner</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBEAN_PROPERTY_SYMBOL__OWNER = IPROPERTY_SYMBOL_FEATURE_COUNT + 0; - - /** - * The number of structural features of the '<em>IBean Property Symbol</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBEAN_PROPERTY_SYMBOL_FEATURE_COUNT = IPROPERTY_SYMBOL_FEATURE_COUNT + 1; - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.context.symbol.internal.impl.IJavaSymbolImpl <em>IJava Symbol</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.IJavaSymbolImpl - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.SymbolPackageImpl#getIJavaSymbol() - * @generated - */ - int IJAVA_SYMBOL = 3; - - /** - * The feature id for the '<em><b>Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IJAVA_SYMBOL__NAME = ISYMBOL__NAME; - - /** - * The feature id for the '<em><b>Java Element</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IJAVA_SYMBOL__JAVA_ELEMENT = ISYMBOL_FEATURE_COUNT + 0; - - /** - * The number of structural features of the '<em>IJava Symbol</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IJAVA_SYMBOL_FEATURE_COUNT = ISYMBOL_FEATURE_COUNT + 1; - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.context.symbol.internal.impl.ITypeDescriptorImpl <em>IType Descriptor</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.ITypeDescriptorImpl - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.SymbolPackageImpl#getITypeDescriptor() - * @generated - */ - int ITYPE_DESCRIPTOR = 5; - - /** - * The feature id for the '<em><b>Properties</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ITYPE_DESCRIPTOR__PROPERTIES = 0; - - /** - * The feature id for the '<em><b>Type Signature</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ITYPE_DESCRIPTOR__TYPE_SIGNATURE = 1; - - /** - * The feature id for the '<em><b>Super Type Signatures</b></em>' attribute list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ITYPE_DESCRIPTOR__SUPER_TYPE_SIGNATURES = 2; - - /** - * The feature id for the '<em><b>Interface Type Signatures</b></em>' attribute list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ITYPE_DESCRIPTOR__INTERFACE_TYPE_SIGNATURES = 3; - - /** - * The feature id for the '<em><b>Type Signature Delegate</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ITYPE_DESCRIPTOR__TYPE_SIGNATURE_DELEGATE = 4; - - /** - * The feature id for the '<em><b>Methods</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ITYPE_DESCRIPTOR__METHODS = 5; - - /** - * The feature id for the '<em><b>Type Parameter Signatures</b></em>' attribute list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ITYPE_DESCRIPTOR__TYPE_PARAMETER_SIGNATURES = 6; - - /** - * The feature id for the '<em><b>Jdt Context</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ITYPE_DESCRIPTOR__JDT_CONTEXT = 7; - - /** - * The feature id for the '<em><b>Enum Type</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ITYPE_DESCRIPTOR__ENUM_TYPE = 8; - - /** - * The number of structural features of the '<em>IType Descriptor</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ITYPE_DESCRIPTOR_FEATURE_COUNT = 9; - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.context.symbol.IDescribedInDetail <em>IDescribed In Detail</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.context.symbol.IDescribedInDetail - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.SymbolPackageImpl#getIDescribedInDetail() - * @generated - */ - int IDESCRIBED_IN_DETAIL = 6; - - /** - * The number of structural features of the '<em>IDescribed In Detail</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IDESCRIBED_IN_DETAIL_FEATURE_COUNT = 0; - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.context.symbol.internal.impl.IJavaTypeDescriptor2Impl <em>IJava Type Descriptor2</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.IJavaTypeDescriptor2Impl - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.SymbolPackageImpl#getIJavaTypeDescriptor2() - * @generated - */ - int IJAVA_TYPE_DESCRIPTOR2 = 7; - - /** - * The feature id for the '<em><b>Properties</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IJAVA_TYPE_DESCRIPTOR2__PROPERTIES = ITYPE_DESCRIPTOR__PROPERTIES; - - /** - * The feature id for the '<em><b>Type Signature</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IJAVA_TYPE_DESCRIPTOR2__TYPE_SIGNATURE = ITYPE_DESCRIPTOR__TYPE_SIGNATURE; - - /** - * The feature id for the '<em><b>Super Type Signatures</b></em>' attribute list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IJAVA_TYPE_DESCRIPTOR2__SUPER_TYPE_SIGNATURES = ITYPE_DESCRIPTOR__SUPER_TYPE_SIGNATURES; - - /** - * The feature id for the '<em><b>Interface Type Signatures</b></em>' attribute list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IJAVA_TYPE_DESCRIPTOR2__INTERFACE_TYPE_SIGNATURES = ITYPE_DESCRIPTOR__INTERFACE_TYPE_SIGNATURES; - - /** - * The feature id for the '<em><b>Type Signature Delegate</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IJAVA_TYPE_DESCRIPTOR2__TYPE_SIGNATURE_DELEGATE = ITYPE_DESCRIPTOR__TYPE_SIGNATURE_DELEGATE; - - /** - * The feature id for the '<em><b>Methods</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IJAVA_TYPE_DESCRIPTOR2__METHODS = ITYPE_DESCRIPTOR__METHODS; - - /** - * The feature id for the '<em><b>Type Parameter Signatures</b></em>' attribute list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IJAVA_TYPE_DESCRIPTOR2__TYPE_PARAMETER_SIGNATURES = ITYPE_DESCRIPTOR__TYPE_PARAMETER_SIGNATURES; - - /** - * The feature id for the '<em><b>Jdt Context</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IJAVA_TYPE_DESCRIPTOR2__JDT_CONTEXT = ITYPE_DESCRIPTOR__JDT_CONTEXT; - - /** - * The feature id for the '<em><b>Enum Type</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IJAVA_TYPE_DESCRIPTOR2__ENUM_TYPE = ITYPE_DESCRIPTOR__ENUM_TYPE; - - /** - * The feature id for the '<em><b>Type</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IJAVA_TYPE_DESCRIPTOR2__TYPE = ITYPE_DESCRIPTOR_FEATURE_COUNT + 0; - - /** - * The feature id for the '<em><b>Bean Properties</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IJAVA_TYPE_DESCRIPTOR2__BEAN_PROPERTIES = ITYPE_DESCRIPTOR_FEATURE_COUNT + 1; - - /** - * The feature id for the '<em><b>Bean Methods</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IJAVA_TYPE_DESCRIPTOR2__BEAN_METHODS = ITYPE_DESCRIPTOR_FEATURE_COUNT + 2; - - /** - * The feature id for the '<em><b>Array Count</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IJAVA_TYPE_DESCRIPTOR2__ARRAY_COUNT = ITYPE_DESCRIPTOR_FEATURE_COUNT + 3; - - /** - * The number of structural features of the '<em>IJava Type Descriptor2</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IJAVA_TYPE_DESCRIPTOR2_FEATURE_COUNT = ITYPE_DESCRIPTOR_FEATURE_COUNT + 4; - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.context.symbol.internal.impl.IBeanMethodSymbolImpl <em>IBean Method Symbol</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.IBeanMethodSymbolImpl - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.SymbolPackageImpl#getIBeanMethodSymbol() - * @generated - */ - int IBEAN_METHOD_SYMBOL = 8; - - /** - * The feature id for the '<em><b>Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBEAN_METHOD_SYMBOL__NAME = IDESCRIBED_IN_DETAIL_FEATURE_COUNT + 0; - - /** - * The feature id for the '<em><b>Signature</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBEAN_METHOD_SYMBOL__SIGNATURE = IDESCRIBED_IN_DETAIL_FEATURE_COUNT + 1; - - /** - * The feature id for the '<em><b>Owner</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBEAN_METHOD_SYMBOL__OWNER = IDESCRIBED_IN_DETAIL_FEATURE_COUNT + 2; - - /** - * The number of structural features of the '<em>IBean Method Symbol</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBEAN_METHOD_SYMBOL_FEATURE_COUNT = IDESCRIBED_IN_DETAIL_FEATURE_COUNT + 3; - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.context.symbol.internal.impl.IComponentSymbolImpl <em>IComponent Symbol</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.IComponentSymbolImpl - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.SymbolPackageImpl#getIComponentSymbol() - * @generated - */ - int ICOMPONENT_SYMBOL = 9; - - /** - * The feature id for the '<em><b>Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ICOMPONENT_SYMBOL__NAME = IINSTANCE_SYMBOL__NAME; - - /** - * The feature id for the '<em><b>Type Descriptor</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ICOMPONENT_SYMBOL__TYPE_DESCRIPTOR = IINSTANCE_SYMBOL__TYPE_DESCRIPTOR; - - /** - * The feature id for the '<em><b>Readable</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ICOMPONENT_SYMBOL__READABLE = IINSTANCE_SYMBOL__READABLE; - - /** - * The feature id for the '<em><b>Writable</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ICOMPONENT_SYMBOL__WRITABLE = IINSTANCE_SYMBOL__WRITABLE; - - /** - * The feature id for the '<em><b>Type Resolved</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ICOMPONENT_SYMBOL__TYPE_RESOLVED = IINSTANCE_SYMBOL__TYPE_RESOLVED; - - /** - * The feature id for the '<em><b>Runtime Source</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ICOMPONENT_SYMBOL__RUNTIME_SOURCE = IINSTANCE_SYMBOL__RUNTIME_SOURCE; - - /** - * The number of structural features of the '<em>IComponent Symbol</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ICOMPONENT_SYMBOL_FEATURE_COUNT = IINSTANCE_SYMBOL_FEATURE_COUNT + 0; - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.context.symbol.internal.impl.IMapTypeDescriptorImpl <em>IMap Type Descriptor</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.IMapTypeDescriptorImpl - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.SymbolPackageImpl#getIMapTypeDescriptor() - * @generated - */ - int IMAP_TYPE_DESCRIPTOR = 11; - - /** - * The feature id for the '<em><b>Properties</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IMAP_TYPE_DESCRIPTOR__PROPERTIES = ITYPE_DESCRIPTOR__PROPERTIES; - - /** - * The feature id for the '<em><b>Type Signature</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IMAP_TYPE_DESCRIPTOR__TYPE_SIGNATURE = ITYPE_DESCRIPTOR__TYPE_SIGNATURE; - - /** - * The feature id for the '<em><b>Super Type Signatures</b></em>' attribute list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IMAP_TYPE_DESCRIPTOR__SUPER_TYPE_SIGNATURES = ITYPE_DESCRIPTOR__SUPER_TYPE_SIGNATURES; - - /** - * The feature id for the '<em><b>Interface Type Signatures</b></em>' attribute list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IMAP_TYPE_DESCRIPTOR__INTERFACE_TYPE_SIGNATURES = ITYPE_DESCRIPTOR__INTERFACE_TYPE_SIGNATURES; - - /** - * The feature id for the '<em><b>Type Signature Delegate</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IMAP_TYPE_DESCRIPTOR__TYPE_SIGNATURE_DELEGATE = ITYPE_DESCRIPTOR__TYPE_SIGNATURE_DELEGATE; - - /** - * The feature id for the '<em><b>Methods</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IMAP_TYPE_DESCRIPTOR__METHODS = ITYPE_DESCRIPTOR__METHODS; - - /** - * The feature id for the '<em><b>Type Parameter Signatures</b></em>' attribute list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IMAP_TYPE_DESCRIPTOR__TYPE_PARAMETER_SIGNATURES = ITYPE_DESCRIPTOR__TYPE_PARAMETER_SIGNATURES; - - /** - * The feature id for the '<em><b>Jdt Context</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IMAP_TYPE_DESCRIPTOR__JDT_CONTEXT = ITYPE_DESCRIPTOR__JDT_CONTEXT; - - /** - * The feature id for the '<em><b>Enum Type</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IMAP_TYPE_DESCRIPTOR__ENUM_TYPE = ITYPE_DESCRIPTOR__ENUM_TYPE; - - /** - * The feature id for the '<em><b>Map Source</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IMAP_TYPE_DESCRIPTOR__MAP_SOURCE = ITYPE_DESCRIPTOR_FEATURE_COUNT + 0; - - /** - * The feature id for the '<em><b>Immutable</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IMAP_TYPE_DESCRIPTOR__IMMUTABLE = ITYPE_DESCRIPTOR_FEATURE_COUNT + 1; - - /** - * The number of structural features of the '<em>IMap Type Descriptor</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IMAP_TYPE_DESCRIPTOR_FEATURE_COUNT = ITYPE_DESCRIPTOR_FEATURE_COUNT + 2; - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.context.symbol.internal.impl.IMethodSymbolImpl <em>IMethod Symbol</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.IMethodSymbolImpl - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.SymbolPackageImpl#getIMethodSymbol() - * @generated - */ - int IMETHOD_SYMBOL = 12; - - /** - * The feature id for the '<em><b>Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IMETHOD_SYMBOL__NAME = ISYMBOL__NAME; - - /** - * The feature id for the '<em><b>Signature</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IMETHOD_SYMBOL__SIGNATURE = ISYMBOL_FEATURE_COUNT + 0; - - /** - * The number of structural features of the '<em>IMethod Symbol</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IMETHOD_SYMBOL_FEATURE_COUNT = ISYMBOL_FEATURE_COUNT + 1; - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.context.symbol.IBoundedTypeDescriptor <em>IBounded Type Descriptor</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.context.symbol.IBoundedTypeDescriptor - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.SymbolPackageImpl#getIBoundedTypeDescriptor() - * @generated - */ - int IBOUNDED_TYPE_DESCRIPTOR = 14; - - /** - * The feature id for the '<em><b>Properties</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBOUNDED_TYPE_DESCRIPTOR__PROPERTIES = ITYPE_DESCRIPTOR__PROPERTIES; - - /** - * The feature id for the '<em><b>Type Signature</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBOUNDED_TYPE_DESCRIPTOR__TYPE_SIGNATURE = ITYPE_DESCRIPTOR__TYPE_SIGNATURE; - - /** - * The feature id for the '<em><b>Super Type Signatures</b></em>' attribute list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBOUNDED_TYPE_DESCRIPTOR__SUPER_TYPE_SIGNATURES = ITYPE_DESCRIPTOR__SUPER_TYPE_SIGNATURES; - - /** - * The feature id for the '<em><b>Interface Type Signatures</b></em>' attribute list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBOUNDED_TYPE_DESCRIPTOR__INTERFACE_TYPE_SIGNATURES = ITYPE_DESCRIPTOR__INTERFACE_TYPE_SIGNATURES; - - /** - * The feature id for the '<em><b>Type Signature Delegate</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBOUNDED_TYPE_DESCRIPTOR__TYPE_SIGNATURE_DELEGATE = ITYPE_DESCRIPTOR__TYPE_SIGNATURE_DELEGATE; - - /** - * The feature id for the '<em><b>Methods</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBOUNDED_TYPE_DESCRIPTOR__METHODS = ITYPE_DESCRIPTOR__METHODS; - - /** - * The feature id for the '<em><b>Type Parameter Signatures</b></em>' attribute list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBOUNDED_TYPE_DESCRIPTOR__TYPE_PARAMETER_SIGNATURES = ITYPE_DESCRIPTOR__TYPE_PARAMETER_SIGNATURES; - - /** - * The feature id for the '<em><b>Jdt Context</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBOUNDED_TYPE_DESCRIPTOR__JDT_CONTEXT = ITYPE_DESCRIPTOR__JDT_CONTEXT; - - /** - * The feature id for the '<em><b>Enum Type</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBOUNDED_TYPE_DESCRIPTOR__ENUM_TYPE = ITYPE_DESCRIPTOR__ENUM_TYPE; - - /** - * The number of structural features of the '<em>IBounded Type Descriptor</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBOUNDED_TYPE_DESCRIPTOR_FEATURE_COUNT = ITYPE_DESCRIPTOR_FEATURE_COUNT + 0; - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.context.symbol.internal.impl.IBoundedMapTypeDescriptorImpl <em>IBounded Map Type Descriptor</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.IBoundedMapTypeDescriptorImpl - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.SymbolPackageImpl#getIBoundedMapTypeDescriptor() - * @generated - */ - int IBOUNDED_MAP_TYPE_DESCRIPTOR = 15; - - /** - * The feature id for the '<em><b>Properties</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBOUNDED_MAP_TYPE_DESCRIPTOR__PROPERTIES = IMAP_TYPE_DESCRIPTOR__PROPERTIES; - - /** - * The feature id for the '<em><b>Type Signature</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBOUNDED_MAP_TYPE_DESCRIPTOR__TYPE_SIGNATURE = IMAP_TYPE_DESCRIPTOR__TYPE_SIGNATURE; - - /** - * The feature id for the '<em><b>Super Type Signatures</b></em>' attribute list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBOUNDED_MAP_TYPE_DESCRIPTOR__SUPER_TYPE_SIGNATURES = IMAP_TYPE_DESCRIPTOR__SUPER_TYPE_SIGNATURES; - - /** - * The feature id for the '<em><b>Interface Type Signatures</b></em>' attribute list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBOUNDED_MAP_TYPE_DESCRIPTOR__INTERFACE_TYPE_SIGNATURES = IMAP_TYPE_DESCRIPTOR__INTERFACE_TYPE_SIGNATURES; - - /** - * The feature id for the '<em><b>Type Signature Delegate</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBOUNDED_MAP_TYPE_DESCRIPTOR__TYPE_SIGNATURE_DELEGATE = IMAP_TYPE_DESCRIPTOR__TYPE_SIGNATURE_DELEGATE; - - /** - * The feature id for the '<em><b>Methods</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBOUNDED_MAP_TYPE_DESCRIPTOR__METHODS = IMAP_TYPE_DESCRIPTOR__METHODS; - - /** - * The feature id for the '<em><b>Type Parameter Signatures</b></em>' attribute list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBOUNDED_MAP_TYPE_DESCRIPTOR__TYPE_PARAMETER_SIGNATURES = IMAP_TYPE_DESCRIPTOR__TYPE_PARAMETER_SIGNATURES; - - /** - * The feature id for the '<em><b>Jdt Context</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBOUNDED_MAP_TYPE_DESCRIPTOR__JDT_CONTEXT = IMAP_TYPE_DESCRIPTOR__JDT_CONTEXT; - - /** - * The feature id for the '<em><b>Enum Type</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBOUNDED_MAP_TYPE_DESCRIPTOR__ENUM_TYPE = IMAP_TYPE_DESCRIPTOR__ENUM_TYPE; - - /** - * The feature id for the '<em><b>Map Source</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBOUNDED_MAP_TYPE_DESCRIPTOR__MAP_SOURCE = IMAP_TYPE_DESCRIPTOR__MAP_SOURCE; - - /** - * The feature id for the '<em><b>Immutable</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBOUNDED_MAP_TYPE_DESCRIPTOR__IMMUTABLE = IMAP_TYPE_DESCRIPTOR__IMMUTABLE; - - /** - * The number of structural features of the '<em>IBounded Map Type Descriptor</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBOUNDED_MAP_TYPE_DESCRIPTOR_FEATURE_COUNT = IMAP_TYPE_DESCRIPTOR_FEATURE_COUNT + 0; - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.context.symbol.internal.impl.IBoundedJavaTypeDescriptorImpl <em>IBounded Java Type Descriptor</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.IBoundedJavaTypeDescriptorImpl - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.SymbolPackageImpl#getIBoundedJavaTypeDescriptor() - * @generated - */ - int IBOUNDED_JAVA_TYPE_DESCRIPTOR = 16; - - /** - * The feature id for the '<em><b>Properties</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBOUNDED_JAVA_TYPE_DESCRIPTOR__PROPERTIES = IJAVA_TYPE_DESCRIPTOR2__PROPERTIES; - - /** - * The feature id for the '<em><b>Type Signature</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBOUNDED_JAVA_TYPE_DESCRIPTOR__TYPE_SIGNATURE = IJAVA_TYPE_DESCRIPTOR2__TYPE_SIGNATURE; - - /** - * The feature id for the '<em><b>Super Type Signatures</b></em>' attribute list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBOUNDED_JAVA_TYPE_DESCRIPTOR__SUPER_TYPE_SIGNATURES = IJAVA_TYPE_DESCRIPTOR2__SUPER_TYPE_SIGNATURES; - - /** - * The feature id for the '<em><b>Interface Type Signatures</b></em>' attribute list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBOUNDED_JAVA_TYPE_DESCRIPTOR__INTERFACE_TYPE_SIGNATURES = IJAVA_TYPE_DESCRIPTOR2__INTERFACE_TYPE_SIGNATURES; - - /** - * The feature id for the '<em><b>Type Signature Delegate</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBOUNDED_JAVA_TYPE_DESCRIPTOR__TYPE_SIGNATURE_DELEGATE = IJAVA_TYPE_DESCRIPTOR2__TYPE_SIGNATURE_DELEGATE; - - /** - * The feature id for the '<em><b>Methods</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBOUNDED_JAVA_TYPE_DESCRIPTOR__METHODS = IJAVA_TYPE_DESCRIPTOR2__METHODS; - - /** - * The feature id for the '<em><b>Type Parameter Signatures</b></em>' attribute list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBOUNDED_JAVA_TYPE_DESCRIPTOR__TYPE_PARAMETER_SIGNATURES = IJAVA_TYPE_DESCRIPTOR2__TYPE_PARAMETER_SIGNATURES; - - /** - * The feature id for the '<em><b>Jdt Context</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBOUNDED_JAVA_TYPE_DESCRIPTOR__JDT_CONTEXT = IJAVA_TYPE_DESCRIPTOR2__JDT_CONTEXT; - - /** - * The feature id for the '<em><b>Enum Type</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBOUNDED_JAVA_TYPE_DESCRIPTOR__ENUM_TYPE = IJAVA_TYPE_DESCRIPTOR2__ENUM_TYPE; - - /** - * The feature id for the '<em><b>Type</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBOUNDED_JAVA_TYPE_DESCRIPTOR__TYPE = IJAVA_TYPE_DESCRIPTOR2__TYPE; - - /** - * The feature id for the '<em><b>Bean Properties</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBOUNDED_JAVA_TYPE_DESCRIPTOR__BEAN_PROPERTIES = IJAVA_TYPE_DESCRIPTOR2__BEAN_PROPERTIES; - - /** - * The feature id for the '<em><b>Bean Methods</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBOUNDED_JAVA_TYPE_DESCRIPTOR__BEAN_METHODS = IJAVA_TYPE_DESCRIPTOR2__BEAN_METHODS; - - /** - * The feature id for the '<em><b>Array Count</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBOUNDED_JAVA_TYPE_DESCRIPTOR__ARRAY_COUNT = IJAVA_TYPE_DESCRIPTOR2__ARRAY_COUNT; - - /** - * The number of structural features of the '<em>IBounded Java Type Descriptor</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBOUNDED_JAVA_TYPE_DESCRIPTOR_FEATURE_COUNT = IJAVA_TYPE_DESCRIPTOR2_FEATURE_COUNT + 0; - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.context.symbol.internal.impl.IListTypeDescriptorImpl <em>IList Type Descriptor</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.IListTypeDescriptorImpl - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.SymbolPackageImpl#getIListTypeDescriptor() - * @generated - */ - int ILIST_TYPE_DESCRIPTOR = 17; - - /** - * The feature id for the '<em><b>Properties</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ILIST_TYPE_DESCRIPTOR__PROPERTIES = ITYPE_DESCRIPTOR__PROPERTIES; - - /** - * The feature id for the '<em><b>Type Signature</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ILIST_TYPE_DESCRIPTOR__TYPE_SIGNATURE = ITYPE_DESCRIPTOR__TYPE_SIGNATURE; - - /** - * The feature id for the '<em><b>Super Type Signatures</b></em>' attribute list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ILIST_TYPE_DESCRIPTOR__SUPER_TYPE_SIGNATURES = ITYPE_DESCRIPTOR__SUPER_TYPE_SIGNATURES; - - /** - * The feature id for the '<em><b>Interface Type Signatures</b></em>' attribute list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ILIST_TYPE_DESCRIPTOR__INTERFACE_TYPE_SIGNATURES = ITYPE_DESCRIPTOR__INTERFACE_TYPE_SIGNATURES; - - /** - * The feature id for the '<em><b>Type Signature Delegate</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ILIST_TYPE_DESCRIPTOR__TYPE_SIGNATURE_DELEGATE = ITYPE_DESCRIPTOR__TYPE_SIGNATURE_DELEGATE; - - /** - * The feature id for the '<em><b>Methods</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ILIST_TYPE_DESCRIPTOR__METHODS = ITYPE_DESCRIPTOR__METHODS; - - /** - * The feature id for the '<em><b>Type Parameter Signatures</b></em>' attribute list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ILIST_TYPE_DESCRIPTOR__TYPE_PARAMETER_SIGNATURES = ITYPE_DESCRIPTOR__TYPE_PARAMETER_SIGNATURES; - - /** - * The feature id for the '<em><b>Jdt Context</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ILIST_TYPE_DESCRIPTOR__JDT_CONTEXT = ITYPE_DESCRIPTOR__JDT_CONTEXT; - - /** - * The feature id for the '<em><b>Enum Type</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ILIST_TYPE_DESCRIPTOR__ENUM_TYPE = ITYPE_DESCRIPTOR__ENUM_TYPE; - - /** - * The feature id for the '<em><b>List Source</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ILIST_TYPE_DESCRIPTOR__LIST_SOURCE = ITYPE_DESCRIPTOR_FEATURE_COUNT + 0; - - /** - * The number of structural features of the '<em>IList Type Descriptor</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ILIST_TYPE_DESCRIPTOR_FEATURE_COUNT = ITYPE_DESCRIPTOR_FEATURE_COUNT + 1; - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.context.symbol.internal.impl.IBoundedListTypeDescriptorImpl <em>IBounded List Type Descriptor</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.IBoundedListTypeDescriptorImpl - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.SymbolPackageImpl#getIBoundedListTypeDescriptor() - * @generated - */ - int IBOUNDED_LIST_TYPE_DESCRIPTOR = 18; - - /** - * The feature id for the '<em><b>Properties</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBOUNDED_LIST_TYPE_DESCRIPTOR__PROPERTIES = ILIST_TYPE_DESCRIPTOR__PROPERTIES; - - /** - * The feature id for the '<em><b>Type Signature</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBOUNDED_LIST_TYPE_DESCRIPTOR__TYPE_SIGNATURE = ILIST_TYPE_DESCRIPTOR__TYPE_SIGNATURE; - - /** - * The feature id for the '<em><b>Super Type Signatures</b></em>' attribute list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBOUNDED_LIST_TYPE_DESCRIPTOR__SUPER_TYPE_SIGNATURES = ILIST_TYPE_DESCRIPTOR__SUPER_TYPE_SIGNATURES; - - /** - * The feature id for the '<em><b>Interface Type Signatures</b></em>' attribute list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBOUNDED_LIST_TYPE_DESCRIPTOR__INTERFACE_TYPE_SIGNATURES = ILIST_TYPE_DESCRIPTOR__INTERFACE_TYPE_SIGNATURES; - - /** - * The feature id for the '<em><b>Type Signature Delegate</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBOUNDED_LIST_TYPE_DESCRIPTOR__TYPE_SIGNATURE_DELEGATE = ILIST_TYPE_DESCRIPTOR__TYPE_SIGNATURE_DELEGATE; - - /** - * The feature id for the '<em><b>Methods</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBOUNDED_LIST_TYPE_DESCRIPTOR__METHODS = ILIST_TYPE_DESCRIPTOR__METHODS; - - /** - * The feature id for the '<em><b>Type Parameter Signatures</b></em>' attribute list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBOUNDED_LIST_TYPE_DESCRIPTOR__TYPE_PARAMETER_SIGNATURES = ILIST_TYPE_DESCRIPTOR__TYPE_PARAMETER_SIGNATURES; - - /** - * The feature id for the '<em><b>Jdt Context</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBOUNDED_LIST_TYPE_DESCRIPTOR__JDT_CONTEXT = ILIST_TYPE_DESCRIPTOR__JDT_CONTEXT; - - /** - * The feature id for the '<em><b>Enum Type</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBOUNDED_LIST_TYPE_DESCRIPTOR__ENUM_TYPE = ILIST_TYPE_DESCRIPTOR__ENUM_TYPE; - - /** - * The feature id for the '<em><b>List Source</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBOUNDED_LIST_TYPE_DESCRIPTOR__LIST_SOURCE = ILIST_TYPE_DESCRIPTOR__LIST_SOURCE; - - /** - * The number of structural features of the '<em>IBounded List Type Descriptor</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IBOUNDED_LIST_TYPE_DESCRIPTOR_FEATURE_COUNT = ILIST_TYPE_DESCRIPTOR_FEATURE_COUNT + 0; - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.context.symbol.ERuntimeSource <em>ERuntime Source</em>}' enum. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.context.symbol.ERuntimeSource - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.SymbolPackageImpl#getERuntimeSource() - * @generated - */ - int ERUNTIME_SOURCE = 19; - - /** - * The meta object id for the '<em>IType</em>' data type. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jdt.core.IType - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.SymbolPackageImpl#getIType() - * @generated - */ - int ITYPE = 20; - - /** - * The meta object id for the '<em>IJava Element</em>' data type. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jdt.core.IJavaElement - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.SymbolPackageImpl#getIJavaElement() - * @generated - */ - int IJAVA_ELEMENT = 21; - - /** - * The meta object id for the '<em>Value Type</em>' data type. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.internal.types.ValueType - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.SymbolPackageImpl#getValueType() - * @generated - */ - int VALUE_TYPE = 22; - - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.context.symbol.IBeanInstanceSymbol <em>IBean Instance Symbol</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>IBean Instance Symbol</em>'. - * @see org.eclipse.jst.jsf.context.symbol.IBeanInstanceSymbol - * @generated - */ - EClass getIBeanInstanceSymbol(); - - /** - * Returns the meta object for the reference list '{@link org.eclipse.jst.jsf.context.symbol.IBeanInstanceSymbol#getProperties <em>Properties</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the reference list '<em>Properties</em>'. - * @see org.eclipse.jst.jsf.context.symbol.IBeanInstanceSymbol#getProperties() - * @see #getIBeanInstanceSymbol() - * @generated - */ - EReference getIBeanInstanceSymbol_Properties(); - - /** - * Returns the meta object for the reference list '{@link org.eclipse.jst.jsf.context.symbol.IBeanInstanceSymbol#getMethods <em>Methods</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the reference list '<em>Methods</em>'. - * @see org.eclipse.jst.jsf.context.symbol.IBeanInstanceSymbol#getMethods() - * @see #getIBeanInstanceSymbol() - * @generated - */ - EReference getIBeanInstanceSymbol_Methods(); - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.context.symbol.IBeanPropertySymbol <em>IBean Property Symbol</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>IBean Property Symbol</em>'. - * @see org.eclipse.jst.jsf.context.symbol.IBeanPropertySymbol - * @generated - */ - EClass getIBeanPropertySymbol(); - - /** - * Returns the meta object for the reference '{@link org.eclipse.jst.jsf.context.symbol.IBeanPropertySymbol#getOwner <em>Owner</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the reference '<em>Owner</em>'. - * @see org.eclipse.jst.jsf.context.symbol.IBeanPropertySymbol#getOwner() - * @see #getIBeanPropertySymbol() - * @generated - */ - EReference getIBeanPropertySymbol_Owner(); - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.context.symbol.IInstanceSymbol <em>IInstance Symbol</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>IInstance Symbol</em>'. - * @see org.eclipse.jst.jsf.context.symbol.IInstanceSymbol - * @generated - */ - EClass getIInstanceSymbol(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.context.symbol.IInstanceSymbol#isTypeResolved <em>Type Resolved</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Type Resolved</em>'. - * @see org.eclipse.jst.jsf.context.symbol.IInstanceSymbol#isTypeResolved() - * @see #getIInstanceSymbol() - * @generated - */ - EAttribute getIInstanceSymbol_TypeResolved(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.context.symbol.IInstanceSymbol#getRuntimeSource <em>Runtime Source</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Runtime Source</em>'. - * @see org.eclipse.jst.jsf.context.symbol.IInstanceSymbol#getRuntimeSource() - * @see #getIInstanceSymbol() - * @generated - */ - EAttribute getIInstanceSymbol_RuntimeSource(); - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.context.symbol.IJavaSymbol <em>IJava Symbol</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>IJava Symbol</em>'. - * @see org.eclipse.jst.jsf.context.symbol.IJavaSymbol - * @generated - */ - EClass getIJavaSymbol(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.context.symbol.IJavaSymbol#getJavaElement <em>Java Element</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Java Element</em>'. - * @see org.eclipse.jst.jsf.context.symbol.IJavaSymbol#getJavaElement() - * @see #getIJavaSymbol() - * @generated - */ - EAttribute getIJavaSymbol_JavaElement(); - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.context.symbol.ISymbol <em>ISymbol</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>ISymbol</em>'. - * @see org.eclipse.jst.jsf.context.symbol.ISymbol - * @generated - */ - EClass getISymbol(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.context.symbol.ISymbol#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.context.symbol.ISymbol#getName() - * @see #getISymbol() - * @generated - */ - EAttribute getISymbol_Name(); - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.context.symbol.ITypeDescriptor <em>IType Descriptor</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>IType Descriptor</em>'. - * @see org.eclipse.jst.jsf.context.symbol.ITypeDescriptor - * @generated - */ - EClass getITypeDescriptor(); - - /** - * Returns the meta object for the reference list '{@link org.eclipse.jst.jsf.context.symbol.ITypeDescriptor#getProperties <em>Properties</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the reference list '<em>Properties</em>'. - * @see org.eclipse.jst.jsf.context.symbol.ITypeDescriptor#getProperties() - * @see #getITypeDescriptor() - * @generated - */ - EReference getITypeDescriptor_Properties(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.context.symbol.ITypeDescriptor#getTypeSignature <em>Type Signature</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Type Signature</em>'. - * @see org.eclipse.jst.jsf.context.symbol.ITypeDescriptor#getTypeSignature() - * @see #getITypeDescriptor() - * @generated - */ - EAttribute getITypeDescriptor_TypeSignature(); - - /** - * Returns the meta object for the attribute list '{@link org.eclipse.jst.jsf.context.symbol.ITypeDescriptor#getSuperTypeSignatures <em>Super Type Signatures</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute list '<em>Super Type Signatures</em>'. - * @see org.eclipse.jst.jsf.context.symbol.ITypeDescriptor#getSuperTypeSignatures() - * @see #getITypeDescriptor() - * @generated - */ - EAttribute getITypeDescriptor_SuperTypeSignatures(); - - /** - * Returns the meta object for the attribute list '{@link org.eclipse.jst.jsf.context.symbol.ITypeDescriptor#getInterfaceTypeSignatures <em>Interface Type Signatures</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute list '<em>Interface Type Signatures</em>'. - * @see org.eclipse.jst.jsf.context.symbol.ITypeDescriptor#getInterfaceTypeSignatures() - * @see #getITypeDescriptor() - * @generated - */ - EAttribute getITypeDescriptor_InterfaceTypeSignatures(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.context.symbol.ITypeDescriptor#getTypeSignatureDelegate <em>Type Signature Delegate</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Type Signature Delegate</em>'. - * @see org.eclipse.jst.jsf.context.symbol.ITypeDescriptor#getTypeSignatureDelegate() - * @see #getITypeDescriptor() - * @generated - */ - EAttribute getITypeDescriptor_TypeSignatureDelegate(); - - /** - * Returns the meta object for the reference list '{@link org.eclipse.jst.jsf.context.symbol.ITypeDescriptor#getMethods <em>Methods</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the reference list '<em>Methods</em>'. - * @see org.eclipse.jst.jsf.context.symbol.ITypeDescriptor#getMethods() - * @see #getITypeDescriptor() - * @generated - */ - EReference getITypeDescriptor_Methods(); - - /** - * Returns the meta object for the attribute list '{@link org.eclipse.jst.jsf.context.symbol.ITypeDescriptor#getTypeParameterSignatures <em>Type Parameter Signatures</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute list '<em>Type Parameter Signatures</em>'. - * @see org.eclipse.jst.jsf.context.symbol.ITypeDescriptor#getTypeParameterSignatures() - * @see #getITypeDescriptor() - * @generated - */ - EAttribute getITypeDescriptor_TypeParameterSignatures(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.context.symbol.ITypeDescriptor#getJdtContext <em>Jdt Context</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Jdt Context</em>'. - * @see org.eclipse.jst.jsf.context.symbol.ITypeDescriptor#getJdtContext() - * @see #getITypeDescriptor() - * @generated - */ - EAttribute getITypeDescriptor_JdtContext(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.context.symbol.ITypeDescriptor#isEnumType <em>Enum Type</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Enum Type</em>'. - * @see org.eclipse.jst.jsf.context.symbol.ITypeDescriptor#isEnumType() - * @see #getITypeDescriptor() - * @generated - */ - EAttribute getITypeDescriptor_EnumType(); - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.context.symbol.IDescribedInDetail <em>IDescribed In Detail</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>IDescribed In Detail</em>'. - * @see org.eclipse.jst.jsf.context.symbol.IDescribedInDetail - * @generated - */ - EClass getIDescribedInDetail(); - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.context.symbol.IJavaTypeDescriptor2 <em>IJava Type Descriptor2</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>IJava Type Descriptor2</em>'. - * @see org.eclipse.jst.jsf.context.symbol.IJavaTypeDescriptor2 - * @generated - */ - EClass getIJavaTypeDescriptor2(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.context.symbol.IJavaTypeDescriptor2#getType <em>Type</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Type</em>'. - * @see org.eclipse.jst.jsf.context.symbol.IJavaTypeDescriptor2#getType() - * @see #getIJavaTypeDescriptor2() - * @generated - */ - EAttribute getIJavaTypeDescriptor2_Type(); - - /** - * Returns the meta object for the reference list '{@link org.eclipse.jst.jsf.context.symbol.IJavaTypeDescriptor2#getBeanProperties <em>Bean Properties</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the reference list '<em>Bean Properties</em>'. - * @see org.eclipse.jst.jsf.context.symbol.IJavaTypeDescriptor2#getBeanProperties() - * @see #getIJavaTypeDescriptor2() - * @generated - */ - EReference getIJavaTypeDescriptor2_BeanProperties(); - - /** - * Returns the meta object for the reference list '{@link org.eclipse.jst.jsf.context.symbol.IJavaTypeDescriptor2#getBeanMethods <em>Bean Methods</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the reference list '<em>Bean Methods</em>'. - * @see org.eclipse.jst.jsf.context.symbol.IJavaTypeDescriptor2#getBeanMethods() - * @see #getIJavaTypeDescriptor2() - * @generated - */ - EReference getIJavaTypeDescriptor2_BeanMethods(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.context.symbol.IJavaTypeDescriptor2#getArrayCount <em>Array Count</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Array Count</em>'. - * @see org.eclipse.jst.jsf.context.symbol.IJavaTypeDescriptor2#getArrayCount() - * @see #getIJavaTypeDescriptor2() - * @generated - */ - EAttribute getIJavaTypeDescriptor2_ArrayCount(); - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.context.symbol.IBeanMethodSymbol <em>IBean Method Symbol</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>IBean Method Symbol</em>'. - * @see org.eclipse.jst.jsf.context.symbol.IBeanMethodSymbol - * @generated - */ - EClass getIBeanMethodSymbol(); - - /** - * Returns the meta object for the reference '{@link org.eclipse.jst.jsf.context.symbol.IBeanMethodSymbol#getOwner <em>Owner</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the reference '<em>Owner</em>'. - * @see org.eclipse.jst.jsf.context.symbol.IBeanMethodSymbol#getOwner() - * @see #getIBeanMethodSymbol() - * @generated - */ - EReference getIBeanMethodSymbol_Owner(); - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.context.symbol.IComponentSymbol <em>IComponent Symbol</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>IComponent Symbol</em>'. - * @see org.eclipse.jst.jsf.context.symbol.IComponentSymbol - * @generated - */ - EClass getIComponentSymbol(); - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.context.symbol.IPropertySymbol <em>IProperty Symbol</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>IProperty Symbol</em>'. - * @see org.eclipse.jst.jsf.context.symbol.IPropertySymbol - * @generated - */ - EClass getIPropertySymbol(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.context.symbol.IPropertySymbol#isIntermediate <em>Intermediate</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Intermediate</em>'. - * @see org.eclipse.jst.jsf.context.symbol.IPropertySymbol#isIntermediate() - * @see #getIPropertySymbol() - * @generated - */ - EAttribute getIPropertySymbol_Intermediate(); - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.context.symbol.IMapTypeDescriptor <em>IMap Type Descriptor</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>IMap Type Descriptor</em>'. - * @see org.eclipse.jst.jsf.context.symbol.IMapTypeDescriptor - * @generated - */ - EClass getIMapTypeDescriptor(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.context.symbol.IMapTypeDescriptor#getMapSource <em>Map Source</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Map Source</em>'. - * @see org.eclipse.jst.jsf.context.symbol.IMapTypeDescriptor#getMapSource() - * @see #getIMapTypeDescriptor() - * @generated - */ - EAttribute getIMapTypeDescriptor_MapSource(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.context.symbol.IMapTypeDescriptor#isImmutable <em>Immutable</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Immutable</em>'. - * @see org.eclipse.jst.jsf.context.symbol.IMapTypeDescriptor#isImmutable() - * @see #getIMapTypeDescriptor() - * @generated - */ - EAttribute getIMapTypeDescriptor_Immutable(); - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.context.symbol.IMethodSymbol <em>IMethod Symbol</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>IMethod Symbol</em>'. - * @see org.eclipse.jst.jsf.context.symbol.IMethodSymbol - * @generated - */ - EClass getIMethodSymbol(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.context.symbol.IMethodSymbol#getSignature <em>Signature</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Signature</em>'. - * @see org.eclipse.jst.jsf.context.symbol.IMethodSymbol#getSignature() - * @see #getIMethodSymbol() - * @generated - */ - EAttribute getIMethodSymbol_Signature(); - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.context.symbol.IObjectSymbol <em>IObject Symbol</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>IObject Symbol</em>'. - * @see org.eclipse.jst.jsf.context.symbol.IObjectSymbol - * @generated - */ - EClass getIObjectSymbol(); - - /** - * Returns the meta object for the reference '{@link org.eclipse.jst.jsf.context.symbol.IObjectSymbol#getTypeDescriptor <em>Type Descriptor</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the reference '<em>Type Descriptor</em>'. - * @see org.eclipse.jst.jsf.context.symbol.IObjectSymbol#getTypeDescriptor() - * @see #getIObjectSymbol() - * @generated - */ - EReference getIObjectSymbol_TypeDescriptor(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.context.symbol.IObjectSymbol#isReadable <em>Readable</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Readable</em>'. - * @see org.eclipse.jst.jsf.context.symbol.IObjectSymbol#isReadable() - * @see #getIObjectSymbol() - * @generated - */ - EAttribute getIObjectSymbol_Readable(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.context.symbol.IObjectSymbol#isWritable <em>Writable</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Writable</em>'. - * @see org.eclipse.jst.jsf.context.symbol.IObjectSymbol#isWritable() - * @see #getIObjectSymbol() - * @generated - */ - EAttribute getIObjectSymbol_Writable(); - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.context.symbol.IBoundedTypeDescriptor <em>IBounded Type Descriptor</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>IBounded Type Descriptor</em>'. - * @see org.eclipse.jst.jsf.context.symbol.IBoundedTypeDescriptor - * @generated - */ - EClass getIBoundedTypeDescriptor(); - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.context.symbol.IBoundedMapTypeDescriptor <em>IBounded Map Type Descriptor</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>IBounded Map Type Descriptor</em>'. - * @see org.eclipse.jst.jsf.context.symbol.IBoundedMapTypeDescriptor - * @generated - */ - EClass getIBoundedMapTypeDescriptor(); - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.context.symbol.IBoundedJavaTypeDescriptor <em>IBounded Java Type Descriptor</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>IBounded Java Type Descriptor</em>'. - * @see org.eclipse.jst.jsf.context.symbol.IBoundedJavaTypeDescriptor - * @generated - */ - EClass getIBoundedJavaTypeDescriptor(); - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.context.symbol.IListTypeDescriptor <em>IList Type Descriptor</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>IList Type Descriptor</em>'. - * @see org.eclipse.jst.jsf.context.symbol.IListTypeDescriptor - * @generated - */ - EClass getIListTypeDescriptor(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.context.symbol.IListTypeDescriptor#getListSource <em>List Source</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>List Source</em>'. - * @see org.eclipse.jst.jsf.context.symbol.IListTypeDescriptor#getListSource() - * @see #getIListTypeDescriptor() - * @generated - */ - EAttribute getIListTypeDescriptor_ListSource(); - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.context.symbol.IBoundedListTypeDescriptor <em>IBounded List Type Descriptor</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>IBounded List Type Descriptor</em>'. - * @see org.eclipse.jst.jsf.context.symbol.IBoundedListTypeDescriptor - * @generated - */ - EClass getIBoundedListTypeDescriptor(); - - /** - * Returns the meta object for enum '{@link org.eclipse.jst.jsf.context.symbol.ERuntimeSource <em>ERuntime Source</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for enum '<em>ERuntime Source</em>'. - * @see org.eclipse.jst.jsf.context.symbol.ERuntimeSource - * @generated - */ - EEnum getERuntimeSource(); - - /** - * Returns the meta object for data type '{@link org.eclipse.jdt.core.IType <em>IType</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for data type '<em>IType</em>'. - * @see org.eclipse.jdt.core.IType - * @model instanceClass="org.eclipse.jdt.core.IType" - * @generated - */ - EDataType getIType(); - - /** - * Returns the meta object for data type '{@link org.eclipse.jdt.core.IJavaElement <em>IJava Element</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for data type '<em>IJava Element</em>'. - * @see org.eclipse.jdt.core.IJavaElement - * @model instanceClass="org.eclipse.jdt.core.IJavaElement" - * @generated - */ - EDataType getIJavaElement(); - - /** - * Returns the meta object for data type '{@link org.eclipse.jst.jsf.common.internal.types.ValueType <em>Value Type</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for data type '<em>Value Type</em>'. - * @see org.eclipse.jst.jsf.common.internal.types.ValueType - * @model instanceClass="org.eclipse.jst.jsf.common.internal.types.ValueType" - * @generated - */ - EDataType getValueType(); - - /** - * 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 - */ - SymbolFactory getSymbolFactory(); - - /** - * <!-- 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.context.symbol.internal.impl.IBeanInstanceSymbolImpl <em>IBean Instance Symbol</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.IBeanInstanceSymbolImpl - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.SymbolPackageImpl#getIBeanInstanceSymbol() - * @generated - */ - EClass IBEAN_INSTANCE_SYMBOL = eINSTANCE.getIBeanInstanceSymbol(); - - /** - * The meta object literal for the '<em><b>Properties</b></em>' reference list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference IBEAN_INSTANCE_SYMBOL__PROPERTIES = eINSTANCE.getIBeanInstanceSymbol_Properties(); - - /** - * The meta object literal for the '<em><b>Methods</b></em>' reference list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference IBEAN_INSTANCE_SYMBOL__METHODS = eINSTANCE.getIBeanInstanceSymbol_Methods(); - - /** - * The meta object literal for the '{@link org.eclipse.jst.jsf.context.symbol.internal.impl.IBeanPropertySymbolImpl <em>IBean Property Symbol</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.IBeanPropertySymbolImpl - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.SymbolPackageImpl#getIBeanPropertySymbol() - * @generated - */ - EClass IBEAN_PROPERTY_SYMBOL = eINSTANCE.getIBeanPropertySymbol(); - - /** - * The meta object literal for the '<em><b>Owner</b></em>' reference feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference IBEAN_PROPERTY_SYMBOL__OWNER = eINSTANCE.getIBeanPropertySymbol_Owner(); - - /** - * The meta object literal for the '{@link org.eclipse.jst.jsf.context.symbol.internal.impl.IInstanceSymbolImpl <em>IInstance Symbol</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.IInstanceSymbolImpl - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.SymbolPackageImpl#getIInstanceSymbol() - * @generated - */ - EClass IINSTANCE_SYMBOL = eINSTANCE.getIInstanceSymbol(); - - /** - * The meta object literal for the '<em><b>Type Resolved</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute IINSTANCE_SYMBOL__TYPE_RESOLVED = eINSTANCE.getIInstanceSymbol_TypeResolved(); - - /** - * The meta object literal for the '<em><b>Runtime Source</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute IINSTANCE_SYMBOL__RUNTIME_SOURCE = eINSTANCE.getIInstanceSymbol_RuntimeSource(); - - /** - * The meta object literal for the '{@link org.eclipse.jst.jsf.context.symbol.internal.impl.IJavaSymbolImpl <em>IJava Symbol</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.IJavaSymbolImpl - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.SymbolPackageImpl#getIJavaSymbol() - * @generated - */ - EClass IJAVA_SYMBOL = eINSTANCE.getIJavaSymbol(); - - /** - * The meta object literal for the '<em><b>Java Element</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute IJAVA_SYMBOL__JAVA_ELEMENT = eINSTANCE.getIJavaSymbol_JavaElement(); - - /** - * The meta object literal for the '{@link org.eclipse.jst.jsf.context.symbol.ISymbol <em>ISymbol</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.context.symbol.ISymbol - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.SymbolPackageImpl#getISymbol() - * @generated - */ - EClass ISYMBOL = eINSTANCE.getISymbol(); - - /** - * The meta object literal for the '<em><b>Name</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute ISYMBOL__NAME = eINSTANCE.getISymbol_Name(); - - /** - * The meta object literal for the '{@link org.eclipse.jst.jsf.context.symbol.internal.impl.ITypeDescriptorImpl <em>IType Descriptor</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.ITypeDescriptorImpl - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.SymbolPackageImpl#getITypeDescriptor() - * @generated - */ - EClass ITYPE_DESCRIPTOR = eINSTANCE.getITypeDescriptor(); - - /** - * The meta object literal for the '<em><b>Properties</b></em>' reference list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference ITYPE_DESCRIPTOR__PROPERTIES = eINSTANCE.getITypeDescriptor_Properties(); - - /** - * The meta object literal for the '<em><b>Type Signature</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute ITYPE_DESCRIPTOR__TYPE_SIGNATURE = eINSTANCE.getITypeDescriptor_TypeSignature(); - - /** - * The meta object literal for the '<em><b>Super Type Signatures</b></em>' attribute list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute ITYPE_DESCRIPTOR__SUPER_TYPE_SIGNATURES = eINSTANCE.getITypeDescriptor_SuperTypeSignatures(); - - /** - * The meta object literal for the '<em><b>Interface Type Signatures</b></em>' attribute list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute ITYPE_DESCRIPTOR__INTERFACE_TYPE_SIGNATURES = eINSTANCE.getITypeDescriptor_InterfaceTypeSignatures(); - - /** - * The meta object literal for the '<em><b>Type Signature Delegate</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute ITYPE_DESCRIPTOR__TYPE_SIGNATURE_DELEGATE = eINSTANCE.getITypeDescriptor_TypeSignatureDelegate(); - - /** - * The meta object literal for the '<em><b>Methods</b></em>' reference list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference ITYPE_DESCRIPTOR__METHODS = eINSTANCE.getITypeDescriptor_Methods(); - - /** - * The meta object literal for the '<em><b>Type Parameter Signatures</b></em>' attribute list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute ITYPE_DESCRIPTOR__TYPE_PARAMETER_SIGNATURES = eINSTANCE.getITypeDescriptor_TypeParameterSignatures(); - - /** - * The meta object literal for the '<em><b>Jdt Context</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute ITYPE_DESCRIPTOR__JDT_CONTEXT = eINSTANCE.getITypeDescriptor_JdtContext(); - - /** - * The meta object literal for the '<em><b>Enum Type</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute ITYPE_DESCRIPTOR__ENUM_TYPE = eINSTANCE.getITypeDescriptor_EnumType(); - - /** - * The meta object literal for the '{@link org.eclipse.jst.jsf.context.symbol.IDescribedInDetail <em>IDescribed In Detail</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.context.symbol.IDescribedInDetail - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.SymbolPackageImpl#getIDescribedInDetail() - * @generated - */ - EClass IDESCRIBED_IN_DETAIL = eINSTANCE.getIDescribedInDetail(); - - /** - * The meta object literal for the '{@link org.eclipse.jst.jsf.context.symbol.internal.impl.IJavaTypeDescriptor2Impl <em>IJava Type Descriptor2</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.IJavaTypeDescriptor2Impl - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.SymbolPackageImpl#getIJavaTypeDescriptor2() - * @generated - */ - EClass IJAVA_TYPE_DESCRIPTOR2 = eINSTANCE.getIJavaTypeDescriptor2(); - - /** - * The meta object literal for the '<em><b>Type</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute IJAVA_TYPE_DESCRIPTOR2__TYPE = eINSTANCE.getIJavaTypeDescriptor2_Type(); - - /** - * The meta object literal for the '<em><b>Bean Properties</b></em>' reference list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference IJAVA_TYPE_DESCRIPTOR2__BEAN_PROPERTIES = eINSTANCE.getIJavaTypeDescriptor2_BeanProperties(); - - /** - * The meta object literal for the '<em><b>Bean Methods</b></em>' reference list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference IJAVA_TYPE_DESCRIPTOR2__BEAN_METHODS = eINSTANCE.getIJavaTypeDescriptor2_BeanMethods(); - - /** - * The meta object literal for the '<em><b>Array Count</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute IJAVA_TYPE_DESCRIPTOR2__ARRAY_COUNT = eINSTANCE.getIJavaTypeDescriptor2_ArrayCount(); - - /** - * The meta object literal for the '{@link org.eclipse.jst.jsf.context.symbol.internal.impl.IBeanMethodSymbolImpl <em>IBean Method Symbol</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.IBeanMethodSymbolImpl - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.SymbolPackageImpl#getIBeanMethodSymbol() - * @generated - */ - EClass IBEAN_METHOD_SYMBOL = eINSTANCE.getIBeanMethodSymbol(); - - /** - * The meta object literal for the '<em><b>Owner</b></em>' reference feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference IBEAN_METHOD_SYMBOL__OWNER = eINSTANCE.getIBeanMethodSymbol_Owner(); - - /** - * The meta object literal for the '{@link org.eclipse.jst.jsf.context.symbol.internal.impl.IComponentSymbolImpl <em>IComponent Symbol</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.IComponentSymbolImpl - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.SymbolPackageImpl#getIComponentSymbol() - * @generated - */ - EClass ICOMPONENT_SYMBOL = eINSTANCE.getIComponentSymbol(); - - /** - * The meta object literal for the '{@link org.eclipse.jst.jsf.context.symbol.internal.impl.IPropertySymbolImpl <em>IProperty Symbol</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.IPropertySymbolImpl - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.SymbolPackageImpl#getIPropertySymbol() - * @generated - */ - EClass IPROPERTY_SYMBOL = eINSTANCE.getIPropertySymbol(); - - /** - * The meta object literal for the '<em><b>Intermediate</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute IPROPERTY_SYMBOL__INTERMEDIATE = eINSTANCE.getIPropertySymbol_Intermediate(); - - /** - * The meta object literal for the '{@link org.eclipse.jst.jsf.context.symbol.internal.impl.IMapTypeDescriptorImpl <em>IMap Type Descriptor</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.IMapTypeDescriptorImpl - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.SymbolPackageImpl#getIMapTypeDescriptor() - * @generated - */ - EClass IMAP_TYPE_DESCRIPTOR = eINSTANCE.getIMapTypeDescriptor(); - - /** - * The meta object literal for the '<em><b>Map Source</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute IMAP_TYPE_DESCRIPTOR__MAP_SOURCE = eINSTANCE.getIMapTypeDescriptor_MapSource(); - - /** - * The meta object literal for the '<em><b>Immutable</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute IMAP_TYPE_DESCRIPTOR__IMMUTABLE = eINSTANCE.getIMapTypeDescriptor_Immutable(); - - /** - * The meta object literal for the '{@link org.eclipse.jst.jsf.context.symbol.internal.impl.IMethodSymbolImpl <em>IMethod Symbol</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.IMethodSymbolImpl - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.SymbolPackageImpl#getIMethodSymbol() - * @generated - */ - EClass IMETHOD_SYMBOL = eINSTANCE.getIMethodSymbol(); - - /** - * The meta object literal for the '<em><b>Signature</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute IMETHOD_SYMBOL__SIGNATURE = eINSTANCE.getIMethodSymbol_Signature(); - - /** - * The meta object literal for the '{@link org.eclipse.jst.jsf.context.symbol.IObjectSymbol <em>IObject Symbol</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.context.symbol.IObjectSymbol - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.SymbolPackageImpl#getIObjectSymbol() - * @generated - */ - EClass IOBJECT_SYMBOL = eINSTANCE.getIObjectSymbol(); - - /** - * The meta object literal for the '<em><b>Type Descriptor</b></em>' reference feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference IOBJECT_SYMBOL__TYPE_DESCRIPTOR = eINSTANCE.getIObjectSymbol_TypeDescriptor(); - - /** - * The meta object literal for the '<em><b>Readable</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute IOBJECT_SYMBOL__READABLE = eINSTANCE.getIObjectSymbol_Readable(); - - /** - * The meta object literal for the '<em><b>Writable</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute IOBJECT_SYMBOL__WRITABLE = eINSTANCE.getIObjectSymbol_Writable(); - - /** - * The meta object literal for the '{@link org.eclipse.jst.jsf.context.symbol.IBoundedTypeDescriptor <em>IBounded Type Descriptor</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.context.symbol.IBoundedTypeDescriptor - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.SymbolPackageImpl#getIBoundedTypeDescriptor() - * @generated - */ - EClass IBOUNDED_TYPE_DESCRIPTOR = eINSTANCE.getIBoundedTypeDescriptor(); - - /** - * The meta object literal for the '{@link org.eclipse.jst.jsf.context.symbol.internal.impl.IBoundedMapTypeDescriptorImpl <em>IBounded Map Type Descriptor</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.IBoundedMapTypeDescriptorImpl - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.SymbolPackageImpl#getIBoundedMapTypeDescriptor() - * @generated - */ - EClass IBOUNDED_MAP_TYPE_DESCRIPTOR = eINSTANCE.getIBoundedMapTypeDescriptor(); - - /** - * The meta object literal for the '{@link org.eclipse.jst.jsf.context.symbol.internal.impl.IBoundedJavaTypeDescriptorImpl <em>IBounded Java Type Descriptor</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.IBoundedJavaTypeDescriptorImpl - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.SymbolPackageImpl#getIBoundedJavaTypeDescriptor() - * @generated - */ - EClass IBOUNDED_JAVA_TYPE_DESCRIPTOR = eINSTANCE.getIBoundedJavaTypeDescriptor(); - - /** - * The meta object literal for the '{@link org.eclipse.jst.jsf.context.symbol.internal.impl.IListTypeDescriptorImpl <em>IList Type Descriptor</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.IListTypeDescriptorImpl - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.SymbolPackageImpl#getIListTypeDescriptor() - * @generated - */ - EClass ILIST_TYPE_DESCRIPTOR = eINSTANCE.getIListTypeDescriptor(); - - /** - * The meta object literal for the '<em><b>List Source</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute ILIST_TYPE_DESCRIPTOR__LIST_SOURCE = eINSTANCE.getIListTypeDescriptor_ListSource(); - - /** - * The meta object literal for the '{@link org.eclipse.jst.jsf.context.symbol.internal.impl.IBoundedListTypeDescriptorImpl <em>IBounded List Type Descriptor</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.IBoundedListTypeDescriptorImpl - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.SymbolPackageImpl#getIBoundedListTypeDescriptor() - * @generated - */ - EClass IBOUNDED_LIST_TYPE_DESCRIPTOR = eINSTANCE.getIBoundedListTypeDescriptor(); - - /** - * The meta object literal for the '{@link org.eclipse.jst.jsf.context.symbol.ERuntimeSource <em>ERuntime Source</em>}' enum. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.context.symbol.ERuntimeSource - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.SymbolPackageImpl#getERuntimeSource() - * @generated - */ - EEnum ERUNTIME_SOURCE = eINSTANCE.getERuntimeSource(); - - /** - * The meta object literal for the '<em>IType</em>' data type. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jdt.core.IType - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.SymbolPackageImpl#getIType() - * @generated - */ - EDataType ITYPE = eINSTANCE.getIType(); - - /** - * The meta object literal for the '<em>IJava Element</em>' data type. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jdt.core.IJavaElement - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.SymbolPackageImpl#getIJavaElement() - * @generated - */ - EDataType IJAVA_ELEMENT = eINSTANCE.getIJavaElement(); - - /** - * The meta object literal for the '<em>Value Type</em>' data type. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.internal.types.ValueType - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.SymbolPackageImpl#getValueType() - * @generated - */ - EDataType VALUE_TYPE = eINSTANCE.getValueType(); - - } - -} //SymbolPackage diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/IBeanInstanceSymbolImpl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/IBeanInstanceSymbolImpl.java deleted file mode 100644 index 4124126d6..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/IBeanInstanceSymbolImpl.java +++ /dev/null @@ -1,248 +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.context.symbol.internal.impl; - -import java.util.HashMap; - -import org.eclipse.emf.common.util.BasicEList; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.jst.jsf.common.internal.types.TypeConstants; -import org.eclipse.jst.jsf.context.symbol.IBeanInstanceSymbol; -import org.eclipse.jst.jsf.context.symbol.IBoundedListTypeDescriptor; -import org.eclipse.jst.jsf.context.symbol.IBoundedMapTypeDescriptor; -import org.eclipse.jst.jsf.context.symbol.IJavaTypeDescriptor2; -import org.eclipse.jst.jsf.context.symbol.ISymbol; -import org.eclipse.jst.jsf.context.symbol.ITypeDescriptor; -import org.eclipse.jst.jsf.context.symbol.SymbolFactory; -import org.eclipse.jst.jsf.context.symbol.SymbolPackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>IBean Instance Symbol</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.jst.jsf.context.symbol.internal.impl.IBeanInstanceSymbolImpl#getProperties <em>Properties</em>}</li> - * <li>{@link org.eclipse.jst.jsf.context.symbol.internal.impl.IBeanInstanceSymbolImpl#getMethods <em>Methods</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class IBeanInstanceSymbolImpl extends IInstanceSymbolImpl implements IBeanInstanceSymbol { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @SuppressWarnings("hiding") - public static final String copyright = "Copyright 2006 Oracle"; //$NON-NLS-1$ - - /** - * A detailed description (human readable) about this instance symbol - */ - protected String _detailedDescription = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IBeanInstanceSymbolImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * @return the EClass - * <!-- end-user-doc --> - * @generated - */ - protected EClass eStaticClass() { - return SymbolPackage.Literals.IBEAN_INSTANCE_SYMBOL; - } - - /** - * <!-- begin-user-doc --> - * @return the list of bean properties - * <!-- end-user-doc --> - * @generated NOT - */ - public EList getProperties() - { - return getJavaTypeDescriptor().getBeanProperties(); - } - - /** - * <!-- begin-user-doc --> - * @return the list of methods - * <!-- end-user-doc --> - * @generated NOT - */ - public EList getMethods() { - return getJavaTypeDescriptor().getBeanMethods(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - public IJavaTypeDescriptor2 getJavaTypeDescriptor() { - return (IJavaTypeDescriptor2) getTypeDescriptor(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - public void setJavaTypeDescriptor(IJavaTypeDescriptor2 newTypeDescriptor) { - setTypeDescriptor(newTypeDescriptor); - } - - /** - * <!-- begin-user-doc --> - * @param featureID - * @param resolve - * @param coreType - * @return the object related to featureID - * <!-- end-user-doc --> - * @generated - */ - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case SymbolPackage.IBEAN_INSTANCE_SYMBOL__PROPERTIES: - return getProperties(); - case SymbolPackage.IBEAN_INSTANCE_SYMBOL__METHODS: - return getMethods(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * @param featureID - * @return whether the corresponding feature is set - * <!-- end-user-doc --> - * @generated - */ - public boolean eIsSet(int featureID) { - switch (featureID) { - case SymbolPackage.IBEAN_INSTANCE_SYMBOL__PROPERTIES: - return !getProperties().isEmpty(); - case SymbolPackage.IBEAN_INSTANCE_SYMBOL__METHODS: - return !getMethods().isEmpty(); - } - return super.eIsSet(featureID); - } - - public String getDetailedDescription() - { - return _detailedDescription; - } - - public void setDetailedDescription(String detailedDescription) - { - this._detailedDescription = detailedDescription; - } - - /** - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.IInstanceSymbolImpl#isTypeResolved() - * @generated NOT - */ - // @Override - public boolean isTypeResolved() - { - return getJavaTypeDescriptor() != null; - } - - /** - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.IInstanceSymbolImpl#setTypeDescriptor(org.eclipse.jst.jsf.context.symbol.ITypeDescriptor) - * @generated NOT - */ - public void setTypeDescriptor(ITypeDescriptor newTypeDescriptor) - { - if (newTypeDescriptor instanceof IJavaTypeDescriptor2) - { - super.setTypeDescriptor(newTypeDescriptor); - } - else - { - throw new IllegalArgumentException("Bean instance symbol requires a IJavaTypeDescriptor2"); //$NON-NLS-1$ - } - } - - public boolean isReadable() - { - // beans always readable - return true; - } - - public boolean isWritable() - { - // beans not writable - return false; - } - - public void setReadable(boolean value) { - // do nothing - } - - public void setWritable(boolean value) { - // do nothing - } - - /* - * @generated NOT - */ - public ITypeDescriptor coerce(String typeSignature) - { - if (supportsCoercion(typeSignature)) - { - if (TypeConstants.TYPE_MAP.equals(typeSignature)) - { - IBoundedMapTypeDescriptor mapDesc = - SymbolFactory.eINSTANCE.createIBoundedMapTypeDescriptor(); - // bean maps are generally writable - mapDesc.setImmutable(true); - mapDesc.setMapSource(new HashMap()); // give it an empty map - return mapDesc; - } - else if (TypeConstants.TYPE_LIST.equals(typeSignature)) - { - IBoundedListTypeDescriptor listDesc = - SymbolFactory.eINSTANCE.createIBoundedListTypeDescriptor(); - - // bean maps are generally writable - listDesc.setListSource(new BasicEList()); // give it an empty list - return listDesc; - } - } - - return null; - } - - /** (non-Javadoc) - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.IPropertySymbolImpl#call(java.lang.String, org.eclipse.emf.common.util.EList, java.lang.String) - * - * @generated NOT - */ - public ISymbol call(String methodName, EList methodArguments, - String symbolName) - { - return Util.call(methodName, methodArguments, symbolName, getTypeDescriptor()); - } - -} //IBeanInstanceSymbolImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/IBeanMethodSymbolImpl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/IBeanMethodSymbolImpl.java deleted file mode 100644 index 03606b41b..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/IBeanMethodSymbolImpl.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.context.symbol.internal.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.jdt.core.IMethod; -import org.eclipse.jdt.core.Signature; -import org.eclipse.jst.jsf.context.symbol.IBeanMethodSymbol; -import org.eclipse.jst.jsf.context.symbol.IJavaTypeDescriptor2; -import org.eclipse.jst.jsf.context.symbol.IMethodSymbol; -import org.eclipse.jst.jsf.context.symbol.ISymbol; -import org.eclipse.jst.jsf.context.symbol.SymbolPackage; - - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>IBean Method Symbol</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.jst.jsf.context.symbol.internal.impl.IBeanMethodSymbolImpl#getName <em>Name</em>}</li> - * <li>{@link org.eclipse.jst.jsf.context.symbol.internal.impl.IBeanMethodSymbolImpl#getSignature <em>Signature</em>}</li> - * <li>{@link org.eclipse.jst.jsf.context.symbol.internal.impl.IBeanMethodSymbolImpl#getOwner <em>Owner</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class IBeanMethodSymbolImpl extends EObjectImpl implements IBeanMethodSymbol { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright 2006 Oracle"; //$NON-NLS-1$ - - /** - * 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 #getSignature() <em>Signature</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getSignature() - * @generated - * @ordered - */ - protected static final String SIGNATURE_EDEFAULT = null; - - /** - * The cached value of the '{@link #getSignature() <em>Signature</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getSignature() - * @generated - * @ordered - */ - protected String signature = SIGNATURE_EDEFAULT; - - /** - * The cached value of the '{@link #getOwner() <em>Owner</em>}' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getOwner() - * @generated - * @ordered - */ - protected IJavaTypeDescriptor2 owner = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IBeanMethodSymbolImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * @return the static eclass - * <!-- end-user-doc --> - * @generated - */ - protected EClass eStaticClass() { - return SymbolPackage.Literals.IBEAN_METHOD_SYMBOL; - } - - /** - * <!-- begin-user-doc --> - * @return the name of the method symbol - * <!-- 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, SymbolPackage.IBEAN_METHOD_SYMBOL__NAME, oldName, name)); - } - - /** - * <!-- begin-user-doc --> - * @return the signature in JVM/JDT form - * <!-- end-user-doc --> - * @generated - */ - public String getSignature() { - return signature; - } - - /** - * <!-- begin-user-doc --> - * @param newSignature - * <!-- end-user-doc --> - * @generated - */ - public void setSignature(String newSignature) { - String oldSignature = signature; - signature = newSignature; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, SymbolPackage.IBEAN_METHOD_SYMBOL__SIGNATURE, oldSignature, signature)); - } - - /** - * <!-- begin-user-doc --> - * @return the java type descriptor that owns this symbol - * <!-- end-user-doc --> - * @generated - */ - public IJavaTypeDescriptor2 getOwner() { - if (owner != null && owner.eIsProxy()) { - InternalEObject oldOwner = (InternalEObject)owner; - owner = (IJavaTypeDescriptor2)eResolveProxy(oldOwner); - if (owner != oldOwner) { - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.RESOLVE, SymbolPackage.IBEAN_METHOD_SYMBOL__OWNER, oldOwner, owner)); - } - } - return owner; - } - - /** - * <!-- begin-user-doc --> - * @return the java type descriptor that derives this symbol - * <!-- end-user-doc --> - * @generated - */ - public IJavaTypeDescriptor2 basicGetOwner() { - return owner; - } - - /** - * <!-- begin-user-doc --> - * @param newOwner - * <!-- end-user-doc --> - * @generated - */ - public void setOwner(IJavaTypeDescriptor2 newOwner) { - IJavaTypeDescriptor2 oldOwner = owner; - owner = newOwner; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, SymbolPackage.IBEAN_METHOD_SYMBOL__OWNER, oldOwner, owner)); - } - - /** - * <!-- begin-user-doc --> - * @param featureID - * @param resolve - * @param coreType - * @return the feature object for featureID - * <!-- end-user-doc --> - * @generated - */ - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case SymbolPackage.IBEAN_METHOD_SYMBOL__NAME: - return getName(); - case SymbolPackage.IBEAN_METHOD_SYMBOL__SIGNATURE: - return getSignature(); - case SymbolPackage.IBEAN_METHOD_SYMBOL__OWNER: - if (resolve) return getOwner(); - return basicGetOwner(); - } - 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 SymbolPackage.IBEAN_METHOD_SYMBOL__NAME: - setName((String)newValue); - return; - case SymbolPackage.IBEAN_METHOD_SYMBOL__SIGNATURE: - setSignature((String)newValue); - return; - case SymbolPackage.IBEAN_METHOD_SYMBOL__OWNER: - setOwner((IJavaTypeDescriptor2)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * @param featureID - * <!-- end-user-doc --> - * @generated - */ - public void eUnset(int featureID) { - switch (featureID) { - case SymbolPackage.IBEAN_METHOD_SYMBOL__NAME: - setName(NAME_EDEFAULT); - return; - case SymbolPackage.IBEAN_METHOD_SYMBOL__SIGNATURE: - setSignature(SIGNATURE_EDEFAULT); - return; - case SymbolPackage.IBEAN_METHOD_SYMBOL__OWNER: - setOwner((IJavaTypeDescriptor2)null); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * @param featureID - * @return true if the feature has been set - * <!-- end-user-doc --> - * @generated - */ - public boolean eIsSet(int featureID) { - switch (featureID) { - case SymbolPackage.IBEAN_METHOD_SYMBOL__NAME: - return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); - case SymbolPackage.IBEAN_METHOD_SYMBOL__SIGNATURE: - return SIGNATURE_EDEFAULT == null ? signature != null : !SIGNATURE_EDEFAULT.equals(signature); - case SymbolPackage.IBEAN_METHOD_SYMBOL__OWNER: - return owner != null; - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * @param derivedFeatureID - * @param baseClass - * @return the feature id - * <!-- end-user-doc --> - * @generated - */ - public int eBaseStructuralFeatureID(int derivedFeatureID, Class baseClass) { - if (baseClass == ISymbol.class) { - switch (derivedFeatureID) { - case SymbolPackage.IBEAN_METHOD_SYMBOL__NAME: return SymbolPackage.ISYMBOL__NAME; - default: return -1; - } - } - if (baseClass == IMethodSymbol.class) { - switch (derivedFeatureID) { - case SymbolPackage.IBEAN_METHOD_SYMBOL__SIGNATURE: return SymbolPackage.IMETHOD_SYMBOL__SIGNATURE; - default: return -1; - } - } - return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass); - } - - /** - * <!-- begin-user-doc --> - * @param baseFeatureID - * @param baseClass - * @return the feature id - * <!-- end-user-doc --> - * @generated - */ - public int eDerivedStructuralFeatureID(int baseFeatureID, Class baseClass) { - if (baseClass == ISymbol.class) { - switch (baseFeatureID) { - case SymbolPackage.ISYMBOL__NAME: return SymbolPackage.IBEAN_METHOD_SYMBOL__NAME; - default: return -1; - } - } - if (baseClass == IMethodSymbol.class) { - switch (baseFeatureID) { - case SymbolPackage.IMETHOD_SYMBOL__SIGNATURE: return SymbolPackage.IBEAN_METHOD_SYMBOL__SIGNATURE; - default: return -1; - } - } - return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass); - } - - /** - * <!-- begin-user-doc --> - * @return the default string representation - * <!-- end-user-doc --> - * @generated - */ - public String toString() { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (name: "); //$NON-NLS-1$ - result.append(name); - result.append(", signature: "); //$NON-NLS-1$ - result.append(signature); - result.append(')'); - return result.toString(); - } - - public String getDetailedDescription() { - StringBuffer descBuffer = new StringBuffer("<p><b>"); //$NON-NLS-1$ - descBuffer.append(Messages.getString("IBeanMethodSymbolImpl.DetailDesc")); //$NON-NLS-1$ - descBuffer.append("</b> "); //$NON-NLS-1$ - descBuffer.append(Signature.toString(signature, getName(), null, false, true)).append("</p>"); //$NON-NLS-1$ - IMethod method = JavaUtil.findCorrespondingMethod(this); - if (method != null) { - String javadoc = JavaUtil.getMethodJavadoc(method); - if (javadoc != null) { - descBuffer.append("<p>").append(javadoc).append("</p>"); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - return descBuffer.toString(); - } - - public void setDetailedDescription(String detailedDescription) { - throw new UnsupportedOperationException("Detailed Description is derived on property symbols"); //$NON-NLS-1$ - } - - -} //IBeanMethodSymbolImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/IBeanPropertySymbolImpl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/IBeanPropertySymbolImpl.java deleted file mode 100644 index be6a2aa1c..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/IBeanPropertySymbolImpl.java +++ /dev/null @@ -1,354 +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.context.symbol.internal.impl; - -import java.util.HashMap; - -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.InternalEObject; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jdt.core.Signature; -import org.eclipse.jst.jsf.common.internal.types.TypeConstants; -import org.eclipse.jst.jsf.common.util.JDTBeanProperty; -import org.eclipse.jst.jsf.context.symbol.IBeanPropertySymbol; -import org.eclipse.jst.jsf.context.symbol.IBoundedListTypeDescriptor; -import org.eclipse.jst.jsf.context.symbol.IBoundedMapTypeDescriptor; -import org.eclipse.jst.jsf.context.symbol.IJavaTypeDescriptor2; -import org.eclipse.jst.jsf.context.symbol.ISymbol; -import org.eclipse.jst.jsf.context.symbol.ITypeDescriptor; -import org.eclipse.jst.jsf.context.symbol.SymbolFactory; -import org.eclipse.jst.jsf.context.symbol.SymbolPackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>IBean Property Symbol</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.jst.jsf.context.symbol.internal.impl.IBeanPropertySymbolImpl#getOwner <em>Owner</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class IBeanPropertySymbolImpl extends IPropertySymbolImpl implements IBeanPropertySymbol { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @SuppressWarnings("hiding") - public static final String copyright = "Copyright 2006 Oracle"; //$NON-NLS-1$ - - - /** - * The cached value of the '{@link #getOwner() <em>Owner</em>}' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getOwner() - * @generated - * @ordered - */ - protected IJavaTypeDescriptor2 owner = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IBeanPropertySymbolImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * @return the static class - * <!-- end-user-doc --> - * @generated - */ - protected EClass eStaticClass() { - return SymbolPackage.Literals.IBEAN_PROPERTY_SYMBOL; - } - - /** - * <!-- begin-user-doc --> - * @return the owner's type descriptor - * <!-- end-user-doc --> - * @generated - */ - public IJavaTypeDescriptor2 getOwner() { - if (owner != null && owner.eIsProxy()) { - InternalEObject oldOwner = (InternalEObject)owner; - owner = (IJavaTypeDescriptor2)eResolveProxy(oldOwner); - if (owner != oldOwner) { - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.RESOLVE, SymbolPackage.IBEAN_PROPERTY_SYMBOL__OWNER, oldOwner, owner)); - } - } - return owner; - } - - /** - * <!-- begin-user-doc --> - * @return the java type descriptor for this instance - * <!-- end-user-doc --> - * @generated - */ - public IJavaTypeDescriptor2 basicGetOwner() { - return owner; - } - - /** - * <!-- begin-user-doc --> - * @param newOwner - * <!-- end-user-doc --> - * @generated - */ - public void setOwner(IJavaTypeDescriptor2 newOwner) { - IJavaTypeDescriptor2 oldOwner = owner; - owner = newOwner; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, SymbolPackage.IBEAN_PROPERTY_SYMBOL__OWNER, oldOwner, owner)); - } - - /** - * <!-- begin-user-doc --> - * @param featureID - * @param resolve - * @param coreType - * @return the value for the featureID - * <!-- end-user-doc --> - * @generated - */ - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case SymbolPackage.IBEAN_PROPERTY_SYMBOL__OWNER: - if (resolve) return getOwner(); - return basicGetOwner(); - } - 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 SymbolPackage.IBEAN_PROPERTY_SYMBOL__OWNER: - setOwner((IJavaTypeDescriptor2)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * @param featureID - * <!-- end-user-doc --> - * @generated - */ - public void eUnset(int featureID) { - switch (featureID) { - case SymbolPackage.IBEAN_PROPERTY_SYMBOL__OWNER: - setOwner((IJavaTypeDescriptor2)null); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * @param featureID - * @return true if the feature is set - * <!-- end-user-doc --> - * @generated - */ - public boolean eIsSet(int featureID) { - switch (featureID) { - case SymbolPackage.IBEAN_PROPERTY_SYMBOL__OWNER: - return owner != null; - } - return super.eIsSet(featureID); - } - - public String getDetailedDescription() - { - return createDetailedDescription(); - } - - public void setDetailedDescription(String detailedDescription) - { - throw new UnsupportedOperationException("Detailed Description is derived on property symbols"); //$NON-NLS-1$ - } - - /** - * @generated NOT - */ - public ITypeDescriptor coerce(final String typeSignature) - { - // ensure that we have an erased version - final String erasedTypeSignature = Signature.getTypeErasure(typeSignature); - - if (supportsCoercion(typeSignature)) - { - if (TypeConstants.TYPE_MAP.equals(erasedTypeSignature)) - { - IBoundedMapTypeDescriptor mapDesc = - SymbolFactory.eINSTANCE.createIBoundedMapTypeDescriptor(); - // bean maps are generally writable - mapDesc.setImmutable(true); - mapDesc.setMapSource(new HashMap()); // give it an empty map - return mapDesc; - } - else if (TypeConstants.TYPE_LIST.equals(erasedTypeSignature)) - { - IBoundedListTypeDescriptor listDesc = - SymbolFactory.eINSTANCE.createIBoundedListTypeDescriptor(); - listDesc.setJdtContext(deriveBestJdtContext()); - - // bean maps are generally writable - return listDesc; - } - } - - return null; - - } - - /** - * @return the derived jdt element - * @generated NOT - */ - private IJavaElement deriveBestJdtContext() - { - IJavaElement contextElement = null; - if (getTypeDescriptor() instanceof IJavaTypeDescriptor2) - { - contextElement = - ((IJavaTypeDescriptor2)getTypeDescriptor()).getType(); - } - - if (contextElement == null) - { - contextElement = getTypeDescriptor().getJdtContext(); - } - - return contextElement; - } - - /** (non-Javadoc) - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.IPropertySymbolImpl#call(java.lang.String, org.eclipse.emf.common.util.EList, java.lang.String) - * - * @generated NOT - */ - public ISymbol call(String methodName, EList methodArguments, - String symbolName) - { - return Util.call(methodName, methodArguments, symbolName, getTypeDescriptor()); - } - - -// private List convertArgsToSignatures(List methodArgs) -// { -// List args = new ArrayList(); -// -// for (final Iterator it = methodArgs.iterator(); it.hasNext();) -// { -// Object arg = it.next(); -// String className = arg.getClass().getName(); -// String resolvedName = Signature.createTypeSignature(className, true); -// args.add(resolvedName); -// } -// -// return args; -// } - - /** - * @generated NOT - */ - public boolean supportsCoercion(String typeSignature) { - // first check that our type descriptor even thinks it is - // an instanceof this type - if (getTypeDescriptor().instanceOf(typeSignature)) - { - // for java bean instances, we need to minimally support - // Map, List and Array to conform to the basic spec - // for JSF EL - if (TypeConstants.TYPE_MAP.equals(Signature.getTypeErasure(typeSignature))) - { - return true; - } - else if (TypeConstants.TYPE_LIST.equals(Signature.getTypeErasure(typeSignature))) - { - return true; - } - } - - // otherwise, not supported - return false; - } - - /** - * @return the detail description - * @generated NOT - */ - private String createDetailedDescription() - { - StringBuffer additionalInfo = new StringBuffer("<p><b>"); //$NON-NLS-1$ - ITypeDescriptor typeDescriptor_ = getTypeDescriptor(); - if (typeDescriptor_ != null) { - additionalInfo.append(Messages.getString("IBeanPropertySymbolImpl.Type")); //$NON-NLS-1$ - additionalInfo.append("</b>"); //$NON-NLS-1$ - additionalInfo.append(Signature.toString(typeDescriptor_.getTypeSignature())); - } - additionalInfo.append("</p>"); //$NON-NLS-1$ - additionalInfo.append("<p><b>"); //$NON-NLS-1$ - - additionalInfo.append(Messages.getString("IBeanPropertySymbolImpl.Access")); //$NON-NLS-1$ - additionalInfo.append("</b>"); //$NON-NLS-1$ - if (isReadable() && isWritable()) { - additionalInfo.append(Messages.getString("IBeanPropertySymbolImpl.read_write")); //$NON-NLS-1$ - } else if (isReadable()) { - additionalInfo.append(Messages.getString("IBeanPropertySymbolImpl.readonly")); //$NON-NLS-1$ - } else if (isWritable()) { - additionalInfo.append(Messages.getString("IBeanPropertySymbolImpl.writeonly")); //$NON-NLS-1$ - } else { - additionalInfo.append(Messages.getString("IBeanPropertySymbolImpl.none")); //$NON-NLS-1$ - } - additionalInfo.append("</p>"); //$NON-NLS-1$ - JDTBeanProperty property = JavaUtil.findCorrespondingJDTProperty(this); - if (property != null) { - String javaDoc = null; - if (property.getGetter() != null) { - javaDoc = JavaUtil.getMethodJavadoc(property.getGetter()); - } - if (javaDoc == null && property.getSetter() != null) { - javaDoc = JavaUtil.getMethodJavadoc(property.getSetter()); - } - if (javaDoc != null) { - additionalInfo.append("<p>").append(javaDoc).append("</p>"); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - - return additionalInfo.toString(); - } - -} //IBeanPropertySymbolImpl - diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/IBoundedJavaTypeDescriptorImpl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/IBoundedJavaTypeDescriptorImpl.java deleted file mode 100644 index af1f404e6..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/IBoundedJavaTypeDescriptorImpl.java +++ /dev/null @@ -1,98 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: IBoundedJavaTypeDescriptorImpl.java,v 1.8 2007/10/01 04:29:44 cbateman Exp $ - */ -package org.eclipse.jst.jsf.context.symbol.internal.impl; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.jdt.core.Signature; -import org.eclipse.jst.jsf.common.internal.types.TypeConstants; -import org.eclipse.jst.jsf.context.symbol.IBoundedJavaTypeDescriptor; -import org.eclipse.jst.jsf.context.symbol.IPropertySymbol; -import org.eclipse.jst.jsf.context.symbol.ISymbol; -import org.eclipse.jst.jsf.context.symbol.SymbolFactory; -import org.eclipse.jst.jsf.context.symbol.SymbolPackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>IBounded Java Type Descriptor</b></em>'. - * <!-- end-user-doc --> - * <p> - * </p> - * - * @generated - */ -public class IBoundedJavaTypeDescriptorImpl extends IJavaTypeDescriptor2Impl implements IBoundedJavaTypeDescriptor { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @SuppressWarnings("hiding") - public static final String copyright = "Copyright 2006 Oracle"; //$NON-NLS-1$ - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IBoundedJavaTypeDescriptorImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EClass eStaticClass() { - return SymbolPackage.Literals.IBOUNDED_JAVA_TYPE_DESCRIPTOR; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - public boolean isUnboundedForType(String typeSignature) { - // TODO: for now, return true if the type is a resolved object - // need to add support for template checking (Java5) and - // decide what to do with unresolved (Q) type signatures - return typeSignature != null - && typeSignature.startsWith(Character.toString(Signature.C_RESOLVED)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - public ISymbol getUnboundedProperty(Object name, String typeSignature) { - ISymbol retValue = null; - - if (isUnboundedForType(typeSignature)) - { - IPropertySymbol propSymbol = SymbolFactory.eINSTANCE.createIPropertySymbol(); - // TODO: there is a possible problem here for non-string keyed maps - propSymbol.setName(name.toString()); - propSymbol.setReadable(true); - IBoundedJavaTypeDescriptor typeDesc = - SymbolFactory.eINSTANCE.createIBoundedJavaTypeDescriptor(); - - typeDesc.setTypeSignatureDelegate(TypeConstants.TYPE_JAVAOBJECT); - propSymbol.setTypeDescriptor(typeDesc); - retValue = propSymbol; - } - - return retValue; - } - - public ISymbol calculateSyntheticCall(String methodName, EList methodArgs, - String symbolName) - { - return getUnboundedProperty(symbolName, TypeConstants.TYPE_JAVAOBJECT); - } -} //IBoundedJavaTypeDescriptorImpl
\ No newline at end of file diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/IBoundedListTypeDescriptorImpl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/IBoundedListTypeDescriptorImpl.java deleted file mode 100644 index e6cb34b8a..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/IBoundedListTypeDescriptorImpl.java +++ /dev/null @@ -1,259 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: IBoundedListTypeDescriptorImpl.java,v 1.6 2007/10/01 04:29:44 cbateman Exp $ - */ -package org.eclipse.jst.jsf.context.symbol.internal.impl; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.jdt.core.IMethod; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jdt.core.Signature; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; -import org.eclipse.jst.jsf.common.internal.types.TypeConstants; -import org.eclipse.jst.jsf.common.util.JDTBeanIntrospector; -import org.eclipse.jst.jsf.common.util.TypeUtil; -import org.eclipse.jst.jsf.context.symbol.IBoundedListTypeDescriptor; -import org.eclipse.jst.jsf.context.symbol.IJavaTypeDescriptor2; -import org.eclipse.jst.jsf.context.symbol.IPropertySymbol; -import org.eclipse.jst.jsf.context.symbol.ISymbol; -import org.eclipse.jst.jsf.context.symbol.ITypeDescriptor; -import org.eclipse.jst.jsf.context.symbol.SymbolFactory; -import org.eclipse.jst.jsf.context.symbol.SymbolPackage; - - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>IBounded List Type Descriptor</b></em>'. - * <!-- end-user-doc --> - * <p> - * </p> - * - * @generated - */ -public class IBoundedListTypeDescriptorImpl extends IListTypeDescriptorImpl implements IBoundedListTypeDescriptor { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @SuppressWarnings("hiding") - public static final String copyright = "Copyright 2006 Oracle"; //$NON-NLS-1$ - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IBoundedListTypeDescriptorImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EClass eStaticClass() { - return SymbolPackage.Literals.IBOUNDED_LIST_TYPE_DESCRIPTOR; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - public boolean isUnboundedForType(String typeSignature) - { - // type signature must be a boxed integer - // TODO: at this level, do we need to deal with coercion to - // other integer types? list.get() takes an integer... - return typeSignature != null && TypeConstants.TYPE_BOXED_INTEGER.equals(typeSignature); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - public ISymbol getUnboundedProperty(Object name, String typeSignature) { - ISymbol retValue = null; - - if (isUnboundedForType(typeSignature) - && name instanceof Number) - { - // get integer value - int offset = ((Number)name).intValue(); - - // first see if we have it in our map source - // TODO: retValue = getFromMap(name.toString()); - - if (retValue == null) - { - IPropertySymbol propSymbol = SymbolFactory.eINSTANCE.createIPropertySymbol(); - // TODO: there is a possible problem here for non-string keyed maps - propSymbol.setName(name.toString()); - propSymbol.setReadable(true); - propSymbol.setTypeDescriptor(getBoundsTypeDescriptor(offset)); - retValue = propSymbol; - } - } - - return retValue; - } - - /** - * <!-- begin-user-doc --> - * @param methodName - * @param methodArguments - * @param symbolName - * @return a symbol representing the return value of the method - * <!-- end-user-doc --> - * @generated NOT - */ - public ISymbol call(String methodName, EList methodArguments, String symbolName) - { - ISymbol result = null; - final IType type = resolveType(getTypeSignature()); - - if (type != null) - { - final JDTBeanIntrospector introspector = - new JDTBeanIntrospector(type); - - final IMethod callMethod = - matchMethod(methodName, methodArguments, introspector.getAllMethods()); - - if (callMethod != null) - { - try - { - // resolve the method's return type; don't erase parameters - final String retTypeSignature = - TypeUtil.resolveTypeSignature - (type, callMethod.getReturnType(), false) ; - - final IPropertySymbol propSymbol = - SymbolFactory.eINSTANCE.createIPropertySymbol(); - - // TODO: there is a possible problem here for non-string keyed maps - propSymbol.setName(symbolName); - propSymbol.setReadable(true); - IJavaTypeDescriptor2 typeDesc = - SymbolFactory.eINSTANCE.createIJavaTypeDescriptor2(); - - typeDesc.setArrayCount(Signature.getArrayCount(retTypeSignature)); - - // may be null - typeDesc.setType(resolveType(retTypeSignature)); - typeDesc.setTypeSignatureDelegate(retTypeSignature); - propSymbol.setTypeDescriptor(typeDesc); - result = propSymbol; - } - catch (JavaModelException e) - { - JSFCommonPlugin.log(e); - // fall-through and return null result - } - } - } - - return result; - } - - private IMethod matchMethod(String name, List methodArguments, IMethod[] allMethods) - { - final List argSigs = convertArgsToSignatures(methodArguments); - IMethod matchedMethod = null; - - for (int i = 0; i < allMethods.length; i++) - { - final IMethod method = allMethods[i]; - - // check for names and argument count match - if (method.getParameterTypes().length == argSigs.size() - && method.getElementName().equals(name)) - { - String[] methods = method.getParameterTypes(); - // need to verify argument matches - boolean isMatched = true; - CHECK_ARGUMENTS: for (int j = 0; j < methods.length; j++) - { - if (!methods[j].equals(argSigs.get(j))) - { - // not a match - isMatched = false; - break CHECK_ARGUMENTS; - } - } - - if (isMatched) - { - return method; - } - } - } - - return matchedMethod; - } - - private List convertArgsToSignatures(List methodArgs) - { - List args = new ArrayList(); - - for (final Iterator it = methodArgs.iterator(); it.hasNext();) - { - Object arg = it.next(); - String className = arg.getClass().getName(); - String resolvedName = Signature.createTypeSignature(className, true); - args.add(resolvedName); - } - - return args; - } - - /** - * @return the ITypeDescriptor for this List's element type (bound type). - * Defaults to java.lang.Object if no bounds or can't resolve bounds - * - * @generated NOT - */ - private ITypeDescriptor getBoundsTypeDescriptor(int offset) - { - IJavaTypeDescriptor2 typeDesc = null; - - List typeParameters = getTypeParameterSignatures(); - - // if no bounds at all, then default to bounded java object - if (typeParameters.size() == 0) - { - typeDesc = - SymbolFactory.eINSTANCE.createIBoundedJavaTypeDescriptor(); - - typeDesc.setTypeSignatureDelegate(TypeConstants.TYPE_JAVAOBJECT); - } - else - { - // TODO: there should only be exactly one on a list... - final String elementType = (String) typeParameters.get(0); - - typeDesc = - SymbolFactory.eINSTANCE.createIJavaTypeDescriptor2(); - - typeDesc.setArrayCount(Signature.getArrayCount(elementType)); - - // may be null - typeDesc.setType(resolveType(elementType)); - typeDesc.setTypeSignatureDelegate(elementType); - } - - return typeDesc; - } -} //IBoundedListTypeDescriptorImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/IBoundedMapTypeDescriptorImpl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/IBoundedMapTypeDescriptorImpl.java deleted file mode 100644 index 198999511..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/IBoundedMapTypeDescriptorImpl.java +++ /dev/null @@ -1,139 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: IBoundedMapTypeDescriptorImpl.java,v 1.7 2007/10/01 04:29:44 cbateman Exp $ - */ -package org.eclipse.jst.jsf.context.symbol.internal.impl; - -import java.util.Iterator; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EClass; -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.symbol.IBoundedJavaTypeDescriptor; -import org.eclipse.jst.jsf.context.symbol.IBoundedMapTypeDescriptor; -import org.eclipse.jst.jsf.context.symbol.IPropertySymbol; -import org.eclipse.jst.jsf.context.symbol.ISymbol; -import org.eclipse.jst.jsf.context.symbol.SymbolFactory; -import org.eclipse.jst.jsf.context.symbol.SymbolPackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>IBounded Map Type Descriptor</b></em>'. - * <!-- end-user-doc --> - * <p> - * </p> - * - * @generated - */ -public class IBoundedMapTypeDescriptorImpl extends IMapTypeDescriptorImpl implements IBoundedMapTypeDescriptor { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @SuppressWarnings("hiding") - public static final String copyright = "Copyright 2006 Oracle"; //$NON-NLS-1$ - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IBoundedMapTypeDescriptorImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EClass eStaticClass() { - return SymbolPackage.Literals.IBOUNDED_MAP_TYPE_DESCRIPTOR; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - public boolean isUnboundedForType(String typeSignature) { - // TODO: for now, return true if the type is a resolved object - // need to add support for template checking (Java5) and - // decide what to do with unresolved (Q) type signatures - return typeSignature != null - && typeSignature.startsWith(Character.toString(Signature.C_RESOLVED)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - public ISymbol getUnboundedProperty(Object name, String typeSignature) { - ISymbol retValue = null; - - if (isUnboundedForType(typeSignature)) - { - // first see if we have it in our map source - retValue = getFromMap(name.toString()); - - if (retValue == null) - { - IPropertySymbol propSymbol = SymbolFactory.eINSTANCE.createIPropertySymbol(); - // TODO: there is a possible problem here for non-string keyed maps - propSymbol.setName(name.toString()); - propSymbol.setReadable(true); - IBoundedJavaTypeDescriptor typeDesc = - SymbolFactory.eINSTANCE.createIBoundedJavaTypeDescriptor(); - - typeDesc.setTypeSignatureDelegate(TypeConstants.TYPE_JAVAOBJECT); - propSymbol.setTypeDescriptor(typeDesc); - retValue = propSymbol; - } - } - - return retValue; - - } - - /** - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.ITypeDescriptorImpl#calculateSyntheticCall(java.lang.String, org.eclipse.emf.common.util.EList, java.lang.String) - * @generated NOT - */ - public ISymbol calculateSyntheticCall(String methodName, EList methodArgs, - String symbolName) { - if ("get".equals(methodName) //$NON-NLS-1$ - && methodArgs.size() == 1) - { - return getUnboundedProperty(symbolName, ((ValueType) methodArgs.get(0)).getSignature()); - } - - // default is return null - return null; - } - - - /** - * @generated NOT - */ - private ISymbol getFromMap(final String name) - { - for (final Iterator it = getProperties().iterator(); it.hasNext();) - { - ISymbol symbol = (ISymbol) it.next(); - - if (symbol.getName().equals(name)) - { - return symbol; - } - } - - return null; - } - -} //IBoundedMapTypeDescriptorImpl
\ No newline at end of file diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/IComponentSymbolImpl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/IComponentSymbolImpl.java deleted file mode 100644 index 15a592ef9..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/IComponentSymbolImpl.java +++ /dev/null @@ -1,99 +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.context.symbol.internal.impl; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.jst.jsf.context.symbol.IComponentSymbol; -import org.eclipse.jst.jsf.context.symbol.ITypeDescriptor; -import org.eclipse.jst.jsf.context.symbol.SymbolPackage; - - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>IComponent Symbol</b></em>'. - * <!-- end-user-doc --> - * <p> - * </p> - * - * @generated - */ -public class IComponentSymbolImpl extends IInstanceSymbolImpl implements IComponentSymbol { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @SuppressWarnings("hiding") - public static final String copyright = "Copyright 2006 Oracle"; //$NON-NLS-1$ - - /** - * A human readable description of this symbol - */ - protected String _detailedDescription = null; - - /** - * true if this component symbol is readable - */ - protected boolean _isReadable = READABLE_EDEFAULT; - - /** - * true if this component symbol is writable - */ - protected boolean _isWritable = WRITABLE_EDEFAULT; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IComponentSymbolImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * @return the static class - * <!-- end-user-doc --> - * @generated - */ - protected EClass eStaticClass() { - return SymbolPackage.Literals.ICOMPONENT_SYMBOL; - } - - public String getDetailedDescription() { - return _detailedDescription; - } - - public void setDetailedDescription(String detailedDescription) { - _detailedDescription = detailedDescription; - } - - /** - * @generated NOT - */ - public ITypeDescriptor coerce(String typeSignature) { - // TODO: - return getTypeDescriptor(); - } - - /** - * @generated NOT - */ - public boolean supportsCoercion(String typeSignature) { - // TODO: - if (getTypeDescriptor().instanceOf(typeSignature)) - { - return true; - } - return false; - } -} //IComponentSymbolImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/IInstanceSymbolImpl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/IInstanceSymbolImpl.java deleted file mode 100644 index bc868c512..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/IInstanceSymbolImpl.java +++ /dev/null @@ -1,499 +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.context.symbol.internal.impl; - -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.InternalEObject; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.impl.EObjectImpl; -import org.eclipse.jst.jsf.common.internal.types.TypeConstants; -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.ITypeDescriptor; -import org.eclipse.jst.jsf.context.symbol.SymbolPackage; - - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>IInstance Symbol</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.jst.jsf.context.symbol.internal.impl.IInstanceSymbolImpl#getName <em>Name</em>}</li> - * <li>{@link org.eclipse.jst.jsf.context.symbol.internal.impl.IInstanceSymbolImpl#getTypeDescriptor <em>Type Descriptor</em>}</li> - * <li>{@link org.eclipse.jst.jsf.context.symbol.internal.impl.IInstanceSymbolImpl#isReadable <em>Readable</em>}</li> - * <li>{@link org.eclipse.jst.jsf.context.symbol.internal.impl.IInstanceSymbolImpl#isWritable <em>Writable</em>}</li> - * <li>{@link org.eclipse.jst.jsf.context.symbol.internal.impl.IInstanceSymbolImpl#isTypeResolved <em>Type Resolved</em>}</li> - * <li>{@link org.eclipse.jst.jsf.context.symbol.internal.impl.IInstanceSymbolImpl#getRuntimeSource <em>Runtime Source</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class IInstanceSymbolImpl extends EObjectImpl implements IInstanceSymbol { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright 2006 Oracle"; //$NON-NLS-1$ - - /** - * 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 cached value of the '{@link #getTypeDescriptor() <em>Type Descriptor</em>}' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getTypeDescriptor() - * @generated - * @ordered - */ - protected ITypeDescriptor typeDescriptor = null; - - /** - * The default value of the '{@link #isReadable() <em>Readable</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isReadable() - * @generated NOT - * @ordered - */ - protected static final boolean READABLE_EDEFAULT = true; - - /** - * The cached value of the '{@link #isReadable() <em>Readable</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isReadable() - * @generated - * @ordered - */ - protected boolean readable = READABLE_EDEFAULT; - - /** - * The default value of the '{@link #isWritable() <em>Writable</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isWritable() - * @generated - * @ordered - */ - protected static final boolean WRITABLE_EDEFAULT = false; - - /** - * The cached value of the '{@link #isWritable() <em>Writable</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isWritable() - * @generated - * @ordered - */ - protected boolean writable = WRITABLE_EDEFAULT; - - /** - * The default value of the '{@link #isTypeResolved() <em>Type Resolved</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isTypeResolved() - * @generated - * @ordered - */ - protected static final boolean TYPE_RESOLVED_EDEFAULT = false; - - /** - * The default value of the '{@link #getRuntimeSource() <em>Runtime Source</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getRuntimeSource() - * @generated - * @ordered - */ - protected static final ERuntimeSource RUNTIME_SOURCE_EDEFAULT = ERuntimeSource.TAG_INSTANTIATED_SYMBOL_LITERAL; - - /** - * The cached value of the '{@link #getRuntimeSource() <em>Runtime Source</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getRuntimeSource() - * @generated - * @ordered - */ - protected ERuntimeSource runtimeSource = RUNTIME_SOURCE_EDEFAULT; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IInstanceSymbolImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * @return the static class - * <!-- end-user-doc --> - * @generated - */ - protected EClass eStaticClass() { - return SymbolPackage.Literals.IINSTANCE_SYMBOL; - } - - /** - * <!-- begin-user-doc --> - * @return the symbol 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, SymbolPackage.IINSTANCE_SYMBOL__NAME, oldName, name)); - } - - /** - * <!-- begin-user-doc --> - * @return the type descriptor for this instance - * <!-- end-user-doc --> - * @generated - */ - public ITypeDescriptor getTypeDescriptor() { - if (typeDescriptor != null && typeDescriptor.eIsProxy()) { - InternalEObject oldTypeDescriptor = (InternalEObject)typeDescriptor; - typeDescriptor = (ITypeDescriptor)eResolveProxy(oldTypeDescriptor); - if (typeDescriptor != oldTypeDescriptor) { - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.RESOLVE, SymbolPackage.IINSTANCE_SYMBOL__TYPE_DESCRIPTOR, oldTypeDescriptor, typeDescriptor)); - } - } - return typeDescriptor; - } - - /** - * <!-- begin-user-doc --> - * @return the instance type - * <!-- end-user-doc --> - * @generated - */ - public ITypeDescriptor basicGetTypeDescriptor() { - return typeDescriptor; - } - - /** - * <!-- begin-user-doc --> - * @param newTypeDescriptor - * <!-- end-user-doc --> - * @generated - */ - public void setTypeDescriptor(ITypeDescriptor newTypeDescriptor) { - ITypeDescriptor oldTypeDescriptor = typeDescriptor; - typeDescriptor = newTypeDescriptor; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, SymbolPackage.IINSTANCE_SYMBOL__TYPE_DESCRIPTOR, oldTypeDescriptor, typeDescriptor)); - } - - /** - * <!-- begin-user-doc --> - * @return true if instance symbol is readable - * <!-- end-user-doc --> - * @generated - */ - public boolean isReadable() { - return readable; - } - - /** - * <!-- begin-user-doc --> - * @param newReadable - * <!-- end-user-doc --> - * @generated - */ - public void setReadable(boolean newReadable) { - boolean oldReadable = readable; - readable = newReadable; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, SymbolPackage.IINSTANCE_SYMBOL__READABLE, oldReadable, readable)); - } - - /** - * <!-- begin-user-doc --> - * @return true if instance is writable. - * - * Normally, instances should not be - * considered writable, since the VariableResolver has no setter, however - * this is included to allow for unforeseen cases that may require an - * instance symbol to appear to be writable - * <!-- end-user-doc --> - * @generated - */ - public boolean isWritable() { - return writable; - } - - /** - * <!-- begin-user-doc --> - * @param newWritable - * <!-- end-user-doc --> - * @generated - */ - public void setWritable(boolean newWritable) { - boolean oldWritable = writable; - writable = newWritable; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, SymbolPackage.IINSTANCE_SYMBOL__WRITABLE, oldWritable, writable)); - } - - /** - * <!-- begin-user-doc --> - * @return true if the type descriptor has been resolved for this symbol - * <!-- end-user-doc --> - * @generated NOT - */ - public boolean isTypeResolved() - { - return getTypeDescriptor() != null; - } - - /** - * <!-- begin-user-doc --> - * @return return the symbol's runtime source - * <!-- end-user-doc --> - * @generated - */ - public ERuntimeSource getRuntimeSource() { - return runtimeSource; - } - - /** - * <!-- begin-user-doc --> - * @param newRuntimeSource - * <!-- end-user-doc --> - * @generated - */ - public void setRuntimeSource(ERuntimeSource newRuntimeSource) { - ERuntimeSource oldRuntimeSource = runtimeSource; - runtimeSource = newRuntimeSource == null ? RUNTIME_SOURCE_EDEFAULT : newRuntimeSource; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, SymbolPackage.IINSTANCE_SYMBOL__RUNTIME_SOURCE, oldRuntimeSource, runtimeSource)); - } - - /** - * @generated NOT - */ - public boolean supportsCoercion(String typeSignature) - { - // first check that our type descriptor even thinks it is - // an instanceof this type - if (getTypeDescriptor().instanceOf(typeSignature)) - { - // for java bean instances, we need to minimally support - // Map, List and Array to conform to the basic spec - // for JSF EL - if (TypeConstants.TYPE_MAP.equals(typeSignature)) - { - return true; - } - else if (TypeConstants.TYPE_LIST.equals(typeSignature) - /*TODO: || isArray*/) - { - return true; - } - } - - // otherwise, not supported - return false; - } - - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - public ITypeDescriptor coerce(String typeSignature) { - // TODO: - return getTypeDescriptor(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - public ISymbol call(String methodName, EList methodArguments, String symbolName) { - return Util.call(methodName,methodArguments,symbolName,getTypeDescriptor()); - } - - /** - * <!-- begin-user-doc --> - * @param featureID - * @param resolve - * @param coreType - * @return the value for the featureID - * <!-- end-user-doc --> - * @generated - */ - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case SymbolPackage.IINSTANCE_SYMBOL__NAME: - return getName(); - case SymbolPackage.IINSTANCE_SYMBOL__TYPE_DESCRIPTOR: - if (resolve) return getTypeDescriptor(); - return basicGetTypeDescriptor(); - case SymbolPackage.IINSTANCE_SYMBOL__READABLE: - return isReadable() ? Boolean.TRUE : Boolean.FALSE; - case SymbolPackage.IINSTANCE_SYMBOL__WRITABLE: - return isWritable() ? Boolean.TRUE : Boolean.FALSE; - case SymbolPackage.IINSTANCE_SYMBOL__TYPE_RESOLVED: - return isTypeResolved() ? Boolean.TRUE : Boolean.FALSE; - case SymbolPackage.IINSTANCE_SYMBOL__RUNTIME_SOURCE: - return getRuntimeSource(); - } - 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 SymbolPackage.IINSTANCE_SYMBOL__NAME: - setName((String)newValue); - return; - case SymbolPackage.IINSTANCE_SYMBOL__TYPE_DESCRIPTOR: - setTypeDescriptor((ITypeDescriptor)newValue); - return; - case SymbolPackage.IINSTANCE_SYMBOL__READABLE: - setReadable(((Boolean)newValue).booleanValue()); - return; - case SymbolPackage.IINSTANCE_SYMBOL__WRITABLE: - setWritable(((Boolean)newValue).booleanValue()); - return; - case SymbolPackage.IINSTANCE_SYMBOL__RUNTIME_SOURCE: - setRuntimeSource((ERuntimeSource)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * @param featureID - * <!-- end-user-doc --> - * @generated - */ - public void eUnset(int featureID) { - switch (featureID) { - case SymbolPackage.IINSTANCE_SYMBOL__NAME: - setName(NAME_EDEFAULT); - return; - case SymbolPackage.IINSTANCE_SYMBOL__TYPE_DESCRIPTOR: - setTypeDescriptor((ITypeDescriptor)null); - return; - case SymbolPackage.IINSTANCE_SYMBOL__READABLE: - setReadable(READABLE_EDEFAULT); - return; - case SymbolPackage.IINSTANCE_SYMBOL__WRITABLE: - setWritable(WRITABLE_EDEFAULT); - return; - case SymbolPackage.IINSTANCE_SYMBOL__RUNTIME_SOURCE: - setRuntimeSource(RUNTIME_SOURCE_EDEFAULT); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * @param featureID - * @return true if the feature has been set - * <!-- end-user-doc --> - * @generated - */ - public boolean eIsSet(int featureID) { - switch (featureID) { - case SymbolPackage.IINSTANCE_SYMBOL__NAME: - return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); - case SymbolPackage.IINSTANCE_SYMBOL__TYPE_DESCRIPTOR: - return typeDescriptor != null; - case SymbolPackage.IINSTANCE_SYMBOL__READABLE: - return readable != READABLE_EDEFAULT; - case SymbolPackage.IINSTANCE_SYMBOL__WRITABLE: - return writable != WRITABLE_EDEFAULT; - case SymbolPackage.IINSTANCE_SYMBOL__TYPE_RESOLVED: - return isTypeResolved() != TYPE_RESOLVED_EDEFAULT; - case SymbolPackage.IINSTANCE_SYMBOL__RUNTIME_SOURCE: - return runtimeSource != RUNTIME_SOURCE_EDEFAULT; - } - 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(" (name: "); //$NON-NLS-1$ - result.append(name); - result.append(", readable: "); //$NON-NLS-1$ - result.append(readable); - result.append(", writable: "); //$NON-NLS-1$ - result.append(writable); - result.append(", runtimeSource: "); //$NON-NLS-1$ - result.append(runtimeSource); - result.append(')'); - return result.toString(); - } - -} //IInstanceSymbolImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/IJavaSymbolImpl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/IJavaSymbolImpl.java deleted file mode 100644 index 32d8de6b8..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/IJavaSymbolImpl.java +++ /dev/null @@ -1,241 +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.context.symbol.internal.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.jdt.core.IJavaElement; -import org.eclipse.jst.jsf.context.symbol.IJavaSymbol; -import org.eclipse.jst.jsf.context.symbol.SymbolPackage; - - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>IJava Symbol</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.jst.jsf.context.symbol.internal.impl.IJavaSymbolImpl#getName <em>Name</em>}</li> - * <li>{@link org.eclipse.jst.jsf.context.symbol.internal.impl.IJavaSymbolImpl#getJavaElement <em>Java Element</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class IJavaSymbolImpl extends EObjectImpl implements IJavaSymbol { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright 2006 Oracle"; //$NON-NLS-1$ - - /** - * 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 #getJavaElement() <em>Java Element</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getJavaElement() - * @generated - * @ordered - */ - protected static final IJavaElement JAVA_ELEMENT_EDEFAULT = null; - - /** - * The cached value of the '{@link #getJavaElement() <em>Java Element</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getJavaElement() - * @generated - * @ordered - */ - protected IJavaElement javaElement = JAVA_ELEMENT_EDEFAULT; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IJavaSymbolImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * @return the static eclass - * <!-- end-user-doc --> - * @generated - */ - protected EClass eStaticClass() { - return SymbolPackage.Literals.IJAVA_SYMBOL; - } - - /** - * <!-- begin-user-doc --> - * @return the symbol 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, SymbolPackage.IJAVA_SYMBOL__NAME, oldName, name)); - } - - /** - * <!-- begin-user-doc --> - * @return the IJavaElement associated with this symbol - * <!-- end-user-doc --> - * @generated - */ - public IJavaElement getJavaElement() { - return javaElement; - } - - /** - * <!-- begin-user-doc --> - * @param newJavaElement - * <!-- end-user-doc --> - * @generated - */ - public void setJavaElement(IJavaElement newJavaElement) { - IJavaElement oldJavaElement = javaElement; - javaElement = newJavaElement; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, SymbolPackage.IJAVA_SYMBOL__JAVA_ELEMENT, oldJavaElement, javaElement)); - } - - /** - * <!-- begin-user-doc --> - * @param featureID - * @param resolve - * @param coreType - * @return the feature - * <!-- end-user-doc --> - * @generated - */ - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case SymbolPackage.IJAVA_SYMBOL__NAME: - return getName(); - case SymbolPackage.IJAVA_SYMBOL__JAVA_ELEMENT: - return getJavaElement(); - } - 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 SymbolPackage.IJAVA_SYMBOL__NAME: - setName((String)newValue); - return; - case SymbolPackage.IJAVA_SYMBOL__JAVA_ELEMENT: - setJavaElement((IJavaElement)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * @param featureID - * <!-- end-user-doc --> - * @generated - */ - public void eUnset(int featureID) { - switch (featureID) { - case SymbolPackage.IJAVA_SYMBOL__NAME: - setName(NAME_EDEFAULT); - return; - case SymbolPackage.IJAVA_SYMBOL__JAVA_ELEMENT: - setJavaElement(JAVA_ELEMENT_EDEFAULT); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * @param featureID - * @return true if featureID's feature has been set - * <!-- end-user-doc --> - * @generated - */ - public boolean eIsSet(int featureID) { - switch (featureID) { - case SymbolPackage.IJAVA_SYMBOL__NAME: - return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); - case SymbolPackage.IJAVA_SYMBOL__JAVA_ELEMENT: - return JAVA_ELEMENT_EDEFAULT == null ? javaElement != null : !JAVA_ELEMENT_EDEFAULT.equals(javaElement); - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * @return the default string representation - * <!-- end-user-doc --> - * @generated - */ - public String toString() { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (name: "); //$NON-NLS-1$ - result.append(name); - result.append(", javaElement: "); //$NON-NLS-1$ - result.append(javaElement); - result.append(')'); - return result.toString(); - } - -} //IJavaSymbolImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/IJavaTypeDescriptor2Impl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/IJavaTypeDescriptor2Impl.java deleted file mode 100644 index 573f2280c..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/IJavaTypeDescriptor2Impl.java +++ /dev/null @@ -1,679 +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.context.symbol.internal.impl; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.eclipse.emf.common.notify.Notification; -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.impl.ENotificationImpl; -import org.eclipse.jdt.core.Flags; -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IMethod; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jdt.core.Signature; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; -import org.eclipse.jst.jsf.common.internal.types.TypeInfoCache; -import org.eclipse.jst.jsf.common.util.JDTBeanIntrospector; -import org.eclipse.jst.jsf.common.util.JDTBeanProperty; -import org.eclipse.jst.jsf.common.util.TypeUtil; -import org.eclipse.jst.jsf.context.symbol.IBeanMethodSymbol; -import org.eclipse.jst.jsf.context.symbol.IBeanPropertySymbol; -import org.eclipse.jst.jsf.context.symbol.IJavaTypeDescriptor2; -import org.eclipse.jst.jsf.context.symbol.IObjectSymbol; -import org.eclipse.jst.jsf.context.symbol.IPropertySymbol; -import org.eclipse.jst.jsf.context.symbol.SymbolFactory; -import org.eclipse.jst.jsf.context.symbol.SymbolPackage; - - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>IJava Type Descriptor2</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.jst.jsf.context.symbol.internal.impl.IJavaTypeDescriptor2Impl#getType <em>Type</em>}</li> - * <li>{@link org.eclipse.jst.jsf.context.symbol.internal.impl.IJavaTypeDescriptor2Impl#getBeanProperties <em>Bean Properties</em>}</li> - * <li>{@link org.eclipse.jst.jsf.context.symbol.internal.impl.IJavaTypeDescriptor2Impl#getBeanMethods <em>Bean Methods</em>}</li> - * <li>{@link org.eclipse.jst.jsf.context.symbol.internal.impl.IJavaTypeDescriptor2Impl#getArrayCount <em>Array Count</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class IJavaTypeDescriptor2Impl extends ITypeDescriptorImpl implements IJavaTypeDescriptor2 { - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @SuppressWarnings("hiding") - public static final String copyright = "Copyright 2006 Oracle"; //$NON-NLS-1$ - - /** - * The default value of the '{@link #getType() <em>Type</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getType() - * @generated - * @ordered - */ - protected static final IType TYPE_EDEFAULT = null; - - /** - * The cached value of the '{@link #getType() <em>Type</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getType() - * @generated - * @ordered - */ - protected IType type = TYPE_EDEFAULT; - - /** - * The default value of the '{@link #getArrayCount() <em>Array Count</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getArrayCount() - * @generated - * @ordered - */ - protected static final int ARRAY_COUNT_EDEFAULT = 0; - - /** - * The cached value of the '{@link #getArrayCount() <em>Array Count</em>}' attribute. - * <!-- begin-user-doc --> - * records the array nesting of the type. IType doesn't encapsulate - * array types. So if this type is an array then type will represent - * the base element and this value will be > 0. If not an array, then - * _arrayCount is always 0. - * <!-- end-user-doc --> - * @see #getArrayCount() - * @generated - * @ordered - */ - protected int arrayCount = ARRAY_COUNT_EDEFAULT; - - /** - * The default value of the '{@link #getJdtContext() <em>Jdt Context</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getJdtContext() - * @generated - * @ordered - */ - @SuppressWarnings("hiding") - protected static final IJavaElement JDT_CONTEXT_EDEFAULT = null; - - /** - * The cached value of the '{@link #getJdtContext() <em>Jdt Context</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getJdtContext() - * @generated - * @ordered - */ - @SuppressWarnings("hiding") - protected IJavaElement jdtContext = JDT_CONTEXT_EDEFAULT; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IJavaTypeDescriptor2Impl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * @return the static class - * <!-- end-user-doc --> - * @generated - */ - protected EClass eStaticClass() { - return SymbolPackage.Literals.IJAVA_TYPE_DESCRIPTOR2; - } - - /** - * <!-- begin-user-doc --> - * @return the JDT type descriptor; if type is an array then this type - * represent's the array base type only - * <!-- end-user-doc --> - * @generated - */ - public IType getType() { - return type; - } - - /** - * <!-- begin-user-doc --> - * @param newType - * <!-- end-user-doc --> - * @generated - */ - public void setType(IType newType) { - IType oldType = type; - type = newType; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, SymbolPackage.IJAVA_TYPE_DESCRIPTOR2__TYPE, oldType, type)); - } - - /** - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.ITypeDescriptorImpl#getInterfaceTypeSignatures() - * @generated NOT - */ - public EList getInterfaceTypeSignatures() - { - EList interfaces = new BasicEList(); - - IType type_ = getType(); - - if (type_ != null) - { - final TypeInfoCache typeInfoCache = TypeInfoCache.getInstance(); - IType[] interfaceTypes = typeInfoCache.getCachedInterfaceTypes(type_); - if (interfaceTypes == null) { - interfaceTypes = typeInfoCache.cacheInterfaceTypesFor(type_); - } - copySignatures(interfaces, interfaceTypes); - } - - return interfaces; - } - - /** - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.ITypeDescriptorImpl#getSuperTypeSignatures() - * @generated NOT - */ - public EList getSuperTypeSignatures() - { - EList interfaces = new BasicEList(); - - IType type_ = getType(); - - if (type_ != null) - { - final TypeInfoCache typeInfoCache = TypeInfoCache.getInstance(); - IType[] interfaceTypes = typeInfoCache.getCachedSupertypes(type_); - - if (interfaceTypes == null) - { - interfaceTypes = typeInfoCache.cacheSupertypesFor(type_); - } - copySignatures(interfaces, interfaceTypes); - } - - return interfaces; - } - - - private void copySignatures(List list, IType[] types) - { - if (types != null) - { - for (int i = 0; i < types.length; i++) - { - final IType type_ = types[i]; - final String signature = TypeUtil.getSignature(type_); - - if (signature != null) - { - list.add(signature); - } - } - } - } - - public EList getProperties() - { - return getBeanProperties(); - } - - - public EList getMethods() - { - return getBeanMethods(); - } - - /** - * <!-- begin-user-doc --> - * @return the bean props for this java type - * <!-- end-user-doc --> - * @generated NOT - */ - public EList getBeanProperties() - { - TypeInfoCache typeInfoCache = TypeInfoCache.getInstance(); - IBeanPropertySymbol[] properties = typeInfoCache.getCachedPropertySymbols(type); - Collection propertyColl; - if (properties == null) { - propertyColl = getPropertiesInternal(); - properties = (IBeanPropertySymbol[]) propertyColl.toArray(new IBeanPropertySymbol[propertyColl.size()]); - typeInfoCache.cachePropertySymbols(type, properties); - } - else - { - propertyColl = new ArrayList(properties.length); - Collections.addAll(propertyColl, (Object[])properties); - } - BasicEList list = new BasicEList(propertyColl); - return list; - } - - /** - * <!-- begin-user-doc --> - * @return the bean methods for this type - * <!-- end-user-doc --> - * @generated NOT - */ - public EList getBeanMethods() { - TypeInfoCache typeInfoCache = TypeInfoCache.getInstance(); - IBeanMethodSymbol[] methods = typeInfoCache.getCachedMethodSymbols(type); - Collection methodColl; - if (methods == null) - { - methodColl = getMethodsInternal(); - methods = (IBeanMethodSymbol[]) methodColl.toArray(new IBeanMethodSymbol[methodColl.size()]); - typeInfoCache.cacheMethodSymbols(type, methods); - } else { - methodColl = new ArrayList(methods.length); - Collections.addAll(methodColl, (Object[])methods); - } - BasicEList list = new BasicEList(methodColl); - return list; - } - - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public int getArrayCount() { - return arrayCount; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setArrayCount(int newArrayCount) { - int oldArrayCount = arrayCount; - arrayCount = newArrayCount; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, SymbolPackage.IJAVA_TYPE_DESCRIPTOR2__ARRAY_COUNT, oldArrayCount, arrayCount)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public IJavaElement getJdtContext() { - return jdtContext; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setJdtContext(IJavaElement newJdtContext) { - IJavaElement oldJdtContext = jdtContext; - jdtContext = newJdtContext; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, SymbolPackage.IJAVA_TYPE_DESCRIPTOR2__JDT_CONTEXT, oldJdtContext, jdtContext)); - } - - /** - * <!-- begin-user-doc --> - * - * Tries to load an IType for a fully resolved (i.e. starts with L not Q) - * type signature using the current jdtContext. - * - * @return the resolved IType or null if none could be resolved. - * - * <!-- end-user-doc --> - * @generated NOT - */ - public IType resolveType(String resolvedTypeSignature) - { - IType resolvedType = null; - - // we need to obtain an IJavaProject within which to resolve - // the type. - IJavaProject project = null; - - // first, see if we have an IType - if (getType() != null) - { - // optimize: if the type sig is my type sig, then return getType() - if (resolvedTypeSignature.equals(getTypeSignature())) - { - resolvedType = getType(); - } - else - { - project = getType().getJavaProject(); - - if (project != null) - { - resolvedType = TypeUtil.resolveType(project, resolvedTypeSignature); - } - } - } - - // if not, see if a jdtContext hint has been set - if (resolvedType == null && getJdtContext() != null) - { - resolvedType = super.resolveType(resolvedTypeSignature); - } - - return resolvedType; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case SymbolPackage.IJAVA_TYPE_DESCRIPTOR2__TYPE: - return getType(); - case SymbolPackage.IJAVA_TYPE_DESCRIPTOR2__BEAN_PROPERTIES: - return getBeanProperties(); - case SymbolPackage.IJAVA_TYPE_DESCRIPTOR2__BEAN_METHODS: - return getBeanMethods(); - case SymbolPackage.IJAVA_TYPE_DESCRIPTOR2__ARRAY_COUNT: - return Integer.valueOf(getArrayCount()); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case SymbolPackage.IJAVA_TYPE_DESCRIPTOR2__TYPE: - setType((IType)newValue); - return; - case SymbolPackage.IJAVA_TYPE_DESCRIPTOR2__BEAN_PROPERTIES: - getBeanProperties().clear(); - getBeanProperties().addAll((Collection)newValue); - return; - case SymbolPackage.IJAVA_TYPE_DESCRIPTOR2__BEAN_METHODS: - getBeanMethods().clear(); - getBeanMethods().addAll((Collection)newValue); - return; - case SymbolPackage.IJAVA_TYPE_DESCRIPTOR2__ARRAY_COUNT: - setArrayCount(((Integer)newValue).intValue()); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eUnset(int featureID) { - switch (featureID) { - case SymbolPackage.IJAVA_TYPE_DESCRIPTOR2__TYPE: - setType(TYPE_EDEFAULT); - return; - case SymbolPackage.IJAVA_TYPE_DESCRIPTOR2__BEAN_PROPERTIES: - getBeanProperties().clear(); - return; - case SymbolPackage.IJAVA_TYPE_DESCRIPTOR2__BEAN_METHODS: - getBeanMethods().clear(); - return; - case SymbolPackage.IJAVA_TYPE_DESCRIPTOR2__ARRAY_COUNT: - setArrayCount(ARRAY_COUNT_EDEFAULT); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean eIsSet(int featureID) { - switch (featureID) { - case SymbolPackage.IJAVA_TYPE_DESCRIPTOR2__TYPE: - return TYPE_EDEFAULT == null ? type != null : !TYPE_EDEFAULT.equals(type); - case SymbolPackage.IJAVA_TYPE_DESCRIPTOR2__BEAN_PROPERTIES: - return !getBeanProperties().isEmpty(); - case SymbolPackage.IJAVA_TYPE_DESCRIPTOR2__BEAN_METHODS: - return !getBeanMethods().isEmpty(); - case SymbolPackage.IJAVA_TYPE_DESCRIPTOR2__ARRAY_COUNT: - return arrayCount != ARRAY_COUNT_EDEFAULT; - } - return super.eIsSet(featureID); - } - - public boolean isArray() - { - return getArrayCount() > 0; - } - - /** - * @generated NOT - */ - public IObjectSymbol getArrayElement() - { - if (isArray()) - { - final String typeSignature = getTypeSignature(); - final int arrayCount_ = Signature.getArrayCount(typeSignature); - final String baseType = Signature.getElementType(typeSignature); - final String elementTypeSignature = Signature.createArraySignature(baseType, arrayCount_-1); - - final IJavaTypeDescriptor2 elementTypeDesc = - SymbolFactory.eINSTANCE.createIJavaTypeDescriptor2(); - final String fullyQualifiedElementType = TypeUtil.getFullyQualifiedName(baseType); - - IType elementType = null; - - try - { - IType myType = getType(); - if (myType != null) - { - elementType = getType().getJavaProject() - .findType(fullyQualifiedElementType); - } - } - catch (JavaModelException e) - { - // suppress - } - - if (elementType != null) - { - elementTypeDesc.setType(elementType); - } - else - { - elementTypeDesc.setTypeSignatureDelegate(elementTypeSignature); - } - - elementTypeDesc.setArrayCount(Signature.getArrayCount(elementTypeSignature)); - - IPropertySymbol newPropertySymbol = - SymbolFactory.eINSTANCE.createIPropertySymbol(); - newPropertySymbol.setTypeDescriptor(elementTypeDesc); - newPropertySymbol.setWritable(true); - newPropertySymbol.setReadable(true); - newPropertySymbol.setName(fullyQualifiedElementType); - return newPropertySymbol; - } - - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.ITypeDescriptorImpl#getTypeSignature() - * @generated NOT - */ - public String getTypeSignature() - { - if (getType() == null) - { - if (eIsSet(SymbolPackage.IJAVA_TYPE_DESCRIPTOR2__TYPE_SIGNATURE_DELEGATE)) - { - return getTypeSignatureDelegate(); - } - - return null; - } - - // make sure to array type nesting if using IType - return Signature.createArraySignature( - TypeUtil.getSignature(getType()), getArrayCount()); - } - - private Collection getPropertiesInternal() - { - // if I'm an array then I have no bean properties - if (isArray()) - { - return Collections.EMPTY_LIST; - } - - final JDTBeanIntrospector introspector = - new JDTBeanIntrospector(getType()); - - final Map<String, JDTBeanProperty> properties = introspector.getProperties(); - - final Collection calculatedProps = new ArrayList(properties.size()); - - for (final Iterator<Map.Entry<String, JDTBeanProperty>> it = properties.entrySet().iterator(); it.hasNext();) - { - Map.Entry<String, JDTBeanProperty> entry = it.next(); - final String propertyName = entry.getKey(); - final JDTBeanProperty property = entry.getValue(); - - final IBeanPropertySymbol workingCopy = - SymbolFactory.eINSTANCE.createIBeanPropertySymbol(); - workingCopy.setName(propertyName); - workingCopy.setOwner(this); - - final IJavaTypeDescriptor2 workingCopyDesc = - SymbolFactory.eINSTANCE.createIJavaTypeDescriptor2(); - workingCopy.setTypeDescriptor(workingCopyDesc); - workingCopy.setReadable(property.isReadable()); - workingCopy.setWritable(property.isWritable()); - - workingCopyDesc.setArrayCount(property.getArrayCount()); - workingCopyDesc.getTypeParameterSignatures().addAll(property.getTypeParameterSignatures()); - workingCopyDesc.setEnumType(property.isEnumType()); - - final IType newType = property.getType(); - final String signature = property.getTypeSignature(); - - if (newType != null) - { - workingCopyDesc.setType(newType); - } - else - { - workingCopyDesc.setTypeSignatureDelegate(signature); - } - - calculatedProps.add(workingCopy); - } - - return calculatedProps; - } - - private Collection getMethodsInternal() - { - JDTBeanIntrospector introspector = - new JDTBeanIntrospector(getType()); - - IMethod[] methods = introspector.getAllMethods(); - - List methodSymbols = new ArrayList(); - - for (int i = 0; i < methods.length; i++) - { - IMethod method = methods[i]; - - try - { - // to be a bean method, it must not a constructor, must be public - // and must not be static - if (!method.isConstructor() - && Flags.isPublic(method.getFlags()) - && !Flags.isStatic(method.getFlags())) - { - String methodName = method.getElementName(); - IBeanMethodSymbol workingCopy = SymbolFactory.eINSTANCE.createIBeanMethodSymbol(); - workingCopy.setName(methodName); - workingCopy.setOwner(this); - workingCopy.setSignature(TypeUtil. - resolveMethodSignature - (getType(), - method.getSignature())); - methodSymbols.add(workingCopy); - } - } - catch (JavaModelException jme) - { - // error reading meta-data. Skip to next one - JSFCommonPlugin.log(jme); - } - } - - return methodSymbols; - } - - - /** - * <!-- begin-user-doc --> - * @return the default string rep - * <!-- end-user-doc --> - * @generated - */ - public String toString() { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (type: "); //$NON-NLS-1$ - result.append(type); - result.append(", arrayCount: "); //$NON-NLS-1$ - result.append(arrayCount); - result.append(')'); - return result.toString(); - } - -} //IJavaTypeDescriptor2Impl diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/IListTypeDescriptorImpl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/IListTypeDescriptorImpl.java deleted file mode 100644 index 7046cee25..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/IListTypeDescriptorImpl.java +++ /dev/null @@ -1,207 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: IListTypeDescriptorImpl.java,v 1.5 2007/10/01 04:29:44 cbateman Exp $ - */ -package org.eclipse.jst.jsf.context.symbol.internal.impl; - -import org.eclipse.emf.common.notify.Notification; - -import org.eclipse.emf.common.util.ECollections; -import org.eclipse.emf.common.util.EList; - -import org.eclipse.emf.ecore.EClass; - -import org.eclipse.emf.ecore.impl.ENotificationImpl; - -import org.eclipse.jst.jsf.common.internal.types.TypeConstants; -import org.eclipse.jst.jsf.context.symbol.IListTypeDescriptor; -import org.eclipse.jst.jsf.context.symbol.SymbolPackage; - - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>IList Type Descriptor</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.jst.jsf.context.symbol.internal.impl.IListTypeDescriptorImpl#getListSource <em>List Source</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class IListTypeDescriptorImpl extends ITypeDescriptorImpl implements IListTypeDescriptor { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @SuppressWarnings("hiding") - public static final String copyright = "Copyright 2006 Oracle"; //$NON-NLS-1$ - - /** - * The default value of the '{@link #getListSource() <em>List Source</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getListSource() - * @generated - * @ordered - */ - protected static final EList LIST_SOURCE_EDEFAULT = null; - - /** - * The cached value of the '{@link #getListSource() <em>List Source</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getListSource() - * @generated - * @ordered - */ - protected EList listSource = LIST_SOURCE_EDEFAULT; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IListTypeDescriptorImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EClass eStaticClass() { - return SymbolPackage.Literals.ILIST_TYPE_DESCRIPTOR; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EList getListSource() { - return listSource; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setListSource(EList newListSource) { - EList oldListSource = listSource; - listSource = newListSource; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, SymbolPackage.ILIST_TYPE_DESCRIPTOR__LIST_SOURCE, oldListSource, listSource)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case SymbolPackage.ILIST_TYPE_DESCRIPTOR__LIST_SOURCE: - return getListSource(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case SymbolPackage.ILIST_TYPE_DESCRIPTOR__LIST_SOURCE: - setListSource((EList)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eUnset(int featureID) { - switch (featureID) { - case SymbolPackage.ILIST_TYPE_DESCRIPTOR__LIST_SOURCE: - setListSource(LIST_SOURCE_EDEFAULT); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean eIsSet(int featureID) { - switch (featureID) { - case SymbolPackage.ILIST_TYPE_DESCRIPTOR__LIST_SOURCE: - return LIST_SOURCE_EDEFAULT == null ? listSource != null : !LIST_SOURCE_EDEFAULT.equals(listSource); - } - 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(" (listSource: "); //$NON-NLS-1$ - result.append(listSource); - result.append(')'); - return result.toString(); - } - - /* - * @generated NOT - */ - public EList getInterfaceTypeSignatures() { - return ECollections.EMPTY_ELIST; - } - - public EList getMethods() - { - // TODO: should this return the methods on a List? - return ECollections.EMPTY_ELIST; - } - - public EList getProperties() - { - // TODO: a list has no properties as such. What to do here? - return ECollections.EMPTY_ELIST; - } - - /** - * @generated NOT - */ - public EList getSuperTypeSignatures() { - return ECollections.EMPTY_ELIST; - } - - /** - * @generated NOT - */ - public String getTypeSignature() - { - return TypeConstants.TYPE_LIST; - } - -} //IListTypeDescriptorImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/IMapSourceInfo.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/IMapSourceInfo.java deleted file mode 100644 index a5de57969..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/IMapSourceInfo.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.eclipse.jst.jsf.context.symbol.internal.impl; - -/** - * Information about the map source used by the IMapTypeDescriptor - * - */ -public interface IMapSourceInfo -{ - - /** - * @param key - * @return true if the map source has changed since key was last set - */ - boolean hasChanged(final Object key); - - /** - * The key is used in the standard HashMap way. - * - * @param key - * @return the cached value for the key. - */ - Object getCachedValue(final Object key); - /** - * Add cached value for key. - * - * @param key - * @param value - */ - void putCachedValue(final Object key, final Object value); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/IMapTypeDescriptorImpl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/IMapTypeDescriptorImpl.java deleted file mode 100644 index eb9990290..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/IMapTypeDescriptorImpl.java +++ /dev/null @@ -1,464 +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.context.symbol.internal.impl; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.StringTokenizer; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.BasicEList; -import org.eclipse.emf.common.util.ECollections; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -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.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.IPropertySymbol; -import org.eclipse.jst.jsf.context.symbol.ITypeDescriptor; -import org.eclipse.jst.jsf.context.symbol.SymbolFactory; -import org.eclipse.jst.jsf.context.symbol.SymbolPackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>IMap Type Descriptor</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.jst.jsf.context.symbol.internal.impl.IMapTypeDescriptorImpl#getMapSource <em>Map Source</em>}</li> - * <li>{@link org.eclipse.jst.jsf.context.symbol.internal.impl.IMapTypeDescriptorImpl#isImmutable <em>Immutable</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class IMapTypeDescriptorImpl extends ITypeDescriptorImpl implements IMapTypeDescriptor { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @SuppressWarnings("hiding") - public static final String copyright = "Copyright 2006 Oracle"; //$NON-NLS-1$ - - /** - * The default value of the '{@link #getMapSource() <em>Map Source</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getMapSource() - * @generated - * @ordered - */ - protected static final Map MAP_SOURCE_EDEFAULT = null; - - /** - * The cached value of the '{@link #getMapSource() <em>Map Source</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getMapSource() - * @generated - * @ordered - */ - protected Map mapSource = MAP_SOURCE_EDEFAULT; - - /** - * The default value of the '{@link #isImmutable() <em>Immutable</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isImmutable() - * @generated - * @ordered - */ - protected static final boolean IMMUTABLE_EDEFAULT = true; - - private static final Object MAP_TYPE_DESCRIPTOR_PROP_KEY = new Object(); - - /** - * The cached value of the '{@link #isImmutable() <em>Immutable</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isImmutable() - * @generated - * @ordered - */ - protected boolean immutable = IMMUTABLE_EDEFAULT; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IMapTypeDescriptorImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * @return the static eClass - * <!-- end-user-doc --> - * @generated - */ - protected EClass eStaticClass() { - return SymbolPackage.Literals.IMAP_TYPE_DESCRIPTOR; - } - - /** - * <!-- begin-user-doc --> - * @return the map source - * <!-- end-user-doc --> - * @generated - */ - public Map getMapSource() { - return mapSource; - } - - /** - * <!-- begin-user-doc --> - * @param newMapSource - * <!-- end-user-doc --> - * @generated - */ - public void setMapSource(Map newMapSource) { - Map oldMapSource = mapSource; - mapSource = newMapSource; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, SymbolPackage.IMAP_TYPE_DESCRIPTOR__MAP_SOURCE, oldMapSource, mapSource)); - } - - /** - * <!-- begin-user-doc --> - * @return true if this map is immutable as defined in the java.util.Map - * interface. - * <!-- end-user-doc --> - * @generated - */ - public boolean isImmutable() { - return immutable; - } - - /** - * <!-- begin-user-doc --> - * @param newImmutable - * <!-- end-user-doc --> - * @generated - */ - public void setImmutable(boolean newImmutable) { - boolean oldImmutable = immutable; - immutable = newImmutable; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, SymbolPackage.IMAP_TYPE_DESCRIPTOR__IMMUTABLE, oldImmutable, immutable)); - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.ITypeDescriptorImpl#getTypeSignature() - * @generated NOT - */ - public String getTypeSignature() - { - // if the delegate has been set, use it - if (eIsSet(SymbolPackage.IMAP_TYPE_DESCRIPTOR__TYPE_SIGNATURE_DELEGATE)) - { - return getTypeSignatureDelegate(); - } - - // otherwise use Map - return TypeConstants.TYPE_MAP; - } - - public EList getInterfaceTypeSignatures() { - return ECollections.EMPTY_ELIST; - } - - public EList getSuperTypeSignatures() { - return ECollections.EMPTY_ELIST; - } - - /** - * @see org.eclipse.jst.jsf.context.symbol.internal.impl.ITypeDescriptorImpl#getProperties() - */ - public EList getProperties() - { - final BasicEList list = new BasicEList(); - final Map source = getMapSource(); - if (source instanceof IMapSourceInfo) - { - if (!((IMapSourceInfo) source).hasChanged(MAP_TYPE_DESCRIPTOR_PROP_KEY)) - { - EList cachedList = (EList) ((IMapSourceInfo)source).getCachedValue(MAP_TYPE_DESCRIPTOR_PROP_KEY); - - if (cachedList != null) - { - return cachedList; - } - } - } - final Map segmentMap = processSegments(source); - list.addAll(segmentMap.values()); - - if (source instanceof IMapSourceInfo) - { - ((IMapSourceInfo)source).putCachedValue(MAP_TYPE_DESCRIPTOR_PROP_KEY, list); - } - return list; - } - - public EList getMethods() - { - // TODO: should this return the methods on a Map? - return ECollections.EMPTY_ELIST; - } - - /** - * @generated NOT - */ - public IObjectSymbol getArrayElement() - { - return null; - } - - /** - * @generated NOT - */ - public boolean isArray() - { - // a map is never an array - return false; - } - - private Map processSegments(final Map source) - { - final Map segmentMap = new HashMap(); - final Set<Map.Entry<String, Object>> entrySet = source.entrySet(); - for (final Map.Entry<String, Object> entry : entrySet) - { - - final String key = entry.getKey(); - final String segments[] = fastTokenSplit(key); - if (segments.length == 0) - { - continue; - } - IPropertySymbol property = (IPropertySymbol) segmentMap - .get(segments[0]); - - if (property == null) - { - final Object propValue = entry.getValue(); - property = SymbolFactory.eINSTANCE.createIPropertySymbol(); - property.setName(segments[0]); - ITypeDescriptor typeDesc = null; - - // TODO: need wrapper object to rationalize - if (propValue != null) - { - if (propValue instanceof IType) - { - typeDesc = SymbolFactory.eINSTANCE - .createIJavaTypeDescriptor2(); - ((IJavaTypeDescriptor2) typeDesc) - .setType((IType) propValue); - } else if (propValue instanceof IInstanceSymbol) - { - typeDesc = ((IInstanceSymbol) propValue) - .getTypeDescriptor(); - } else if (propValue instanceof IPropertySymbol) - { - typeDesc = ((IPropertySymbol) propValue) - .getTypeDescriptor(); - } else - { - final String className = propValue.getClass().getName(); - final String typeSignature = Signature - .createTypeSignature(className, true); - typeDesc = SymbolFactory.eINSTANCE - .createIMapTypeDescriptor(); - ((IMapTypeDescriptor) typeDesc) - .setMapSource(new HashMap()); - ((IMapTypeDescriptor) typeDesc) - .setTypeSignatureDelegate(typeSignature); - // inherit this descriptor's mutability - ((IMapTypeDescriptor) typeDesc) - .setImmutable(isImmutable()); - property.setIntermediate(true); // set the property as - // intermediate until we - // find out different - } - - property.setTypeDescriptor(typeDesc); - property.setReadable(true); - // is only writable if map is not immutable - property.setWritable(!isImmutable()); - } - - segmentMap.put(segments[0], property); - } - - final ITypeDescriptor typeDesc = property.getTypeDescriptor(); - - if (typeDesc instanceof IMapTypeDescriptor) - { - if (segments.length == 1) - { - // TODO: not always allowed - // ((IMapTypeDescriptor)typeDesc).getMapSource().put(null, - // source.get(key)); - // property is more than simply intermediate - property.setIntermediate(false); - } else - { - ((IMapTypeDescriptor) typeDesc).getMapSource().put( - key.substring(key.indexOf('.') + 1), - entry.getValue()); - } - } - } - - return segmentMap; - } - - /** - * Based on measurements, this beats Pattern.split by 15-30% even with - * a pre-compiled pattern. - * - * @param splitValue - * @return the array of strings split by the '.' token - */ - private static String[] fastTokenSplit(final String splitValue) - { - if (splitValue == null || splitValue.length() == 0) - { - return new String[0]; - } - if (splitValue.indexOf('.') > -1) - { - return tokenizerSplit(splitValue); - } - return new String[] {splitValue}; - } - - private static String[] tokenizerSplit(final String splitValue) - { - StringTokenizer stringTokenizer = new StringTokenizer(splitValue, "."); //$NON-NLS-1$ - // initialize to a large size, since we're just going to truncate - // it once at the end and want to reduce the chance of resize during - // the loop. - final List<String> splitValues = new ArrayList<String>(32); - - while (stringTokenizer.hasMoreTokens()) - { - splitValues.add(stringTokenizer.nextToken()); - } - - return splitValues.toArray(new String[0]); - } - - /** - * <!-- begin-user-doc --> - * @param featureID - * @param resolve - * @param coreType - * @return the object for the feature id - * <!-- end-user-doc --> - * @generated - */ - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case SymbolPackage.IMAP_TYPE_DESCRIPTOR__MAP_SOURCE: - return getMapSource(); - case SymbolPackage.IMAP_TYPE_DESCRIPTOR__IMMUTABLE: - return isImmutable() ? Boolean.TRUE : Boolean.FALSE; - } - 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 SymbolPackage.IMAP_TYPE_DESCRIPTOR__MAP_SOURCE: - setMapSource((Map)newValue); - return; - case SymbolPackage.IMAP_TYPE_DESCRIPTOR__IMMUTABLE: - setImmutable(((Boolean)newValue).booleanValue()); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * @param featureID - * <!-- end-user-doc --> - * @generated - */ - public void eUnset(int featureID) { - switch (featureID) { - case SymbolPackage.IMAP_TYPE_DESCRIPTOR__MAP_SOURCE: - setMapSource(MAP_SOURCE_EDEFAULT); - return; - case SymbolPackage.IMAP_TYPE_DESCRIPTOR__IMMUTABLE: - setImmutable(IMMUTABLE_EDEFAULT); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * @param featureID - * @return true if is set - * <!-- end-user-doc --> - * @generated - */ - public boolean eIsSet(int featureID) { - switch (featureID) { - case SymbolPackage.IMAP_TYPE_DESCRIPTOR__MAP_SOURCE: - return MAP_SOURCE_EDEFAULT == null ? mapSource != null : !MAP_SOURCE_EDEFAULT.equals(mapSource); - case SymbolPackage.IMAP_TYPE_DESCRIPTOR__IMMUTABLE: - return immutable != IMMUTABLE_EDEFAULT; - } - 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(" (mapSource: "); //$NON-NLS-1$ - result.append(mapSource); - result.append(", immutable: "); //$NON-NLS-1$ - result.append(immutable); - result.append(')'); - return result.toString(); - } - -} //IMapTypeDescriptorImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/IMethodSymbolImpl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/IMethodSymbolImpl.java deleted file mode 100644 index 2e9a75ed6..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/IMethodSymbolImpl.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.context.symbol.internal.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.context.symbol.IMethodSymbol; -import org.eclipse.jst.jsf.context.symbol.SymbolPackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>IMethod Symbol</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.jst.jsf.context.symbol.internal.impl.IMethodSymbolImpl#getName <em>Name</em>}</li> - * <li>{@link org.eclipse.jst.jsf.context.symbol.internal.impl.IMethodSymbolImpl#getSignature <em>Signature</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class IMethodSymbolImpl extends EObjectImpl implements IMethodSymbol { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright 2006 Oracle"; //$NON-NLS-1$ - - /** - * 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 #getSignature() <em>Signature</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getSignature() - * @generated - * @ordered - */ - protected static final String SIGNATURE_EDEFAULT = null; - - /** - * The cached value of the '{@link #getSignature() <em>Signature</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getSignature() - * @generated - * @ordered - */ - protected String signature = SIGNATURE_EDEFAULT; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IMethodSymbolImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * @return the static eclass - * <!-- end-user-doc --> - * @generated - */ - protected EClass eStaticClass() { - return SymbolPackage.Literals.IMETHOD_SYMBOL; - } - - /** - * <!-- begin-user-doc --> - * @return the method 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, SymbolPackage.IMETHOD_SYMBOL__NAME, oldName, name)); - } - - /** - * <!-- begin-user-doc --> - * @return the method signature in JVM/JDT form - * <!-- end-user-doc --> - * @generated - */ - public String getSignature() { - return signature; - } - - /** - * <!-- begin-user-doc --> - * @param newSignature - * <!-- end-user-doc --> - * @generated - */ - public void setSignature(String newSignature) { - String oldSignature = signature; - signature = newSignature; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, SymbolPackage.IMETHOD_SYMBOL__SIGNATURE, oldSignature, signature)); - } - - /** - * <!-- begin-user-doc --> - * @param featureID - * @param resolve - * @param coreType - * @return the property as a feature object - * <!-- end-user-doc --> - * @generated - */ - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case SymbolPackage.IMETHOD_SYMBOL__NAME: - return getName(); - case SymbolPackage.IMETHOD_SYMBOL__SIGNATURE: - return getSignature(); - } - 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 SymbolPackage.IMETHOD_SYMBOL__NAME: - setName((String)newValue); - return; - case SymbolPackage.IMETHOD_SYMBOL__SIGNATURE: - setSignature((String)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * @param featureID - * <!-- end-user-doc --> - * @generated - */ - public void eUnset(int featureID) { - switch (featureID) { - case SymbolPackage.IMETHOD_SYMBOL__NAME: - setName(NAME_EDEFAULT); - return; - case SymbolPackage.IMETHOD_SYMBOL__SIGNATURE: - setSignature(SIGNATURE_EDEFAULT); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * @param featureID - * @return true if the feature has been set - * <!-- end-user-doc --> - * @generated - */ - public boolean eIsSet(int featureID) { - switch (featureID) { - case SymbolPackage.IMETHOD_SYMBOL__NAME: - return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); - case SymbolPackage.IMETHOD_SYMBOL__SIGNATURE: - return SIGNATURE_EDEFAULT == null ? signature != null : !SIGNATURE_EDEFAULT.equals(signature); - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * @return the raw string representation - * <!-- end-user-doc --> - * @generated - */ - public String toString() { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (name: "); //$NON-NLS-1$ - result.append(name); - result.append(", signature: "); //$NON-NLS-1$ - result.append(signature); - result.append(')'); - return result.toString(); - } - -} //IMethodSymbolImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/IPropertySymbolImpl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/IPropertySymbolImpl.java deleted file mode 100644 index 64d314e7e..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/IPropertySymbolImpl.java +++ /dev/null @@ -1,469 +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.context.symbol.internal.impl; - -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.InternalEObject; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.impl.EObjectImpl; -import org.eclipse.jst.jsf.context.symbol.IPropertySymbol; -import org.eclipse.jst.jsf.context.symbol.ISymbol; -import org.eclipse.jst.jsf.context.symbol.ITypeDescriptor; -import org.eclipse.jst.jsf.context.symbol.SymbolPackage; - - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>IProperty Symbol</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.jst.jsf.context.symbol.internal.impl.IPropertySymbolImpl#getName <em>Name</em>}</li> - * <li>{@link org.eclipse.jst.jsf.context.symbol.internal.impl.IPropertySymbolImpl#getTypeDescriptor <em>Type Descriptor</em>}</li> - * <li>{@link org.eclipse.jst.jsf.context.symbol.internal.impl.IPropertySymbolImpl#isReadable <em>Readable</em>}</li> - * <li>{@link org.eclipse.jst.jsf.context.symbol.internal.impl.IPropertySymbolImpl#isWritable <em>Writable</em>}</li> - * <li>{@link org.eclipse.jst.jsf.context.symbol.internal.impl.IPropertySymbolImpl#isIntermediate <em>Intermediate</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class IPropertySymbolImpl extends EObjectImpl implements IPropertySymbol { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright 2006 Oracle"; //$NON-NLS-1$ - - /** - * 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 cached value of the '{@link #getTypeDescriptor() <em>Type Descriptor</em>}' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getTypeDescriptor() - * @generated - * @ordered - */ - protected ITypeDescriptor typeDescriptor = null; - - - /** - * Set to true if this property symbol is readable - */ - protected boolean isReadable = READABLE_EDEFAULT; - - /** - * Set to true if this property symbol is writable - */ - protected boolean isWritable = WRITABLE_EDEFAULT; - - /** - * The default value of the '{@link #isReadable() <em>Readable</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isReadable() - * @generated - * @ordered - */ - protected static final boolean READABLE_EDEFAULT = false; - - /** - * The cached value of the '{@link #isReadable() <em>Readable</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isReadable() - * @generated - * @ordered - */ - protected boolean readable = READABLE_EDEFAULT; - - /** - * The default value of the '{@link #isWritable() <em>Writable</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isWritable() - * @generated - * @ordered - */ - protected static final boolean WRITABLE_EDEFAULT = false; - - /** - * The cached value of the '{@link #isWritable() <em>Writable</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isWritable() - * @generated - * @ordered - */ - protected boolean writable = WRITABLE_EDEFAULT; - - /** - * The default value of the '{@link #isIntermediate() <em>Intermediate</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isIntermediate() - * @generated - * @ordered - */ - protected static final boolean INTERMEDIATE_EDEFAULT = false; - - /** - * The cached value of the '{@link #isIntermediate() <em>Intermediate</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isIntermediate() - * @generated - * @ordered - */ - protected boolean intermediate = INTERMEDIATE_EDEFAULT; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IPropertySymbolImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * @return the static eClass - * <!-- end-user-doc --> - * @generated - */ - protected EClass eStaticClass() { - return SymbolPackage.Literals.IPROPERTY_SYMBOL; - } - - /** - * <!-- begin-user-doc --> - * @return return the property name - * <!-- end-user-doc --> - * @generated - */ - public String getName() { - return name; - } - - /** - * <!-- begin-user-doc --> - * @param newName the new name of the property - * <!-- end-user-doc --> - * @generated - */ - public void setName(String newName) { - String oldName = name; - name = newName; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, SymbolPackage.IPROPERTY_SYMBOL__NAME, oldName, name)); - } - - /** - * <!-- begin-user-doc --> - * @return the property's type descriptor ?? can be null ?? - * <!-- end-user-doc --> - * @generated - */ - public ITypeDescriptor getTypeDescriptor() { - if (typeDescriptor != null && typeDescriptor.eIsProxy()) { - InternalEObject oldTypeDescriptor = (InternalEObject)typeDescriptor; - typeDescriptor = (ITypeDescriptor)eResolveProxy(oldTypeDescriptor); - if (typeDescriptor != oldTypeDescriptor) { - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.RESOLVE, SymbolPackage.IPROPERTY_SYMBOL__TYPE_DESCRIPTOR, oldTypeDescriptor, typeDescriptor)); - } - } - return typeDescriptor; - } - - /** - * <!-- begin-user-doc --> - * @return the type descriptor - * <!-- end-user-doc --> - * @generated - */ - public ITypeDescriptor basicGetTypeDescriptor() { - return typeDescriptor; - } - - /** - * <!-- begin-user-doc --> - * @param newTypeDescriptor - * <!-- end-user-doc --> - * @generated - */ - public void setTypeDescriptor(ITypeDescriptor newTypeDescriptor) { - ITypeDescriptor oldTypeDescriptor = typeDescriptor; - typeDescriptor = newTypeDescriptor; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, SymbolPackage.IPROPERTY_SYMBOL__TYPE_DESCRIPTOR, oldTypeDescriptor, typeDescriptor)); - } - - /** - * <!-- begin-user-doc --> - * @return true if property is readable - * <!-- end-user-doc --> - * @generated - */ - public boolean isReadable() { - return readable; - } - - /** - * <!-- begin-user-doc --> - * @param newReadable - * <!-- end-user-doc --> - * @generated - */ - public void setReadable(boolean newReadable) { - boolean oldReadable = readable; - readable = newReadable; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, SymbolPackage.IPROPERTY_SYMBOL__READABLE, oldReadable, readable)); - } - - /** - * <!-- begin-user-doc --> - * @return true if property is writable - * <!-- end-user-doc --> - * @generated - */ - public boolean isWritable() { - return writable; - } - - /** - * <!-- begin-user-doc --> - * @param newWritable - * <!-- end-user-doc --> - * @generated - */ - public void setWritable(boolean newWritable) { - boolean oldWritable = writable; - writable = newWritable; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, SymbolPackage.IPROPERTY_SYMBOL__WRITABLE, oldWritable, writable)); - } - - /** - * <!-- begin-user-doc --> - * @return true if this property is intermediate and has no value of it's own - * besides as a path to it's own properties. This is used to support the - * situation in JSF where a map-based property can have dots in it (i.e. - * a loadBundle key my.property) and so creates a (discouraged) ambiguous - * situation where a property like #{x.y.z) really corresponds to a key - * "y.z" in a property file pointed to by "x" instead of there being an - * actual y property on x that has value in and of itself (in this case - * "#{x.y}" is invalid even though "#{x.y.z}" is valid). - * <!-- end-user-doc --> - * @generated - */ - public boolean isIntermediate() { - return intermediate; - } - - /** - * <!-- begin-user-doc --> - * @param newIntermediate - * <!-- end-user-doc --> - * @generated - */ - public void setIntermediate(boolean newIntermediate) { - boolean oldIntermediate = intermediate; - intermediate = newIntermediate; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, SymbolPackage.IPROPERTY_SYMBOL__INTERMEDIATE, oldIntermediate, intermediate)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - public boolean supportsCoercion(String typeSignature) { - // TODO: for now, not supported on generic properties - return false; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - public ITypeDescriptor coerce(String typeSignature) - { - // TODO: for now, no generic property type coercion - return getTypeDescriptor(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ISymbol call(String methodName, EList methodArguments, String symbolName) { - // TODO: implement this method - // Ensure that you remove @generated or mark it @generated NOT - throw new UnsupportedOperationException(); - } - - /** - * <!-- begin-user-doc --> - * @param featureID - * @param resolve - * @param coreType - * @return the eObject for the featureID - * <!-- end-user-doc --> - * @generated - */ - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case SymbolPackage.IPROPERTY_SYMBOL__NAME: - return getName(); - case SymbolPackage.IPROPERTY_SYMBOL__TYPE_DESCRIPTOR: - if (resolve) return getTypeDescriptor(); - return basicGetTypeDescriptor(); - case SymbolPackage.IPROPERTY_SYMBOL__READABLE: - return isReadable() ? Boolean.TRUE : Boolean.FALSE; - case SymbolPackage.IPROPERTY_SYMBOL__WRITABLE: - return isWritable() ? Boolean.TRUE : Boolean.FALSE; - case SymbolPackage.IPROPERTY_SYMBOL__INTERMEDIATE: - return isIntermediate() ? Boolean.TRUE : Boolean.FALSE; - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * @param featureID -- set the feature - * @param newValue - * <!-- end-user-doc --> - * @generated - */ - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case SymbolPackage.IPROPERTY_SYMBOL__NAME: - setName((String)newValue); - return; - case SymbolPackage.IPROPERTY_SYMBOL__TYPE_DESCRIPTOR: - setTypeDescriptor((ITypeDescriptor)newValue); - return; - case SymbolPackage.IPROPERTY_SYMBOL__READABLE: - setReadable(((Boolean)newValue).booleanValue()); - return; - case SymbolPackage.IPROPERTY_SYMBOL__WRITABLE: - setWritable(((Boolean)newValue).booleanValue()); - return; - case SymbolPackage.IPROPERTY_SYMBOL__INTERMEDIATE: - setIntermediate(((Boolean)newValue).booleanValue()); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * @param featureID -- unset the feature - * <!-- end-user-doc --> - * @generated - */ - public void eUnset(int featureID) { - switch (featureID) { - case SymbolPackage.IPROPERTY_SYMBOL__NAME: - setName(NAME_EDEFAULT); - return; - case SymbolPackage.IPROPERTY_SYMBOL__TYPE_DESCRIPTOR: - setTypeDescriptor((ITypeDescriptor)null); - return; - case SymbolPackage.IPROPERTY_SYMBOL__READABLE: - setReadable(READABLE_EDEFAULT); - return; - case SymbolPackage.IPROPERTY_SYMBOL__WRITABLE: - setWritable(WRITABLE_EDEFAULT); - return; - case SymbolPackage.IPROPERTY_SYMBOL__INTERMEDIATE: - setIntermediate(INTERMEDIATE_EDEFAULT); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * @param featureID - * @return true if is set - * <!-- end-user-doc --> - * @generated - */ - public boolean eIsSet(int featureID) { - switch (featureID) { - case SymbolPackage.IPROPERTY_SYMBOL__NAME: - return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); - case SymbolPackage.IPROPERTY_SYMBOL__TYPE_DESCRIPTOR: - return typeDescriptor != null; - case SymbolPackage.IPROPERTY_SYMBOL__READABLE: - return readable != READABLE_EDEFAULT; - case SymbolPackage.IPROPERTY_SYMBOL__WRITABLE: - return writable != WRITABLE_EDEFAULT; - case SymbolPackage.IPROPERTY_SYMBOL__INTERMEDIATE: - return intermediate != INTERMEDIATE_EDEFAULT; - } - 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(" (name: "); //$NON-NLS-1$ - result.append(name); - result.append(", readable: "); //$NON-NLS-1$ - result.append(readable); - result.append(", writable: "); //$NON-NLS-1$ - result.append(writable); - result.append(", intermediate: "); //$NON-NLS-1$ - result.append(intermediate); - result.append(')'); - return result.toString(); - } - -} //IPropertySymbolImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/ITypeDescriptorImpl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/ITypeDescriptorImpl.java deleted file mode 100644 index b23a30329..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/ITypeDescriptorImpl.java +++ /dev/null @@ -1,521 +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.context.symbol.internal.impl; - -import java.util.Collection; -import java.util.Iterator; - -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.EDataTypeEList; -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.Signature; -import org.eclipse.jst.jsf.common.util.TypeUtil; -import org.eclipse.jst.jsf.context.symbol.IObjectSymbol; -import org.eclipse.jst.jsf.context.symbol.ISymbol; -import org.eclipse.jst.jsf.context.symbol.ITypeDescriptor; -import org.eclipse.jst.jsf.context.symbol.SymbolPackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>IType Descriptor</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.jst.jsf.context.symbol.internal.impl.ITypeDescriptorImpl#getProperties <em>Properties</em>}</li> - * <li>{@link org.eclipse.jst.jsf.context.symbol.internal.impl.ITypeDescriptorImpl#getTypeSignature <em>Type Signature</em>}</li> - * <li>{@link org.eclipse.jst.jsf.context.symbol.internal.impl.ITypeDescriptorImpl#getSuperTypeSignatures <em>Super Type Signatures</em>}</li> - * <li>{@link org.eclipse.jst.jsf.context.symbol.internal.impl.ITypeDescriptorImpl#getInterfaceTypeSignatures <em>Interface Type Signatures</em>}</li> - * <li>{@link org.eclipse.jst.jsf.context.symbol.internal.impl.ITypeDescriptorImpl#getTypeSignatureDelegate <em>Type Signature Delegate</em>}</li> - * <li>{@link org.eclipse.jst.jsf.context.symbol.internal.impl.ITypeDescriptorImpl#getMethods <em>Methods</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public abstract class ITypeDescriptorImpl extends EObjectImpl implements ITypeDescriptor { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright 2006 Oracle"; //$NON-NLS-1$ - - /** - * The default value of the '{@link #getTypeSignature() <em>Type Signature</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getTypeSignature() - * @generated - * @ordered - */ - protected static final String TYPE_SIGNATURE_EDEFAULT = ""; //$NON-NLS-1$ - - /** - * The default value of the '{@link #getTypeSignatureDelegate() <em>Type Signature Delegate</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getTypeSignatureDelegate() - * @generated - * @ordered - */ - protected static final String TYPE_SIGNATURE_DELEGATE_EDEFAULT = null; - - /** - * The cached value of the '{@link #getTypeSignatureDelegate() <em>Type Signature Delegate</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getTypeSignatureDelegate() - * @generated - * @ordered - */ - protected String typeSignatureDelegate = TYPE_SIGNATURE_DELEGATE_EDEFAULT; - - /** - * The cached value of the '{@link #getTypeParameterSignatures() <em>Type Parameter Signatures</em>}' attribute list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getTypeParameterSignatures() - * @generated - * @ordered - */ - protected EList typeParameterSignatures; - - /** - * The default value of the '{@link #getJdtContext() <em>Jdt Context</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getJdtContext() - * @generated - * @ordered - */ - protected static final IJavaElement JDT_CONTEXT_EDEFAULT = null; - - /** - * The cached value of the '{@link #getJdtContext() <em>Jdt Context</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getJdtContext() - * @generated - * @ordered - */ - protected IJavaElement jdtContext = JDT_CONTEXT_EDEFAULT; - - /** - * The default value of the '{@link #isEnumType() <em>Enum Type</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isEnumType() - * @generated - * @ordered - */ - protected static final boolean ENUM_TYPE_EDEFAULT = false; - - /** - * The cached value of the '{@link #isEnumType() <em>Enum Type</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isEnumType() - * @generated - * @ordered - */ - protected boolean enumType = ENUM_TYPE_EDEFAULT; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ITypeDescriptorImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * @return the static class - * <!-- end-user-doc --> - * @generated - */ - protected EClass eStaticClass() { - return SymbolPackage.Literals.ITYPE_DESCRIPTOR; - } - - /** - * <!-- begin-user-doc --> - * @return get properties for this type - * <!-- end-user-doc --> - * @generated NOT - */ - public abstract EList getProperties(); - - /** - * <!-- begin-user-doc --> - * @return the type signature in JVM/JDT signature form - * <!-- end-user-doc --> - * @generated NOT - */ - public abstract String getTypeSignature(); - - /** - * <!-- begin-user-doc --> - * @return the list of super types - * <!-- end-user-doc --> - * @generated NOT - */ - public abstract EList getSuperTypeSignatures(); - - /** - * <!-- begin-user-doc --> - * @return the list of implemented interfaces - * <!-- end-user-doc --> - * @generated NOT - */ - public abstract EList getInterfaceTypeSignatures(); - - /** - * <!-- begin-user-doc --> - * @return the type signature delegate. The descriptor may choose to use - * this delegate it if it is set and it cannot derive this information - * from other properties - * <!-- end-user-doc --> - * @generated - */ - public String getTypeSignatureDelegate() { - return typeSignatureDelegate; - } - - /** - * <!-- begin-user-doc --> - * @param newTypeSignatureDelegate - * <!-- end-user-doc --> - * @generated - */ - public void setTypeSignatureDelegate(String newTypeSignatureDelegate) { - String oldTypeSignatureDelegate = typeSignatureDelegate; - typeSignatureDelegate = newTypeSignatureDelegate; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, SymbolPackage.ITYPE_DESCRIPTOR__TYPE_SIGNATURE_DELEGATE, oldTypeSignatureDelegate, typeSignatureDelegate)); - } - - /** - * <!-- begin-user-doc --> - * @return the methods for this type or empty list if none exist - * <!-- end-user-doc --> - * @generated NOT - */ - public abstract EList getMethods(); - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EList getTypeParameterSignatures() { - if (typeParameterSignatures == null) { - typeParameterSignatures = new EDataTypeEList(String.class, this, SymbolPackage.ITYPE_DESCRIPTOR__TYPE_PARAMETER_SIGNATURES); - } - return typeParameterSignatures; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public IJavaElement getJdtContext() { - return jdtContext; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setJdtContext(IJavaElement newJdtContext) { - IJavaElement oldJdtContext = jdtContext; - jdtContext = newJdtContext; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, SymbolPackage.ITYPE_DESCRIPTOR__JDT_CONTEXT, oldJdtContext, jdtContext)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean isEnumType() { - return enumType; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setEnumType(boolean newEnumType) { - boolean oldEnumType = enumType; - enumType = newEnumType; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, SymbolPackage.ITYPE_DESCRIPTOR__ENUM_TYPE, oldEnumType, enumType)); - } - - /** - * <!-- begin-user-doc --> - * Note about generics: - * - * This call mimics the runtime instanceOf to the degree possible. - * Therefore, any type parameters (<...>) in typeSignature will be - * deleted using Signature.getTypeErasure() since this data won't be - * available at runtime. - * <!-- end-user-doc --> - * @generated NOT - */ - public boolean instanceOf(final String typeSignature) - { - final String typeErasedSignature = Signature.getTypeErasure(typeSignature); - - if (Signature.getTypeErasure(getTypeSignature()) != null - && Signature.getTypeErasure(getTypeSignature()).equals(typeErasedSignature)) - { - return true; - } - - for (final Iterator it = getSuperTypeSignatures().iterator(); it.hasNext();) - { - final String superType = (String) it.next(); - - if (Signature.getTypeErasure(superType).equals(typeErasedSignature)) - { - return true; - } - } - - for (final Iterator it = getInterfaceTypeSignatures().iterator(); it.hasNext();) - { - final String superType = (String) it.next(); - - if (Signature.getTypeErasure(superType).equals(typeErasedSignature)) - { - return true; - } - } - - return false; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - public boolean isArray() - { - return Signature.getArrayCount(getTypeSignature()) > 0; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - public IObjectSymbol getArrayElement() - { - if (isArray()) - { - // sub-class of ITypeDescriptor must implement this if they which to provide - // array element support - throw new UnsupportedOperationException("Base type descriptor does not support this function"); //$NON-NLS-1$ - } - - // shouldn't be called if not an array - return null; - } - - /** - /** - * <!-- begin-user-doc --> - * - * Tries to load an IType for a fully resolved (i.e. starts with L not Q) - * type signature using the current jdtContext. - * - * @return the resolved IType or null if none could be resolved. - * - * <!-- end-user-doc --> - * @generated NOT - */ - public IType resolveType(String resolvedTypeSignature) - { - // we need to obtain an IJavaProject within which to resolve - // the type. - IJavaProject project = null; - - // see if a jdtContext hint has been set - if (getJdtContext() != null) - { - project = getJdtContext().getJavaProject(); - } - - if (project != null) - { - return TypeUtil.resolveType(project, resolvedTypeSignature); - } - - return null; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - public ISymbol calculateSyntheticCall(String methodName, EList methodArgs, String symbolName) { - // sub-classes need only implement if they have something meaningful - // the want to do here - // by default return null to indicate this type descriptor doesn't - // wish to handle calls - return null; - } - - /** - * <!-- begin-user-doc --> - * @param featureID - * @param resolve - * @param coreType - * @return get the feature - * <!-- end-user-doc --> - * @generated - */ - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case SymbolPackage.ITYPE_DESCRIPTOR__PROPERTIES: - return getProperties(); - case SymbolPackage.ITYPE_DESCRIPTOR__TYPE_SIGNATURE: - return getTypeSignature(); - case SymbolPackage.ITYPE_DESCRIPTOR__SUPER_TYPE_SIGNATURES: - return getSuperTypeSignatures(); - case SymbolPackage.ITYPE_DESCRIPTOR__INTERFACE_TYPE_SIGNATURES: - return getInterfaceTypeSignatures(); - case SymbolPackage.ITYPE_DESCRIPTOR__TYPE_SIGNATURE_DELEGATE: - return getTypeSignatureDelegate(); - case SymbolPackage.ITYPE_DESCRIPTOR__METHODS: - return getMethods(); - } - 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 SymbolPackage.ITYPE_DESCRIPTOR__PROPERTIES: - getProperties().clear(); - getProperties().addAll((Collection)newValue); - return; - case SymbolPackage.ITYPE_DESCRIPTOR__SUPER_TYPE_SIGNATURES: - getSuperTypeSignatures().clear(); - getSuperTypeSignatures().addAll((Collection)newValue); - return; - case SymbolPackage.ITYPE_DESCRIPTOR__INTERFACE_TYPE_SIGNATURES: - getInterfaceTypeSignatures().clear(); - getInterfaceTypeSignatures().addAll((Collection)newValue); - return; - case SymbolPackage.ITYPE_DESCRIPTOR__TYPE_SIGNATURE_DELEGATE: - setTypeSignatureDelegate((String)newValue); - return; - case SymbolPackage.ITYPE_DESCRIPTOR__METHODS: - getMethods().clear(); - getMethods().addAll((Collection)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * @param featureID - * <!-- end-user-doc --> - * @generated - */ - public void eUnset(int featureID) { - switch (featureID) { - case SymbolPackage.ITYPE_DESCRIPTOR__PROPERTIES: - getProperties().clear(); - return; - case SymbolPackage.ITYPE_DESCRIPTOR__SUPER_TYPE_SIGNATURES: - getSuperTypeSignatures().clear(); - return; - case SymbolPackage.ITYPE_DESCRIPTOR__INTERFACE_TYPE_SIGNATURES: - getInterfaceTypeSignatures().clear(); - return; - case SymbolPackage.ITYPE_DESCRIPTOR__TYPE_SIGNATURE_DELEGATE: - setTypeSignatureDelegate(TYPE_SIGNATURE_DELEGATE_EDEFAULT); - return; - case SymbolPackage.ITYPE_DESCRIPTOR__METHODS: - getMethods().clear(); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * @param featureID - * @return true if feature has been set - * <!-- end-user-doc --> - * @generated - */ - public boolean eIsSet(int featureID) { - switch (featureID) { - case SymbolPackage.ITYPE_DESCRIPTOR__PROPERTIES: - return !getProperties().isEmpty(); - case SymbolPackage.ITYPE_DESCRIPTOR__TYPE_SIGNATURE: - return TYPE_SIGNATURE_EDEFAULT == null ? getTypeSignature() != null : !TYPE_SIGNATURE_EDEFAULT.equals(getTypeSignature()); - case SymbolPackage.ITYPE_DESCRIPTOR__SUPER_TYPE_SIGNATURES: - return !getSuperTypeSignatures().isEmpty(); - case SymbolPackage.ITYPE_DESCRIPTOR__INTERFACE_TYPE_SIGNATURES: - return !getInterfaceTypeSignatures().isEmpty(); - case SymbolPackage.ITYPE_DESCRIPTOR__TYPE_SIGNATURE_DELEGATE: - return TYPE_SIGNATURE_DELEGATE_EDEFAULT == null ? typeSignatureDelegate != null : !TYPE_SIGNATURE_DELEGATE_EDEFAULT.equals(typeSignatureDelegate); - case SymbolPackage.ITYPE_DESCRIPTOR__METHODS: - return !getMethods().isEmpty(); - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * @return the debug string format of the type signature - * <!-- end-user-doc --> - * @generated - */ - public String toString() { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (typeSignatureDelegate: "); //$NON-NLS-1$ - result.append(typeSignatureDelegate); - result.append(')'); - return result.toString(); - } -} //ITypeDescriptorImpl - diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/JavaUtil.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/JavaUtil.java deleted file mode 100644 index d6353752c..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/JavaUtil.java +++ /dev/null @@ -1,104 +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.context.symbol.internal.impl; - -import java.io.IOException; -import java.io.Reader; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jdt.core.IMethod; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jdt.ui.JavadocContentAccess; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; -import org.eclipse.jst.jsf.common.util.JDTBeanIntrospector; -import org.eclipse.jst.jsf.common.util.JDTBeanProperty; -import org.eclipse.jst.jsf.common.util.TypeUtil; -import org.eclipse.jst.jsf.context.symbol.IBeanMethodSymbol; -import org.eclipse.jst.jsf.context.symbol.IBeanPropertySymbol; - -/** - * Utility class for accessing jdt elements for jsf el symbols - */ -public class JavaUtil { - - private JavaUtil() { - // utility class - } - - /** - * @param method - * @return the javadoc text for the given method. Will return null if no javadoc is found - */ - public static String getMethodJavadoc(final IMethod method) { - try { - final Reader contentReader = JavadocContentAccess.getHTMLContentReader(method, true, true); - if (contentReader != null) { - return read(contentReader); - } - } catch (final JavaModelException e) { - JSFCommonPlugin.log(IStatus.WARNING, "error reading javadoc for method '" + method.getElementName() + "'.", e); //$NON-NLS-1$ //$NON-NLS-2$ - } - return null; - } - - private static String read(final Reader rd) { - final StringBuffer buffer= new StringBuffer(); - final char[] readBuffer= new char[2048]; - - try { - int n= rd.read(readBuffer); - while (n > 0) { - buffer.append(readBuffer, 0, n); - n= rd.read(readBuffer); - } - return buffer.toString(); - } catch (final IOException x) { - // should not happen, but otherwise simply ignore - } - - return null; - } - - /** - * @param symbol - the method symbol to look for - * @return the IMethod for the given method symbol. Will return <code>null</code>, if none is found. - */ - public static IMethod findCorrespondingMethod(final IBeanMethodSymbol symbol) { - final IType type = symbol.getOwner().getType(); - final JDTBeanIntrospector introspector = new JDTBeanIntrospector(type); - final IMethod[] methods = introspector.getAllMethods(); - for (final IMethod method : methods) { - if (method.getElementName().equals(symbol.getName())) { - try { - final String currentMethodsSignature = TypeUtil.resolveMethodSignature(method.getDeclaringType(), - method.getSignature()); - if (currentMethodsSignature.equals(symbol.getSignature())) { - return method; - } - } catch (final JavaModelException e) { - JSFCommonPlugin.log(IStatus.WARNING, "error determining for method '" //$NON-NLS-1$ - + method.getElementName() + "'.", e); //$NON-NLS-1$ - } - } - } - return null; - } - - /** - * @param propertySymbol - the property symbol to look for - * @return a JDTBeanProperty for the given property symbol - */ - public static JDTBeanProperty findCorrespondingJDTProperty(final IBeanPropertySymbol propertySymbol) { - final JDTBeanIntrospector introspector = new JDTBeanIntrospector(propertySymbol.getOwner().getType()); - return introspector.getProperties().get(propertySymbol.getName()); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/Messages.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/Messages.java deleted file mode 100644 index f731e4b5b..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/Messages.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.context.symbol.internal.impl; - -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -/*package*/ class Messages -{ - private static final String BUNDLE_NAME = "org.eclipse.jst.jsf.context.symbol.internal.impl.messages"; //$NON-NLS-1$ - - private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle - .getBundle(BUNDLE_NAME); - - private Messages() - { - // no external instantiation - } - - 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.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/SymbolFactoryImpl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/SymbolFactoryImpl.java deleted file mode 100644 index 75c59b868..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/SymbolFactoryImpl.java +++ /dev/null @@ -1,426 +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.context.symbol.internal.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.jdt.core.IJavaElement; -import org.eclipse.jdt.core.IType; -import org.eclipse.jst.jsf.common.internal.types.ValueType; -import org.eclipse.jst.jsf.context.symbol.ERuntimeSource; -import org.eclipse.jst.jsf.context.symbol.IBeanInstanceSymbol; -import org.eclipse.jst.jsf.context.symbol.IBeanMethodSymbol; -import org.eclipse.jst.jsf.context.symbol.IBeanPropertySymbol; -import org.eclipse.jst.jsf.context.symbol.IBoundedJavaTypeDescriptor; -import org.eclipse.jst.jsf.context.symbol.IBoundedListTypeDescriptor; -import org.eclipse.jst.jsf.context.symbol.IBoundedMapTypeDescriptor; -import org.eclipse.jst.jsf.context.symbol.IComponentSymbol; -import org.eclipse.jst.jsf.context.symbol.IInstanceSymbol; -import org.eclipse.jst.jsf.context.symbol.IJavaSymbol; -import org.eclipse.jst.jsf.context.symbol.IJavaTypeDescriptor2; -import org.eclipse.jst.jsf.context.symbol.IListTypeDescriptor; -import org.eclipse.jst.jsf.context.symbol.IMapTypeDescriptor; -import org.eclipse.jst.jsf.context.symbol.IMethodSymbol; -import org.eclipse.jst.jsf.context.symbol.IPropertySymbol; -import org.eclipse.jst.jsf.context.symbol.SymbolFactory; -import org.eclipse.jst.jsf.context.symbol.SymbolPackage; - - - -/** - * <!-- begin-user-doc --> - * An implementation of the model <b>Factory</b>. - * <!-- end-user-doc --> - * @generated - */ -public class SymbolFactoryImpl extends EFactoryImpl implements SymbolFactory { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright 2006 Oracle"; //$NON-NLS-1$ - - /** - * Creates the default factory implementation. - * <!-- begin-user-doc --> - * @return the SymbolFactory - * <!-- end-user-doc --> - * @generated - */ - public static SymbolFactory init() { - try { - SymbolFactory theSymbolFactory = (SymbolFactory)EPackage.Registry.INSTANCE.getEFactory("http:///org/eclipse/jst/jsf/context/symbol.ecore"); //$NON-NLS-1$ - if (theSymbolFactory != null) { - return theSymbolFactory; - } - } - catch (Exception exception) { - EcorePlugin.INSTANCE.log(exception); - } - return new SymbolFactoryImpl(); - } - - /** - * Creates an instance of the factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public SymbolFactoryImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * @param eClass - * @return the model instace for the model class - * <!-- end-user-doc --> - * @generated - */ - public EObject create(EClass eClass) { - switch (eClass.getClassifierID()) { - case SymbolPackage.IBEAN_INSTANCE_SYMBOL: return createIBeanInstanceSymbol(); - case SymbolPackage.IBEAN_PROPERTY_SYMBOL: return createIBeanPropertySymbol(); - case SymbolPackage.IINSTANCE_SYMBOL: return createIInstanceSymbol(); - case SymbolPackage.IJAVA_SYMBOL: return createIJavaSymbol(); - case SymbolPackage.IJAVA_TYPE_DESCRIPTOR2: return createIJavaTypeDescriptor2(); - case SymbolPackage.IBEAN_METHOD_SYMBOL: return createIBeanMethodSymbol(); - case SymbolPackage.ICOMPONENT_SYMBOL: return createIComponentSymbol(); - case SymbolPackage.IPROPERTY_SYMBOL: return createIPropertySymbol(); - case SymbolPackage.IMAP_TYPE_DESCRIPTOR: return createIMapTypeDescriptor(); - case SymbolPackage.IMETHOD_SYMBOL: return createIMethodSymbol(); - case SymbolPackage.IBOUNDED_MAP_TYPE_DESCRIPTOR: return createIBoundedMapTypeDescriptor(); - case SymbolPackage.IBOUNDED_JAVA_TYPE_DESCRIPTOR: return createIBoundedJavaTypeDescriptor(); - case SymbolPackage.ILIST_TYPE_DESCRIPTOR: return createIListTypeDescriptor(); - case SymbolPackage.IBOUNDED_LIST_TYPE_DESCRIPTOR: return createIBoundedListTypeDescriptor(); - default: - throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - - /** - * <!-- begin-user-doc --> - * @param eDataType - * @param initialValue - * @return an object constructed from the initialValue string - * <!-- end-user-doc --> - * @generated - */ - public Object createFromString(EDataType eDataType, String initialValue) { - switch (eDataType.getClassifierID()) { - case SymbolPackage.ERUNTIME_SOURCE: - return createERuntimeSourceFromString(eDataType, initialValue); - case SymbolPackage.ITYPE: - return createITypeFromString(eDataType, initialValue); - case SymbolPackage.IJAVA_ELEMENT: - return createIJavaElementFromString(eDataType, initialValue); - default: - throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - - /** - * <!-- begin-user-doc --> - * @param eDataType - * @param instanceValue - * @return the string equivelent of eDataType for the instance - * <!-- end-user-doc --> - * @generated - */ - public String convertToString(EDataType eDataType, Object instanceValue) { - switch (eDataType.getClassifierID()) { - case SymbolPackage.ERUNTIME_SOURCE: - return convertERuntimeSourceToString(eDataType, instanceValue); - case SymbolPackage.ITYPE: - return convertITypeToString(eDataType, instanceValue); - case SymbolPackage.IJAVA_ELEMENT: - return convertIJavaElementToString(eDataType, instanceValue); - default: - throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - - /** - * <!-- begin-user-doc --> - * @return a new bean instance symbol - * <!-- end-user-doc --> - * @generated - */ - public IBeanInstanceSymbol createIBeanInstanceSymbol() { - IBeanInstanceSymbolImpl iBeanInstanceSymbol = new IBeanInstanceSymbolImpl(); - return iBeanInstanceSymbol; - } - - /** - * <!-- begin-user-doc --> - * @return a new bean property symbol - * <!-- end-user-doc --> - * @generated - */ - public IBeanPropertySymbol createIBeanPropertySymbol() { - IBeanPropertySymbolImpl iBeanPropertySymbol = new IBeanPropertySymbolImpl(); - return iBeanPropertySymbol; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public IInstanceSymbol createIInstanceSymbol() { - IInstanceSymbolImpl iInstanceSymbol = new IInstanceSymbolImpl(); - return iInstanceSymbol; - } - - /** - * <!-- begin-user-doc --> - * @return a new java symbol - * <!-- end-user-doc --> - * @generated - */ - public IJavaSymbol createIJavaSymbol() { - IJavaSymbolImpl iJavaSymbol = new IJavaSymbolImpl(); - return iJavaSymbol; - } - - /** - * <!-- begin-user-doc --> - * @return a new java type descriptor - * <!-- end-user-doc --> - * @generated - */ - public IJavaTypeDescriptor2 createIJavaTypeDescriptor2() { - IJavaTypeDescriptor2Impl iJavaTypeDescriptor2 = new IJavaTypeDescriptor2Impl(); - return iJavaTypeDescriptor2; - } - - /** - * <!-- begin-user-doc --> - * @return a new bean method symbol - * <!-- end-user-doc --> - * @generated - */ - public IBeanMethodSymbol createIBeanMethodSymbol() { - IBeanMethodSymbolImpl iBeanMethodSymbol = new IBeanMethodSymbolImpl(); - return iBeanMethodSymbol; - } - - /** - * <!-- begin-user-doc --> - * @return a new component derived symbol - * <!-- end-user-doc --> - * @generated - */ - public IComponentSymbol createIComponentSymbol() { - IComponentSymbolImpl iComponentSymbol = new IComponentSymbolImpl(); - return iComponentSymbol; - } - - /** - * <!-- begin-user-doc --> - * @return a new property symbol - * <!-- end-user-doc --> - * @generated - */ - public IPropertySymbol createIPropertySymbol() { - IPropertySymbolImpl iPropertySymbol = new IPropertySymbolImpl(); - return iPropertySymbol; - } - - /** - * <!-- begin-user-doc --> - * @return create map type descriptor - * <!-- end-user-doc --> - * @generated - */ - public IMapTypeDescriptor createIMapTypeDescriptor() { - IMapTypeDescriptorImpl iMapTypeDescriptor = new IMapTypeDescriptorImpl(); - return iMapTypeDescriptor; - } - - /** - * <!-- begin-user-doc --> - * @return the method symbol - * <!-- end-user-doc --> - * @generated - */ - public IMethodSymbol createIMethodSymbol() { - IMethodSymbolImpl iMethodSymbol = new IMethodSymbolImpl(); - return iMethodSymbol; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public IBoundedMapTypeDescriptor createIBoundedMapTypeDescriptor() { - IBoundedMapTypeDescriptorImpl iBoundedMapTypeDescriptor = new IBoundedMapTypeDescriptorImpl(); - return iBoundedMapTypeDescriptor; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public IBoundedJavaTypeDescriptor createIBoundedJavaTypeDescriptor() { - IBoundedJavaTypeDescriptorImpl iBoundedJavaTypeDescriptor = new IBoundedJavaTypeDescriptorImpl(); - return iBoundedJavaTypeDescriptor; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public IListTypeDescriptor createIListTypeDescriptor() { - IListTypeDescriptorImpl iListTypeDescriptor = new IListTypeDescriptorImpl(); - return iListTypeDescriptor; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public IBoundedListTypeDescriptor createIBoundedListTypeDescriptor() { - IBoundedListTypeDescriptorImpl iBoundedListTypeDescriptor = new IBoundedListTypeDescriptorImpl(); - return iBoundedListTypeDescriptor; - } - - /** - * <!-- begin-user-doc --> - * @param eDataType - * @param initialValue - * @return - * <!-- end-user-doc --> - * @generated - */ - public ERuntimeSource createERuntimeSourceFromString(EDataType eDataType, String initialValue) { - ERuntimeSource result = ERuntimeSource.get(initialValue); - if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - return result; - } - - /** - * <!-- begin-user-doc --> - * @param eDataType - * @param instanceValue - * @return the converted runtime source - * <!-- end-user-doc --> - * @generated - */ - public String convertERuntimeSourceToString(EDataType eDataType, Object instanceValue) { - return instanceValue == null ? null : instanceValue.toString(); - } - - /** - * <!-- begin-user-doc --> - * @param eDataType - * @param initialValue - * @return - * <!-- end-user-doc --> - * @generated - */ - public IType createITypeFromString(EDataType eDataType, String initialValue) { - return (IType)super.createFromString(eDataType, initialValue); - } - - /** - * <!-- begin-user-doc --> - * @param eDataType - * @param instanceValue - * @return the converted string - * <!-- end-user-doc --> - * @generated - */ - public String convertITypeToString(EDataType eDataType, Object instanceValue) { - return super.convertToString(eDataType, instanceValue); - } - - /** - * <!-- begin-user-doc --> - * @param eDataType - * @param initialValue - * @return return the java element - * <!-- end-user-doc --> - * @generated - */ - public IJavaElement createIJavaElementFromString(EDataType eDataType, String initialValue) { - return (IJavaElement)super.createFromString(eDataType, initialValue); - } - - /** - * <!-- begin-user-doc --> - * @param eDataType - * @param instanceValue - * @return the converted string - * <!-- end-user-doc --> - * @generated - */ - public String convertIJavaElementToString(EDataType eDataType, Object instanceValue) { - return super.convertToString(eDataType, instanceValue); - } - - /** - * <!-- begin-user-doc --> - * @param eDataType - * @param initialValue - * @return the value type for the data type - * <!-- end-user-doc --> - * @generated - */ - public ValueType createValueTypeFromString(EDataType eDataType, String initialValue) { - return (ValueType)super.createFromString(eDataType, initialValue); - } - - /** - * <!-- begin-user-doc --> - * @param eDataType - * @param instanceValue - * @return the string for the value type - * <!-- end-user-doc --> - * @generated - */ - public String convertValueTypeToString(EDataType eDataType, Object instanceValue) { - return super.convertToString(eDataType, instanceValue); - } - - /** - * <!-- begin-user-doc --> - * @return the symbol package - * <!-- end-user-doc --> - * @generated - */ - public SymbolPackage getSymbolPackage() { - return (SymbolPackage)getEPackage(); - } - - /** - * <!-- begin-user-doc --> - * @return get the symbol package - * <!-- end-user-doc --> - * @deprecated - * @generated - */ - public static SymbolPackage getPackage() { - return SymbolPackage.eINSTANCE; - } - -} //SymbolFactoryImpl - diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/SymbolPackageImpl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/SymbolPackageImpl.java deleted file mode 100644 index bcb6cca44..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/SymbolPackageImpl.java +++ /dev/null @@ -1,1032 +0,0 @@ -/** - * Copyright 2006 Oracle - * - * $Id: SymbolPackageImpl.java,v 1.8 2008/11/18 22:24:43 gkessler Exp $ - */ -package org.eclipse.jst.jsf.context.symbol.internal.impl; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EDataType; -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.jdt.core.IJavaElement; -import org.eclipse.jdt.core.IType; - -import org.eclipse.jst.jsf.common.internal.types.ValueType; - -import org.eclipse.jst.jsf.context.symbol.ERuntimeSource; -import org.eclipse.jst.jsf.context.symbol.IBeanInstanceSymbol; -import org.eclipse.jst.jsf.context.symbol.IBeanMethodSymbol; -import org.eclipse.jst.jsf.context.symbol.IBeanPropertySymbol; -import org.eclipse.jst.jsf.context.symbol.IBoundedJavaTypeDescriptor; -import org.eclipse.jst.jsf.context.symbol.IBoundedListTypeDescriptor; -import org.eclipse.jst.jsf.context.symbol.IBoundedMapTypeDescriptor; -import org.eclipse.jst.jsf.context.symbol.IBoundedTypeDescriptor; -import org.eclipse.jst.jsf.context.symbol.IComponentSymbol; -import org.eclipse.jst.jsf.context.symbol.IDescribedInDetail; -import org.eclipse.jst.jsf.context.symbol.IInstanceSymbol; -import org.eclipse.jst.jsf.context.symbol.IJavaSymbol; -import org.eclipse.jst.jsf.context.symbol.IJavaTypeDescriptor2; -import org.eclipse.jst.jsf.context.symbol.IListTypeDescriptor; -import org.eclipse.jst.jsf.context.symbol.IMapTypeDescriptor; -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.ITypeDescriptor; -import org.eclipse.jst.jsf.context.symbol.SymbolFactory; -import org.eclipse.jst.jsf.context.symbol.SymbolPackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model <b>Package</b>. - * <!-- end-user-doc --> - * @generated - */ -public class SymbolPackageImpl extends EPackageImpl implements SymbolPackage { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright 2006 Oracle"; //$NON-NLS-1$ - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass iBeanInstanceSymbolEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass iBeanPropertySymbolEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass iInstanceSymbolEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass iJavaSymbolEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass iSymbolEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass iTypeDescriptorEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass iDescribedInDetailEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass iJavaTypeDescriptor2EClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass iBeanMethodSymbolEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass iComponentSymbolEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass iPropertySymbolEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass iMapTypeDescriptorEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass iMethodSymbolEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass iObjectSymbolEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass iBoundedTypeDescriptorEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass iBoundedMapTypeDescriptorEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass iBoundedJavaTypeDescriptorEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass iListTypeDescriptorEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass iBoundedListTypeDescriptorEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EEnum eRuntimeSourceEEnum = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EDataType iTypeEDataType = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EDataType iJavaElementEDataType = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EDataType valueTypeEDataType = 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.context.symbol.SymbolPackage#eNS_URI - * @see #init() - * @generated - */ - private SymbolPackageImpl() { - super(eNS_URI, SymbolFactory.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 symbols package - * <!-- end-user-doc --> - * @see #eNS_URI - * @see #createPackageContents() - * @see #initializePackageContents() - * @generated - */ - public static SymbolPackage init() { - if (isInited) return (SymbolPackage)EPackage.Registry.INSTANCE.getEPackage(SymbolPackage.eNS_URI); - - // Obtain or create and register package - SymbolPackageImpl theSymbolPackage = (SymbolPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(eNS_URI) instanceof SymbolPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(eNS_URI) : new SymbolPackageImpl()); - - isInited = true; - - // Create package meta-data objects - theSymbolPackage.createPackageContents(); - - // Initialize created meta-data - theSymbolPackage.initializePackageContents(); - - // Mark meta-data to indicate it can't be changed - theSymbolPackage.freeze(); - - return theSymbolPackage; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getIBeanInstanceSymbol() { - return iBeanInstanceSymbolEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getIBeanInstanceSymbol_Properties() { - return (EReference)iBeanInstanceSymbolEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getIBeanInstanceSymbol_Methods() { - return (EReference)iBeanInstanceSymbolEClass.getEStructuralFeatures().get(1); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getIBeanPropertySymbol() { - return iBeanPropertySymbolEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getIBeanPropertySymbol_Owner() { - return (EReference)iBeanPropertySymbolEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getIInstanceSymbol() { - return iInstanceSymbolEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getIInstanceSymbol_TypeResolved() { - return (EAttribute)iInstanceSymbolEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getIInstanceSymbol_RuntimeSource() { - return (EAttribute)iInstanceSymbolEClass.getEStructuralFeatures().get(1); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getIJavaSymbol() { - return iJavaSymbolEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getIJavaSymbol_JavaElement() { - return (EAttribute)iJavaSymbolEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getISymbol() { - return iSymbolEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getISymbol_Name() { - return (EAttribute)iSymbolEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getITypeDescriptor() { - return iTypeDescriptorEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getITypeDescriptor_Properties() { - return (EReference)iTypeDescriptorEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getITypeDescriptor_TypeSignature() { - return (EAttribute)iTypeDescriptorEClass.getEStructuralFeatures().get(1); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getITypeDescriptor_SuperTypeSignatures() { - return (EAttribute)iTypeDescriptorEClass.getEStructuralFeatures().get(2); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getITypeDescriptor_InterfaceTypeSignatures() { - return (EAttribute)iTypeDescriptorEClass.getEStructuralFeatures().get(3); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getITypeDescriptor_TypeSignatureDelegate() { - return (EAttribute)iTypeDescriptorEClass.getEStructuralFeatures().get(4); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getITypeDescriptor_Methods() { - return (EReference)iTypeDescriptorEClass.getEStructuralFeatures().get(5); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getITypeDescriptor_TypeParameterSignatures() { - return (EAttribute)iTypeDescriptorEClass.getEStructuralFeatures().get(6); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getITypeDescriptor_JdtContext() { - return (EAttribute)iTypeDescriptorEClass.getEStructuralFeatures().get(7); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getITypeDescriptor_EnumType() { - return (EAttribute)iTypeDescriptorEClass.getEStructuralFeatures().get(8); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getIDescribedInDetail() { - return iDescribedInDetailEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getIJavaTypeDescriptor2() { - return iJavaTypeDescriptor2EClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getIJavaTypeDescriptor2_Type() { - return (EAttribute)iJavaTypeDescriptor2EClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getIJavaTypeDescriptor2_BeanProperties() { - return (EReference)iJavaTypeDescriptor2EClass.getEStructuralFeatures().get(1); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getIJavaTypeDescriptor2_BeanMethods() { - return (EReference)iJavaTypeDescriptor2EClass.getEStructuralFeatures().get(2); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getIJavaTypeDescriptor2_ArrayCount() { - return (EAttribute)iJavaTypeDescriptor2EClass.getEStructuralFeatures().get(3); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getIBeanMethodSymbol() { - return iBeanMethodSymbolEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getIBeanMethodSymbol_Owner() { - return (EReference)iBeanMethodSymbolEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getIComponentSymbol() { - return iComponentSymbolEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getIPropertySymbol() { - return iPropertySymbolEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getIPropertySymbol_Intermediate() { - return (EAttribute)iPropertySymbolEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getIMapTypeDescriptor() { - return iMapTypeDescriptorEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getIMapTypeDescriptor_MapSource() { - return (EAttribute)iMapTypeDescriptorEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getIMapTypeDescriptor_Immutable() { - return (EAttribute)iMapTypeDescriptorEClass.getEStructuralFeatures().get(1); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getIMethodSymbol() { - return iMethodSymbolEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getIMethodSymbol_Signature() { - return (EAttribute)iMethodSymbolEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getIObjectSymbol() { - return iObjectSymbolEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getIObjectSymbol_TypeDescriptor() { - return (EReference)iObjectSymbolEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getIObjectSymbol_Readable() { - return (EAttribute)iObjectSymbolEClass.getEStructuralFeatures().get(1); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getIObjectSymbol_Writable() { - return (EAttribute)iObjectSymbolEClass.getEStructuralFeatures().get(2); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getIBoundedTypeDescriptor() { - return iBoundedTypeDescriptorEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getIBoundedMapTypeDescriptor() { - return iBoundedMapTypeDescriptorEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getIBoundedJavaTypeDescriptor() { - return iBoundedJavaTypeDescriptorEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getIListTypeDescriptor() { - return iListTypeDescriptorEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getIListTypeDescriptor_ListSource() { - return (EAttribute)iListTypeDescriptorEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getIBoundedListTypeDescriptor() { - return iBoundedListTypeDescriptorEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EEnum getERuntimeSource() { - return eRuntimeSourceEEnum; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EDataType getIType() { - return iTypeEDataType; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EDataType getIJavaElement() { - return iJavaElementEDataType; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EDataType getValueType() { - return valueTypeEDataType; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public SymbolFactory getSymbolFactory() { - return (SymbolFactory)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 - iBeanInstanceSymbolEClass = createEClass(IBEAN_INSTANCE_SYMBOL); - createEReference(iBeanInstanceSymbolEClass, IBEAN_INSTANCE_SYMBOL__PROPERTIES); - createEReference(iBeanInstanceSymbolEClass, IBEAN_INSTANCE_SYMBOL__METHODS); - - iBeanPropertySymbolEClass = createEClass(IBEAN_PROPERTY_SYMBOL); - createEReference(iBeanPropertySymbolEClass, IBEAN_PROPERTY_SYMBOL__OWNER); - - iInstanceSymbolEClass = createEClass(IINSTANCE_SYMBOL); - createEAttribute(iInstanceSymbolEClass, IINSTANCE_SYMBOL__TYPE_RESOLVED); - createEAttribute(iInstanceSymbolEClass, IINSTANCE_SYMBOL__RUNTIME_SOURCE); - - iJavaSymbolEClass = createEClass(IJAVA_SYMBOL); - createEAttribute(iJavaSymbolEClass, IJAVA_SYMBOL__JAVA_ELEMENT); - - iSymbolEClass = createEClass(ISYMBOL); - createEAttribute(iSymbolEClass, ISYMBOL__NAME); - - iTypeDescriptorEClass = createEClass(ITYPE_DESCRIPTOR); - createEReference(iTypeDescriptorEClass, ITYPE_DESCRIPTOR__PROPERTIES); - createEAttribute(iTypeDescriptorEClass, ITYPE_DESCRIPTOR__TYPE_SIGNATURE); - createEAttribute(iTypeDescriptorEClass, ITYPE_DESCRIPTOR__SUPER_TYPE_SIGNATURES); - createEAttribute(iTypeDescriptorEClass, ITYPE_DESCRIPTOR__INTERFACE_TYPE_SIGNATURES); - createEAttribute(iTypeDescriptorEClass, ITYPE_DESCRIPTOR__TYPE_SIGNATURE_DELEGATE); - createEReference(iTypeDescriptorEClass, ITYPE_DESCRIPTOR__METHODS); - createEAttribute(iTypeDescriptorEClass, ITYPE_DESCRIPTOR__TYPE_PARAMETER_SIGNATURES); - createEAttribute(iTypeDescriptorEClass, ITYPE_DESCRIPTOR__JDT_CONTEXT); - createEAttribute(iTypeDescriptorEClass, ITYPE_DESCRIPTOR__ENUM_TYPE); - - iDescribedInDetailEClass = createEClass(IDESCRIBED_IN_DETAIL); - - iJavaTypeDescriptor2EClass = createEClass(IJAVA_TYPE_DESCRIPTOR2); - createEAttribute(iJavaTypeDescriptor2EClass, IJAVA_TYPE_DESCRIPTOR2__TYPE); - createEReference(iJavaTypeDescriptor2EClass, IJAVA_TYPE_DESCRIPTOR2__BEAN_PROPERTIES); - createEReference(iJavaTypeDescriptor2EClass, IJAVA_TYPE_DESCRIPTOR2__BEAN_METHODS); - createEAttribute(iJavaTypeDescriptor2EClass, IJAVA_TYPE_DESCRIPTOR2__ARRAY_COUNT); - - iBeanMethodSymbolEClass = createEClass(IBEAN_METHOD_SYMBOL); - createEReference(iBeanMethodSymbolEClass, IBEAN_METHOD_SYMBOL__OWNER); - - iComponentSymbolEClass = createEClass(ICOMPONENT_SYMBOL); - - iPropertySymbolEClass = createEClass(IPROPERTY_SYMBOL); - createEAttribute(iPropertySymbolEClass, IPROPERTY_SYMBOL__INTERMEDIATE); - - iMapTypeDescriptorEClass = createEClass(IMAP_TYPE_DESCRIPTOR); - createEAttribute(iMapTypeDescriptorEClass, IMAP_TYPE_DESCRIPTOR__MAP_SOURCE); - createEAttribute(iMapTypeDescriptorEClass, IMAP_TYPE_DESCRIPTOR__IMMUTABLE); - - iMethodSymbolEClass = createEClass(IMETHOD_SYMBOL); - createEAttribute(iMethodSymbolEClass, IMETHOD_SYMBOL__SIGNATURE); - - iObjectSymbolEClass = createEClass(IOBJECT_SYMBOL); - createEReference(iObjectSymbolEClass, IOBJECT_SYMBOL__TYPE_DESCRIPTOR); - createEAttribute(iObjectSymbolEClass, IOBJECT_SYMBOL__READABLE); - createEAttribute(iObjectSymbolEClass, IOBJECT_SYMBOL__WRITABLE); - - iBoundedTypeDescriptorEClass = createEClass(IBOUNDED_TYPE_DESCRIPTOR); - - iBoundedMapTypeDescriptorEClass = createEClass(IBOUNDED_MAP_TYPE_DESCRIPTOR); - - iBoundedJavaTypeDescriptorEClass = createEClass(IBOUNDED_JAVA_TYPE_DESCRIPTOR); - - iListTypeDescriptorEClass = createEClass(ILIST_TYPE_DESCRIPTOR); - createEAttribute(iListTypeDescriptorEClass, ILIST_TYPE_DESCRIPTOR__LIST_SOURCE); - - iBoundedListTypeDescriptorEClass = createEClass(IBOUNDED_LIST_TYPE_DESCRIPTOR); - - // Create enums - eRuntimeSourceEEnum = createEEnum(ERUNTIME_SOURCE); - - // Create data types - iTypeEDataType = createEDataType(ITYPE); - iJavaElementEDataType = createEDataType(IJAVA_ELEMENT); - valueTypeEDataType = createEDataType(VALUE_TYPE); - } - - /** - * <!-- 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 - iBeanInstanceSymbolEClass.getESuperTypes().add(this.getIInstanceSymbol()); - iBeanInstanceSymbolEClass.getESuperTypes().add(this.getIDescribedInDetail()); - iBeanPropertySymbolEClass.getESuperTypes().add(this.getIPropertySymbol()); - iBeanPropertySymbolEClass.getESuperTypes().add(this.getIDescribedInDetail()); - iInstanceSymbolEClass.getESuperTypes().add(this.getIObjectSymbol()); - iJavaSymbolEClass.getESuperTypes().add(this.getISymbol()); - iJavaTypeDescriptor2EClass.getESuperTypes().add(this.getITypeDescriptor()); - iBeanMethodSymbolEClass.getESuperTypes().add(this.getIDescribedInDetail()); - iBeanMethodSymbolEClass.getESuperTypes().add(this.getIMethodSymbol()); - iComponentSymbolEClass.getESuperTypes().add(this.getIInstanceSymbol()); - iComponentSymbolEClass.getESuperTypes().add(this.getIDescribedInDetail()); - iPropertySymbolEClass.getESuperTypes().add(this.getIObjectSymbol()); - iMapTypeDescriptorEClass.getESuperTypes().add(this.getITypeDescriptor()); - iMethodSymbolEClass.getESuperTypes().add(this.getISymbol()); - iObjectSymbolEClass.getESuperTypes().add(this.getISymbol()); - iBoundedTypeDescriptorEClass.getESuperTypes().add(this.getITypeDescriptor()); - iBoundedMapTypeDescriptorEClass.getESuperTypes().add(this.getIMapTypeDescriptor()); - iBoundedMapTypeDescriptorEClass.getESuperTypes().add(this.getIBoundedTypeDescriptor()); - iBoundedJavaTypeDescriptorEClass.getESuperTypes().add(this.getIJavaTypeDescriptor2()); - iBoundedJavaTypeDescriptorEClass.getESuperTypes().add(this.getIBoundedTypeDescriptor()); - iListTypeDescriptorEClass.getESuperTypes().add(this.getITypeDescriptor()); - iBoundedListTypeDescriptorEClass.getESuperTypes().add(this.getIListTypeDescriptor()); - iBoundedListTypeDescriptorEClass.getESuperTypes().add(this.getIBoundedTypeDescriptor()); - - // Initialize classes and features; add operations and parameters - initEClass(iBeanInstanceSymbolEClass, IBeanInstanceSymbol.class, "IBeanInstanceSymbol", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEReference(getIBeanInstanceSymbol_Properties(), this.getIBeanPropertySymbol(), null, "properties", null, 0, -1, IBeanInstanceSymbol.class, !IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEReference(getIBeanInstanceSymbol_Methods(), this.getIBeanMethodSymbol(), null, "methods", null, 0, -1, IBeanInstanceSymbol.class, !IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - - addEOperation(iBeanInstanceSymbolEClass, this.getIJavaTypeDescriptor2(), "getJavaTypeDescriptor", 0, 1); //$NON-NLS-1$ - - EOperation op = addEOperation(iBeanInstanceSymbolEClass, null, "setJavaTypeDescriptor"); //$NON-NLS-1$ - addEParameter(op, this.getIJavaTypeDescriptor2(), "newTypeDescriptor", 0, 1); //$NON-NLS-1$ - - initEClass(iBeanPropertySymbolEClass, IBeanPropertySymbol.class, "IBeanPropertySymbol", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEReference(getIBeanPropertySymbol_Owner(), this.getIJavaTypeDescriptor2(), null, "owner", null, 0, 1, IBeanPropertySymbol.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - - initEClass(iInstanceSymbolEClass, IInstanceSymbol.class, "IInstanceSymbol", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEAttribute(getIInstanceSymbol_TypeResolved(), ecorePackage.getEBoolean(), "typeResolved", null, 0, 1, IInstanceSymbol.class, !IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEAttribute(getIInstanceSymbol_RuntimeSource(), this.getERuntimeSource(), "runtimeSource", "TAG_INSTANTIATED_SYMBOL", 0, 1, IInstanceSymbol.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ //$NON-NLS-2$ - - initEClass(iJavaSymbolEClass, IJavaSymbol.class, "IJavaSymbol", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEAttribute(getIJavaSymbol_JavaElement(), this.getIJavaElement(), "javaElement", null, 0, 1, IJavaSymbol.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - - initEClass(iSymbolEClass, ISymbol.class, "ISymbol", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEAttribute(getISymbol_Name(), ecorePackage.getEString(), "name", null, 0, 1, ISymbol.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - - initEClass(iTypeDescriptorEClass, ITypeDescriptor.class, "ITypeDescriptor", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEReference(getITypeDescriptor_Properties(), this.getIPropertySymbol(), null, "properties", null, 0, -1, ITypeDescriptor.class, !IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEAttribute(getITypeDescriptor_TypeSignature(), ecorePackage.getEString(), "typeSignature", "", 0, 1, ITypeDescriptor.class, !IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ //$NON-NLS-2$ - initEAttribute(getITypeDescriptor_SuperTypeSignatures(), ecorePackage.getEString(), "superTypeSignatures", null, 0, -1, ITypeDescriptor.class, !IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEAttribute(getITypeDescriptor_InterfaceTypeSignatures(), ecorePackage.getEString(), "interfaceTypeSignatures", null, 0, -1, ITypeDescriptor.class, !IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEAttribute(getITypeDescriptor_TypeSignatureDelegate(), ecorePackage.getEString(), "typeSignatureDelegate", null, 0, 1, ITypeDescriptor.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEReference(getITypeDescriptor_Methods(), this.getIMethodSymbol(), null, "methods", null, 0, -1, ITypeDescriptor.class, !IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEAttribute(getITypeDescriptor_TypeParameterSignatures(), ecorePackage.getEString(), "typeParameterSignatures", null, 0, -1, ITypeDescriptor.class, IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEAttribute(getITypeDescriptor_JdtContext(), this.getIJavaElement(), "jdtContext", null, 0, 1, ITypeDescriptor.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEAttribute(getITypeDescriptor_EnumType(), ecorePackage.getEBoolean(), "enumType", null, 0, 1, ITypeDescriptor.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - - op = addEOperation(iTypeDescriptorEClass, ecorePackage.getEBoolean(), "instanceOf", 0, 1); //$NON-NLS-1$ - addEParameter(op, ecorePackage.getEString(), "typeSignature", 0, 1); //$NON-NLS-1$ - - addEOperation(iTypeDescriptorEClass, ecorePackage.getEBoolean(), "isArray", 0, 1); //$NON-NLS-1$ - - addEOperation(iTypeDescriptorEClass, this.getIObjectSymbol(), "getArrayElement", 0, 1); //$NON-NLS-1$ - - op = addEOperation(iTypeDescriptorEClass, this.getIType(), "resolveType", 0, 1); //$NON-NLS-1$ - addEParameter(op, ecorePackage.getEString(), "resolvedTypeSignature", 0, 1); //$NON-NLS-1$ - - op = addEOperation(iTypeDescriptorEClass, this.getISymbol(), "calculateSyntheticCall", 0, 1); //$NON-NLS-1$ - addEParameter(op, ecorePackage.getEString(), "methodName", 0, 1); //$NON-NLS-1$ - addEParameter(op, this.getValueType(), "methodArgs", 0, -1); //$NON-NLS-1$ - addEParameter(op, ecorePackage.getEString(), "symbolName", 0, 1); //$NON-NLS-1$ - - initEClass(iDescribedInDetailEClass, IDescribedInDetail.class, "IDescribedInDetail", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - - initEClass(iJavaTypeDescriptor2EClass, IJavaTypeDescriptor2.class, "IJavaTypeDescriptor2", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEAttribute(getIJavaTypeDescriptor2_Type(), this.getIType(), "type", null, 0, 1, IJavaTypeDescriptor2.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEReference(getIJavaTypeDescriptor2_BeanProperties(), this.getIBeanPropertySymbol(), null, "beanProperties", null, 0, -1, IJavaTypeDescriptor2.class, !IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEReference(getIJavaTypeDescriptor2_BeanMethods(), this.getIBeanPropertySymbol(), null, "beanMethods", null, 0, -1, IJavaTypeDescriptor2.class, !IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEAttribute(getIJavaTypeDescriptor2_ArrayCount(), ecorePackage.getEInt(), "arrayCount", null, 0, 1, IJavaTypeDescriptor2.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - - initEClass(iBeanMethodSymbolEClass, IBeanMethodSymbol.class, "IBeanMethodSymbol", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEReference(getIBeanMethodSymbol_Owner(), this.getIJavaTypeDescriptor2(), null, "owner", null, 0, 1, IBeanMethodSymbol.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - - initEClass(iComponentSymbolEClass, IComponentSymbol.class, "IComponentSymbol", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - - initEClass(iPropertySymbolEClass, IPropertySymbol.class, "IPropertySymbol", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEAttribute(getIPropertySymbol_Intermediate(), ecorePackage.getEBoolean(), "intermediate", null, 0, 1, IPropertySymbol.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - - initEClass(iMapTypeDescriptorEClass, IMapTypeDescriptor.class, "IMapTypeDescriptor", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEAttribute(getIMapTypeDescriptor_MapSource(), ecorePackage.getEMap(), "mapSource", null, 0, 1, IMapTypeDescriptor.class, IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEAttribute(getIMapTypeDescriptor_Immutable(), ecorePackage.getEBoolean(), "immutable", "true", 0, 1, IMapTypeDescriptor.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ //$NON-NLS-2$ - - initEClass(iMethodSymbolEClass, IMethodSymbol.class, "IMethodSymbol", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEAttribute(getIMethodSymbol_Signature(), ecorePackage.getEString(), "signature", null, 0, 1, IMethodSymbol.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - - initEClass(iObjectSymbolEClass, IObjectSymbol.class, "IObjectSymbol", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEReference(getIObjectSymbol_TypeDescriptor(), this.getITypeDescriptor(), null, "typeDescriptor", null, 0, 1, IObjectSymbol.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEAttribute(getIObjectSymbol_Readable(), ecorePackage.getEBoolean(), "readable", null, 0, 1, IObjectSymbol.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEAttribute(getIObjectSymbol_Writable(), ecorePackage.getEBoolean(), "writable", null, 0, 1, IObjectSymbol.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - - op = addEOperation(iObjectSymbolEClass, ecorePackage.getEBoolean(), "supportsCoercion", 0, 1); //$NON-NLS-1$ - addEParameter(op, ecorePackage.getEString(), "typeSignature", 0, 1); //$NON-NLS-1$ - - op = addEOperation(iObjectSymbolEClass, this.getITypeDescriptor(), "coerce", 0, 1); //$NON-NLS-1$ - addEParameter(op, ecorePackage.getEString(), "typeSignature", 0, 1); //$NON-NLS-1$ - - op = addEOperation(iObjectSymbolEClass, this.getISymbol(), "call", 0, 1); //$NON-NLS-1$ - addEParameter(op, ecorePackage.getEString(), "methodName", 0, 1); //$NON-NLS-1$ - addEParameter(op, this.getValueType(), "methodArguments", 0, -1); //$NON-NLS-1$ - addEParameter(op, ecorePackage.getEString(), "symbolName", 0, 1); //$NON-NLS-1$ - - initEClass(iBoundedTypeDescriptorEClass, IBoundedTypeDescriptor.class, "IBoundedTypeDescriptor", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - - op = addEOperation(iBoundedTypeDescriptorEClass, ecorePackage.getEBoolean(), "isUnboundedForType", 0, 1); //$NON-NLS-1$ - addEParameter(op, ecorePackage.getEString(), "typeSignature", 0, 1); //$NON-NLS-1$ - - op = addEOperation(iBoundedTypeDescriptorEClass, this.getISymbol(), "getUnboundedProperty", 0, 1); //$NON-NLS-1$ - addEParameter(op, ecorePackage.getEJavaObject(), "name", 0, 1); //$NON-NLS-1$ - addEParameter(op, ecorePackage.getEString(), "typeSignature", 0, 1); //$NON-NLS-1$ - - initEClass(iBoundedMapTypeDescriptorEClass, IBoundedMapTypeDescriptor.class, "IBoundedMapTypeDescriptor", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - - initEClass(iBoundedJavaTypeDescriptorEClass, IBoundedJavaTypeDescriptor.class, "IBoundedJavaTypeDescriptor", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - - initEClass(iListTypeDescriptorEClass, IListTypeDescriptor.class, "IListTypeDescriptor", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEAttribute(getIListTypeDescriptor_ListSource(), ecorePackage.getEEList(), "listSource", null, 0, 1, IListTypeDescriptor.class, IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - - initEClass(iBoundedListTypeDescriptorEClass, IBoundedListTypeDescriptor.class, "IBoundedListTypeDescriptor", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - - // Initialize enums and add enum literals - initEEnum(eRuntimeSourceEEnum, ERuntimeSource.class, "ERuntimeSource"); //$NON-NLS-1$ - addEEnumLiteral(eRuntimeSourceEEnum, ERuntimeSource.BUILT_IN_SYMBOL_LITERAL); - addEEnumLiteral(eRuntimeSourceEEnum, ERuntimeSource.MANAGED_BEAN_SYMBOL_LITERAL); - addEEnumLiteral(eRuntimeSourceEEnum, ERuntimeSource.TAG_INSTANTIATED_SYMBOL_LITERAL); - addEEnumLiteral(eRuntimeSourceEEnum, ERuntimeSource.OTHER_LITERAL); - - // Initialize data types - initEDataType(iTypeEDataType, IType.class, "IType", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEDataType(iJavaElementEDataType, IJavaElement.class, "IJavaElement", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEDataType(valueTypeEDataType, ValueType.class, "ValueType", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - - // Create resource - createResource(eNS_URI); - } - -} //SymbolPackageImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/Util.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/Util.java deleted file mode 100644 index 0c2f288e3..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/Util.java +++ /dev/null @@ -1,191 +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.context.symbol.internal.impl; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.jdt.core.IMethod; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jdt.core.Signature; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; -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.JDTBeanIntrospector; -import org.eclipse.jst.jsf.common.util.TypeUtil; -import org.eclipse.jst.jsf.context.symbol.IJavaTypeDescriptor2; -import org.eclipse.jst.jsf.context.symbol.IPropertySymbol; -import org.eclipse.jst.jsf.context.symbol.ISymbol; -import org.eclipse.jst.jsf.context.symbol.ITypeDescriptor; -import org.eclipse.jst.jsf.context.symbol.SymbolFactory; - -final class Util -{ - static ISymbol call(String methodName, EList methodArguments, - String symbolName, ITypeDescriptor typeDesc) - { - // first, see if the type descriptor wants to handle the call - ISymbol result = typeDesc.calculateSyntheticCall(methodName, methodArguments, symbolName); - - final IType type= typeDesc.resolveType(typeDesc.getTypeSignature()); - - // if the type is resolved and the typeDesc didn't already handle - // the call then do this the hard way... - if (type != null && result == null) - { - final JDTBeanIntrospector introspector = - new JDTBeanIntrospector(type); - - final IMethod callMethod = - Util.matchMethod(methodName, methodArguments, introspector.getAllMethods(),typeDesc.getTypeParameterSignatures()); - - if (callMethod != null) - { - try - { - // resolve the method's return type; don't erase parameters - String retTypeSignature = callMethod.getReturnType(); - - // if we have a type variable, try to parameter match it - if (Signature.getTypeSignatureKind(retTypeSignature) == Signature.TYPE_VARIABLE_SIGNATURE) - { - retTypeSignature = TypeUtil.matchTypeParameterToArgument - (type - , retTypeSignature, typeDesc.getTypeParameterSignatures()); - - if (retTypeSignature == null) - { - retTypeSignature = TypeConstants.TYPE_JAVAOBJECT; - } - } - // otherwise, try and resolve it in type - else - { - retTypeSignature = TypeUtil.resolveTypeSignature - (type, callMethod.getReturnType(), false); - } - - final IPropertySymbol propSymbol = - SymbolFactory.eINSTANCE.createIPropertySymbol(); - - // TODO: there is a possible problem here for non-string keyed maps - propSymbol.setName(symbolName); - propSymbol.setReadable(true); - - { - IJavaTypeDescriptor2 newTypeDesc = null; - - if (retTypeSignature.equals(TypeConstants.TYPE_JAVAOBJECT)) - { - newTypeDesc = SymbolFactory.eINSTANCE.createIBoundedJavaTypeDescriptor(); - } - else - { - newTypeDesc = SymbolFactory.eINSTANCE.createIJavaTypeDescriptor2(); - } - - newTypeDesc.setArrayCount(Signature.getArrayCount(retTypeSignature)); - - // may be null - newTypeDesc.setType(typeDesc.resolveType(retTypeSignature)); - newTypeDesc.setTypeSignatureDelegate(retTypeSignature); - propSymbol.setTypeDescriptor(newTypeDesc); - } - - result = propSymbol; - } - catch (JavaModelException e) - { - JSFCommonPlugin.log(e); - // fall-through and return null result - } - } - } - - return result; - } - - static IMethod matchMethod(String methodName, List methodArguments, IMethod[] allMethods, List typeParameterSignatures) - { -// final List argSigs = convertArgsToSignatures(methodArguments); - IMethod matchedMethod = null; - - for (int i = 0; i < allMethods.length; i++) - { - final IMethod method = allMethods[i]; - - // check for names and argument count match - if (method.getParameterTypes().length == methodArguments.size() - && method.getElementName().equals(methodName)) - { - List<String> methods = resolveMethodParameters(method, typeParameterSignatures); - - // need to verify argument matches - boolean isMatched = true; - CHECK_ARGUMENTS: for (int j = 0; j < methods.size(); j++) - { - final ValueType valueType = (ValueType) methodArguments.get(j); - - // if the parameters match, or if the method expects an object - // and we have a class - // TODO: there are some cases not supported here like: - // - method name overloading - // - autoboxing primitives - // - certain kinds of parameterized args - if (!methods.get(j).equals(valueType.getSignature()) - && !(methods.get(j).equals(TypeConstants.TYPE_JAVAOBJECT) - && Signature.getTypeSignatureKind(valueType.getSignature())==Signature.CLASS_TYPE_SIGNATURE)) - { - // not a match - isMatched = false; - break CHECK_ARGUMENTS; - } - } - - if (isMatched) - { - return method; - } - } - } - - return matchedMethod; - } - - static List<String> resolveMethodParameters(IMethod method, List typeParametersSignatures) - { - List<String> resolved = new ArrayList<String>(); - String[] parameterTypes = method.getParameterTypes(); - for (String parameter : parameterTypes) - { - parameter = TypeUtil.resolveTypeSignature(method.getDeclaringType() - , parameter, false); - - if (Signature.getTypeSignatureKind(parameter) == Signature.TYPE_VARIABLE_SIGNATURE) - { - parameter = TypeUtil.matchTypeParameterToArgument - (method.getDeclaringType(), parameter, typeParametersSignatures); - } - - if (parameter == null) - { - parameter = TypeConstants.TYPE_JAVAOBJECT; - } - - resolved.add(parameter); - } - - return resolved; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/messages.properties b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/messages.properties deleted file mode 100644 index c8ed3b496..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/impl/messages.properties +++ /dev/null @@ -1,18 +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 -############################################################################### -IBeanMethodSymbolImpl.DetailDesc=Signature: -IBeanPropertySymbolImpl.Access=Access: -IBeanPropertySymbolImpl.hiding=hiding -IBeanPropertySymbolImpl.none=none -IBeanPropertySymbolImpl.read_write=read/write -IBeanPropertySymbolImpl.readonly=read-only -IBeanPropertySymbolImpl.Type=Type: -IBeanPropertySymbolImpl.writeonly=write-only diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/provider/IBeanInstanceSymbolItemProvider.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/provider/IBeanInstanceSymbolItemProvider.java deleted file mode 100644 index ee8e4b9ad..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/provider/IBeanInstanceSymbolItemProvider.java +++ /dev/null @@ -1,219 +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.context.symbol.internal.provider; - - -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.ResourceLocator; -import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; -import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.edit.provider.IItemPropertySource; -import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; -import org.eclipse.emf.edit.provider.ITreeItemContentProvider; -import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry; -import org.eclipse.jface.text.contentassist.ICompletionProposal; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; -import org.eclipse.jst.jsf.context.symbol.IBeanInstanceSymbol; -import org.eclipse.jst.jsf.context.symbol.SymbolPackage; -import org.eclipse.jst.jsf.context.symbol.provider.IContentProposalProvider; -import org.eclipse.swt.graphics.Image; - -/** - * This is the item provider adapter for a {@link org.eclipse.jst.jsf.context.symbol.IBeanInstanceSymbol} object. - * <!-- begin-user-doc --> - * @extends IContentProposalProvider - * <!-- end-user-doc --> - * @generated - */ -public class IBeanInstanceSymbolItemProvider - extends IInstanceSymbolItemProvider - implements - IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource, IContentProposalProvider -{ - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @SuppressWarnings("hiding") - public static final String copyright = "Copyright 2006 Oracle"; //$NON-NLS-1$ - - /** - * This constructs an instance from a factory and a notifier. - * <!-- begin-user-doc --> - * @param adapterFactory - * <!-- end-user-doc --> - * @generated - */ - public IBeanInstanceSymbolItemProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * This returns the property descriptors for the adapted class. - * <!-- begin-user-doc --> - * @param object - * @return - * <!-- end-user-doc --> - * @generated - */ - public List getPropertyDescriptors(Object object) { - if (itemPropertyDescriptors == null) { - super.getPropertyDescriptors(object); - - addPropertiesPropertyDescriptor(object); - addMethodsPropertyDescriptor(object); - } - return itemPropertyDescriptors; - } - - /** - * This adds a property descriptor for the Properties feature. - * <!-- begin-user-doc --> - * @param object - * <!-- end-user-doc --> - * @generated - */ - protected void addPropertiesPropertyDescriptor(Object object) { - itemPropertyDescriptors.add - (createItemPropertyDescriptor - (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), - getResourceLocator(), - getString("_UI_IBeanInstanceSymbol_properties_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_IBeanInstanceSymbol_properties_feature", "_UI_IBeanInstanceSymbol_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - SymbolPackage.Literals.IBEAN_INSTANCE_SYMBOL__PROPERTIES, - false, - false, - false, - null, - null, - null)); - } - - /** - * This adds a property descriptor for the Methods feature. - * <!-- begin-user-doc --> - * @param object - * <!-- end-user-doc --> - * @generated - */ - protected void addMethodsPropertyDescriptor(Object object) { - itemPropertyDescriptors.add - (createItemPropertyDescriptor - (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), - getResourceLocator(), - getString("_UI_IBeanInstanceSymbol_methods_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_IBeanInstanceSymbol_methods_feature", "_UI_IBeanInstanceSymbol_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - SymbolPackage.Literals.IBEAN_INSTANCE_SYMBOL__METHODS, - false, - false, - false, - null, - null, - null)); - } - - /** - * This returns IBeanInstanceSymbol.gif. - * <!-- begin-user-doc --> - * @param object - * @return the image associated with object or null if not found - * <!-- end-user-doc --> - * @generated - */ - public Object getImage(Object object) { - return overlayImage(object, getResourceLocator().getImage("full/obj16/IBeanInstanceSymbol")); //$NON-NLS-1$ - } - - /** - * This returns the label text for the adapted class. - * <!-- begin-user-doc --> - * @param object - * @return the text label associated with object or null if not found - * <!-- end-user-doc --> - * @generated NOT - */ - public String getText(Object object) { - String label = ((IBeanInstanceSymbol)object).getName(); - return label == null || label.length() == 0 ? - getString("_UI_IBeanInstanceSymbol_type") : //$NON-NLS-1$ - label; - } - - /** - * This handles model notifications by calling {@link #updateChildren(Notification)} to update any cached - * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged(Notification)}. - * <!-- begin-user-doc --> - * @param notification - * <!-- end-user-doc --> - * @generated - */ - public void notifyChanged(Notification notification) { - updateChildren(notification); - super.notifyChanged(notification); - } - - /** - * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s - * describing all of the children that can be created under this object. - * <!-- begin-user-doc --> - * @param newChildDescriptors - * @param object - * <!-- end-user-doc --> - * @generated - */ - protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { - super.collectNewChildDescriptors(newChildDescriptors, object); - } - - /** - * Return the resource locator for this item provider's resources. - * <!-- begin-user-doc --> - * @return the resource locator - * <!-- end-user-doc --> - * @generated - */ - public ResourceLocator getResourceLocator() { - return JSFCommonPlugin.INSTANCE; - } - - /** - * @param target_ - * @param proposalFactory - * @return a completion proposal for target at offset - */ - public ICompletionProposal[] getProposals(Object target_, - IProposalCreationFactory proposalFactory) - { - IBeanInstanceSymbol symbol = (IBeanInstanceSymbol) target_; - - final String replacementText = symbol.getName(); - final String displayText = getText(symbol); - final String additionalText = symbol.getDetailedDescription(); - final Image displayImage = - ExtendedImageRegistry.getInstance().getImage(getImage(symbol)); - - return new ICompletionProposal[] - { - proposalFactory.createProposal(replacementText, - displayText, - additionalText, - displayImage, - target_) - }; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/provider/IBeanMethodSymbolItemProvider.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/provider/IBeanMethodSymbolItemProvider.java deleted file mode 100644 index ed4eaae3a..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/provider/IBeanMethodSymbolItemProvider.java +++ /dev/null @@ -1,254 +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.context.symbol.internal.provider; - - -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.ResourceLocator; -import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; -import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.edit.provider.IItemPropertySource; -import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; -import org.eclipse.emf.edit.provider.ITreeItemContentProvider; -import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; -import org.eclipse.emf.edit.provider.ItemProviderAdapter; -import org.eclipse.emf.edit.provider.ViewerNotification; -import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry; -import org.eclipse.jface.text.contentassist.ICompletionProposal; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; -import org.eclipse.jst.jsf.context.symbol.IBeanMethodSymbol; -import org.eclipse.jst.jsf.context.symbol.SymbolPackage; -import org.eclipse.jst.jsf.context.symbol.provider.IContentProposalProvider; -import org.eclipse.swt.graphics.Image; - - - -/** - * This is the item provider adapter for a {@link org.eclipse.jst.jsf.context.symbol.IBeanMethodSymbol} object. - * <!-- begin-user-doc --> - * @extends IContentProposalProvider - * <!-- end-user-doc --> - * @generated - */ -public class IBeanMethodSymbolItemProvider - extends ItemProviderAdapter - implements - IEditingDomainItemProvider, - IStructuredItemContentProvider, - ITreeItemContentProvider, - IItemLabelProvider, - IItemPropertySource, - IContentProposalProvider { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright 2006 Oracle"; //$NON-NLS-1$ - - /** - * This constructs an instance from a factory and a notifier. - * <!-- begin-user-doc --> - * @param adapterFactory - * <!-- end-user-doc --> - * @generated - */ - public IBeanMethodSymbolItemProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * This returns the property descriptors for the adapted class. - * <!-- begin-user-doc --> - * @param object - * @return the list of property descriptors - * <!-- end-user-doc --> - * @generated - */ - public List getPropertyDescriptors(Object object) { - if (itemPropertyDescriptors == null) { - super.getPropertyDescriptors(object); - - addNamePropertyDescriptor(object); - addSignaturePropertyDescriptor(object); - addOwnerPropertyDescriptor(object); - } - return itemPropertyDescriptors; - } - - /** - * This adds a property descriptor for the Name feature. - * <!-- begin-user-doc --> - * @param object - * <!-- end-user-doc --> - * @generated - */ - protected void addNamePropertyDescriptor(Object object) { - itemPropertyDescriptors.add - (createItemPropertyDescriptor - (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), - getResourceLocator(), - getString("_UI_ISymbol_name_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_ISymbol_name_feature", "_UI_ISymbol_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - SymbolPackage.Literals.ISYMBOL__NAME, - true, - false, - false, - ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, - null, - null)); - } - - /** - * This adds a property descriptor for the Signature feature. - * <!-- begin-user-doc --> - * @param object - * <!-- end-user-doc --> - * @generated - */ - protected void addSignaturePropertyDescriptor(Object object) { - itemPropertyDescriptors.add - (createItemPropertyDescriptor - (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), - getResourceLocator(), - getString("_UI_IMethodSymbol_signature_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_IMethodSymbol_signature_feature", "_UI_IMethodSymbol_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - SymbolPackage.Literals.IMETHOD_SYMBOL__SIGNATURE, - true, - false, - false, - ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, - null, - null)); - } - - /** - * This adds a property descriptor for the Owner feature. - * <!-- begin-user-doc --> - * @param object - * <!-- end-user-doc --> - * @generated - */ - protected void addOwnerPropertyDescriptor(Object object) { - itemPropertyDescriptors.add - (createItemPropertyDescriptor - (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), - getResourceLocator(), - getString("_UI_IBeanMethodSymbol_owner_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_IBeanMethodSymbol_owner_feature", "_UI_IBeanMethodSymbol_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - SymbolPackage.Literals.IBEAN_METHOD_SYMBOL__OWNER, - true, - false, - false, - null, - null, - null)); - } - - /** - * This returns IBeanMethodSymbol.gif. - * <!-- begin-user-doc --> - * @param object - * @return the image associated with object or null if no found - * <!-- end-user-doc --> - * @generated - */ - public Object getImage(Object object) { - return overlayImage(object, getResourceLocator().getImage("full/obj16/IBeanMethodSymbol")); //$NON-NLS-1$ - } - - /** - * This returns the label text for the adapted class. - * <!-- begin-user-doc --> - * @param object - * @return the text label associated with label or null if not found - * <!-- end-user-doc --> - * @generated NOT - */ - public String getText(Object object) { - String label = ((IBeanMethodSymbol)object).getName(); - return label == null || label.length() == 0 ? - getString("_UI_IBeanMethodSymbol_type") : //$NON-NLS-1$ - label; - } - - /** - * This handles model notifications by calling {@link #updateChildren(Notification)} to update any cached - * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged(Notification)}. - * <!-- begin-user-doc --> - * @param notification - * <!-- end-user-doc --> - * @generated - */ - public void notifyChanged(Notification notification) { - updateChildren(notification); - - switch (notification.getFeatureID(IBeanMethodSymbol.class)) { - case SymbolPackage.IBEAN_METHOD_SYMBOL__NAME: - case SymbolPackage.IBEAN_METHOD_SYMBOL__SIGNATURE: - fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); - return; - } - super.notifyChanged(notification); - } - - /** - * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s - * describing all of the children that can be created under this object. - * <!-- begin-user-doc --> - * @param newChildDescriptors - * @param object - * <!-- end-user-doc --> - * @generated - */ - protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { - super.collectNewChildDescriptors(newChildDescriptors, object); - } - - /** - * Return the resource locator for this item provider's resources. - * <!-- begin-user-doc --> - * @return the resource locator - * <!-- end-user-doc --> - * @generated - */ - public ResourceLocator getResourceLocator() { - return JSFCommonPlugin.INSTANCE; - } - - public ICompletionProposal[] getProposals(Object target_, - IProposalCreationFactory proposalFactory) - { - IBeanMethodSymbol symbol = (IBeanMethodSymbol) target_; - - final String replacementText = symbol.getName(); - final String displayText = getText(target_); - final String additionalText = symbol.getDetailedDescription(); - final Image displayImage = - ExtendedImageRegistry.getInstance().getImage(getImage(symbol)); - - return new ICompletionProposal[] - { - proposalFactory.createProposal(replacementText, - displayText, - additionalText, - displayImage, - target_) - }; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/provider/IBeanPropertySymbolItemProvider.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/provider/IBeanPropertySymbolItemProvider.java deleted file mode 100644 index cc2714420..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/provider/IBeanPropertySymbolItemProvider.java +++ /dev/null @@ -1,196 +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.context.symbol.internal.provider; - - -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.ResourceLocator; -import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; -import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.edit.provider.IItemPropertySource; -import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; -import org.eclipse.emf.edit.provider.ITreeItemContentProvider; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; -import org.eclipse.jst.jsf.context.symbol.IBeanPropertySymbol; -import org.eclipse.jst.jsf.context.symbol.ITypeDescriptor; -import org.eclipse.jst.jsf.context.symbol.SymbolPackage; -import org.eclipse.jst.jsf.context.symbol.provider.IContentProposalProvider; - -/** - * This is the item provider adapter for a {@link org.eclipse.jst.jsf.context.symbol.IBeanPropertySymbol} object. - * <!-- begin-user-doc --> - * @extends IContentProposalProvider - * <!-- end-user-doc --> - * @generated - */ -public class IBeanPropertySymbolItemProvider - extends IPropertySymbolItemProvider - implements - IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource, IContentProposalProvider -{ - private static final String PROPERTY_SYMBOL_WO = "full/obj16/IBeanPropertySymbol_wo"; //$NON-NLS-1$ - private static final String PROPERTY_SYMBOL_RO = "full/obj16/IBeanPropertySymbol_ro"; //$NON-NLS-1$ - private static final String PROPERTY_SYMBOL_RW = "full/obj16/IBeanPropertySymbol_rw"; //$NON-NLS-1$ - private static final String PROPERTY_SYMBOL_WO_INDEXABLE = "full/obj16/IBeanPropertySymbol_wo_indexable"; //$NON-NLS-1$ - private static final String PROPERTY_SYMBOL_RO_INDEXABLE = "full/obj16/IBeanPropertySymbol_ro_indexable"; //$NON-NLS-1$ - private static final String PROPERTY_SYMBOL_RW_INDEXABLE = "full/obj16/IBeanPropertySymbol_rw_indexable"; //$NON-NLS-1$ - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @SuppressWarnings("hiding") - public static final String copyright = "Copyright 2006 Oracle"; //$NON-NLS-1$ - - /** - * This constructs an instance from a factory and a notifier. - * <!-- begin-user-doc --> - * @param adapterFactory - * @extends IContentProposalProvider - * <!-- end-user-doc --> - * @generated - */ - public IBeanPropertySymbolItemProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * This returns the property descriptors for the adapted class. - * <!-- begin-user-doc --> - * @param object - * @return the list of property descriptors - * <!-- end-user-doc --> - * @generated - */ - public List getPropertyDescriptors(Object object) { - if (itemPropertyDescriptors == null) { - super.getPropertyDescriptors(object); - - addOwnerPropertyDescriptor(object); - } - return itemPropertyDescriptors; - } - - /** - * This adds a property descriptor for the Owner feature. - * <!-- begin-user-doc --> - * @param object - * <!-- end-user-doc --> - * @generated - */ - protected void addOwnerPropertyDescriptor(Object object) { - itemPropertyDescriptors.add - (createItemPropertyDescriptor - (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), - getResourceLocator(), - getString("_UI_IBeanPropertySymbol_owner_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_IBeanPropertySymbol_owner_feature", "_UI_IBeanPropertySymbol_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - SymbolPackage.Literals.IBEAN_PROPERTY_SYMBOL__OWNER, - true, - false, - false, - null, - null, - null)); - } - - /** - * This returns IBeanPropertySymbol.gif. - * <!-- begin-user-doc --> - * @param object - * @return the image associated with object or null if not found - * <!-- end-user-doc --> - * @generated NOT - */ - public Object getImage(Object object) { - IBeanPropertySymbol propertySymbol = (IBeanPropertySymbol) object; - String imageFile = null; - ITypeDescriptor typeDescriptor = propertySymbol.getTypeDescriptor(); - if (typeDescriptor != null && (typeDescriptor.isArray() || typeDescriptor.instanceOf("Ljava.util.List;") || typeDescriptor.instanceOf("Ljava.util.Map;"))) { //$NON-NLS-1$ //$NON-NLS-2$ - // property is somehow "indexable" by int/String: - if (propertySymbol.isReadable() && propertySymbol.isWritable()) { - imageFile = PROPERTY_SYMBOL_RW_INDEXABLE; - } else if (propertySymbol.isReadable()) { - imageFile = PROPERTY_SYMBOL_RO_INDEXABLE; - } else if (propertySymbol.isWritable()) { - imageFile = PROPERTY_SYMBOL_WO_INDEXABLE; - } - } else { - if (propertySymbol.isReadable() && propertySymbol.isWritable()) { - imageFile = PROPERTY_SYMBOL_RW; - } else if (propertySymbol.isReadable()) { - imageFile = PROPERTY_SYMBOL_RO; - } else if (propertySymbol.isWritable()) { - imageFile = PROPERTY_SYMBOL_WO; - } - } - return imageFile == null? null : overlayImage(object, getResourceLocator().getImage(imageFile)); - } - - /** - * This returns the label text for the adapted class. - * <!-- begin-user-doc --> - * @param object - * @return the text label associated with object - * <!-- end-user-doc --> - * @generated - */ - public String getText(Object object) { - String label = ((IBeanPropertySymbol)object).getName(); - return label == null || label.length() == 0 ? - getString("_UI_IBeanPropertySymbol_type") : //$NON-NLS-1$ - getString("_UI_IBeanPropertySymbol_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * This handles model notifications by calling {@link #updateChildren(Notification)} to update any cached - * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged(Notification)}. - * <!-- begin-user-doc --> - * @param notification - * <!-- end-user-doc --> - * @generated - */ - public void notifyChanged(Notification notification) { - updateChildren(notification); - super.notifyChanged(notification); - } - - /** - * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s - * describing all of the children that can be created under this object. - * <!-- begin-user-doc --> - * @param newChildDescriptors - * @param object - * <!-- end-user-doc --> - * @generated - */ - protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { - super.collectNewChildDescriptors(newChildDescriptors, object); - } - - /** - * Return the resource locator for this item provider's resources. - * <!-- begin-user-doc --> - * @return the resource locator - * <!-- end-user-doc --> - * @generated - */ - public ResourceLocator getResourceLocator() { - return JSFCommonPlugin.INSTANCE; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/provider/IBoundedJavaTypeDescriptorItemProvider.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/provider/IBoundedJavaTypeDescriptorItemProvider.java deleted file mode 100644 index 1c85e05dc..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/provider/IBoundedJavaTypeDescriptorItemProvider.java +++ /dev/null @@ -1,127 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: IBoundedJavaTypeDescriptorItemProvider.java,v 1.7 2007/10/01 04:29:43 cbateman Exp $ - */ -package org.eclipse.jst.jsf.context.symbol.internal.provider; - - -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.ResourceLocator; -import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.edit.provider.IItemPropertySource; -import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; -import org.eclipse.emf.edit.provider.ITreeItemContentProvider; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; -import org.eclipse.jst.jsf.context.symbol.IBoundedJavaTypeDescriptor; - -/** - * This is the item provider adapter for a {@link org.eclipse.jst.jsf.context.symbol.IBoundedJavaTypeDescriptor} object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -public class IBoundedJavaTypeDescriptorItemProvider - extends IJavaTypeDescriptor2ItemProvider - implements - IEditingDomainItemProvider, - IStructuredItemContentProvider, - ITreeItemContentProvider, - IItemLabelProvider, - IItemPropertySource { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @SuppressWarnings("hiding") - public static final String copyright = "Copyright 2006 Oracle"; //$NON-NLS-1$ - - /** - * This constructs an instance from a factory and a notifier. - * <!-- begin-user-doc --> - * @param adapterFactory - * <!-- end-user-doc --> - * @generated - */ - public IBoundedJavaTypeDescriptorItemProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * This returns the property descriptors for the adapted class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public List getPropertyDescriptors(Object object) { - if (itemPropertyDescriptors == null) { - super.getPropertyDescriptors(object); - - } - return itemPropertyDescriptors; - } - - /** - * This returns IBoundedJavaTypeDescriptor.gif. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Object getImage(Object object) { - return overlayImage(object, getResourceLocator().getImage("full/obj16/IBoundedJavaTypeDescriptor")); //$NON-NLS-1$ - } - - /** - * This returns the label text for the adapted class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getText(Object object) { - String label = ((IBoundedJavaTypeDescriptor)object).getTypeSignature(); - return label == null || label.length() == 0 ? - getString("_UI_IBoundedJavaTypeDescriptor_type") : //$NON-NLS-1$ - getString("_UI_IBoundedJavaTypeDescriptor_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * This handles model notifications by calling {@link #updateChildren(Notification)} to update any cached - * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged(Notification)}. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void notifyChanged(Notification notification) { - updateChildren(notification); - super.notifyChanged(notification); - } - - /** - * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s - * describing all of the children that can be created under this object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { - super.collectNewChildDescriptors(newChildDescriptors, object); - } - - /** - * Return the resource locator for this item provider's resources. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ResourceLocator getResourceLocator() { - return JSFCommonPlugin.INSTANCE; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/provider/IBoundedListTypeDescriptorItemProvider.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/provider/IBoundedListTypeDescriptorItemProvider.java deleted file mode 100644 index 4bee1ad98..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/provider/IBoundedListTypeDescriptorItemProvider.java +++ /dev/null @@ -1,136 +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.context.symbol.internal.provider; - - -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; - -import org.eclipse.emf.common.util.ResourceLocator; - -import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.edit.provider.IItemPropertySource; -import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; -import org.eclipse.emf.edit.provider.ITreeItemContentProvider; - -import org.eclipse.jst.jsf.common.JSFCommonPlugin; - -import org.eclipse.jst.jsf.context.symbol.IBoundedListTypeDescriptor; - -/** - * This is the item provider adapter for a {@link org.eclipse.jst.jsf.context.symbol.IBoundedListTypeDescriptor} object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -public class IBoundedListTypeDescriptorItemProvider - extends IListTypeDescriptorItemProvider - implements - IEditingDomainItemProvider, - IStructuredItemContentProvider, - ITreeItemContentProvider, - IItemLabelProvider, - IItemPropertySource { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @SuppressWarnings("hiding") - public static final String copyright = "Copyright 2006 Oracle"; //$NON-NLS-1$ - - /** - * This constructs an instance from a factory and a notifier. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param adapterFactory - * @generated - */ - public IBoundedListTypeDescriptorItemProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * This returns the property descriptors for the adapted class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public List getPropertyDescriptors(Object object) { - if (itemPropertyDescriptors == null) { - super.getPropertyDescriptors(object); - - } - return itemPropertyDescriptors; - } - - /** - * This returns IBoundedListTypeDescriptor.gif. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Object getImage(Object object) { - return overlayImage(object, getResourceLocator().getImage("full/obj16/IBoundedListTypeDescriptor")); //$NON-NLS-1$ - } - - /** - * This returns the label text for the adapted class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getText(Object object) { - String label = ((IBoundedListTypeDescriptor)object).getTypeSignature(); - return label == null || label.length() == 0 ? - getString("_UI_IBoundedListTypeDescriptor_type") : //$NON-NLS-1$ - getString("_UI_IBoundedListTypeDescriptor_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * This handles model notifications by calling {@link #updateChildren(Notification)} to update any cached - * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged(Notification)}. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void notifyChanged(Notification notification) { - updateChildren(notification); - super.notifyChanged(notification); - } - - /** - * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children - * that can be created under this object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { - super.collectNewChildDescriptors(newChildDescriptors, object); - } - - /** - * Return the resource locator for this item provider's resources. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ResourceLocator getResourceLocator() { - return JSFCommonPlugin.INSTANCE; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/provider/IBoundedMapTypeDescriptorItemProvider.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/provider/IBoundedMapTypeDescriptorItemProvider.java deleted file mode 100644 index 02b1a2409..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/provider/IBoundedMapTypeDescriptorItemProvider.java +++ /dev/null @@ -1,127 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: IBoundedMapTypeDescriptorItemProvider.java,v 1.7 2007/10/01 04:29:43 cbateman Exp $ - */ -package org.eclipse.jst.jsf.context.symbol.internal.provider; - - -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.ResourceLocator; -import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.edit.provider.IItemPropertySource; -import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; -import org.eclipse.emf.edit.provider.ITreeItemContentProvider; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; -import org.eclipse.jst.jsf.context.symbol.IBoundedMapTypeDescriptor; - -/** - * This is the item provider adapter for a {@link org.eclipse.jst.jsf.context.symbol.IBoundedMapTypeDescriptor} object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -public class IBoundedMapTypeDescriptorItemProvider - extends IMapTypeDescriptorItemProvider - implements - IEditingDomainItemProvider, - IStructuredItemContentProvider, - ITreeItemContentProvider, - IItemLabelProvider, - IItemPropertySource { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @SuppressWarnings("hiding") - public static final String copyright = "Copyright 2006 Oracle"; //$NON-NLS-1$ - - /** - * This constructs an instance from a factory and a notifier. - * <!-- begin-user-doc --> - * @param adapterFactory - * <!-- end-user-doc --> - * @generated - */ - public IBoundedMapTypeDescriptorItemProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * This returns the property descriptors for the adapted class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public List getPropertyDescriptors(Object object) { - if (itemPropertyDescriptors == null) { - super.getPropertyDescriptors(object); - - } - return itemPropertyDescriptors; - } - - /** - * This returns IBoundedMapTypeDescriptor.gif. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Object getImage(Object object) { - return overlayImage(object, getResourceLocator().getImage("full/obj16/IBoundedMapTypeDescriptor")); //$NON-NLS-1$ - } - - /** - * This returns the label text for the adapted class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getText(Object object) { - String label = ((IBoundedMapTypeDescriptor)object).getTypeSignature(); - return label == null || label.length() == 0 ? - getString("_UI_IBoundedMapTypeDescriptor_type") : //$NON-NLS-1$ - getString("_UI_IBoundedMapTypeDescriptor_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * This handles model notifications by calling {@link #updateChildren(Notification)} to update any cached - * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged(Notification)}. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void notifyChanged(Notification notification) { - updateChildren(notification); - super.notifyChanged(notification); - } - - /** - * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s - * describing all of the children that can be created under this object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { - super.collectNewChildDescriptors(newChildDescriptors, object); - } - - /** - * Return the resource locator for this item provider's resources. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ResourceLocator getResourceLocator() { - return JSFCommonPlugin.INSTANCE; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/provider/IComponentSymbolItemProvider.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/provider/IComponentSymbolItemProvider.java deleted file mode 100644 index 96b04f747..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/provider/IComponentSymbolItemProvider.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.context.symbol.internal.provider; - - -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.ResourceLocator; -import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.edit.provider.IItemPropertySource; -import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; -import org.eclipse.emf.edit.provider.ITreeItemContentProvider; -import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry; -import org.eclipse.jface.text.contentassist.ICompletionProposal; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; -import org.eclipse.jst.jsf.context.symbol.IComponentSymbol; -import org.eclipse.jst.jsf.context.symbol.provider.IContentProposalProvider; -import org.eclipse.swt.graphics.Image; - -/** - * This is the item provider adapter for a {@link org.eclipse.jst.jsf.context.symbol.IComponentSymbol} object. - * <!-- begin-user-doc --> - * @extends IContentProposalProvider - * <!-- end-user-doc --> - * @generated - */ -public class IComponentSymbolItemProvider - extends IInstanceSymbolItemProvider - implements - IEditingDomainItemProvider, - IStructuredItemContentProvider, - ITreeItemContentProvider, - IItemLabelProvider, - IItemPropertySource, - IContentProposalProvider -{ - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @SuppressWarnings("hiding") - public static final String copyright = "Copyright 2006 Oracle"; //$NON-NLS-1$ - - /** - * This constructs an instance from a factory and a notifier. - * <!-- begin-user-doc --> - * @param adapterFactory - * <!-- end-user-doc --> - * @generated - */ - public IComponentSymbolItemProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * This returns the property descriptors for the adapted class. - * <!-- begin-user-doc --> - * @param object - * @return the property descriptor list - * <!-- end-user-doc --> - * @generated - */ - public List getPropertyDescriptors(Object object) { - if (itemPropertyDescriptors == null) { - super.getPropertyDescriptors(object); - - } - return itemPropertyDescriptors; - } - - /** - * This returns IComponentSymbol.gif. - * <!-- begin-user-doc --> - * @param object - * @return the image associated with object or null if not found - * <!-- end-user-doc --> - * @generated - */ - public Object getImage(Object object) { - return overlayImage(object, getResourceLocator().getImage("full/obj16/IComponentSymbol")); //$NON-NLS-1$ - } - - /** - * This returns the label text for the adapted class. - * <!-- begin-user-doc --> - * @param object - * @return the text label for object or null if not found - * <!-- end-user-doc --> - * @generated NOT - */ - public String getText(Object object) { - String label = ((IComponentSymbol)object).getName(); - return label == null || label.length() == 0 ? - getString("_UI_IComponentSymbol_type") : //$NON-NLS-1$ - label; - } - - /** - * This handles model notifications by calling {@link #updateChildren(Notification)} to update any cached - * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged(Notification)}. - * <!-- begin-user-doc --> - * @param notification - * <!-- end-user-doc --> - * @generated - */ - public void notifyChanged(Notification notification) { - updateChildren(notification); - super.notifyChanged(notification); - } - - /** - * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s - * describing all of the children that can be created under this object. - * <!-- begin-user-doc --> - * @param newChildDescriptors - * @param object - * <!-- end-user-doc --> - * @generated - */ - protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { - super.collectNewChildDescriptors(newChildDescriptors, object); - } - - /** - * Return the resource locator for this item provider's resources. - * <!-- begin-user-doc --> - * @return the resource locator - * <!-- end-user-doc --> - * @generated - */ - public ResourceLocator getResourceLocator() { - return JSFCommonPlugin.INSTANCE; - } - - public ICompletionProposal[] getProposals(Object target_, - IProposalCreationFactory proposalFactory) - { - IComponentSymbol symbol = (IComponentSymbol) target_; - - final String replacementText = symbol.getName(); - final String displayText = getText(symbol); - final String additionalText = symbol.getDetailedDescription(); - final Image displayImage = - ExtendedImageRegistry.getInstance().getImage(getImage(symbol)); - - return new ICompletionProposal[] - { - proposalFactory.createProposal(replacementText, - displayText, - additionalText, - displayImage, - target_) - }; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/provider/IInstanceSymbolItemProvider.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/provider/IInstanceSymbolItemProvider.java deleted file mode 100644 index 155bfb186..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/provider/IInstanceSymbolItemProvider.java +++ /dev/null @@ -1,329 +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.context.symbol.internal.provider; - - -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.ResourceLocator; -import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; -import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.edit.provider.IItemPropertySource; -import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; -import org.eclipse.emf.edit.provider.ITreeItemContentProvider; -import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; -import org.eclipse.emf.edit.provider.ItemProviderAdapter; -import org.eclipse.emf.edit.provider.ViewerNotification; -import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry; -import org.eclipse.jface.text.contentassist.ICompletionProposal; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; -import org.eclipse.jst.jsf.context.symbol.IInstanceSymbol; -import org.eclipse.jst.jsf.context.symbol.SymbolPackage; -import org.eclipse.jst.jsf.context.symbol.provider.IContentProposalProvider; -import org.eclipse.swt.graphics.Image; - - - - -/** - * This is the item provider adapter for a {@link org.eclipse.jst.jsf.context.symbol.IInstanceSymbol} object. - * <!-- begin-user-doc --> - * @extends IContentProposalProvider - * <!-- end-user-doc --> - * @generated - */ -public class IInstanceSymbolItemProvider - extends ItemProviderAdapter - implements - IEditingDomainItemProvider, - IStructuredItemContentProvider, - ITreeItemContentProvider, - IItemLabelProvider, - IItemPropertySource, - IContentProposalProvider { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright 2006 Oracle"; //$NON-NLS-1$ - - /** - * This constructs an instance from a factory and a notifier. - * <!-- begin-user-doc --> - * @param adapterFactory - * <!-- end-user-doc --> - * @generated - */ - public IInstanceSymbolItemProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * This returns the property descriptors for the adapted class. - * <!-- begin-user-doc --> - * @param object - * @return the EMF property descriptors - * <!-- end-user-doc --> - * @generated - */ - public List getPropertyDescriptors(Object object) { - if (itemPropertyDescriptors == null) { - super.getPropertyDescriptors(object); - - addNamePropertyDescriptor(object); - addTypeDescriptorPropertyDescriptor(object); - addReadablePropertyDescriptor(object); - addWritablePropertyDescriptor(object); - addTypeResolvedPropertyDescriptor(object); - addRuntimeSourcePropertyDescriptor(object); - } - return itemPropertyDescriptors; - } - - /** - * This adds a property descriptor for the Name feature. - * <!-- begin-user-doc --> - * @param object - * <!-- end-user-doc --> - * @generated - */ - protected void addNamePropertyDescriptor(Object object) { - itemPropertyDescriptors.add - (createItemPropertyDescriptor - (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), - getResourceLocator(), - getString("_UI_ISymbol_name_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_ISymbol_name_feature", "_UI_ISymbol_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - SymbolPackage.Literals.ISYMBOL__NAME, - true, - false, - false, - ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, - null, - null)); - } - - /** - * This adds a property descriptor for the Type Descriptor feature. - * <!-- begin-user-doc --> - * @param object - * <!-- end-user-doc --> - * @generated - */ - protected void addTypeDescriptorPropertyDescriptor(Object object) { - itemPropertyDescriptors.add - (createItemPropertyDescriptor - (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), - getResourceLocator(), - getString("_UI_IObjectSymbol_typeDescriptor_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_IObjectSymbol_typeDescriptor_feature", "_UI_IObjectSymbol_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - SymbolPackage.Literals.IOBJECT_SYMBOL__TYPE_DESCRIPTOR, - true, - false, - true, - null, - null, - null)); - } - - /** - * This adds a property descriptor for the Readable feature. - * <!-- begin-user-doc --> - * @param object - * <!-- end-user-doc --> - * @generated - */ - protected void addReadablePropertyDescriptor(Object object) { - itemPropertyDescriptors.add - (createItemPropertyDescriptor - (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), - getResourceLocator(), - getString("_UI_IObjectSymbol_readable_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_IObjectSymbol_readable_feature", "_UI_IObjectSymbol_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - SymbolPackage.Literals.IOBJECT_SYMBOL__READABLE, - true, - false, - false, - ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE, - null, - null)); - } - - /** - * This adds a property descriptor for the Writable feature. - * <!-- begin-user-doc --> - * @param object - * <!-- end-user-doc --> - * @generated - */ - protected void addWritablePropertyDescriptor(Object object) { - itemPropertyDescriptors.add - (createItemPropertyDescriptor - (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), - getResourceLocator(), - getString("_UI_IObjectSymbol_writable_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_IObjectSymbol_writable_feature", "_UI_IObjectSymbol_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - SymbolPackage.Literals.IOBJECT_SYMBOL__WRITABLE, - true, - false, - false, - ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE, - null, - null)); - } - - /** - * This adds a property descriptor for the Type Resolved feature. - * <!-- begin-user-doc --> - * @param object - * <!-- end-user-doc --> - * @generated - */ - protected void addTypeResolvedPropertyDescriptor(Object object) { - itemPropertyDescriptors.add - (createItemPropertyDescriptor - (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), - getResourceLocator(), - getString("_UI_IInstanceSymbol_typeResolved_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_IInstanceSymbol_typeResolved_feature", "_UI_IInstanceSymbol_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - SymbolPackage.Literals.IINSTANCE_SYMBOL__TYPE_RESOLVED, - false, - false, - false, - ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE, - null, - null)); - } - - /** - * This adds a property descriptor for the Runtime Source feature. - * <!-- begin-user-doc --> - * @param object - * <!-- end-user-doc --> - * @generated - */ - protected void addRuntimeSourcePropertyDescriptor(Object object) { - itemPropertyDescriptors.add - (createItemPropertyDescriptor - (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), - getResourceLocator(), - getString("_UI_IInstanceSymbol_runtimeSource_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_IInstanceSymbol_runtimeSource_feature", "_UI_IInstanceSymbol_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - SymbolPackage.Literals.IINSTANCE_SYMBOL__RUNTIME_SOURCE, - true, - false, - false, - ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, - null, - null)); - } - - /** - * This returns IInstanceSymbol.gif. - * <!-- begin-user-doc --> - * @param object - * @return the image adaption for object - * <!-- end-user-doc --> - * @generated - */ - public Object getImage(Object object) { - return overlayImage(object, getResourceLocator().getImage("full/obj16/IInstanceSymbol")); //$NON-NLS-1$ - } - - /** - * This returns the label text for the adapted class. - * <!-- begin-user-doc --> - * @param object - * @return the text representation of object - * <!-- end-user-doc --> - * @generated NOT - */ - public String getText(Object object) { - String label = ((IInstanceSymbol)object).getName(); - return label == null || label.length() == 0 ? - getString("_UI_IInstanceSymbol_type") : //$NON-NLS-1$ - label; - } - - /** - * This handles model notifications by calling {@link #updateChildren(Notification)} to update any cached - * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged(Notification)}. - * <!-- begin-user-doc --> - * @param notification - * <!-- end-user-doc --> - * @generated - */ - public void notifyChanged(Notification notification) { - updateChildren(notification); - - switch (notification.getFeatureID(IInstanceSymbol.class)) { - case SymbolPackage.IINSTANCE_SYMBOL__NAME: - case SymbolPackage.IINSTANCE_SYMBOL__READABLE: - case SymbolPackage.IINSTANCE_SYMBOL__WRITABLE: - case SymbolPackage.IINSTANCE_SYMBOL__TYPE_RESOLVED: - case SymbolPackage.IINSTANCE_SYMBOL__RUNTIME_SOURCE: - fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); - return; - } - super.notifyChanged(notification); - } - - /** - * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s - * describing all of the children that can be created under this object. - * <!-- begin-user-doc --> - * @param newChildDescriptors - * @param object - * <!-- end-user-doc --> - * @generated - */ - protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { - super.collectNewChildDescriptors(newChildDescriptors, object); - } - - /** - * Return the resource locator for this item provider's resources. - * <!-- begin-user-doc --> - * @return the resource locator - * <!-- end-user-doc --> - * @generated - */ - public ResourceLocator getResourceLocator() { - return JSFCommonPlugin.INSTANCE; - } - - public ICompletionProposal[] getProposals(Object target_, - IProposalCreationFactory proposalFactory) - { - IInstanceSymbol symbol = (IInstanceSymbol) target_; - - final String replacementText = symbol.getName(); - final String displayText = getText(symbol); - //final String additionalText = symbol.getDetailedDescription(); - final Image displayImage = - ExtendedImageRegistry.getInstance().getImage(getImage(symbol)); - - return new ICompletionProposal[] - { - proposalFactory.createProposal(replacementText, - displayText, - null, - displayImage, - target_) - }; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/provider/IJavaSymbolItemProvider.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/provider/IJavaSymbolItemProvider.java deleted file mode 100644 index 021cd5bed..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/provider/IJavaSymbolItemProvider.java +++ /dev/null @@ -1,204 +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.context.symbol.internal.provider; - - -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.ResourceLocator; -import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; -import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.edit.provider.IItemPropertySource; -import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; -import org.eclipse.emf.edit.provider.ITreeItemContentProvider; -import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; -import org.eclipse.emf.edit.provider.ItemProviderAdapter; -import org.eclipse.emf.edit.provider.ViewerNotification; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; -import org.eclipse.jst.jsf.context.symbol.IJavaSymbol; -import org.eclipse.jst.jsf.context.symbol.SymbolPackage; - - - - -/** - * This is the item provider adapter for a {@link org.eclipse.jst.jsf.context.symbol.IJavaSymbol} object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -public class IJavaSymbolItemProvider - extends ItemProviderAdapter - implements - IEditingDomainItemProvider, - IStructuredItemContentProvider, - ITreeItemContentProvider, - IItemLabelProvider, - IItemPropertySource { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright 2006 Oracle"; //$NON-NLS-1$ - - /** - * This constructs an instance from a factory and a notifier. - * <!-- begin-user-doc --> - * @param adapterFactory - * <!-- end-user-doc --> - * @generated - */ - public IJavaSymbolItemProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * This returns the property descriptors for the adapted class. - * <!-- begin-user-doc --> - * @param object - * @return the list of property descriptors - * <!-- end-user-doc --> - * @generated - */ - public List getPropertyDescriptors(Object object) { - if (itemPropertyDescriptors == null) { - super.getPropertyDescriptors(object); - - addNamePropertyDescriptor(object); - addJavaElementPropertyDescriptor(object); - } - return itemPropertyDescriptors; - } - - /** - * This adds a property descriptor for the Name feature. - * <!-- begin-user-doc --> - * @param object - * <!-- end-user-doc --> - * @generated - */ - protected void addNamePropertyDescriptor(Object object) { - itemPropertyDescriptors.add - (createItemPropertyDescriptor - (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), - getResourceLocator(), - getString("_UI_ISymbol_name_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_ISymbol_name_feature", "_UI_ISymbol_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - SymbolPackage.Literals.ISYMBOL__NAME, - true, - false, - false, - ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, - null, - null)); - } - - /** - * This adds a property descriptor for the Java Element feature. - * <!-- begin-user-doc --> - * @param object - * <!-- end-user-doc --> - * @generated - */ - protected void addJavaElementPropertyDescriptor(Object object) { - itemPropertyDescriptors.add - (createItemPropertyDescriptor - (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), - getResourceLocator(), - getString("_UI_IJavaSymbol_javaElement_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_IJavaSymbol_javaElement_feature", "_UI_IJavaSymbol_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - SymbolPackage.Literals.IJAVA_SYMBOL__JAVA_ELEMENT, - true, - false, - false, - ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, - null, - null)); - } - - /** - * This returns IJavaSymbol.gif. - * <!-- begin-user-doc --> - * @param object - * @return the image associated with object or null if not found - * <!-- end-user-doc --> - * @generated - */ - public Object getImage(Object object) { - return overlayImage(object, getResourceLocator().getImage("full/obj16/IJavaSymbol")); //$NON-NLS-1$ - } - - /** - * This returns the label text for the adapted class. - * <!-- begin-user-doc --> - * @param object - * @return the text label associated with object or null if no found - * <!-- end-user-doc --> - * @generated - */ - public String getText(Object object) { - String label = ((IJavaSymbol)object).getName(); - return label == null || label.length() == 0 ? - getString("_UI_IJavaSymbol_type") : //$NON-NLS-1$ - getString("_UI_IJavaSymbol_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * This handles model notifications by calling {@link #updateChildren(Notification)} to update any cached - * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged(Notification)}. - * <!-- begin-user-doc --> - * @param notification - * <!-- end-user-doc --> - * @generated - */ - public void notifyChanged(Notification notification) { - updateChildren(notification); - - switch (notification.getFeatureID(IJavaSymbol.class)) { - case SymbolPackage.IJAVA_SYMBOL__NAME: - case SymbolPackage.IJAVA_SYMBOL__JAVA_ELEMENT: - fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); - return; - } - super.notifyChanged(notification); - } - - /** - * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s - * describing all of the children that can be created under this object. - * <!-- begin-user-doc --> - * @param newChildDescriptors - * @param object - * <!-- end-user-doc --> - * @generated - */ - protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { - super.collectNewChildDescriptors(newChildDescriptors, object); - } - - /** - * Return the resource locator for this item provider's resources. - * <!-- begin-user-doc --> - * @return the resource locator - * <!-- end-user-doc --> - * @generated - */ - public ResourceLocator getResourceLocator() { - return JSFCommonPlugin.INSTANCE; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/provider/IJavaTypeDescriptor2ItemProvider.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/provider/IJavaTypeDescriptor2ItemProvider.java deleted file mode 100644 index 201abe48d..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/provider/IJavaTypeDescriptor2ItemProvider.java +++ /dev/null @@ -1,250 +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.context.symbol.internal.provider; - - -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.ResourceLocator; -import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; -import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.edit.provider.IItemPropertySource; -import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; -import org.eclipse.emf.edit.provider.ITreeItemContentProvider; -import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; -import org.eclipse.emf.edit.provider.ViewerNotification; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; -import org.eclipse.jst.jsf.context.symbol.IJavaTypeDescriptor2; -import org.eclipse.jst.jsf.context.symbol.SymbolPackage; - - - -/** - * This is the item provider adapter for a {@link org.eclipse.jst.jsf.context.symbol.IJavaTypeDescriptor2} object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -public class IJavaTypeDescriptor2ItemProvider - extends ITypeDescriptorItemProvider - implements - IEditingDomainItemProvider, - IStructuredItemContentProvider, - ITreeItemContentProvider, - IItemLabelProvider, - IItemPropertySource { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @SuppressWarnings("hiding") - public static final String copyright = "Copyright 2006 Oracle"; //$NON-NLS-1$ - - /** - * This constructs an instance from a factory and a notifier. - * <!-- begin-user-doc --> - * @param adapterFactory - * <!-- end-user-doc --> - * @generated - */ - public IJavaTypeDescriptor2ItemProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * This returns the property descriptors for the adapted class. - * <!-- begin-user-doc --> - * @param object - * @return the emf property descriptors - * <!-- end-user-doc --> - * @generated - */ - public List getPropertyDescriptors(Object object) { - if (itemPropertyDescriptors == null) { - super.getPropertyDescriptors(object); - - addTypePropertyDescriptor(object); - addBeanPropertiesPropertyDescriptor(object); - addBeanMethodsPropertyDescriptor(object); - } - return itemPropertyDescriptors; - } - - /** - * This adds a property descriptor for the Type feature. - * <!-- begin-user-doc --> - * @param object - * <!-- end-user-doc --> - * @generated - */ - protected void addTypePropertyDescriptor(Object object) { - itemPropertyDescriptors.add - (createItemPropertyDescriptor - (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), - getResourceLocator(), - getString("_UI_IJavaTypeDescriptor2_type_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_IJavaTypeDescriptor2_type_feature", "_UI_IJavaTypeDescriptor2_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - SymbolPackage.Literals.IJAVA_TYPE_DESCRIPTOR2__TYPE, - true, - false, - false, - ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, - null, - null)); - } - - /** - * This adds a property descriptor for the Bean Properties feature. - * <!-- begin-user-doc --> - * @param object - * <!-- end-user-doc --> - * @generated - */ - protected void addBeanPropertiesPropertyDescriptor(Object object) { - itemPropertyDescriptors.add - (createItemPropertyDescriptor - (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), - getResourceLocator(), - getString("_UI_IJavaTypeDescriptor2_beanProperties_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_IJavaTypeDescriptor2_beanProperties_feature", "_UI_IJavaTypeDescriptor2_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - SymbolPackage.Literals.IJAVA_TYPE_DESCRIPTOR2__BEAN_PROPERTIES, - true, - false, - false, - null, - null, - null)); - } - - /** - * This adds a property descriptor for the Bean Methods feature. - * <!-- begin-user-doc --> - * @param object - * <!-- end-user-doc --> - * @generated - */ - protected void addBeanMethodsPropertyDescriptor(Object object) { - itemPropertyDescriptors.add - (createItemPropertyDescriptor - (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), - getResourceLocator(), - getString("_UI_IJavaTypeDescriptor2_beanMethods_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_IJavaTypeDescriptor2_beanMethods_feature", "_UI_IJavaTypeDescriptor2_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - SymbolPackage.Literals.IJAVA_TYPE_DESCRIPTOR2__BEAN_METHODS, - true, - false, - false, - null, - null, - null)); - } - - /** - * This adds a property descriptor for the Array Count feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param object - * @generated - */ - protected void addArrayCountPropertyDescriptor(Object object) { - itemPropertyDescriptors.add - (createItemPropertyDescriptor - (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), - getResourceLocator(), - getString("_UI_IJavaTypeDescriptor2_arrayCount_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_IJavaTypeDescriptor2_arrayCount_feature", "_UI_IJavaTypeDescriptor2_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - SymbolPackage.Literals.IJAVA_TYPE_DESCRIPTOR2__ARRAY_COUNT, - true, - false, - false, - ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE, - null, - null)); - } - - - /** - * This returns IJavaTypeDescriptor2.gif. - * <!-- begin-user-doc --> - * @param object - * @return the image adaption for object - * <!-- end-user-doc --> - * @generated - */ - public Object getImage(Object object) { - return overlayImage(object, getResourceLocator().getImage("full/obj16/IJavaTypeDescriptor2")); //$NON-NLS-1$ - } - - /** - * This returns the label text for the adapted class. - * <!-- begin-user-doc --> - * @param object - * @return the text representation of object - * <!-- end-user-doc --> - * @generated - */ - public String getText(Object object) { - String label = ((IJavaTypeDescriptor2)object).getTypeSignature(); - return label == null || label.length() == 0 ? - getString("_UI_IJavaTypeDescriptor2_type") : //$NON-NLS-1$ - getString("_UI_IJavaTypeDescriptor2_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * This handles model notifications by calling {@link #updateChildren(Notification)} to update any cached - * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged(Notification)}. - * <!-- begin-user-doc --> - * @param notification - * <!-- end-user-doc --> - * @generated - */ - public void notifyChanged(Notification notification) { - updateChildren(notification); - - switch (notification.getFeatureID(IJavaTypeDescriptor2.class)) { - case SymbolPackage.IJAVA_TYPE_DESCRIPTOR2__TYPE: - fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); - return; - } - super.notifyChanged(notification); - } - - /** - * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s - * describing all of the children that can be created under this object. - * <!-- begin-user-doc --> - * @param newChildDescriptors - * @param object - * <!-- end-user-doc --> - * @generated - */ - protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { - super.collectNewChildDescriptors(newChildDescriptors, object); - } - - /** - * Return the resource locator for this item provider's resources. - * <!-- begin-user-doc --> - * @return the resource locator - * <!-- end-user-doc --> - * @generated - */ - public ResourceLocator getResourceLocator() { - return JSFCommonPlugin.INSTANCE; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/provider/IListTypeDescriptorItemProvider.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/provider/IListTypeDescriptorItemProvider.java deleted file mode 100644 index 76d3eb3ed..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/provider/IListTypeDescriptorItemProvider.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: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.context.symbol.internal.provider; - - -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; - -import org.eclipse.emf.common.util.ResourceLocator; - -import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; -import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.edit.provider.IItemPropertySource; -import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; -import org.eclipse.emf.edit.provider.ITreeItemContentProvider; -import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; -import org.eclipse.emf.edit.provider.ViewerNotification; - -import org.eclipse.jst.jsf.common.JSFCommonPlugin; - -import org.eclipse.jst.jsf.context.symbol.IListTypeDescriptor; -import org.eclipse.jst.jsf.context.symbol.SymbolPackage; - -/** - * This is the item provider adapter for a {@link org.eclipse.jst.jsf.context.symbol.IListTypeDescriptor} object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -public class IListTypeDescriptorItemProvider - extends ITypeDescriptorItemProvider - implements - IEditingDomainItemProvider, - IStructuredItemContentProvider, - ITreeItemContentProvider, - IItemLabelProvider, - IItemPropertySource { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @SuppressWarnings("hiding") - public static final String copyright = "Copyright 2006 Oracle"; //$NON-NLS-1$ - - /** - * This constructs an instance from a factory and a notifier. - * <!-- begin-user-doc --> - * @param adapterFactory - * <!-- end-user-doc --> - * @generated - */ - public IListTypeDescriptorItemProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * This returns the property descriptors for the adapted class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public List getPropertyDescriptors(Object object) { - if (itemPropertyDescriptors == null) { - super.getPropertyDescriptors(object); - - addListSourcePropertyDescriptor(object); - } - return itemPropertyDescriptors; - } - - /** - * This adds a property descriptor for the List Source feature. - * <!-- begin-user-doc --> - * @param object - * <!-- end-user-doc --> - * @generated - */ - protected void addListSourcePropertyDescriptor(Object object) { - itemPropertyDescriptors.add - (createItemPropertyDescriptor - (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), - getResourceLocator(), - getString("_UI_IListTypeDescriptor_listSource_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_IListTypeDescriptor_listSource_feature", "_UI_IListTypeDescriptor_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - SymbolPackage.Literals.ILIST_TYPE_DESCRIPTOR__LIST_SOURCE, - true, - false, - false, - ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, - null, - null)); - } - - /** - * This returns IListTypeDescriptor.gif. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Object getImage(Object object) { - return overlayImage(object, getResourceLocator().getImage("full/obj16/IListTypeDescriptor")); //$NON-NLS-1$ - } - - /** - * This returns the label text for the adapted class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getText(Object object) { - String label = ((IListTypeDescriptor)object).getTypeSignature(); - return label == null || label.length() == 0 ? - getString("_UI_IListTypeDescriptor_type") : //$NON-NLS-1$ - getString("_UI_IListTypeDescriptor_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * This handles model notifications by calling {@link #updateChildren(Notification)} to update any cached - * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged(Notification)}. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void notifyChanged(Notification notification) { - updateChildren(notification); - - switch (notification.getFeatureID(IListTypeDescriptor.class)) { - case SymbolPackage.ILIST_TYPE_DESCRIPTOR__LIST_SOURCE: - fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); - return; - } - super.notifyChanged(notification); - } - - /** - * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children - * that can be created under this object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { - super.collectNewChildDescriptors(newChildDescriptors, object); - } - - /** - * Return the resource locator for this item provider's resources. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ResourceLocator getResourceLocator() { - return JSFCommonPlugin.INSTANCE; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/provider/IMapTypeDescriptorItemProvider.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/provider/IMapTypeDescriptorItemProvider.java deleted file mode 100644 index 165629ca9..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/provider/IMapTypeDescriptorItemProvider.java +++ /dev/null @@ -1,204 +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.context.symbol.internal.provider; - - -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.ResourceLocator; -import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; -import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.edit.provider.IItemPropertySource; -import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; -import org.eclipse.emf.edit.provider.ITreeItemContentProvider; -import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; -import org.eclipse.emf.edit.provider.ViewerNotification; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; -import org.eclipse.jst.jsf.context.symbol.IMapTypeDescriptor; -import org.eclipse.jst.jsf.context.symbol.SymbolPackage; - - - -/** - * This is the item provider adapter for a {@link org.eclipse.jst.jsf.context.symbol.IMapTypeDescriptor} object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -public class IMapTypeDescriptorItemProvider - extends ITypeDescriptorItemProvider - implements - IEditingDomainItemProvider, - IStructuredItemContentProvider, - ITreeItemContentProvider, - IItemLabelProvider, - IItemPropertySource { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @SuppressWarnings("hiding") - public static final String copyright = "Copyright 2006 Oracle"; //$NON-NLS-1$ - - /** - * This constructs an instance from a factory and a notifier. - * <!-- begin-user-doc --> - * @param adapterFactory - * <!-- end-user-doc --> - * @generated - */ - public IMapTypeDescriptorItemProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * This returns the property descriptors for the adapted class. - * <!-- begin-user-doc --> - * @param object - * @return the prop descriptor - * <!-- end-user-doc --> - * @generated - */ - public List getPropertyDescriptors(Object object) { - if (itemPropertyDescriptors == null) { - super.getPropertyDescriptors(object); - - addMapSourcePropertyDescriptor(object); - addImmutablePropertyDescriptor(object); - } - return itemPropertyDescriptors; - } - - /** - * This adds a property descriptor for the Map Source feature. - * <!-- begin-user-doc --> - * @param object - * <!-- end-user-doc --> - * @generated - */ - protected void addMapSourcePropertyDescriptor(Object object) { - itemPropertyDescriptors.add - (createItemPropertyDescriptor - (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), - getResourceLocator(), - getString("_UI_IMapTypeDescriptor_mapSource_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_IMapTypeDescriptor_mapSource_feature", "_UI_IMapTypeDescriptor_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - SymbolPackage.Literals.IMAP_TYPE_DESCRIPTOR__MAP_SOURCE, - true, - false, - false, - ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, - null, - null)); - } - - /** - * This adds a property descriptor for the Immutable feature. - * <!-- begin-user-doc --> - * @param object - * <!-- end-user-doc --> - * @generated - */ - protected void addImmutablePropertyDescriptor(Object object) { - itemPropertyDescriptors.add - (createItemPropertyDescriptor - (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), - getResourceLocator(), - getString("_UI_IMapTypeDescriptor_immutable_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_IMapTypeDescriptor_immutable_feature", "_UI_IMapTypeDescriptor_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - SymbolPackage.Literals.IMAP_TYPE_DESCRIPTOR__IMMUTABLE, - true, - false, - false, - ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE, - null, - null)); - } - - /** - * This returns IMapTypeDescriptor.gif. - * <!-- begin-user-doc --> - * @param object - * @return the image adaptation of the object - * <!-- end-user-doc --> - * @generated - */ - public Object getImage(Object object) { - return overlayImage(object, getResourceLocator().getImage("full/obj16/IMapTypeDescriptor")); //$NON-NLS-1$ - } - - /** - * This returns the label text for the adapted class. - * <!-- begin-user-doc --> - * @param object - * @return the text rep of the object - * <!-- end-user-doc --> - * @generated - */ - public String getText(Object object) { - String label = ((IMapTypeDescriptor)object).getTypeSignature(); - return label == null || label.length() == 0 ? - getString("_UI_IMapTypeDescriptor_type") : //$NON-NLS-1$ - getString("_UI_IMapTypeDescriptor_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * This handles model notifications by calling {@link #updateChildren(Notification)} to update any cached - * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged(Notification)}. - * <!-- begin-user-doc --> - * @param notification - * <!-- end-user-doc --> - * @generated - */ - public void notifyChanged(Notification notification) { - updateChildren(notification); - - switch (notification.getFeatureID(IMapTypeDescriptor.class)) { - case SymbolPackage.IMAP_TYPE_DESCRIPTOR__MAP_SOURCE: - case SymbolPackage.IMAP_TYPE_DESCRIPTOR__IMMUTABLE: - fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); - return; - } - super.notifyChanged(notification); - } - - /** - * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s - * describing all of the children that can be created under this object. - * <!-- begin-user-doc --> - * @param newChildDescriptors - * @param object - * <!-- end-user-doc --> - * @generated - */ - protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { - super.collectNewChildDescriptors(newChildDescriptors, object); - } - - /** - * Return the resource locator for this item provider's resources. - * <!-- begin-user-doc --> - * @return the resource locator - * <!-- end-user-doc --> - * @generated - */ - public ResourceLocator getResourceLocator() { - return JSFCommonPlugin.INSTANCE; - } - -} - diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/provider/IMethodSymbolItemProvider.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/provider/IMethodSymbolItemProvider.java deleted file mode 100644 index 0d2902168..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/provider/IMethodSymbolItemProvider.java +++ /dev/null @@ -1,201 +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.context.symbol.internal.provider; - - -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.ResourceLocator; -import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; -import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.edit.provider.IItemPropertySource; -import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; -import org.eclipse.emf.edit.provider.ITreeItemContentProvider; -import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; -import org.eclipse.emf.edit.provider.ItemProviderAdapter; -import org.eclipse.emf.edit.provider.ViewerNotification; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; -import org.eclipse.jst.jsf.context.symbol.IMethodSymbol; -import org.eclipse.jst.jsf.context.symbol.SymbolPackage; - -/** - * This is the item provider adapter for a {@link org.eclipse.jst.jsf.context.symbol.IMethodSymbol} object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -public class IMethodSymbolItemProvider - extends ItemProviderAdapter - implements - IEditingDomainItemProvider, - IStructuredItemContentProvider, - ITreeItemContentProvider, - IItemLabelProvider, - IItemPropertySource { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright 2006 Oracle"; //$NON-NLS-1$ - - /** - * This constructs an instance from a factory and a notifier. - * <!-- begin-user-doc --> - * @param adapterFactory - * <!-- end-user-doc --> - * @generated - */ - public IMethodSymbolItemProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * This returns the property descriptors for the adapted class. - * <!-- begin-user-doc --> - * @param object - * @return the property sheet descriptors - * <!-- end-user-doc --> - * @generated - */ - public List getPropertyDescriptors(Object object) { - if (itemPropertyDescriptors == null) { - super.getPropertyDescriptors(object); - - addNamePropertyDescriptor(object); - addSignaturePropertyDescriptor(object); - } - return itemPropertyDescriptors; - } - - /** - * This adds a property descriptor for the Name feature. - * <!-- begin-user-doc --> - * @param object - * <!-- end-user-doc --> - * @generated - */ - protected void addNamePropertyDescriptor(Object object) { - itemPropertyDescriptors.add - (createItemPropertyDescriptor - (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), - getResourceLocator(), - getString("_UI_ISymbol_name_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_ISymbol_name_feature", "_UI_ISymbol_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - SymbolPackage.Literals.ISYMBOL__NAME, - true, - false, - false, - ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, - null, - null)); - } - - /** - * This adds a property descriptor for the Signature feature. - * <!-- begin-user-doc --> - * @param object - * <!-- end-user-doc --> - * @generated - */ - protected void addSignaturePropertyDescriptor(Object object) { - itemPropertyDescriptors.add - (createItemPropertyDescriptor - (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), - getResourceLocator(), - getString("_UI_IMethodSymbol_signature_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_IMethodSymbol_signature_feature", "_UI_IMethodSymbol_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - SymbolPackage.Literals.IMETHOD_SYMBOL__SIGNATURE, - true, - false, - false, - ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, - null, - null)); - } - - /** - * This returns IMethodSymbol.gif. - * <!-- begin-user-doc --> - * @param object - * @return the image representatino of object - * <!-- end-user-doc --> - * @generated - */ - public Object getImage(Object object) { - return overlayImage(object, getResourceLocator().getImage("full/obj16/IMethodSymbol")); //$NON-NLS-1$ - } - - /** - * This returns the label text for the adapted class. - * <!-- begin-user-doc --> - * @param object - * @return the text represention of object - * <!-- end-user-doc --> - * @generated - */ - public String getText(Object object) { - String label = ((IMethodSymbol)object).getName(); - return label == null || label.length() == 0 ? - getString("_UI_IMethodSymbol_type") : //$NON-NLS-1$ - getString("_UI_IMethodSymbol_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * This handles model notifications by calling {@link #updateChildren(Notification)} to update any cached - * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged(Notification)}. - * <!-- begin-user-doc --> - * @param notification - * <!-- end-user-doc --> - * @generated - */ - public void notifyChanged(Notification notification) { - updateChildren(notification); - - switch (notification.getFeatureID(IMethodSymbol.class)) { - case SymbolPackage.IMETHOD_SYMBOL__NAME: - case SymbolPackage.IMETHOD_SYMBOL__SIGNATURE: - fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); - return; - } - super.notifyChanged(notification); - } - - /** - * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s - * describing all of the children that can be created under this object. - * <!-- begin-user-doc --> - * @param newChildDescriptors - * @param object - * <!-- end-user-doc --> - * @generated - */ - protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { - super.collectNewChildDescriptors(newChildDescriptors, object); - } - - /** - * Return the resource locator for this item provider's resources. - * <!-- begin-user-doc --> - * @return the EMF resource locator - * <!-- end-user-doc --> - * @generated - */ - public ResourceLocator getResourceLocator() { - return JSFCommonPlugin.INSTANCE; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/provider/IPropertySymbolItemProvider.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/provider/IPropertySymbolItemProvider.java deleted file mode 100644 index 3958147ad..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/provider/IPropertySymbolItemProvider.java +++ /dev/null @@ -1,361 +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.context.symbol.internal.provider; - - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.ResourceLocator; -import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; -import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.edit.provider.IItemPropertySource; -import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; -import org.eclipse.emf.edit.provider.ITreeItemContentProvider; -import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; -import org.eclipse.emf.edit.provider.ItemProviderAdapter; -import org.eclipse.emf.edit.provider.ViewerNotification; -import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry; -import org.eclipse.jface.text.contentassist.ICompletionProposal; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; -import org.eclipse.jst.jsf.context.symbol.IDescribedInDetail; -import org.eclipse.jst.jsf.context.symbol.IPropertySymbol; -import org.eclipse.jst.jsf.context.symbol.SymbolPackage; -import org.eclipse.jst.jsf.context.symbol.provider.IContentProposalProvider; -import org.eclipse.swt.graphics.Image; -import org.eclipse.wst.sse.ui.internal.contentassist.CustomCompletionProposal; - -/** - * This is the item provider adapter for a {@link org.eclipse.jst.jsf.context.symbol.IPropertySymbol} object. - * <!-- begin-user-doc --> - * @extends IContentProposalProvider - * <!-- end-user-doc --> - * @generated - */ -public class IPropertySymbolItemProvider - extends ItemProviderAdapter - implements - IEditingDomainItemProvider, - IStructuredItemContentProvider, - ITreeItemContentProvider, - IItemLabelProvider, - IItemPropertySource, - IContentProposalProvider{ - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright 2006 Oracle"; //$NON-NLS-1$ - - /** - * This constructs an instance from a factory and a notifier. - * <!-- begin-user-doc --> - * @param adapterFactory - * <!-- end-user-doc --> - * @generated - */ - public IPropertySymbolItemProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * This returns the property descriptors for the adapted class. - * <!-- begin-user-doc --> - * @param object - * @return the property descriptors - * <!-- end-user-doc --> - * @generated - */ - public List getPropertyDescriptors(Object object) { - if (itemPropertyDescriptors == null) { - super.getPropertyDescriptors(object); - - addNamePropertyDescriptor(object); - addTypeDescriptorPropertyDescriptor(object); - addReadablePropertyDescriptor(object); - addWritablePropertyDescriptor(object); - addIntermediatePropertyDescriptor(object); - } - return itemPropertyDescriptors; - } - - /** - * This adds a property descriptor for the Name feature. - * <!-- begin-user-doc --> - * @param object - * <!-- end-user-doc --> - * @generated - */ - protected void addNamePropertyDescriptor(Object object) { - itemPropertyDescriptors.add - (createItemPropertyDescriptor - (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), - getResourceLocator(), - getString("_UI_ISymbol_name_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_ISymbol_name_feature", "_UI_ISymbol_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - SymbolPackage.Literals.ISYMBOL__NAME, - true, - false, - false, - ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, - null, - null)); - } - - /** - * This adds a property descriptor for the Type Descriptor feature. - * <!-- begin-user-doc --> - * @param object - * <!-- end-user-doc --> - * @generated - */ - protected void addTypeDescriptorPropertyDescriptor(Object object) { - itemPropertyDescriptors.add - (createItemPropertyDescriptor - (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), - getResourceLocator(), - getString("_UI_IObjectSymbol_typeDescriptor_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_IObjectSymbol_typeDescriptor_feature", "_UI_IObjectSymbol_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - SymbolPackage.Literals.IOBJECT_SYMBOL__TYPE_DESCRIPTOR, - true, - false, - true, - null, - null, - null)); - } - - /** - * This adds a property descriptor for the Readable feature. - * <!-- begin-user-doc --> - * @param object - * <!-- end-user-doc --> - * @generated - */ - protected void addReadablePropertyDescriptor(Object object) { - itemPropertyDescriptors.add - (createItemPropertyDescriptor - (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), - getResourceLocator(), - getString("_UI_IObjectSymbol_readable_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_IObjectSymbol_readable_feature", "_UI_IObjectSymbol_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - SymbolPackage.Literals.IOBJECT_SYMBOL__READABLE, - true, - false, - false, - ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE, - null, - null)); - } - - /** - * This adds a property descriptor for the Writable feature. - * <!-- begin-user-doc --> - * @param object - * <!-- end-user-doc --> - * @generated - */ - protected void addWritablePropertyDescriptor(Object object) { - itemPropertyDescriptors.add - (createItemPropertyDescriptor - (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), - getResourceLocator(), - getString("_UI_IObjectSymbol_writable_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_IObjectSymbol_writable_feature", "_UI_IObjectSymbol_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - SymbolPackage.Literals.IOBJECT_SYMBOL__WRITABLE, - true, - false, - false, - ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE, - null, - null)); - } - - /** - * This adds a property descriptor for the Intermediate feature. - * <!-- begin-user-doc --> - * @param object - * <!-- end-user-doc --> - * @generated - */ - protected void addIntermediatePropertyDescriptor(Object object) { - itemPropertyDescriptors.add - (createItemPropertyDescriptor - (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), - getResourceLocator(), - getString("_UI_IPropertySymbol_intermediate_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_IPropertySymbol_intermediate_feature", "_UI_IPropertySymbol_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - SymbolPackage.Literals.IPROPERTY_SYMBOL__INTERMEDIATE, - true, - false, - false, - ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE, - null, - null)); - } - - /** - * This returns IPropertySymbol.gif. - * <!-- begin-user-doc --> - * @param object - * @return the image rep of object - * <!-- end-user-doc --> - * @generated - */ - public Object getImage(Object object) { - return overlayImage(object, getResourceLocator().getImage("full/obj16/IPropertySymbol")); //$NON-NLS-1$ - } - - /** - * This returns the label text for the adapted class. - * <!-- begin-user-doc --> - * @param object - * @return the text representation of the object - * <!-- end-user-doc --> - * @generated NOT - */ - public String getText(Object object) { - String label = ((IPropertySymbol)object).getName(); - return label == null || label.length() == 0 ? - getString("_UI_IPropertySymbol_type") : //$NON-NLS-1$ - label; - } - - /** - * This handles model notifications by calling {@link #updateChildren(Notification)} to update any cached - * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged(Notification)}. - * <!-- begin-user-doc --> - * @param notification - * <!-- end-user-doc --> - * @generated - */ - public void notifyChanged(Notification notification) { - updateChildren(notification); - - switch (notification.getFeatureID(IPropertySymbol.class)) { - case SymbolPackage.IPROPERTY_SYMBOL__NAME: - case SymbolPackage.IPROPERTY_SYMBOL__READABLE: - case SymbolPackage.IPROPERTY_SYMBOL__WRITABLE: - case SymbolPackage.IPROPERTY_SYMBOL__INTERMEDIATE: - fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); - return; - } - super.notifyChanged(notification); - } - - /** - * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s - * describing all of the children that can be created under this object. - * <!-- begin-user-doc --> - * @param newChildDescriptors - * @param object - * <!-- end-user-doc --> - * @generated - */ - protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { - super.collectNewChildDescriptors(newChildDescriptors, object); - } - - /** - * Return the resource locator for this item provider's resources. - * <!-- begin-user-doc --> - * @return the resource locator - * <!-- end-user-doc --> - * @generated - */ - public ResourceLocator getResourceLocator() { - return JSFCommonPlugin.INSTANCE; - } - - /** - * @see org.eclipse.emf.edit.provider.ItemProviderAdapter#getChildren(java.lang.Object) - */ - public Collection getChildren(Object object) - { - final List childSymbols = new ArrayList(); - childSymbols.addAll(((IPropertySymbol)object).getTypeDescriptor().getProperties()); - return Collections.unmodifiableList(childSymbols); - } - - /** - * @see org.eclipse.jst.jsf.context.symbol.provider.IContentProposalProvider#getProposals(Object, org.eclipse.jst.jsf.context.symbol.provider.IContentProposalProvider.IProposalCreationFactory) - */ - public ICompletionProposal[] getProposals(Object target1, IProposalCreationFactory proposalFactory) - { - return getProposalsInternal((IPropertySymbol) target1, proposalFactory, ""); //$NON-NLS-1$ - } - - private ICompletionProposal[] getProposalsInternal(IPropertySymbol symbol, IProposalCreationFactory proposalFactory, String intermediatePrefix) - { - final List completions = new ArrayList(); - final Image displayImage = - ExtendedImageRegistry.getInstance().getImage(getImage(symbol)); - - if (symbol.isIntermediate()) - { - // see if there's something using this as intermediate completion - List props = symbol.getTypeDescriptor().getProperties(); - - for (final Iterator it = props.iterator(); it.hasNext();) - { - final IPropertySymbol propSymbol = (IPropertySymbol) it.next(); - - if (!propSymbol.isIntermediate()) - { - final String replacementText = "['" + intermediatePrefix + symbol.getName() + "." + propSymbol.getName() + "']"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - completions.add(proposalFactory.createProposal( - replacementText, - replacementText, - null, - displayImage, symbol)); - } - else - { - completions.addAll(Arrays.asList(getProposalsInternal(propSymbol, proposalFactory, intermediatePrefix+symbol.getName()+"."))); //$NON-NLS-1$ - } - } - } - else - { - final String replacementText = intermediatePrefix + symbol.getName(); - final String displayText = symbol.getName(); - - completions.add(createProposal(symbol, replacementText, displayText, displayImage, - proposalFactory)); - } - - return (ICompletionProposal[]) completions.toArray(new CustomCompletionProposal[0]); - - } - - private ICompletionProposal createProposal(IPropertySymbol symbol, - final String replacementText, final String displayText, - final Image displayImage, IProposalCreationFactory proposalFactory) { - String additionalText = null; // TODO: put property value here where possible? - if (symbol instanceof IDescribedInDetail) { - additionalText = ((IDescribedInDetail) symbol).getDetailedDescription(); - } - return proposalFactory.createProposal( - replacementText, - displayText, - additionalText, - displayImage, symbol); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/provider/ITypeDescriptorItemProvider.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/provider/ITypeDescriptorItemProvider.java deleted file mode 100644 index 4c34ed350..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/provider/ITypeDescriptorItemProvider.java +++ /dev/null @@ -1,372 +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.context.symbol.internal.provider; - - -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.ResourceLocator; -import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; -import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.edit.provider.IItemPropertySource; -import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; -import org.eclipse.emf.edit.provider.ITreeItemContentProvider; -import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; -import org.eclipse.emf.edit.provider.ItemProviderAdapter; -import org.eclipse.emf.edit.provider.ViewerNotification; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; -import org.eclipse.jst.jsf.context.symbol.ITypeDescriptor; -import org.eclipse.jst.jsf.context.symbol.SymbolPackage; - - - - -/** - * This is the item provider adapter for a {@link org.eclipse.jst.jsf.context.symbol.ITypeDescriptor} object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -public class ITypeDescriptorItemProvider - extends ItemProviderAdapter - implements - IEditingDomainItemProvider, - IStructuredItemContentProvider, - ITreeItemContentProvider, - IItemLabelProvider, - IItemPropertySource { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright 2006 Oracle"; //$NON-NLS-1$ - - /** - * This constructs an instance from a factory and a notifier. - * <!-- begin-user-doc --> - * @param adapterFactory - * <!-- end-user-doc --> - * @generated - */ - public ITypeDescriptorItemProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * This returns the property descriptors for the adapted class. - * <!-- begin-user-doc --> - * @param object - * @return the list of property descriptors - * <!-- end-user-doc --> - * @generated - */ - public List getPropertyDescriptors(Object object) { - if (itemPropertyDescriptors == null) { - super.getPropertyDescriptors(object); - - addPropertiesPropertyDescriptor(object); - addTypeSignaturePropertyDescriptor(object); - addSuperTypeSignaturesPropertyDescriptor(object); - addInterfaceTypeSignaturesPropertyDescriptor(object); - addTypeSignatureDelegatePropertyDescriptor(object); - addMethodsPropertyDescriptor(object); - } - return itemPropertyDescriptors; - } - - /** - * This adds a property descriptor for the Properties feature. - * <!-- begin-user-doc --> - * @param object - * <!-- end-user-doc --> - * @generated - */ - protected void addPropertiesPropertyDescriptor(Object object) { - itemPropertyDescriptors.add - (createItemPropertyDescriptor - (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), - getResourceLocator(), - getString("_UI_ITypeDescriptor_properties_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_ITypeDescriptor_properties_feature", "_UI_ITypeDescriptor_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - SymbolPackage.Literals.ITYPE_DESCRIPTOR__PROPERTIES, - true, - false, - true, - null, - null, - null)); - } - - /** - * This adds a property descriptor for the Type Signature feature. - * <!-- begin-user-doc --> - * @param object - * <!-- end-user-doc --> - * @generated - */ - protected void addTypeSignaturePropertyDescriptor(Object object) { - itemPropertyDescriptors.add - (createItemPropertyDescriptor - (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), - getResourceLocator(), - getString("_UI_ITypeDescriptor_typeSignature_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_ITypeDescriptor_typeSignature_feature", "_UI_ITypeDescriptor_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - SymbolPackage.Literals.ITYPE_DESCRIPTOR__TYPE_SIGNATURE, - false, - false, - false, - ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, - null, - null)); - } - - /** - * This adds a property descriptor for the Super Type Signatures feature. - * <!-- begin-user-doc --> - * @param object - * <!-- end-user-doc --> - * @generated - */ - protected void addSuperTypeSignaturesPropertyDescriptor(Object object) { - itemPropertyDescriptors.add - (createItemPropertyDescriptor - (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), - getResourceLocator(), - getString("_UI_ITypeDescriptor_superTypeSignatures_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_ITypeDescriptor_superTypeSignatures_feature", "_UI_ITypeDescriptor_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - SymbolPackage.Literals.ITYPE_DESCRIPTOR__SUPER_TYPE_SIGNATURES, - true, - false, - false, - ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, - null, - null)); - } - - /** - * This adds a property descriptor for the Interface Type Signatures feature. - * <!-- begin-user-doc --> - * @param object - * <!-- end-user-doc --> - * @generated - */ - protected void addInterfaceTypeSignaturesPropertyDescriptor(Object object) { - itemPropertyDescriptors.add - (createItemPropertyDescriptor - (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), - getResourceLocator(), - getString("_UI_ITypeDescriptor_interfaceTypeSignatures_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_ITypeDescriptor_interfaceTypeSignatures_feature", "_UI_ITypeDescriptor_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - SymbolPackage.Literals.ITYPE_DESCRIPTOR__INTERFACE_TYPE_SIGNATURES, - true, - false, - false, - ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, - null, - null)); - } - - /** - * This adds a property descriptor for the Type Signature Delegate feature. - * <!-- begin-user-doc --> - * @param object - * <!-- end-user-doc --> - * @generated - */ - protected void addTypeSignatureDelegatePropertyDescriptor(Object object) { - itemPropertyDescriptors.add - (createItemPropertyDescriptor - (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), - getResourceLocator(), - getString("_UI_ITypeDescriptor_typeSignatureDelegate_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_ITypeDescriptor_typeSignatureDelegate_feature", "_UI_ITypeDescriptor_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - SymbolPackage.Literals.ITYPE_DESCRIPTOR__TYPE_SIGNATURE_DELEGATE, - true, - false, - false, - ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, - null, - null)); - } - - /** - * This adds a property descriptor for the Methods feature. - * <!-- begin-user-doc --> - * @param object - * <!-- end-user-doc --> - * @generated - */ - protected void addMethodsPropertyDescriptor(Object object) { - itemPropertyDescriptors.add - (createItemPropertyDescriptor - (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), - getResourceLocator(), - getString("_UI_ITypeDescriptor_methods_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_ITypeDescriptor_methods_feature", "_UI_ITypeDescriptor_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - SymbolPackage.Literals.ITYPE_DESCRIPTOR__METHODS, - true, - false, - true, - null, - null, - null)); - } - - /** - * This adds a property descriptor for the Type Parameter Signatures feature. - * <!-- begin-user-doc --> - * @param object - * <!-- end-user-doc --> - * @generated - */ - protected void addTypeParameterSignaturesPropertyDescriptor(Object object) { - itemPropertyDescriptors.add - (createItemPropertyDescriptor - (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), - getResourceLocator(), - getString("_UI_ITypeDescriptor_typeParameterSignatures_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_ITypeDescriptor_typeParameterSignatures_feature", "_UI_ITypeDescriptor_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - SymbolPackage.Literals.ITYPE_DESCRIPTOR__TYPE_PARAMETER_SIGNATURES, - true, - false, - false, - ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, - null, - null)); - } - - /** - * This adds a property descriptor for the Jdt Context feature. - * <!-- begin-user-doc --> - * @param object - * <!-- end-user-doc --> - * @generated - */ - protected void addJdtContextPropertyDescriptor(Object object) { - itemPropertyDescriptors.add - (createItemPropertyDescriptor - (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), - getResourceLocator(), - getString("_UI_ITypeDescriptor_jdtContext_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_ITypeDescriptor_jdtContext_feature", "_UI_ITypeDescriptor_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - SymbolPackage.Literals.ITYPE_DESCRIPTOR__JDT_CONTEXT, - true, - false, - false, - ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, - null, - null)); - } - - /** - * This adds a property descriptor for the Enum Type feature. - * <!-- begin-user-doc --> - * @param object - * <!-- end-user-doc --> - * @generated - */ - protected void addEnumTypePropertyDescriptor(Object object) { - itemPropertyDescriptors.add - (createItemPropertyDescriptor - (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), - getResourceLocator(), - getString("_UI_ITypeDescriptor_enumType_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_ITypeDescriptor_enumType_feature", "_UI_ITypeDescriptor_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - SymbolPackage.Literals.ITYPE_DESCRIPTOR__ENUM_TYPE, - true, - false, - false, - ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE, - null, - null)); - } - - /** - * This returns ITypeDescriptor.gif. - * <!-- begin-user-doc --> - * @param object - * @return the image associated with object or null if not found - * <!-- end-user-doc --> - * @generated - */ - public Object getImage(Object object) { - return overlayImage(object, getResourceLocator().getImage("full/obj16/ITypeDescriptor")); //$NON-NLS-1$ - } - - /** - * This returns the label text for the adapted class. - * <!-- begin-user-doc --> - * @param object - * @return the text label associated with object or null if not found - * <!-- end-user-doc --> - * @generated - */ - public String getText(Object object) { - String label = ((ITypeDescriptor)object).getTypeSignature(); - return label == null || label.length() == 0 ? - getString("_UI_ITypeDescriptor_type") : //$NON-NLS-1$ - getString("_UI_ITypeDescriptor_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * This handles model notifications by calling {@link #updateChildren(Notification)} to update any cached - * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged(Notification)}. - * <!-- begin-user-doc --> - * @param notification - * <!-- end-user-doc --> - * @generated - */ - public void notifyChanged(Notification notification) { - updateChildren(notification); - - switch (notification.getFeatureID(ITypeDescriptor.class)) { - case SymbolPackage.ITYPE_DESCRIPTOR__TYPE_SIGNATURE: - case SymbolPackage.ITYPE_DESCRIPTOR__SUPER_TYPE_SIGNATURES: - case SymbolPackage.ITYPE_DESCRIPTOR__INTERFACE_TYPE_SIGNATURES: - case SymbolPackage.ITYPE_DESCRIPTOR__TYPE_SIGNATURE_DELEGATE: - fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); - return; - } - super.notifyChanged(notification); - } - - /** - * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s - * describing all of the children that can be created under this object. - * <!-- begin-user-doc --> - * @param newChildDescriptors - * @param object - * <!-- end-user-doc --> - * @generated - */ - protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { - super.collectNewChildDescriptors(newChildDescriptors, object); - } - - /** - * Return the resource locator for this item provider's resources. - * <!-- begin-user-doc --> - * @return the resource locator - * <!-- end-user-doc --> - * @generated - */ - public ResourceLocator getResourceLocator() { - return JSFCommonPlugin.INSTANCE; - } - -} - diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/provider/SymbolItemProviderAdapterFactory.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/provider/SymbolItemProviderAdapterFactory.java deleted file mode 100644 index 6dc9171c9..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/provider/SymbolItemProviderAdapterFactory.java +++ /dev/null @@ -1,534 +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.context.symbol.internal.provider; - -import java.util.ArrayList; -import java.util.Collection; - -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.Notifier; -import org.eclipse.emf.edit.provider.ChangeNotifier; -import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; -import org.eclipse.emf.edit.provider.ComposedAdapterFactory; -import org.eclipse.emf.edit.provider.IChangeNotifier; -import org.eclipse.emf.edit.provider.IDisposable; -import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.edit.provider.IItemPropertySource; -import org.eclipse.emf.edit.provider.INotifyChangedListener; -import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; -import org.eclipse.emf.edit.provider.ITreeItemContentProvider; -import org.eclipse.jst.jsf.context.symbol.internal.util.SymbolAdapterFactory; -import org.eclipse.jst.jsf.context.symbol.provider.IContentProposalProvider; - -/** - * This is the factory that is used to provide the interfaces needed to support Viewers. - * The adapters generated by this factory convert EMF adapter notifications into calls to {@link #fireNotifyChanged fireNotifyChanged}. - * The adapters also support Eclipse property sheets. - * Note that most of the adapters are shared among multiple instances. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -public class SymbolItemProviderAdapterFactory extends SymbolAdapterFactory implements ComposeableAdapterFactory, IChangeNotifier, IDisposable { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @SuppressWarnings("hiding") - public static final String copyright = "Copyright 2006 Oracle"; //$NON-NLS-1$ - - /** - * This keeps track of the root adapter factory that delegates to this adapter factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ComposedAdapterFactory parentAdapterFactory; - - /** - * This is used to implement {@link org.eclipse.emf.edit.provider.IChangeNotifier}. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IChangeNotifier changeNotifier = new ChangeNotifier(); - - /** - * This keeps track of all the supported types checked by {@link #isFactoryForType isFactoryForType}. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Collection supportedTypes = new ArrayList(); - - /** - * This constructs an instance. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * TODO: try to got to Gen function to add custom adapters - * instead of a NOT - * @generated NOT - */ - public SymbolItemProviderAdapterFactory() { - supportedTypes.add(IEditingDomainItemProvider.class); - supportedTypes.add(IStructuredItemContentProvider.class); - supportedTypes.add(ITreeItemContentProvider.class); - supportedTypes.add(IItemLabelProvider.class); - supportedTypes.add(IItemPropertySource.class); - supportedTypes.add(IContentProposalProvider.class); - } - - /** - * This keeps track of the one adapter used for all {@link org.eclipse.jst.jsf.context.symbol.IBeanInstanceSymbol} instances. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IBeanInstanceSymbolItemProvider iBeanInstanceSymbolItemProvider; - - /** - * This creates an adapter for a {@link org.eclipse.jst.jsf.context.symbol.IBeanInstanceSymbol}. - * <!-- begin-user-doc --> - * @return the adapter - * <!-- end-user-doc --> - * @generated - */ - public Adapter createIBeanInstanceSymbolAdapter() { - if (iBeanInstanceSymbolItemProvider == null) { - iBeanInstanceSymbolItemProvider = new IBeanInstanceSymbolItemProvider(this); - } - - return iBeanInstanceSymbolItemProvider; - } - - /** - * This keeps track of the one adapter used for all {@link org.eclipse.jst.jsf.context.symbol.IBeanPropertySymbol} instances. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IBeanPropertySymbolItemProvider iBeanPropertySymbolItemProvider; - - /** - * This creates an adapter for a {@link org.eclipse.jst.jsf.context.symbol.IBeanPropertySymbol}. - * <!-- begin-user-doc --> - * @return the adapter - * <!-- end-user-doc --> - * @generated - */ - public Adapter createIBeanPropertySymbolAdapter() { - if (iBeanPropertySymbolItemProvider == null) { - iBeanPropertySymbolItemProvider = new IBeanPropertySymbolItemProvider(this); - } - - return iBeanPropertySymbolItemProvider; - } - - /** - * This keeps track of the one adapter used for all {@link org.eclipse.jst.jsf.context.symbol.IInstanceSymbol} instances. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IInstanceSymbolItemProvider iInstanceSymbolItemProvider; - - /** - * This creates an adapter for a {@link org.eclipse.jst.jsf.context.symbol.IInstanceSymbol}. - * <!-- begin-user-doc --> - * @return the adapter - * <!-- end-user-doc --> - * @generated - */ - public Adapter createIInstanceSymbolAdapter() { - if (iInstanceSymbolItemProvider == null) { - iInstanceSymbolItemProvider = new IInstanceSymbolItemProvider(this); - } - - return iInstanceSymbolItemProvider; - } - - /** - * This keeps track of the one adapter used for all {@link org.eclipse.jst.jsf.context.symbol.IJavaSymbol} instances. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IJavaSymbolItemProvider iJavaSymbolItemProvider; - - /** - * This creates an adapter for a {@link org.eclipse.jst.jsf.context.symbol.IJavaSymbol}. - * <!-- begin-user-doc --> - * @return the adapter - * <!-- end-user-doc --> - * @generated - */ - public Adapter createIJavaSymbolAdapter() { - if (iJavaSymbolItemProvider == null) { - iJavaSymbolItemProvider = new IJavaSymbolItemProvider(this); - } - - return iJavaSymbolItemProvider; - } - - /** - * This keeps track of the one adapter used for all {@link org.eclipse.jst.jsf.context.symbol.IJavaTypeDescriptor2} instances. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IJavaTypeDescriptor2ItemProvider iJavaTypeDescriptor2ItemProvider; - - /** - * This creates an adapter for a {@link org.eclipse.jst.jsf.context.symbol.IJavaTypeDescriptor2}. - * <!-- begin-user-doc --> - * @return the adapter - * <!-- end-user-doc --> - * @generated - */ - public Adapter createIJavaTypeDescriptor2Adapter() { - if (iJavaTypeDescriptor2ItemProvider == null) { - iJavaTypeDescriptor2ItemProvider = new IJavaTypeDescriptor2ItemProvider(this); - } - - return iJavaTypeDescriptor2ItemProvider; - } - - /** - * This keeps track of the one adapter used for all {@link org.eclipse.jst.jsf.context.symbol.IBeanMethodSymbol} instances. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IBeanMethodSymbolItemProvider iBeanMethodSymbolItemProvider; - - /** - * This creates an adapter for a {@link org.eclipse.jst.jsf.context.symbol.IBeanMethodSymbol}. - * <!-- begin-user-doc --> - * @return the adapter - * <!-- end-user-doc --> - * @generated - */ - public Adapter createIBeanMethodSymbolAdapter() { - if (iBeanMethodSymbolItemProvider == null) { - iBeanMethodSymbolItemProvider = new IBeanMethodSymbolItemProvider(this); - } - - return iBeanMethodSymbolItemProvider; - } - - /** - * This keeps track of the one adapter used for all {@link org.eclipse.jst.jsf.context.symbol.IComponentSymbol} instances. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IComponentSymbolItemProvider iComponentSymbolItemProvider; - - /** - * This creates an adapter for a {@link org.eclipse.jst.jsf.context.symbol.IComponentSymbol}. - * <!-- begin-user-doc --> - * @return the adapter - * <!-- end-user-doc --> - * @generated - */ - public Adapter createIComponentSymbolAdapter() { - if (iComponentSymbolItemProvider == null) { - iComponentSymbolItemProvider = new IComponentSymbolItemProvider(this); - } - - return iComponentSymbolItemProvider; - } - - /** - * This keeps track of the one adapter used for all {@link org.eclipse.jst.jsf.context.symbol.IPropertySymbol} instances. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IPropertySymbolItemProvider iPropertySymbolItemProvider; - - /** - * This creates an adapter for a {@link org.eclipse.jst.jsf.context.symbol.IPropertySymbol}. - * <!-- begin-user-doc --> - * @return the property symbol adapter - * <!-- end-user-doc --> - * @generated - */ - public Adapter createIPropertySymbolAdapter() { - if (iPropertySymbolItemProvider == null) { - iPropertySymbolItemProvider = new IPropertySymbolItemProvider(this); - } - - return iPropertySymbolItemProvider; - } - - /** - * This keeps track of the one adapter used for all {@link org.eclipse.jst.jsf.context.symbol.IMapTypeDescriptor} instances. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IMapTypeDescriptorItemProvider iMapTypeDescriptorItemProvider; - - /** - * This creates an adapter for a {@link org.eclipse.jst.jsf.context.symbol.IMapTypeDescriptor}. - * <!-- begin-user-doc --> - * @return the adapter - * <!-- end-user-doc --> - * @generated - */ - public Adapter createIMapTypeDescriptorAdapter() { - if (iMapTypeDescriptorItemProvider == null) { - iMapTypeDescriptorItemProvider = new IMapTypeDescriptorItemProvider(this); - } - - return iMapTypeDescriptorItemProvider; - } - - /** - * This keeps track of the one adapter used for all {@link org.eclipse.jst.jsf.context.symbol.IMethodSymbol} instances. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IMethodSymbolItemProvider iMethodSymbolItemProvider; - - /** - * This creates an adapter for a {@link org.eclipse.jst.jsf.context.symbol.IMethodSymbol}. - * <!-- begin-user-doc --> - * @return the adapter for method symbols - * <!-- end-user-doc --> - * @generated - */ - public Adapter createIMethodSymbolAdapter() { - if (iMethodSymbolItemProvider == null) { - iMethodSymbolItemProvider = new IMethodSymbolItemProvider(this); - } - - return iMethodSymbolItemProvider; - } - - /** - * This keeps track of the one adapter used for all {@link org.eclipse.jst.jsf.context.symbol.IBoundedMapTypeDescriptor} instances. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IBoundedMapTypeDescriptorItemProvider iBoundedMapTypeDescriptorItemProvider; - - /** - * This creates an adapter for a {@link org.eclipse.jst.jsf.context.symbol.IBoundedMapTypeDescriptor}. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Adapter createIBoundedMapTypeDescriptorAdapter() { - if (iBoundedMapTypeDescriptorItemProvider == null) { - iBoundedMapTypeDescriptorItemProvider = new IBoundedMapTypeDescriptorItemProvider(this); - } - - return iBoundedMapTypeDescriptorItemProvider; - } - - /** - * This keeps track of the one adapter used for all {@link org.eclipse.jst.jsf.context.symbol.IBoundedJavaTypeDescriptor} instances. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IBoundedJavaTypeDescriptorItemProvider iBoundedJavaTypeDescriptorItemProvider; - - /** - * This creates an adapter for a {@link org.eclipse.jst.jsf.context.symbol.IBoundedJavaTypeDescriptor}. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Adapter createIBoundedJavaTypeDescriptorAdapter() { - if (iBoundedJavaTypeDescriptorItemProvider == null) { - iBoundedJavaTypeDescriptorItemProvider = new IBoundedJavaTypeDescriptorItemProvider(this); - } - - return iBoundedJavaTypeDescriptorItemProvider; - } - - /** - * This keeps track of the one adapter used for all {@link org.eclipse.jst.jsf.context.symbol.IListTypeDescriptor} instances. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IListTypeDescriptorItemProvider iListTypeDescriptorItemProvider; - - /** - * This creates an adapter for a {@link org.eclipse.jst.jsf.context.symbol.IListTypeDescriptor}. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Adapter createIListTypeDescriptorAdapter() { - if (iListTypeDescriptorItemProvider == null) { - iListTypeDescriptorItemProvider = new IListTypeDescriptorItemProvider(this); - } - - return iListTypeDescriptorItemProvider; - } - - /** - * This keeps track of the one adapter used for all {@link org.eclipse.jst.jsf.context.symbol.IBoundedListTypeDescriptor} instances. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IBoundedListTypeDescriptorItemProvider iBoundedListTypeDescriptorItemProvider; - - /** - * This creates an adapter for a {@link org.eclipse.jst.jsf.context.symbol.IBoundedListTypeDescriptor}. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Adapter createIBoundedListTypeDescriptorAdapter() { - if (iBoundedListTypeDescriptorItemProvider == null) { - iBoundedListTypeDescriptorItemProvider = new IBoundedListTypeDescriptorItemProvider(this); - } - - return iBoundedListTypeDescriptorItemProvider; - } - - /** - * This returns the root adapter factory that contains this factory. - * <!-- begin-user-doc --> - * @return the adapter factory - * <!-- end-user-doc --> - * @generated - */ - public ComposeableAdapterFactory getRootAdapterFactory() { - return parentAdapterFactory == null ? this : parentAdapterFactory.getRootAdapterFactory(); - } - - /** - * This sets the composed adapter factory that contains this factory. - * <!-- begin-user-doc --> - * @param parentAdapterFactory - * <!-- end-user-doc --> - * @generated - */ - public void setParentAdapterFactory(ComposedAdapterFactory parentAdapterFactory) { - this.parentAdapterFactory = parentAdapterFactory; - } - - /** - * <!-- begin-user-doc --> - * @param type - * @return true if the factory supports the adapter type - * <!-- end-user-doc --> - * @generated - */ - public boolean isFactoryForType(Object type) { - return supportedTypes.contains(type) || super.isFactoryForType(type); - } - - /** - * This implementation substitutes the factory itself as the key for the adapter. - * <!-- begin-user-doc --> - * @param notifier - * @param type - * @return the adapter - * <!-- end-user-doc --> - * @generated - */ - public Adapter adapt(Notifier notifier, Object type) { - return super.adapt(notifier, this); - } - - /** - * <!-- begin-user-doc --> - * @param object - * @param type - * @return the adapted object - * <!-- end-user-doc --> - * @generated - */ - public Object adapt(Object object, Object type) { - if (isFactoryForType(type)) { - Object adapter = super.adapt(object, type); - if (!(type instanceof Class) || (((Class)type).isInstance(adapter))) { - return adapter; - } - } - - return null; - } - - /** - * This adds a listener. - * <!-- begin-user-doc --> - * @param notifyChangedListener - * <!-- end-user-doc --> - * @generated - */ - public void addListener(INotifyChangedListener notifyChangedListener) { - changeNotifier.addListener(notifyChangedListener); - } - - /** - * This removes a listener. - * <!-- begin-user-doc --> - * @param notifyChangedListener - * <!-- end-user-doc --> - * @generated - */ - public void removeListener(INotifyChangedListener notifyChangedListener) { - changeNotifier.removeListener(notifyChangedListener); - } - - /** - * This delegates to {@link #changeNotifier} and to {@link #parentAdapterFactory}. - * <!-- begin-user-doc --> - * @param notification - * <!-- end-user-doc --> - * @generated - */ - public void fireNotifyChanged(Notification notification) { - changeNotifier.fireNotifyChanged(notification); - - if (parentAdapterFactory != null) { - parentAdapterFactory.fireNotifyChanged(notification); - } - } - - /** - * This disposes all of the item providers created by this factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void dispose() { - if (iBeanInstanceSymbolItemProvider != null) iBeanInstanceSymbolItemProvider.dispose(); - if (iBeanPropertySymbolItemProvider != null) iBeanPropertySymbolItemProvider.dispose(); - if (iInstanceSymbolItemProvider != null) iInstanceSymbolItemProvider.dispose(); - if (iJavaSymbolItemProvider != null) iJavaSymbolItemProvider.dispose(); - if (iJavaTypeDescriptor2ItemProvider != null) iJavaTypeDescriptor2ItemProvider.dispose(); - if (iBeanMethodSymbolItemProvider != null) iBeanMethodSymbolItemProvider.dispose(); - if (iComponentSymbolItemProvider != null) iComponentSymbolItemProvider.dispose(); - if (iPropertySymbolItemProvider != null) iPropertySymbolItemProvider.dispose(); - if (iMapTypeDescriptorItemProvider != null) iMapTypeDescriptorItemProvider.dispose(); - if (iMethodSymbolItemProvider != null) iMethodSymbolItemProvider.dispose(); - if (iBoundedMapTypeDescriptorItemProvider != null) iBoundedMapTypeDescriptorItemProvider.dispose(); - if (iBoundedJavaTypeDescriptorItemProvider != null) iBoundedJavaTypeDescriptorItemProvider.dispose(); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/source/UnknownTypeContextSymbolFactory.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/source/UnknownTypeContextSymbolFactory.java deleted file mode 100644 index 4a77889fe..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/source/UnknownTypeContextSymbolFactory.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.context.symbol.internal.source; - -import java.util.List; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.jst.jsf.context.symbol.ERuntimeSource; -import org.eclipse.jst.jsf.context.symbol.ISymbol; -import org.eclipse.jst.jsf.context.symbol.InitializedSymbolFactory; -import org.eclipse.jst.jsf.context.symbol.source.AbstractContextSymbolFactory; -import org.eclipse.jst.jsf.context.symbol.source.IAdditionalContextSymbolInfo; - -/** - * Returns an unknown component symbol. - * - * @author cbateman - * - */ -public final class UnknownTypeContextSymbolFactory extends -AbstractContextSymbolFactory -{ - private final InitializedSymbolFactory _factory = new InitializedSymbolFactory(); - - @Override - protected ISymbol internalCreate(final String symbolName, final int scope, - final IAdaptable context, final List problems) - { - return internalCreate(symbolName, scope, context, null); - } - - @Override - protected ISymbol internalCreate(final String symbolName, final int scope, - final IAdaptable context, final List problems, - final IAdditionalContextSymbolInfo info) - { - return _factory.createUnknownComponentSymbol(symbolName, - ERuntimeSource.TAG_INSTANTIATED_SYMBOL_LITERAL); - } - @Override - public boolean supports(final IAdaptable context) - { - return true; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/util/IMethodSymbolBasedType.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/util/IMethodSymbolBasedType.java deleted file mode 100644 index ae764bed7..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/util/IMethodSymbolBasedType.java +++ /dev/null @@ -1,41 +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.context.symbol.internal.util; - -import org.eclipse.jst.jsf.common.internal.types.MethodType; -import org.eclipse.jst.jsf.context.symbol.IMethodSymbol; - -/** - * - * @author cbateman - * - */ -public class IMethodSymbolBasedType extends MethodType -{ - private final IMethodSymbol _methodSymbol; - - /** - * @param methodSymbol - */ - public IMethodSymbolBasedType(IMethodSymbol methodSymbol) - { - super(methodSymbol.getName(), methodSymbol.getSignature()); - _methodSymbol = methodSymbol; - } - - /** - * @return the method symbol - */ - public IMethodSymbol getSymbol() - { - return _methodSymbol; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/util/IObjectSymbolBasedValueType.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/util/IObjectSymbolBasedValueType.java deleted file mode 100644 index 04fbe527d..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/util/IObjectSymbolBasedValueType.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.context.symbol.internal.util; - -import org.eclipse.jst.jsf.common.internal.types.IAssignable; -import org.eclipse.jst.jsf.common.internal.types.ValueType; -import org.eclipse.jst.jsf.context.symbol.IInstanceSymbol; -import org.eclipse.jst.jsf.context.symbol.IObjectSymbol; -import org.eclipse.jst.jsf.context.symbol.IPropertySymbol; -import org.eclipse.jst.jsf.context.symbol.ISymbol; - -/** - * A value type adapter class for IObjectSymbol's - * - * @author cbateman - * - */ -public class IObjectSymbolBasedValueType extends ValueType -{ - private final IObjectSymbol _symbol; - - /** - * @param symbol - * @return a properly configured instance based on the sub-type of symbol. - * Returns null if symbol is not of an appropriate IObjectSymbol type - */ - public static IObjectSymbolBasedValueType getInstance(ISymbol symbol) - { - if (symbol instanceof IInstanceSymbol) - { - if (((IInstanceSymbol)symbol).getTypeDescriptor() != null) - { - return new IObjectSymbolBasedValueType((IInstanceSymbol) symbol); - } - } - else if (symbol instanceof IPropertySymbol) - { - if (((IPropertySymbol)symbol).getTypeDescriptor() != null) - { - return new IObjectSymbolBasedValueType((IPropertySymbol) symbol); - } - } - - return null; - } - - /** - * Constructor for instance symbols (model objects) - * @param symbol - */ - public IObjectSymbolBasedValueType(final IInstanceSymbol symbol) - { - this(symbol.getTypeDescriptor().getTypeSignature(), - (String[])symbol.getTypeDescriptor().getTypeParameterSignatures().toArray(EMPTY_STRING_ARRAY), - (String[])symbol.getTypeDescriptor().getSuperTypeSignatures().toArray(EMPTY_STRING_ARRAY), - (String[])symbol.getTypeDescriptor().getInterfaceTypeSignatures().toArray(EMPTY_STRING_ARRAY), - symbol.getTypeDescriptor().isEnumType(), - IAssignable.ASSIGNMENT_TYPE_RHS /* variables are not assignable */ - , symbol); - } - - /** - * Constructor for property symbols - * - * @param symbol - */ - public IObjectSymbolBasedValueType(final IPropertySymbol symbol) - { - this(symbol.getTypeDescriptor().getTypeSignature(), - (String[])symbol.getTypeDescriptor().getTypeParameterSignatures().toArray(EMPTY_STRING_ARRAY), - (String[])symbol.getTypeDescriptor().getSuperTypeSignatures().toArray(EMPTY_STRING_ARRAY), - (String[])symbol.getTypeDescriptor().getInterfaceTypeSignatures().toArray(EMPTY_STRING_ARRAY), - symbol.getTypeDescriptor().isEnumType(), - ASSIGNMENT_TYPE_NONE | (symbol.isReadable()?IAssignable.ASSIGNMENT_TYPE_RHS:ASSIGNMENT_TYPE_NONE)|(symbol.isWritable()?IAssignable.ASSIGNMENT_TYPE_LHS:ASSIGNMENT_TYPE_NONE) - , symbol); - } - - private IObjectSymbolBasedValueType(final String signature, - final String[] typeArgs, - final String[] superTypes, - final String[] interfaceTypes, - final boolean isEnumType, - final int assignmentMask, - final IObjectSymbol symbol) - { - super(signature, typeArgs, superTypes, interfaceTypes, isEnumType, assignmentMask); - _symbol = symbol; - } - - /** - * @return the underlying IObjectSymbol - */ - public IObjectSymbol getSymbol() - { - return _symbol; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/util/SymbolAdapterFactory.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/util/SymbolAdapterFactory.java deleted file mode 100644 index dcecf364a..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/util/SymbolAdapterFactory.java +++ /dev/null @@ -1,457 +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.context.symbol.internal.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.context.symbol.IBeanInstanceSymbol; -import org.eclipse.jst.jsf.context.symbol.IBeanMethodSymbol; -import org.eclipse.jst.jsf.context.symbol.IBeanPropertySymbol; -import org.eclipse.jst.jsf.context.symbol.IBoundedJavaTypeDescriptor; -import org.eclipse.jst.jsf.context.symbol.IBoundedListTypeDescriptor; -import org.eclipse.jst.jsf.context.symbol.IBoundedMapTypeDescriptor; -import org.eclipse.jst.jsf.context.symbol.IBoundedTypeDescriptor; -import org.eclipse.jst.jsf.context.symbol.IComponentSymbol; -import org.eclipse.jst.jsf.context.symbol.IDescribedInDetail; -import org.eclipse.jst.jsf.context.symbol.IInstanceSymbol; -import org.eclipse.jst.jsf.context.symbol.IJavaSymbol; -import org.eclipse.jst.jsf.context.symbol.IJavaTypeDescriptor2; -import org.eclipse.jst.jsf.context.symbol.IListTypeDescriptor; -import org.eclipse.jst.jsf.context.symbol.IMapTypeDescriptor; -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.ITypeDescriptor; -import org.eclipse.jst.jsf.context.symbol.SymbolPackage; - - - -/** - * <!-- 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.context.symbol.SymbolPackage - * @generated - */ -public class SymbolAdapterFactory extends AdapterFactoryImpl { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright 2006 Oracle"; //$NON-NLS-1$ - - /** - * The cached model package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected static SymbolPackage modelPackage; - - /** - * Creates an instance of the adapter factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public SymbolAdapterFactory() { - if (modelPackage == null) { - modelPackage = SymbolPackage.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 SymbolSwitch modelSwitch = - new SymbolSwitch() { - public Object caseIBeanInstanceSymbol(IBeanInstanceSymbol object) { - return createIBeanInstanceSymbolAdapter(); - } - public Object caseIBeanPropertySymbol(IBeanPropertySymbol object) { - return createIBeanPropertySymbolAdapter(); - } - public Object caseIInstanceSymbol(IInstanceSymbol object) { - return createIInstanceSymbolAdapter(); - } - public Object caseIJavaSymbol(IJavaSymbol object) { - return createIJavaSymbolAdapter(); - } - public Object caseISymbol(ISymbol object) { - return createISymbolAdapter(); - } - public Object caseITypeDescriptor(ITypeDescriptor object) { - return createITypeDescriptorAdapter(); - } - public Object caseIDescribedInDetail(IDescribedInDetail object) { - return createIDescribedInDetailAdapter(); - } - public Object caseIJavaTypeDescriptor2(IJavaTypeDescriptor2 object) { - return createIJavaTypeDescriptor2Adapter(); - } - public Object caseIBeanMethodSymbol(IBeanMethodSymbol object) { - return createIBeanMethodSymbolAdapter(); - } - public Object caseIComponentSymbol(IComponentSymbol object) { - return createIComponentSymbolAdapter(); - } - public Object caseIPropertySymbol(IPropertySymbol object) { - return createIPropertySymbolAdapter(); - } - public Object caseIMapTypeDescriptor(IMapTypeDescriptor object) { - return createIMapTypeDescriptorAdapter(); - } - public Object caseIMethodSymbol(IMethodSymbol object) { - return createIMethodSymbolAdapter(); - } - public Object caseIObjectSymbol(IObjectSymbol object) { - return createIObjectSymbolAdapter(); - } - public Object caseIBoundedTypeDescriptor(IBoundedTypeDescriptor object) { - return createIBoundedTypeDescriptorAdapter(); - } - public Object caseIBoundedMapTypeDescriptor(IBoundedMapTypeDescriptor object) { - return createIBoundedMapTypeDescriptorAdapter(); - } - public Object caseIBoundedJavaTypeDescriptor(IBoundedJavaTypeDescriptor object) { - return createIBoundedJavaTypeDescriptorAdapter(); - } - public Object caseIListTypeDescriptor(IListTypeDescriptor object) { - return createIListTypeDescriptorAdapter(); - } - public Object caseIBoundedListTypeDescriptor(IBoundedListTypeDescriptor object) { - return createIBoundedListTypeDescriptorAdapter(); - } - 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.context.symbol.IBeanInstanceSymbol <em>IBean Instance Symbol</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.context.symbol.IBeanInstanceSymbol - * @generated - */ - public Adapter createIBeanInstanceSymbolAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.context.symbol.IBeanPropertySymbol <em>IBean Property Symbol</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.context.symbol.IBeanPropertySymbol - * @generated - */ - public Adapter createIBeanPropertySymbolAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.context.symbol.IInstanceSymbol <em>IInstance Symbol</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.context.symbol.IInstanceSymbol - * @generated - */ - public Adapter createIInstanceSymbolAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.context.symbol.IJavaSymbol <em>IJava Symbol</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.context.symbol.IJavaSymbol - * @generated - */ - public Adapter createIJavaSymbolAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.context.symbol.ISymbol <em>ISymbol</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.context.symbol.ISymbol - * @generated - */ - public Adapter createISymbolAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.context.symbol.ITypeDescriptor <em>IType Descriptor</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.context.symbol.ITypeDescriptor - * @generated - */ - public Adapter createITypeDescriptorAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.context.symbol.IDescribedInDetail <em>IDescribed In Detail</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.context.symbol.IDescribedInDetail - * @generated - */ - public Adapter createIDescribedInDetailAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.context.symbol.IJavaTypeDescriptor2 <em>IJava Type Descriptor2</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.context.symbol.IJavaTypeDescriptor2 - * @generated - */ - public Adapter createIJavaTypeDescriptor2Adapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.context.symbol.IBeanMethodSymbol <em>IBean Method Symbol</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.context.symbol.IBeanMethodSymbol - * @generated - */ - public Adapter createIBeanMethodSymbolAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.context.symbol.IComponentSymbol <em>IComponent Symbol</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.context.symbol.IComponentSymbol - * @generated - */ - public Adapter createIComponentSymbolAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.context.symbol.IPropertySymbol <em>IProperty Symbol</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.context.symbol.IPropertySymbol - * @generated - */ - public Adapter createIPropertySymbolAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.context.symbol.IMapTypeDescriptor <em>IMap Type Descriptor</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.context.symbol.IMapTypeDescriptor - * @generated - */ - public Adapter createIMapTypeDescriptorAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.context.symbol.IMethodSymbol <em>IMethod Symbol</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.context.symbol.IMethodSymbol - * @generated - */ - public Adapter createIMethodSymbolAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.context.symbol.IObjectSymbol <em>IObject Symbol</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.context.symbol.IObjectSymbol - * @generated - */ - public Adapter createIObjectSymbolAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.context.symbol.IBoundedTypeDescriptor <em>IBounded Type Descriptor</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.context.symbol.IBoundedTypeDescriptor - * @generated - */ - public Adapter createIBoundedTypeDescriptorAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.context.symbol.IBoundedMapTypeDescriptor <em>IBounded Map Type Descriptor</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.context.symbol.IBoundedMapTypeDescriptor - * @generated - */ - public Adapter createIBoundedMapTypeDescriptorAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.context.symbol.IBoundedJavaTypeDescriptor <em>IBounded Java Type Descriptor</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.context.symbol.IBoundedJavaTypeDescriptor - * @generated - */ - public Adapter createIBoundedJavaTypeDescriptorAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.context.symbol.IListTypeDescriptor <em>IList Type Descriptor</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.context.symbol.IListTypeDescriptor - * @generated - */ - public Adapter createIListTypeDescriptorAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.context.symbol.IBoundedListTypeDescriptor <em>IBounded List Type Descriptor</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.context.symbol.IBoundedListTypeDescriptor - * @generated - */ - public Adapter createIBoundedListTypeDescriptorAdapter() { - 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; - } - -} //SymbolAdapterFactory diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/util/SymbolSwitch.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/util/SymbolSwitch.java deleted file mode 100644 index 92c774619..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/util/SymbolSwitch.java +++ /dev/null @@ -1,579 +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.context.symbol.internal.util; - -import java.util.List; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jst.jsf.context.symbol.IBeanInstanceSymbol; -import org.eclipse.jst.jsf.context.symbol.IBeanMethodSymbol; -import org.eclipse.jst.jsf.context.symbol.IBeanPropertySymbol; -import org.eclipse.jst.jsf.context.symbol.IBoundedJavaTypeDescriptor; -import org.eclipse.jst.jsf.context.symbol.IBoundedListTypeDescriptor; -import org.eclipse.jst.jsf.context.symbol.IBoundedMapTypeDescriptor; -import org.eclipse.jst.jsf.context.symbol.IBoundedTypeDescriptor; -import org.eclipse.jst.jsf.context.symbol.IComponentSymbol; -import org.eclipse.jst.jsf.context.symbol.IDescribedInDetail; -import org.eclipse.jst.jsf.context.symbol.IInstanceSymbol; -import org.eclipse.jst.jsf.context.symbol.IJavaSymbol; -import org.eclipse.jst.jsf.context.symbol.IJavaTypeDescriptor2; -import org.eclipse.jst.jsf.context.symbol.IListTypeDescriptor; -import org.eclipse.jst.jsf.context.symbol.IMapTypeDescriptor; -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.ITypeDescriptor; -import org.eclipse.jst.jsf.context.symbol.SymbolPackage; - - - -/** - * <!-- 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.context.symbol.SymbolPackage - * @generated - */ -public class SymbolSwitch { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright 2006 Oracle"; //$NON-NLS-1$ - - /** - * The cached model package - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected static SymbolPackage modelPackage; - - /** - * Creates an instance of the switch. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public SymbolSwitch() { - if (modelPackage == null) { - modelPackage = SymbolPackage.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 SymbolPackage.IBEAN_INSTANCE_SYMBOL: { - IBeanInstanceSymbol iBeanInstanceSymbol = (IBeanInstanceSymbol)theEObject; - Object result = caseIBeanInstanceSymbol(iBeanInstanceSymbol); - if (result == null) result = caseIInstanceSymbol(iBeanInstanceSymbol); - if (result == null) result = caseIDescribedInDetail(iBeanInstanceSymbol); - if (result == null) result = caseIObjectSymbol(iBeanInstanceSymbol); - if (result == null) result = caseISymbol(iBeanInstanceSymbol); - if (result == null) result = defaultCase(theEObject); - return result; - } - case SymbolPackage.IBEAN_PROPERTY_SYMBOL: { - IBeanPropertySymbol iBeanPropertySymbol = (IBeanPropertySymbol)theEObject; - Object result = caseIBeanPropertySymbol(iBeanPropertySymbol); - if (result == null) result = caseIPropertySymbol(iBeanPropertySymbol); - if (result == null) result = caseIDescribedInDetail(iBeanPropertySymbol); - if (result == null) result = caseIObjectSymbol(iBeanPropertySymbol); - if (result == null) result = caseISymbol(iBeanPropertySymbol); - if (result == null) result = defaultCase(theEObject); - return result; - } - case SymbolPackage.IINSTANCE_SYMBOL: { - IInstanceSymbol iInstanceSymbol = (IInstanceSymbol)theEObject; - Object result = caseIInstanceSymbol(iInstanceSymbol); - if (result == null) result = caseIObjectSymbol(iInstanceSymbol); - if (result == null) result = caseISymbol(iInstanceSymbol); - if (result == null) result = defaultCase(theEObject); - return result; - } - case SymbolPackage.IJAVA_SYMBOL: { - IJavaSymbol iJavaSymbol = (IJavaSymbol)theEObject; - Object result = caseIJavaSymbol(iJavaSymbol); - if (result == null) result = caseISymbol(iJavaSymbol); - if (result == null) result = defaultCase(theEObject); - return result; - } - case SymbolPackage.ISYMBOL: { - ISymbol iSymbol = (ISymbol)theEObject; - Object result = caseISymbol(iSymbol); - if (result == null) result = defaultCase(theEObject); - return result; - } - case SymbolPackage.ITYPE_DESCRIPTOR: { - ITypeDescriptor iTypeDescriptor = (ITypeDescriptor)theEObject; - Object result = caseITypeDescriptor(iTypeDescriptor); - if (result == null) result = defaultCase(theEObject); - return result; - } - case SymbolPackage.IDESCRIBED_IN_DETAIL: { - IDescribedInDetail iDescribedInDetail = (IDescribedInDetail)theEObject; - Object result = caseIDescribedInDetail(iDescribedInDetail); - if (result == null) result = defaultCase(theEObject); - return result; - } - case SymbolPackage.IJAVA_TYPE_DESCRIPTOR2: { - IJavaTypeDescriptor2 iJavaTypeDescriptor2 = (IJavaTypeDescriptor2)theEObject; - Object result = caseIJavaTypeDescriptor2(iJavaTypeDescriptor2); - if (result == null) result = caseITypeDescriptor(iJavaTypeDescriptor2); - if (result == null) result = defaultCase(theEObject); - return result; - } - case SymbolPackage.IBEAN_METHOD_SYMBOL: { - IBeanMethodSymbol iBeanMethodSymbol = (IBeanMethodSymbol)theEObject; - Object result = caseIBeanMethodSymbol(iBeanMethodSymbol); - if (result == null) result = caseIDescribedInDetail(iBeanMethodSymbol); - if (result == null) result = caseIMethodSymbol(iBeanMethodSymbol); - if (result == null) result = caseISymbol(iBeanMethodSymbol); - if (result == null) result = defaultCase(theEObject); - return result; - } - case SymbolPackage.ICOMPONENT_SYMBOL: { - IComponentSymbol iComponentSymbol = (IComponentSymbol)theEObject; - Object result = caseIComponentSymbol(iComponentSymbol); - if (result == null) result = caseIInstanceSymbol(iComponentSymbol); - if (result == null) result = caseIDescribedInDetail(iComponentSymbol); - if (result == null) result = caseIObjectSymbol(iComponentSymbol); - if (result == null) result = caseISymbol(iComponentSymbol); - if (result == null) result = defaultCase(theEObject); - return result; - } - case SymbolPackage.IPROPERTY_SYMBOL: { - IPropertySymbol iPropertySymbol = (IPropertySymbol)theEObject; - Object result = caseIPropertySymbol(iPropertySymbol); - if (result == null) result = caseIObjectSymbol(iPropertySymbol); - if (result == null) result = caseISymbol(iPropertySymbol); - if (result == null) result = defaultCase(theEObject); - return result; - } - case SymbolPackage.IMAP_TYPE_DESCRIPTOR: { - IMapTypeDescriptor iMapTypeDescriptor = (IMapTypeDescriptor)theEObject; - Object result = caseIMapTypeDescriptor(iMapTypeDescriptor); - if (result == null) result = caseITypeDescriptor(iMapTypeDescriptor); - if (result == null) result = defaultCase(theEObject); - return result; - } - case SymbolPackage.IMETHOD_SYMBOL: { - IMethodSymbol iMethodSymbol = (IMethodSymbol)theEObject; - Object result = caseIMethodSymbol(iMethodSymbol); - if (result == null) result = caseISymbol(iMethodSymbol); - if (result == null) result = defaultCase(theEObject); - return result; - } - case SymbolPackage.IOBJECT_SYMBOL: { - IObjectSymbol iObjectSymbol = (IObjectSymbol)theEObject; - Object result = caseIObjectSymbol(iObjectSymbol); - if (result == null) result = caseISymbol(iObjectSymbol); - if (result == null) result = defaultCase(theEObject); - return result; - } - case SymbolPackage.IBOUNDED_TYPE_DESCRIPTOR: { - IBoundedTypeDescriptor iBoundedTypeDescriptor = (IBoundedTypeDescriptor)theEObject; - Object result = caseIBoundedTypeDescriptor(iBoundedTypeDescriptor); - if (result == null) result = caseITypeDescriptor(iBoundedTypeDescriptor); - if (result == null) result = defaultCase(theEObject); - return result; - } - case SymbolPackage.IBOUNDED_MAP_TYPE_DESCRIPTOR: { - IBoundedMapTypeDescriptor iBoundedMapTypeDescriptor = (IBoundedMapTypeDescriptor)theEObject; - Object result = caseIBoundedMapTypeDescriptor(iBoundedMapTypeDescriptor); - if (result == null) result = caseIMapTypeDescriptor(iBoundedMapTypeDescriptor); - if (result == null) result = caseIBoundedTypeDescriptor(iBoundedMapTypeDescriptor); - if (result == null) result = caseITypeDescriptor(iBoundedMapTypeDescriptor); - if (result == null) result = defaultCase(theEObject); - return result; - } - case SymbolPackage.IBOUNDED_JAVA_TYPE_DESCRIPTOR: { - IBoundedJavaTypeDescriptor iBoundedJavaTypeDescriptor = (IBoundedJavaTypeDescriptor)theEObject; - Object result = caseIBoundedJavaTypeDescriptor(iBoundedJavaTypeDescriptor); - if (result == null) result = caseIJavaTypeDescriptor2(iBoundedJavaTypeDescriptor); - if (result == null) result = caseIBoundedTypeDescriptor(iBoundedJavaTypeDescriptor); - if (result == null) result = caseITypeDescriptor(iBoundedJavaTypeDescriptor); - if (result == null) result = defaultCase(theEObject); - return result; - } - case SymbolPackage.ILIST_TYPE_DESCRIPTOR: { - IListTypeDescriptor iListTypeDescriptor = (IListTypeDescriptor)theEObject; - Object result = caseIListTypeDescriptor(iListTypeDescriptor); - if (result == null) result = caseITypeDescriptor(iListTypeDescriptor); - if (result == null) result = defaultCase(theEObject); - return result; - } - case SymbolPackage.IBOUNDED_LIST_TYPE_DESCRIPTOR: { - IBoundedListTypeDescriptor iBoundedListTypeDescriptor = (IBoundedListTypeDescriptor)theEObject; - Object result = caseIBoundedListTypeDescriptor(iBoundedListTypeDescriptor); - if (result == null) result = caseIListTypeDescriptor(iBoundedListTypeDescriptor); - if (result == null) result = caseIBoundedTypeDescriptor(iBoundedListTypeDescriptor); - if (result == null) result = caseITypeDescriptor(iBoundedListTypeDescriptor); - if (result == null) result = defaultCase(theEObject); - return result; - } - default: return defaultCase(theEObject); - } - } - - /** - * Returns the result of interpretting the object as an instance of '<em>IBean Instance Symbol</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>IBean Instance Symbol</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object caseIBeanInstanceSymbol(IBeanInstanceSymbol object) { - return null; - } - - /** - * Returns the result of interpretting the object as an instance of '<em>IBean Property Symbol</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>IBean Property Symbol</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object caseIBeanPropertySymbol(IBeanPropertySymbol object) { - return null; - } - - /** - * Returns the result of interpretting the object as an instance of '<em>IInstance Symbol</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>IInstance Symbol</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object caseIInstanceSymbol(IInstanceSymbol object) { - return null; - } - - /** - * Returns the result of interpretting the object as an instance of '<em>IJava Symbol</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>IJava Symbol</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object caseIJavaSymbol(IJavaSymbol object) { - return null; - } - - /** - * Returns the result of interpretting the object as an instance of '<em>ISymbol</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>ISymbol</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object caseISymbol(ISymbol object) { - return null; - } - - /** - * Returns the result of interpretting the object as an instance of '<em>IType Descriptor</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>IType Descriptor</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object caseITypeDescriptor(ITypeDescriptor object) { - return null; - } - - /** - * Returns the result of interpretting the object as an instance of '<em>IDescribed In Detail</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>IDescribed In Detail</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object caseIDescribedInDetail(IDescribedInDetail object) { - return null; - } - - /** - * Returns the result of interpretting the object as an instance of '<em>IJava Type Descriptor2</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>IJava Type Descriptor2</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object caseIJavaTypeDescriptor2(IJavaTypeDescriptor2 object) { - return null; - } - - /** - * Returns the result of interpretting the object as an instance of '<em>IBean Method Symbol</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>IBean Method Symbol</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object caseIBeanMethodSymbol(IBeanMethodSymbol object) { - return null; - } - - /** - * Returns the result of interpretting the object as an instance of '<em>IComponent Symbol</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>IComponent Symbol</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object caseIComponentSymbol(IComponentSymbol object) { - return null; - } - - /** - * Returns the result of interpretting the object as an instance of '<em>IProperty Symbol</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>IProperty Symbol</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object caseIPropertySymbol(IPropertySymbol object) { - return null; - } - - /** - * Returns the result of interpretting the object as an instance of '<em>IMap Type Descriptor</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>IMap Type Descriptor</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object caseIMapTypeDescriptor(IMapTypeDescriptor object) { - return null; - } - - /** - * Returns the result of interpretting the object as an instance of '<em>IMethod Symbol</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>IMethod Symbol</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object caseIMethodSymbol(IMethodSymbol object) { - return null; - } - - /** - * Returns the result of interpretting the object as an instance of '<em>IObject Symbol</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>IObject Symbol</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object caseIObjectSymbol(IObjectSymbol object) { - return null; - } - - /** - * Returns the result of interpretting the object as an instance of '<em>IBounded Type Descriptor</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>IBounded Type Descriptor</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object caseIBoundedTypeDescriptor(IBoundedTypeDescriptor object) { - return null; - } - - /** - * Returns the result of interpretting the object as an instance of '<em>IBounded Map Type Descriptor</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>IBounded Map Type Descriptor</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object caseIBoundedMapTypeDescriptor(IBoundedMapTypeDescriptor object) { - return null; - } - - /** - * Returns the result of interpretting the object as an instance of '<em>IBounded Java Type Descriptor</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>IBounded Java Type Descriptor</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object caseIBoundedJavaTypeDescriptor(IBoundedJavaTypeDescriptor object) { - return null; - } - - /** - * Returns the result of interpretting the object as an instance of '<em>IList Type Descriptor</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>IList Type Descriptor</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object caseIListTypeDescriptor(IListTypeDescriptor object) { - return null; - } - - /** - * Returns the result of interpretting the object as an instance of '<em>IBounded List Type Descriptor</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>IBounded List Type Descriptor</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object caseIBoundedListTypeDescriptor(IBoundedListTypeDescriptor 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; - } - -} //SymbolSwitch - diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/package-info.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/package-info.java deleted file mode 100644 index 3e43b1440..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/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 - * - ********************************************************************************/ - -/** - * EL symbols framework. - * - * <p><b>Provisional API - subject to change</b></p> - */ -package org.eclipse.jst.jsf.context.symbol; diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/provider/IContentProposalProvider.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/provider/IContentProposalProvider.java deleted file mode 100644 index b37344b04..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/provider/IContentProposalProvider.java +++ /dev/null @@ -1,62 +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.context.symbol.provider; - -import org.eclipse.jface.text.contentassist.ICompletionProposal; -import org.eclipse.swt.graphics.Image; - -/** - * Adapts an object to appropriate content proposal - * - * <p><b>Provisional API - subject to change</b></p> - * - * @author cbateman - * - */ -public interface IContentProposalProvider -{ - /** - * @param target - * @param proposalFactory - * @return an content proposal for target or null - * if nothing appropriate can be created - */ - ICompletionProposal[] getProposals(Object target, - IProposalCreationFactory proposalFactory); - - /** - * Implementors of the class can configure certain aspects of the returned - * proposals - * - * @author cbateman - * - */ - public interface IProposalCreationFactory - { - /** - * @param replacementText The text to be replaced - * @param displayText The text to be displayed in the assist window - * @param additionalText The text to be displayed in the "addition info" - * or null - * @param displayImage The image to be displayed or null - * @param sourceObject The original source object. Implementors should - * make no assumptions (i.e. always test instanceof before casting) - * @return a configured completion proposal for the parameters - */ - ICompletionProposal createProposal(final String replacementText, - final String displayText, - final String additionalText, - final Image displayImage, - final Object sourceObject); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/provider/ProposalCreationFactoryAdapter.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/provider/ProposalCreationFactoryAdapter.java deleted file mode 100644 index 588a48b01..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/provider/ProposalCreationFactoryAdapter.java +++ /dev/null @@ -1,105 +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.context.symbol.provider; - -import org.eclipse.jface.text.contentassist.ICompletionProposal; -import org.eclipse.jface.text.contentassist.IContextInformation; -import org.eclipse.jst.jsf.context.symbol.provider.IContentProposalProvider.IProposalCreationFactory; -import org.eclipse.swt.graphics.Image; -import org.eclipse.wst.sse.ui.internal.contentassist.CustomCompletionProposal; - -/** - * Default implementation of the proposal creation factory - * - * <p><b>Provisional API - subject to change</b></p> - * - * @author cbateman - * - */ -public class ProposalCreationFactoryAdapter implements IProposalCreationFactory -{ - /** - * The absolute document offset where the replacement is to occur - */ - protected final int _replacementOffset; - /** - * The number of characters to replace starting from _replaceOffset with - * the proposal. 0 indicates insertion with no replacement - */ - protected final int _replacementLength; - - /** - * @param replacementOffset -- the absolute document offset to do the replacement - * @param replacementLength -- the number of characters to replace or 0 - * for insert without any replacement - */ - public ProposalCreationFactoryAdapter(final int replacementOffset, - final int replacementLength) - { - _replacementOffset = replacementOffset; - _replacementLength = replacementLength; - } - - public ICompletionProposal createProposal(String replacementText, - String displayText, String additionalText, Image displayImage, - Object targetObject) - - { - return createDefaultProposal(replacementText, - _replacementOffset, - _replacementLength, - replacementText.length(), - displayImage, - displayText, - null, - additionalText, - 1); - } - - /** - * Simple factory method for creating a default proposal - * - * @param replacementText - * @param replacementOffset - * @param replacementLength - * @param cursorPosition - * @param displayImage - * @param displayText - * @param contextInfo - * @param additionalText - * @param relevance - * @return a default configuration of the completion proposal based on - * the CustomCompletionProposal - */ - protected static ICompletionProposal - createDefaultProposal(final String replacementText, - final int replacementOffset, - final int replacementLength, - final int cursorPosition, - final Image displayImage, - final String displayText, - final IContextInformation contextInfo, - final String additionalText, - final int relevance) - { - return new CustomCompletionProposal(replacementText, - replacementOffset, - replacementLength, - cursorPosition, - displayImage, - displayText, - contextInfo, - additionalText, - relevance); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/provider/package-info.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/provider/package-info.java deleted file mode 100644 index c1dcf6340..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/provider/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 - * - ********************************************************************************/ - -/** - * Extended providers for the EL symbols framework. - * - * <p><b>Provisional API - subject to change</b></p> - */ -package org.eclipse.jst.jsf.context.symbol.provider; diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/source/AbstractContextSymbolFactory.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/source/AbstractContextSymbolFactory.java deleted file mode 100644 index 149250c71..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/source/AbstractContextSymbolFactory.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: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.context.symbol.source; - -import java.util.List; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; -import org.eclipse.jst.jsf.context.symbol.ISymbol; - -/** - * Must be sub-classed by all contextSymbolFactory extension point implementors - * to create context configured symbols - * - * <p><b>Provisional API - subject to change</b></p> - * - * @author cbateman - * - */ -public abstract class AbstractContextSymbolFactory -{ - /** - * @param symbolName -- the symbol name - * @param scope -- the scope of the symbol - * @param context -- the context; must be supported (call supports(context)) - * @param problems -- populated with problems found during symbol construction. - * @return a new ISymbol configured for the name, scope and context or null - * if the arguments are invalid but some other reason a symbol cannot be created. - * @throws IllegalArgumentException if this method is called with context - * for which supports(context) == false or if scope does not conform - * to exactly one of the ISymbolConstants.SYMBOL_SCOPE_* constants - * @deprecated Use the new create method instead. - */ - @Deprecated - public final ISymbol create(final String symbolName, final int scope, final IAdaptable context, final List problems) - { - if (!supports(context)) - { - throw new IllegalArgumentException("Unsupported context"); //$NON-NLS-1$ - } - else if (!ISymbolConstants.isValid(scope)) - { - throw new IllegalArgumentException("Unsupported symbol constant:"+scope); //$NON-NLS-1$ - } - - try - { - return internalCreate(symbolName, scope, context, problems, null); - } - catch (final Exception e) - { - JSFCommonPlugin.log(e, "During execution of context symbol factory: "+this.getClass().getName()); //$NON-NLS-1$ - return null; - } - } - - /** - * The same as create(symbolName, scope, context, problems), except it calls - * the internalCreate with additionalInfo. By default this has the same - * effect. - * - * @param symbolName - * @param scope - * @param context - * @param problems - * @param additionalInfo - * @return the new Symbol - */ - public final ISymbol create(final String symbolName, final int scope, final IAdaptable context, final List problems, final IAdditionalContextSymbolInfo additionalInfo) - { - if (!supports(context)) - { - throw new IllegalArgumentException("Unsupported context"); //$NON-NLS-1$ - } - else if (!ISymbolConstants.isValid(scope)) - { - throw new IllegalArgumentException("Unsupported symbol constant:"+scope); //$NON-NLS-1$ - } - - try - { - return internalCreate(symbolName, scope, context, problems, additionalInfo); - } - catch (final Exception e) - { - JSFCommonPlugin.log(e, "During execution of context symbol factory: "+this.getClass().getName()); //$NON-NLS-1$ - return null; - } - } - - - /** - * Use of this method is DISCOURAGED. It is preferable to move functionality - * to the new internalCreate method and have this one call it with null. - * - * This method will eventually be deprecated and removed - * - * @param symbolName - * @param scope - * @param context - * @param problems -- see problems arg on create - * @return a new ISymbol for the name, scope and context; may return null - * @deprecated Use the new internalCreate instead. Ignore the new - * additionalInfo parameter if you do not need it. - */ - @Deprecated - protected ISymbol internalCreate(final String symbolName, final int scope, final IAdaptable context, final List problems) - { - // do nothing by default - return null; - } - - /** - * NOTE: when migrating to this method, ensure that the other internalCreate - * method in your implementation doesn't create inconsistent behaviour. - * - * @param symbolName - * @param scope - * @param context Will conform to restrictions you set out in supports(). - * @param problems CURRENTLY IGNORED. - * @param additionalInfo May be null - * @since 3.0 - * @return a new ISymbol for the name, scope and context, but with the option - * to also consult additionalInfo passed by the framework. may return null. - */ - protected ISymbol internalCreate(final String symbolName, final int scope, final IAdaptable context, final List problems, final IAdditionalContextSymbolInfo additionalInfo) - { - // by default, call the other internalCreate for backward compatibility. - // implementers can override to do things with the additional info - return internalCreate(symbolName, scope, context, problems); - } - - /** - * @param context - * @return true if this factory supports the context - */ - public abstract boolean supports(IAdaptable context); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/source/AbstractSymbolSourceProviderFactory.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/source/AbstractSymbolSourceProviderFactory.java deleted file mode 100644 index f793f81fe..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/source/AbstractSymbolSourceProviderFactory.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.context.symbol.source; - -import org.eclipse.core.resources.IProject; - -/** - * Default implementation of ISymbolSourceProviderFactory. Implementors may - * sub-class or create their own separate factory class. - * - * <p><b>Provisional API - subject to change</b></p> - * - * @author cbateman - * - */ -public abstract class AbstractSymbolSourceProviderFactory implements - ISymbolSourceProviderFactory -{ - private IProject _project; - - /** - * Default constructor used by extension manager to create this factory - */ - public AbstractSymbolSourceProviderFactory() - { - // do nothing - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.context.symbol.source.ISymbolSourceProviderFactory#createInstance(org.eclipse.core.resources.IProject) - */ - public final ISymbolSourceProvider createInstance(IProject project) - { - _project = project; - return create(project); - } - - /** - * Override this method to do specialization of provider creation - * - * @param project - * @return the symbol source provider created by the subclass - */ - protected abstract ISymbolSourceProvider create(IProject project); - - /** - * @return the IProject that this source provider is associated with. - */ - protected final IProject getProject() - { - return _project; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/source/IAdditionalContextSymbolInfo.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/source/IAdditionalContextSymbolInfo.java deleted file mode 100644 index ad069e7a0..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/source/IAdditionalContextSymbolInfo.java +++ /dev/null @@ -1,38 +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.context.symbol.source; - - -/** - * Passed to AbstractContextSymbolFactory's to provide additional information. - * All information is optional and need not be used if not needed. - * - * Clients may use but NOT IMPLEMENT. New methods may be added without notice. - * - * @author cbateman - * @since 3.0 - * - */ -public interface IAdditionalContextSymbolInfo -{ - /** - * @return a suggested symbol type signature. May be null. - */ - String getSymbolTypeSignature(); - - /** - * @return the name of the attribute on the current element context that - * contains a value expression that may be used to find type information. - * May be null. - * - */ - String getValueExpressionAttributeName(); -}
\ No newline at end of file diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/source/ISymbolConstants.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/source/ISymbolConstants.java deleted file mode 100644 index 17f36b522..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/source/ISymbolConstants.java +++ /dev/null @@ -1,180 +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.context.symbol.source; - -/** - * Defines global constants for symbols - * - * <p><b>Provisional API - subject to change</b></p> - * - * @author cbateman - * - */ -public class ISymbolConstants { - /** - * Mask to indicate all request scope symbols for a particular context - */ - public final static int SYMBOL_SCOPE_REQUEST = 1; - - /** - * Mask to indicate all session scope symbols for a particular context - */ - public final static int SYMBOL_SCOPE_SESSION = 2; - - /** - * Mask to indicate all application scope symbols for a particular context - */ - public final static int SYMBOL_SCOPE_APPLICATION = 4; - - /** - * Mask to indicate all 'none' scope symbols for a particular context - */ - public final static int SYMBOL_SCOPE_NONE = 8; - -//JSF2.0 - /** - * Mask to indicate all 'view' scope symbols for a particular context - */ - public final static int SYMBOL_SCOPE_VIEW = 16; - - /** - * Mask to indicate all 'flash' scope symbols for a particular context - */ - public final static int SYMBOL_SCOPE_FLASH = 32; - - /** - * the string representation for view scope - */ - public final static String SYMBOL_SCOPE_VIEW_STRING = "view"; //$NON-NLS-1$ - - /** - * the string representation for flash scope - */ - public final static String SYMBOL_SCOPE_FLASH_STRING = "flash"; //$NON-NLS-1$ -// - - /** - * All scopes - */ - public final static int SYMBOL_SCOPE_ALL = - SYMBOL_SCOPE_REQUEST - | SYMBOL_SCOPE_SESSION - | SYMBOL_SCOPE_APPLICATION - | SYMBOL_SCOPE_NONE - | SYMBOL_SCOPE_VIEW - | SYMBOL_SCOPE_FLASH; - - /** - * the string representation for request scope - */ - public final static String SYMBOL_SCOPE_REQUEST_STRING = "request"; //$NON-NLS-1$ - - - /** - * the string representation for session scope - */ - public final static String SYMBOL_SCOPE_SESSION_STRING = "session"; //$NON-NLS-1$ - - /** - * the string representation for application scope - */ - public final static String SYMBOL_SCOPE_APPLICATION_STRING = "application"; //$NON-NLS-1$ - - /** - * the string representation for none scope - */ - public final static String SYMBOL_SCOPE_NONE_STRING = "none"; //$NON-NLS-1$ - - /** - * @param scope - * @return true iff scope matches exactly one scope value (excluding ALL) - */ - public static boolean isValid(int scope) - { - return scope == SYMBOL_SCOPE_APPLICATION - || scope == SYMBOL_SCOPE_REQUEST - || scope == SYMBOL_SCOPE_SESSION - || scope == SYMBOL_SCOPE_NONE - || scope == SYMBOL_SCOPE_VIEW - || scope == SYMBOL_SCOPE_FLASH; - } - - /** - * @param scopeMask - * @return the string representation for a scope mask or null if either - * the mask contains more than one scope or the scope is not valid - */ - public static String getStringForMask(final int scopeMask) - { - if (scopeMask == SYMBOL_SCOPE_REQUEST) - { - return SYMBOL_SCOPE_REQUEST_STRING; - } - else if (scopeMask == SYMBOL_SCOPE_SESSION) - { - return SYMBOL_SCOPE_SESSION_STRING; - } - else if (scopeMask == SYMBOL_SCOPE_APPLICATION) - { - return SYMBOL_SCOPE_APPLICATION_STRING; - } - else if (scopeMask == SYMBOL_SCOPE_NONE) - { - return SYMBOL_SCOPE_NONE_STRING; - } - else if (scopeMask == SYMBOL_SCOPE_VIEW) - { - return SYMBOL_SCOPE_VIEW_STRING; - } - else if (scopeMask == SYMBOL_SCOPE_FLASH) - { - return SYMBOL_SCOPE_FLASH_STRING; - } - - return null; - } - - /** - * @param scopeString - * @return the scope mask for the string or -1 if the string is not - * one of SYMBOL_SCOPE_*_STRING - */ - public static int getMaskForString(final String scopeString) - { - if (SYMBOL_SCOPE_REQUEST_STRING.equals(scopeString)) - { - return SYMBOL_SCOPE_REQUEST; - } - else if (SYMBOL_SCOPE_SESSION_STRING.equals(scopeString)) - { - return SYMBOL_SCOPE_SESSION; - } - else if (SYMBOL_SCOPE_APPLICATION_STRING.equals(scopeString)) - { - return SYMBOL_SCOPE_APPLICATION; - } - else if (SYMBOL_SCOPE_NONE_STRING.equals(scopeString)) - { - return SYMBOL_SCOPE_NONE; - } - else if (SYMBOL_SCOPE_VIEW_STRING.equals(scopeString)) - { - return SYMBOL_SCOPE_VIEW; - } - else if (SYMBOL_SCOPE_FLASH_STRING.equals(scopeString)) - { - return SYMBOL_SCOPE_FLASH; - } - return -1; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/source/ISymbolSourceProvider.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/source/ISymbolSourceProvider.java deleted file mode 100644 index 96dae6546..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/source/ISymbolSourceProvider.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: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.context.symbol.source; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.jst.jsf.context.symbol.ISymbol; - -/** - * Defines a provider that acts as source of symbols. The - * implementor is usually context specific - * - * <p><b>Provisional API - subject to change</b></p> - * - * @author cbateman - * - */ -public interface ISymbolSourceProvider -{ - /** - * @param context - * @param symbolScopeMask - a mask resulting for ORing the SYMBOL_SCOPE_* - * constants to indicate what scopes to retrieve symbols for. - * @return all symbols in context matching symbolScopeMask - */ - ISymbol[] getSymbols(IAdaptable context, int symbolScopeMask); - - /** - * @param prefix - * @param context - * @param symbolScopeMask a mask resulting for ORing the SYMBOL_SCOPE_* - * @return the sub-set of getSymbols that conforms - * to String.startsWith(prefix) in context matching symbolScopeMask. - */ - ISymbol[] getSymbols(String prefix, IAdaptable context, int symbolScopeMask); - - /** - * @param context - * @return true if this provider has symbols for this context - */ - boolean isProvider(IAdaptable context); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/source/ISymbolSourceProviderFactory.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/source/ISymbolSourceProviderFactory.java deleted file mode 100644 index 87b9558ed..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/source/ISymbolSourceProviderFactory.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: - * Cameron Bateman/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.context.symbol.source; - -import org.eclipse.core.resources.IProject; - -/** - * Implemented by extensions wishing to use symbolSourceProvider extension point - * to contribute designtime symbols to the JSF symbol resolver framework. - * - * Instance factory class must implement a zero-argument default constructor - * - * <p><b>Provisional API - subject to change</b></p> - * - * @author cbateman - * - */ -public interface ISymbolSourceProviderFactory -{ - /** - * @param project - * @return a new instance of a symbol source provider for project - */ - ISymbolSourceProvider createInstance(IProject project); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/source/package-info.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/source/package-info.java deleted file mode 100644 index b4a9cc784..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/source/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 - * - ********************************************************************************/ - -/** - * EL Symbols Framework Extension Point API. - * - * <p><b>Provisional API - subject to change</b></p> - */ -package org.eclipse.jst.jsf.context.symbol.source; |