diff options
Diffstat (limited to 'jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm')
36 files changed, 0 insertions, 5455 deletions
diff --git a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/AttributeCMAdapter.java b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/AttributeCMAdapter.java deleted file mode 100644 index c7b37664c..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/AttributeCMAdapter.java +++ /dev/null @@ -1,99 +0,0 @@ -package org.eclipse.jst.jsf.facelet.core.internal.cm; - -import java.util.Enumeration; - -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagAttribute; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.CMDataTypeImpl; -import org.eclipse.wst.xml.core.internal.contentmodel.CMAttributeDeclaration; -import org.eclipse.wst.xml.core.internal.contentmodel.CMDataType; -import org.eclipse.wst.xml.core.internal.contentmodel.CMNode; - -/** - * Adapts Facelet attribute date to the CM model. - * - * @author cbateman - * - */ -public class AttributeCMAdapter implements CMAttributeDeclaration -{ - private static final String DESCRIPTION = "description"; //$NON-NLS-1$ - private final int _usage; - private final String _name; - private String _description; - - /** - * @param name - * @param usage - */ - public AttributeCMAdapter(final String name, final int usage) - { - _name = name; - _usage = usage; - } - - /** - * @param tagAttr - */ - public AttributeCMAdapter(final ITagAttribute tagAttr) - { - this(tagAttr.getName(), tagAttr.isRequired() ? REQUIRED : OPTIONAL); - _description = tagAttr.getDescription(); - } - - public String getAttrName() - { - return _name; - } - - public CMDataType getAttrType() - { - return new CMDataTypeImpl(CMDataType.CDATA); - } - - public String getDefaultValue() - { - return null; - } - - public Enumeration<?> getEnumAttr() - { - return null; - } - - public int getUsage() - { - return _usage; - } - - public String getNodeName() - { - return _name; - } - - public int getNodeType() - { - return CMNode.ATTRIBUTE_DECLARATION; - } - - public Object getProperty(String propertyName) - { - if (DESCRIPTION.equals(propertyName)) - { - return _description; - } - return null; - } - - /** - * @param description - */ - public void setDescription(final String description) - { - _description = description; - } - - public boolean supports(String propertyName) - { - return false; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/CompositeTagInfo.java b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/CompositeTagInfo.java deleted file mode 100644 index ee81c1dea..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/CompositeTagInfo.java +++ /dev/null @@ -1,107 +0,0 @@ -package org.eclipse.jst.jsf.facelet.core.internal.cm; - -import org.eclipse.jst.jsf.common.dom.TagIdentifier; -import org.eclipse.jst.jsf.core.internal.tld.TagIdentifierFactory; -import org.eclipse.jst.jsf.facelet.core.internal.FaceletCorePlugin; -import org.eclipse.jst.jsf.facelet.core.internal.cm.strategy.TagInfoStrategyComposite; -import org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap; - -/** - * A tag info that composes a number of other tag infos selected from a - * TagInfoStrategyComposite. - * - * @author cbateman - * - */ -public abstract class CompositeTagInfo extends TagInfo -{ - private final TagInfoStrategyComposite _compositeStrategy; - private final String _uri; - - /** - * @param uri - * @param compositeStrategy - */ - protected CompositeTagInfo(final String uri, final TagInfoStrategyComposite compositeStrategy) - { - _uri = uri; - _compositeStrategy = compositeStrategy; - } - @Override - public Object getTagProperty(String tagName, String key) - { - final TagIdentifier tagId = TagIdentifierFactory.createJSPTagWrapper( - _uri, tagName); - _compositeStrategy.resetIterator(); - - for (TagInfo tagInfo = getNextExternalInfo(tagId); tagInfo != _compositeStrategy - .getNoResult(); tagInfo = getNextExternalInfo(tagId)) - { - try - { - if (tagInfo != _compositeStrategy.getNoResult()) - { - final Object value = tagInfo.getTagProperty(tagName, key); - - if (value != null) - { - return value; - } - } - - // fall-through - } - catch (final Exception e) - { - FaceletCorePlugin.log("During meta-data strategy", e); //$NON-NLS-1$ - } - } - - return null; - - } - - /** - * @param tagName - * @return a named node map of known attributes for the tag, or null if not - * found - */ - @Override - public CMNamedNodeMap getAttributes(String tagName) - { - final TagIdentifier tagId = TagIdentifierFactory.createJSPTagWrapper( - _uri, tagName); - _compositeStrategy.resetIterator(); - - for (TagInfo tagInfo = getNextExternalInfo(tagId); tagInfo != _compositeStrategy - .getNoResult(); tagInfo = getNextExternalInfo(tagId)) - { - try - { - if (tagInfo != _compositeStrategy.getNoResult()) - { - final CMNamedNodeMap nodeMap = tagInfo - .getAttributes(tagName); - - if (nodeMap != null) - { - return nodeMap; - } - } - - // fall-through - } - catch (final Exception e) - { - FaceletCorePlugin.log("During meta-data strategy", e); //$NON-NLS-1$ - } - } - - return null; - } - - private TagInfo getNextExternalInfo(final TagIdentifier input) - { - return _compositeStrategy.perform(input); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/DocumentElementCMAdapter.java b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/DocumentElementCMAdapter.java deleted file mode 100644 index a20c5f1ef..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/DocumentElementCMAdapter.java +++ /dev/null @@ -1,109 +0,0 @@ -package org.eclipse.jst.jsf.facelet.core.internal.cm; - -import java.util.Iterator; - -import org.eclipse.wst.xml.core.internal.contentmodel.CMContent; -import org.eclipse.wst.xml.core.internal.contentmodel.CMDataType; -import org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration; -import org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap; -import org.eclipse.wst.xml.core.internal.contentmodel.CMNode; - -class DocumentElementCMAdapter implements CMNamedNodeMap, - CMElementDeclaration -{ - private final String _prefix; - private final ElementCMAdapter _adapter; - - public DocumentElementCMAdapter(final ElementCMAdapter adapter, final String prefix) - { - _prefix = prefix; - _adapter = adapter; - } - - public int getLength() - { - return _adapter.getLength(); - } - - public CMNode getNamedItem(String name) - { - return _adapter.getNamedItem(name); - } - - public CMNode item(int index) - { - return _adapter.item(index); - } - - @SuppressWarnings("unchecked") - public Iterator iterator() - { - return _adapter.iterator(); - } - - public CMNamedNodeMap getAttributes() - { - return _adapter.getAttributes(); - } - - public CMContent getContent() - { - return _adapter.getContent(); - } - - public int getContentType() - { - return _adapter.getContentType(); - } - - public CMDataType getDataType() - { - return _adapter.getDataType(); - } - - public String getElementName() - { - return getPrefixedName(_adapter.getElementName()); - } - - public CMNamedNodeMap getLocalElements() - { - return _adapter.getLocalElements(); - } - - public int getMaxOccur() - { - return _adapter.getMaxOccur(); - } - - public int getMinOccur() - { - return _adapter.getMinOccur(); - } - - public String getNodeName() - { - return getPrefixedName(_adapter.getNodeName()); - } - - private String getPrefixedName(final String name) - { - return _prefix + ":"+name; //$NON-NLS-1$ - } - - public int getNodeType() - { - return _adapter.getNodeType(); - } - - public Object getProperty(String propertyName) - { - return _adapter.getProperty(propertyName); - } - - public boolean supports(String propertyName) - { - return _adapter.supports(propertyName); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/DocumentNamespaceCMAdapter.java b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/DocumentNamespaceCMAdapter.java deleted file mode 100644 index bae83f7a7..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/DocumentNamespaceCMAdapter.java +++ /dev/null @@ -1,161 +0,0 @@ -package org.eclipse.jst.jsf.facelet.core.internal.cm; - -import java.util.Iterator; - -import org.eclipse.wst.xml.core.internal.contentmodel.CMDocument; -import org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap; -import org.eclipse.wst.xml.core.internal.contentmodel.CMNamespace; -import org.eclipse.wst.xml.core.internal.contentmodel.CMNode; - -/** - * A namespace a specific to a document, where it's tag name prefix is known. - * - */ -class DocumentNamespaceCMAdapter implements CMNamedNodeMap, CMDocument -{ - private final String _prefix; - private final NamespaceCMAdapter _adapter; - - public DocumentNamespaceCMAdapter(final NamespaceCMAdapter adapter, final String prefix) - { - _prefix = prefix; - _adapter = adapter; - } - - public int getLength() - { - return _adapter.getLength(); - } - - public CMNode getNamedItem(String name) - { - CMNode node = _adapter.getNamedItem(name); - - if (node != null) - { - node = new DocumentElementCMAdapter((ElementCMAdapter) node,_prefix); - } - return node; - } - - public CMNode item(int index) - { - CMNode item = _adapter.item(index); - - if (item != null) - { - item = new DocumentElementCMAdapter((ElementCMAdapter) item,_prefix); - } - return item; - } - - public Iterator<?> iterator() - { - return new WrappingIterator(_adapter.iterator()); - } - - private class WrappingIterator implements Iterator<CMNode> - { - private Iterator<?> _it; - - public WrappingIterator(final Iterator<?> it) - { - _it = it; - } - public boolean hasNext() - { - return _it.hasNext(); - } - - public CMNode next() - { - CMNode node = (CMNode) _it.next(); - node = getNamedItem(node.getNodeName()); - return node; - } - - public void remove() - { - throw new UnsupportedOperationException(""); //$NON-NLS-1$ - } - } - - public CMNamedNodeMap getElements() - { - return this; - } - - public CMNamedNodeMap getEntities() - { - //not changing entities - return _adapter.getEntities(); - } - - public CMNamespace getNamespace() - { - return new CMNamespaceImpl(_adapter.getNamespace(), _prefix); - } - - public String getNodeName() - { - // not changing node name - return _adapter.getNodeName(); - } - - public int getNodeType() - { - return _adapter.getNodeType(); - } - - public Object getProperty(String propertyName) - { - return _adapter.getProperty(propertyName); - } - - public boolean supports(String propertyName) - { - return _adapter.supports(propertyName); - } - - private static class CMNamespaceImpl implements CMNamespace - { - private final CMNamespace _proxy; - private final String _prefix; - - CMNamespaceImpl(CMNamespace proxy, final String prefix) - { - _proxy = proxy; - _prefix = prefix; - } - - public String getPrefix() - { - return _prefix; - } - - public String getURI() - { - return _proxy.getURI(); - } - - public String getNodeName() - { - return _proxy.getNodeName(); - } - - public int getNodeType() - { - return _proxy.getNodeType(); - } - - public Object getProperty(String propertyName) - { - return _proxy.getProperty(propertyName); - } - - public boolean supports(String propertyName) - { - return _proxy.supports(propertyName); - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/ElementCMAdapter.java b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/ElementCMAdapter.java deleted file mode 100644 index b38e43150..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/ElementCMAdapter.java +++ /dev/null @@ -1,147 +0,0 @@ -/** - * - */ -package org.eclipse.jst.jsf.facelet.core.internal.cm; - -import java.util.Iterator; - -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagElement; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.CMDataTypeImpl; -import org.eclipse.wst.xml.core.internal.contentmodel.CMContent; -import org.eclipse.wst.xml.core.internal.contentmodel.CMDataType; -import org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration; -import org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap; -import org.eclipse.wst.xml.core.internal.contentmodel.CMNode; - -class ElementCMAdapter implements CMElementDeclaration, CMNamedNodeMap -{ - private final ITagElement _tagElement; - private final TagInfo _tLDTagInfo; - - ElementCMAdapter(final ITagElement tagElement, final TagInfo tldTagInfo) - { - _tagElement = tagElement; - _tLDTagInfo = tldTagInfo; - } - - public CMNamedNodeMap getAttributes() - { - return this; - } - - public CMContent getContent() - { - return null; - } - - public int getContentType() - { - return ELEMENT; - } - - public CMDataType getDataType() - { - return new CMDataTypeImpl(CMDataType.CDATA); - } - - public String getElementName() - { - return _tagElement.getName(); - } - - public CMNamedNodeMap getLocalElements() - { - // TODO Auto-generated method stub - return null; - } - - public int getMaxOccur() - { - // unbounded - return -1; - } - - public int getMinOccur() - { - // optional - return 0; - } - - public String getNodeName() - { - return _tagElement.getName(); - } - - public int getNodeType() - { - return CMNode.ELEMENT_DECLARATION; - } - - public Object getProperty(final String propertyName) - { - return _tLDTagInfo.getTagProperty(_tagElement.getName(), propertyName); - } - - public boolean supports(final String propertyName) - { - return false; - } - - @Override - public boolean equals(final Object obj) - { - if (obj instanceof ElementCMAdapter) - { - return ((ElementCMAdapter) obj)._tagElement.equals(_tagElement); - } - - return false; - } - - @Override - public int hashCode() - { - return _tagElement.hashCode(); - } - - public int getLength() - { - final CMNamedNodeMap map = _tLDTagInfo.getAttributes(_tagElement.getName()); - - if (map != null) - { - return map.getLength(); - } - - return 0; - } - - public CMNode getNamedItem(final String name) - { - final CMNamedNodeMap map = _tLDTagInfo.getAttributes(_tagElement.getName()); - - if (map != null) - { - return map.getNamedItem(name); - } - return null; - } - - public CMNode item(final int index) - { - final CMNamedNodeMap map = _tLDTagInfo.getAttributes(_tagElement.getName()); - - if (map != null) - { - return map.item(index); - } - return null; - } - - public Iterator<?> iterator() - { - final CMNamedNodeMap map = _tLDTagInfo.getAttributes(_tagElement.getName()); - return map.iterator(); - } - -}
\ No newline at end of file diff --git a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/ExternalTagInfo.java b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/ExternalTagInfo.java deleted file mode 100644 index f17eed387..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/ExternalTagInfo.java +++ /dev/null @@ -1,96 +0,0 @@ -package org.eclipse.jst.jsf.facelet.core.internal.cm; - -import java.util.Iterator; -import java.util.NoSuchElementException; - -import org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap; -import org.eclipse.wst.xml.core.internal.contentmodel.CMNode; - -/** - * Represents information about Facelets brought from external sources such as - * the JSP tag library. - * - * @author cbateman - * - */ -public abstract class ExternalTagInfo extends TagInfo -{ - /** - * Single instance of the null external tag info - */ - public static TagInfo NULL_INSTANCE = new NullExternalTagInfo(); - - @Override - public abstract CMNamedNodeMap getAttributes(final String tagName); - - @Override - public abstract Object getTagProperty(final String tagName, final String key); - - /** - * @author cbateman - * - */ - public static class NullExternalTagInfo extends ExternalTagInfo - { - private NullExternalTagInfo() - { - // no external instantitation - } - - @Override - public CMNamedNodeMap getAttributes(final String tagName) - { - return new NullCMNamedNodeMap(); - } - - @Override - public Object getTagProperty(final String tagName, final String key) - { - // no data so always null - return null; - } - - private static class NullCMNamedNodeMap implements CMNamedNodeMap - { - public int getLength() - { - return 0; - } - - public CMNode getNamedItem(final String name) - { - return null; - } - - public CMNode item(final int index) - { - return null; - } - - public Iterator iterator() - { - return new NullIterator(); - } - } - - private static class NullIterator implements Iterator - { - public boolean hasNext() - { - return false; - } - - public Object next() - { - throw new NoSuchElementException(); - } - - public void remove() - { - throw new UnsupportedOperationException( - "can not remove regions via iterator"); //$NON-NLS-1$ - } - } - } - -}
\ No newline at end of file diff --git a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/FaceletDocumentFactory.java b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/FaceletDocumentFactory.java deleted file mode 100644 index 0c806f8a4..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/FaceletDocumentFactory.java +++ /dev/null @@ -1,177 +0,0 @@ -package org.eclipse.jst.jsf.facelet.core.internal.cm; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.Namespace; -import org.eclipse.jst.jsf.core.JSFVersion; -import org.eclipse.jst.jsf.designtime.internal.view.model.ITagRegistry; -import org.eclipse.jst.jsf.designtime.internal.view.model.TagRegistryFactory.TagRegistryFactoryException; -import org.eclipse.jst.jsf.facelet.core.internal.registry.FaceletRegistryManager.MyRegistryFactory; -import org.eclipse.jst.jsf.facelet.core.internal.util.ViewUtil; -import org.eclipse.jst.jsf.facelet.core.internal.util.ViewUtil.PrefixEntry; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.CMDocumentFactoryTLD; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDDocument; -import org.eclipse.jst.jsp.core.taglib.ITaglibRecord; -import org.eclipse.jst.jsp.core.taglib.TaglibIndex; -import org.eclipse.wst.xml.core.internal.contentmodel.CMDocument; -import org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration; -import org.w3c.dom.Element; - -/** - * Creates CMDocument framework adaptation for Facelet features. - * - * NOTE: this class currently caches state and is NOT THREADSAFE. Share - * instances of this class between unowned classes at your own risk. - * - * @author cbateman - * - */ -public class FaceletDocumentFactory -{ - private final IProject _project; - private final Map<String, NamespaceCMAdapter> _cmDocuments; - private final Map<String, TagInfo> _externalTagInfo; - - /** - * @param project - */ - public FaceletDocumentFactory(final IProject project) - { - _project = project; - _cmDocuments = new HashMap<String, NamespaceCMAdapter>(8); - _externalTagInfo = new HashMap<String, TagInfo>(8); - } - - /** - * @param uri - * @param prefix - * @return the CMDocument for the uri where prefix is used as its namespace - * short-form (usually in the context of an XML document instance). - */ - public CMDocument createCMDocumentForContext(final String uri, - final String prefix) - { - final NamespaceCMAdapter cmDoc = getOrCreateCMDocument(_project, uri); - - if (cmDoc != null) - { - return new DocumentNamespaceCMAdapter(cmDoc, prefix); - } - return null; - } - - /** - * @param element - * @return the CM model data for element or null if none. - */ - public CMElementDeclaration createCMElementDeclaration(final Element element) - { - final String prefix = element.getPrefix(); - final Map<String, PrefixEntry> namespaces = ViewUtil - .getDocumentNamespaces(element.getOwnerDocument()); - final PrefixEntry prefixEntry = namespaces.get(prefix); - - if (prefixEntry != null) - { - final CMDocument cmDoc = createCMDocumentForContext(prefixEntry - .getUri(), prefixEntry.getPrefix()); - - if (cmDoc != null) - { - return (CMElementDeclaration) cmDoc.getElements().getNamedItem( - element.getLocalName()); - } - } - - return null; - } - - /** - * @param ns - * @return the externa tag info the namespace. May return a previously - * cached value. If there is no cached value, then creates it. - */ - public TagInfo getOrCreateExtraTagInfo(final String ns) - { - TagInfo tagInfo = _externalTagInfo.get(ns); - - if (tagInfo == null) - { - tagInfo = createExternalTagInfo(ns); - _externalTagInfo.put(ns, tagInfo); - } - return tagInfo; - } - - /** - * @return a new external tag info for this namespace - */ - private TagInfo createExternalTagInfo(final String uri) - { - final JSFVersion jsfVersion = JSFVersion.valueOfProject(_project); - TagInfo tldTagInfo = null; - if (jsfVersion != null) - { - if (jsfVersion.compareTo(JSFVersion.V2_0) >= 0) - { - tldTagInfo = new FaceletTagInfo(_project, uri); - } else - { - final ITaglibRecord[] tldrecs = TaglibIndex - .getAvailableTaglibRecords(_project.getFullPath()); - FIND_TLDRECORD: for (final ITaglibRecord rec : tldrecs) - { - final String matchUri = rec.getDescriptor().getURI(); - if (uri.equals(matchUri)) - { - final CMDocumentFactoryTLD factory = new CMDocumentFactoryTLD(); - tldTagInfo = new MetadataTagInfo(_project, - (TLDDocument) factory.createCMDocument(rec)); - break FIND_TLDRECORD; - } - } - - if (tldTagInfo == null) - { - tldTagInfo = new MetadataTagInfo(_project, uri); - } - } - } - return tldTagInfo; - } - - private NamespaceCMAdapter getOrCreateCMDocument(final IProject project, - final String uri) - { - NamespaceCMAdapter adapter = _cmDocuments.get(uri); - - if (adapter == null) - { - final MyRegistryFactory factory = new MyRegistryFactory(); - - ITagRegistry registry; - try - { - registry = factory.createTagRegistry(project); - if (registry != null) - { - final Namespace ns = registry.getTagLibrary(uri); - - if (ns != null) - { - adapter = new NamespaceCMAdapter(ns, project); - _cmDocuments.put(uri, adapter); - } - } - } - catch (final TagRegistryFactoryException e) - { - // fall-through - } - } - return adapter; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/FaceletTagInfo.java b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/FaceletTagInfo.java deleted file mode 100644 index a9ab0fafb..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/FaceletTagInfo.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.eclipse.jst.jsf.facelet.core.internal.cm; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.jsf.facelet.core.internal.cm.strategy.FaceletExternalMetadataStrategy; -import org.eclipse.jst.jsf.facelet.core.internal.cm.strategy.IExternalMetadataStrategy; -import org.eclipse.jst.jsf.facelet.core.internal.cm.strategy.MDExternalMetadataStrategy; -import org.eclipse.jst.jsf.facelet.core.internal.cm.strategy.TagInfoStrategyComposite; - -/*package*/class FaceletTagInfo extends CompositeTagInfo -{ - public FaceletTagInfo(final IProject project, final String uri) - { - super(uri, createStrategy(project)); - } - - private static TagInfoStrategyComposite createStrategy( - final IProject project) - { - final IExternalMetadataStrategy mdStrategy = MDExternalMetadataStrategy - .create(project); - final IExternalMetadataStrategy faceletStrategy = new FaceletExternalMetadataStrategy( - project); - final List<String> ids = new ArrayList<String>(); - ids.add(FaceletExternalMetadataStrategy.STRATEGY_ID); - ids.add(MDExternalMetadataStrategy.STRATEGY_ID); - - final TagInfoStrategyComposite strategyComposite = new TagInfoStrategyComposite( - ids); - strategyComposite.addStrategy(faceletStrategy); - strategyComposite.addStrategy(mdStrategy); - return strategyComposite; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/MetadataTagInfo.java b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/MetadataTagInfo.java deleted file mode 100644 index f8b670355..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/MetadataTagInfo.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.eclipse.jst.jsf.facelet.core.internal.cm; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.jsf.facelet.core.internal.cm.strategy.IExternalMetadataStrategy; -import org.eclipse.jst.jsf.facelet.core.internal.cm.strategy.JSPExternalMetadataStrategy; -import org.eclipse.jst.jsf.facelet.core.internal.cm.strategy.MDExternalMetadataStrategy; -import org.eclipse.jst.jsf.facelet.core.internal.cm.strategy.TagInfoStrategyComposite; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDDocument; - -/** - * An external tag info that checks first the meta-data repository and second in - * the provided TLDDocument for data. - * - * @author cbateman - * - */ -/* package */class MetadataTagInfo extends CompositeTagInfo -{ - private MetadataTagInfo(final IProject project, final TLDDocument doc, - final String uri) - { - super(uri, createStrategy(project,doc)); - } - - public MetadataTagInfo(final IProject project, final String uri) - { - this(project, null, uri); - } - - /** - * @param project - * @param doc - */ - public MetadataTagInfo(final IProject project, final TLDDocument doc) - { - this(project, doc, doc.getUri()); - } - - private static TagInfoStrategyComposite createStrategy(final IProject project, final TLDDocument doc) - { - IExternalMetadataStrategy mdStrategy = MDExternalMetadataStrategy.create(project); - JSPExternalMetadataStrategy jspStrategy = new JSPExternalMetadataStrategy(doc); - - final List<String> ids = new ArrayList<String>(); - ids.add(MDExternalMetadataStrategy.STRATEGY_ID); - ids.add(JSPExternalMetadataStrategy.STRATEGY_ID); - - TagInfoStrategyComposite strategyComposite = new TagInfoStrategyComposite(ids); - strategyComposite.addStrategy(mdStrategy); - strategyComposite.addStrategy(jspStrategy); - return strategyComposite; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/NamespaceCMAdapter.java b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/NamespaceCMAdapter.java deleted file mode 100644 index 0732f1954..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/NamespaceCMAdapter.java +++ /dev/null @@ -1,232 +0,0 @@ -package org.eclipse.jst.jsf.facelet.core.internal.cm; - -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.concurrent.atomic.AtomicBoolean; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.jsf.common.internal.managedobject.IManagedObject; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagElement; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.Namespace; -import org.eclipse.wst.xml.core.internal.contentmodel.CMDocument; -import org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap; -import org.eclipse.wst.xml.core.internal.contentmodel.CMNamespace; -import org.eclipse.wst.xml.core.internal.contentmodel.CMNode; - -/*package*/class NamespaceCMAdapter implements CMNamedNodeMap, CMDocument, IManagedObject -{ - private final Namespace _ns; - private final Map<String, ElementCMAdapter> _elements; - private final FaceletDocumentFactory _factory; - private final AtomicBoolean _isDisposed = new AtomicBoolean(false); - - public NamespaceCMAdapter(final Namespace ns, final IProject project) - { - _ns = ns; - _elements = new HashMap<String, ElementCMAdapter>(); - _factory = new FaceletDocumentFactory(project); - } - - public int getLength() - { - if (_ns.hasViewElements()) - { - return _ns.getViewElements().size(); - } - return 0; - } - - public CMNode getNamedItem(final String name) - { - String localname = name; - - if (name != null && name.indexOf(':') > -1) - { - String[] splitName = name.split(":"); //$NON-NLS-1$ - - if (splitName.length == 2) - { - localname = splitName[1]; - } - } - ElementCMAdapter element = _elements.get(localname); - - if (element == null) - { - final ITagElement tagElement = _ns.getViewElement(localname); - if (tagElement != null) - { - TagInfo tagInfo = _factory.getOrCreateExtraTagInfo(_ns.getNSUri()); - element = new ElementCMAdapter(tagElement, tagInfo); - _elements.put(localname, element); - } - } - return element; - } - - // TODO: optimize - public CMNode item(int index) - { - if (_ns.hasViewElements() && index >= 0 - && index < _ns.getViewElements().size()) - { - final Iterator<?> it = iterator(); - for (int i = 0; it.hasNext(); i++) - { - final ITagElement tagElement = (ITagElement) it.next(); - if (i == index) - { - ElementCMAdapter element = _elements.get(tagElement.getName()); - - if (element == null) - { - element = new ElementCMAdapter(tagElement, _factory.getOrCreateExtraTagInfo(_ns.getNSUri())); - _elements.put(tagElement.getName(), element); - return element; - } - } - } - } - return null; - } - - public Iterator<?> iterator() - { - return new WrappingIterator(_ns.getViewElements()); - } - - private class WrappingIterator implements Iterator<CMNode> - { - @SuppressWarnings("unchecked") - final Iterator _viewElementIterator; - @SuppressWarnings("unchecked") - public WrappingIterator(final Collection viewElements) - { - _viewElementIterator = viewElements.iterator(); - } - - public boolean hasNext() - { - return _viewElementIterator.hasNext(); - } - - public CMNode next() - { - ITagElement nextElement = (ITagElement) _viewElementIterator.next(); - CMNode node = getNamedItem(nextElement.getName()); - return node; - } - - public void remove() - { - throw new UnsupportedOperationException(""); //$NON-NLS-1$ - } - - } - public CMNamedNodeMap getElements() - { - return this; - } - - public CMNamedNodeMap getEntities() - { - // no entities - return null; - } - - public CMNamespace getNamespace() - { - return new CMNamespaceImpl(_ns.getNSUri()); - } - - public String getNodeName() - { - return getNamespace().getURI(); - } - - public int getNodeType() - { - return CMNode.DOCUMENT; - } - - public Object getProperty(String propertyName) - { - // none supported for now - return null; - } - - public boolean supports(String propertyName) - { - // support none for now - return false; - } - - private static class CMNamespaceImpl implements CMNamespace - { - private final String _uri; - - CMNamespaceImpl(final String uri) - { - _uri = uri; - } - - public String getPrefix() - { - return null; - } - - public String getURI() - { - return _uri; - } - - public String getNodeName() - { - return getURI(); - } - - public int getNodeType() - { - return CMNode.NAME_SPACE; - } - - public Object getProperty(String propertyName) - { - // TODO Auto-generated method stub - return null; - } - - public boolean supports(String propertyName) - { - // TODO Auto-generated method stub - return false; - } - } - public void dispose() - { - if (_isDisposed.compareAndSet(false, true)) - { - _elements.clear(); - } - } - - public void checkpoint() - { - // TODO: ?? - - } - - public void destroy() - { - // TODO: ?? - - } - - public boolean isDisposed() - { - return _isDisposed.get(); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/TagInfo.java b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/TagInfo.java deleted file mode 100644 index dd801ee87..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/TagInfo.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.eclipse.jst.jsf.facelet.core.internal.cm; - -import org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap; - -/** - * Generic adapter needed to provide CM required metadata for a CMNode from - * different sources. - * - * @author cbateman - * - */ -public abstract class TagInfo -{ - /** - * @param tagName - * @param key - * @return the tag property in the CM model for tagName at key or null if - * not found. - */ - public abstract Object getTagProperty(final String tagName, final String key); - - /** - * @param tagName - * @return the node map of attributes for the tag called tagName - */ - public abstract CMNamedNodeMap getAttributes(final String tagName); - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/addtagmd/AddTagMDFactory.java b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/addtagmd/AddTagMDFactory.java deleted file mode 100644 index aac6e1294..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/addtagmd/AddTagMDFactory.java +++ /dev/null @@ -1,56 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: AddTagMDFactory.java,v 1.1 2010/03/08 18:49:41 cbateman Exp $ - */ -package org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd; - -import org.eclipse.emf.ecore.EFactory; - -/** - * <!-- begin-user-doc --> - * The <b>Factory</b> for the model. - * It provides a create method for each non-abstract class of the model. - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.AddTagMDPackage - * @generated - */ -public interface AddTagMDFactory extends EFactory -{ - /** - * The singleton instance of the factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - AddTagMDFactory eINSTANCE = org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.impl.AddTagMDFactoryImpl.init(); - - /** - * Returns a new object of class '<em>Element Data</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Element Data</em>'. - * @generated - */ - ElementData createElementData(); - - /** - * Returns a new object of class '<em>Attribute Data</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Attribute Data</em>'. - * @generated - */ - AttributeData createAttributeData(); - - /** - * Returns the package supported by this factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the package supported by this factory. - * @generated - */ - AddTagMDPackage getAddTagMDPackage(); - -} //AddTagMDFactory diff --git a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/addtagmd/AddTagMDPackage.java b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/addtagmd/AddTagMDPackage.java deleted file mode 100644 index deaa28449..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/addtagmd/AddTagMDPackage.java +++ /dev/null @@ -1,339 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: AddTagMDPackage.java,v 1.1 2010/03/08 18:49:41 cbateman Exp $ - */ -package org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EEnum; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; - -/** - * <!-- begin-user-doc --> - * The <b>Package</b> for the model. - * It contains accessors for the meta objects to represent - * <ul> - * <li>each class,</li> - * <li>each feature of each class,</li> - * <li>each enum,</li> - * <li>and each data type</li> - * </ul> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.AddTagMDFactory - * @model kind="package" - * @generated - */ -public interface AddTagMDPackage extends EPackage -{ - /** - * The package name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNAME = "addtagmd"; //$NON-NLS-1$ - - /** - * The package namespace URI. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNS_URI = "http://org.eclipse.jst.jsf.facelet.core/additionalTagMetadata.ecore"; //$NON-NLS-1$ - - /** - * The package namespace name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNS_PREFIX = "addTagMD"; //$NON-NLS-1$ - - /** - * The singleton instance of the package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - AddTagMDPackage eINSTANCE = org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.impl.AddTagMDPackageImpl.init(); - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.impl.ElementDataImpl <em>Element Data</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.impl.ElementDataImpl - * @see org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.impl.AddTagMDPackageImpl#getElementData() - * @generated - */ - int ELEMENT_DATA = 0; - - /** - * The feature id for the '<em><b>Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ELEMENT_DATA__NAME = 0; - - /** - * The feature id for the '<em><b>Attributes</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ELEMENT_DATA__ATTRIBUTES = 1; - - /** - * The number of structural features of the '<em>Element Data</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ELEMENT_DATA_FEATURE_COUNT = 2; - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.impl.AttributeDataImpl <em>Attribute Data</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.impl.AttributeDataImpl - * @see org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.impl.AddTagMDPackageImpl#getAttributeData() - * @generated - */ - int ATTRIBUTE_DATA = 1; - - /** - * The feature id for the '<em><b>Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ATTRIBUTE_DATA__NAME = 0; - - /** - * The feature id for the '<em><b>Usage</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ATTRIBUTE_DATA__USAGE = 1; - - /** - * The feature id for the '<em><b>Description</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ATTRIBUTE_DATA__DESCRIPTION = 2; - - /** - * The number of structural features of the '<em>Attribute Data</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ATTRIBUTE_DATA_FEATURE_COUNT = 3; - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.AttributeUsage <em>Attribute Usage</em>}' enum. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.AttributeUsage - * @see org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.impl.AddTagMDPackageImpl#getAttributeUsage() - * @generated - */ - int ATTRIBUTE_USAGE = 2; - - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.ElementData <em>Element Data</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Element Data</em>'. - * @see org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.ElementData - * @generated - */ - EClass getElementData(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.ElementData#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.facelet.core.internal.cm.addtagmd.ElementData#getName() - * @see #getElementData() - * @generated - */ - EAttribute getElementData_Name(); - - /** - * Returns the meta object for the containment reference list '{@link org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.ElementData#getAttributes <em>Attributes</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the containment reference list '<em>Attributes</em>'. - * @see org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.ElementData#getAttributes() - * @see #getElementData() - * @generated - */ - EReference getElementData_Attributes(); - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.AttributeData <em>Attribute Data</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Attribute Data</em>'. - * @see org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.AttributeData - * @generated - */ - EClass getAttributeData(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.AttributeData#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.facelet.core.internal.cm.addtagmd.AttributeData#getName() - * @see #getAttributeData() - * @generated - */ - EAttribute getAttributeData_Name(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.AttributeData#getUsage <em>Usage</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Usage</em>'. - * @see org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.AttributeData#getUsage() - * @see #getAttributeData() - * @generated - */ - EAttribute getAttributeData_Usage(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.AttributeData#getDescription <em>Description</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Description</em>'. - * @see org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.AttributeData#getDescription() - * @see #getAttributeData() - * @generated - */ - EAttribute getAttributeData_Description(); - - /** - * Returns the meta object for enum '{@link org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.AttributeUsage <em>Attribute Usage</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for enum '<em>Attribute Usage</em>'. - * @see org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.AttributeUsage - * @generated - */ - EEnum getAttributeUsage(); - - /** - * 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 - */ - AddTagMDFactory getAddTagMDFactory(); - - /** - * <!-- 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.facelet.core.internal.cm.addtagmd.impl.ElementDataImpl <em>Element Data</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.impl.ElementDataImpl - * @see org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.impl.AddTagMDPackageImpl#getElementData() - * @generated - */ - EClass ELEMENT_DATA = eINSTANCE.getElementData(); - - /** - * The meta object literal for the '<em><b>Name</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute ELEMENT_DATA__NAME = eINSTANCE.getElementData_Name(); - - /** - * The meta object literal for the '<em><b>Attributes</b></em>' containment reference list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference ELEMENT_DATA__ATTRIBUTES = eINSTANCE.getElementData_Attributes(); - - /** - * The meta object literal for the '{@link org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.impl.AttributeDataImpl <em>Attribute Data</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.impl.AttributeDataImpl - * @see org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.impl.AddTagMDPackageImpl#getAttributeData() - * @generated - */ - EClass ATTRIBUTE_DATA = eINSTANCE.getAttributeData(); - - /** - * The meta object literal for the '<em><b>Name</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute ATTRIBUTE_DATA__NAME = eINSTANCE.getAttributeData_Name(); - - /** - * The meta object literal for the '<em><b>Usage</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute ATTRIBUTE_DATA__USAGE = eINSTANCE.getAttributeData_Usage(); - - /** - * The meta object literal for the '<em><b>Description</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute ATTRIBUTE_DATA__DESCRIPTION = eINSTANCE.getAttributeData_Description(); - - /** - * The meta object literal for the '{@link org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.AttributeUsage <em>Attribute Usage</em>}' enum. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.AttributeUsage - * @see org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.impl.AddTagMDPackageImpl#getAttributeUsage() - * @generated - */ - EEnum ATTRIBUTE_USAGE = eINSTANCE.getAttributeUsage(); - - } - -} //AddTagMDPackage diff --git a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/addtagmd/AttributeData.java b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/addtagmd/AttributeData.java deleted file mode 100644 index 1ffa6351a..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/addtagmd/AttributeData.java +++ /dev/null @@ -1,112 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: AttributeData.java,v 1.1 2010/03/08 18:49:41 cbateman Exp $ - */ -package org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd; - -import org.eclipse.emf.ecore.EObject; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Attribute Data</b></em>'. - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.AttributeData#getName <em>Name</em>}</li> - * <li>{@link org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.AttributeData#getUsage <em>Usage</em>}</li> - * <li>{@link org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.AttributeData#getDescription <em>Description</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.AddTagMDPackage#getAttributeData() - * @model - * @generated - */ -public interface AttributeData extends EObject -{ - /** - * Returns the value of the '<em><b>Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Name</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Name</em>' attribute. - * @see #setName(String) - * @see org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.AddTagMDPackage#getAttributeData_Name() - * @model extendedMetaData="kind='element' name='name'" - * @generated - */ - String getName(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.AttributeData#getName <em>Name</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Name</em>' attribute. - * @see #getName() - * @generated - */ - void setName(String value); - - /** - * Returns the value of the '<em><b>Usage</b></em>' attribute. - * The literals are from the enumeration {@link org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.AttributeUsage}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Usage</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Usage</em>' attribute. - * @see org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.AttributeUsage - * @see #setUsage(AttributeUsage) - * @see org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.AddTagMDPackage#getAttributeData_Usage() - * @model extendedMetaData="kind='element' name='usage'" - * @generated - */ - AttributeUsage getUsage(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.AttributeData#getUsage <em>Usage</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Usage</em>' attribute. - * @see org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.AttributeUsage - * @see #getUsage() - * @generated - */ - void setUsage(AttributeUsage value); - - /** - * Returns the value of the '<em><b>Description</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Description</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Description</em>' attribute. - * @see #setDescription(String) - * @see org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.AddTagMDPackage#getAttributeData_Description() - * @model extendedMetaData="kind='element' name='description'" - * @generated - */ - String getDescription(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.AttributeData#getDescription <em>Description</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Description</em>' attribute. - * @see #getDescription() - * @generated - */ - void setDescription(String value); - -} // AttributeData diff --git a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/addtagmd/AttributeUsage.java b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/addtagmd/AttributeUsage.java deleted file mode 100644 index f8bee810f..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/addtagmd/AttributeUsage.java +++ /dev/null @@ -1,287 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: AttributeUsage.java,v 1.1 2010/03/08 18:49:41 cbateman Exp $ - */ -package org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd; - -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -import org.eclipse.emf.common.util.Enumerator; - -/** - * <!-- begin-user-doc --> - * A representation of the literals of the enumeration '<em><b>Attribute Usage</b></em>', - * and utility methods for working with them. - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.AddTagMDPackage#getAttributeUsage() - * @model - * @generated - */ -public enum AttributeUsage implements Enumerator -{ - /** - * The '<em><b>OPTIONAL</b></em>' literal object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #OPTIONAL_VALUE - * @generated - * @ordered - */ - OPTIONAL(0, "OPTIONAL", "OPTIONAL"), //$NON-NLS-1$ //$NON-NLS-2$ - - /** - * The '<em><b>REQUIRED</b></em>' literal object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #REQUIRED_VALUE - * @generated - * @ordered - */ - REQUIRED(1, "REQUIRED", "REQUIRED"), //$NON-NLS-1$ //$NON-NLS-2$ - - /** - * The '<em><b>FIXED</b></em>' literal object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #FIXED_VALUE - * @generated - * @ordered - */ - FIXED(2, "FIXED", "FIXED"), //$NON-NLS-1$ //$NON-NLS-2$ - - /** - * The '<em><b>PROHIBITED</b></em>' literal object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #PROHIBITED_VALUE - * @generated - * @ordered - */ - PROHIBITED(3, "PROHIBITED", "PROHIBITED"); //$NON-NLS-1$ //$NON-NLS-2$ - - /** - * The '<em><b>OPTIONAL</b></em>' literal value. - * <!-- begin-user-doc --> - * <p> - * If the meaning of '<em><b>OPTIONAL</b></em>' literal object isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @see #OPTIONAL - * @model - * @generated - * @ordered - */ - public static final int OPTIONAL_VALUE = 0; - - /** - * The '<em><b>REQUIRED</b></em>' literal value. - * <!-- begin-user-doc --> - * <p> - * If the meaning of '<em><b>REQUIRED</b></em>' literal object isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @see #REQUIRED - * @model - * @generated - * @ordered - */ - public static final int REQUIRED_VALUE = 1; - - /** - * The '<em><b>FIXED</b></em>' literal value. - * <!-- begin-user-doc --> - * <p> - * If the meaning of '<em><b>FIXED</b></em>' literal object isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @see #FIXED - * @model - * @generated - * @ordered - */ - public static final int FIXED_VALUE = 2; - - /** - * The '<em><b>PROHIBITED</b></em>' literal value. - * <!-- begin-user-doc --> - * <p> - * If the meaning of '<em><b>PROHIBITED</b></em>' literal object isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @see #PROHIBITED - * @model - * @generated - * @ordered - */ - public static final int PROHIBITED_VALUE = 3; - - /** - * An array of all the '<em><b>Attribute Usage</b></em>' enumerators. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private static final AttributeUsage[] VALUES_ARRAY = - new AttributeUsage[] - { - OPTIONAL, - REQUIRED, - FIXED, - PROHIBITED, - }; - - /** - * A public read-only list of all the '<em><b>Attribute Usage</b></em>' enumerators. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final List<AttributeUsage> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); - - /** - * Returns the '<em><b>Attribute Usage</b></em>' literal with the specified literal value. - * <!-- begin-user-doc --> - * @param literal - * @return the attribute usage - * <!-- end-user-doc --> - * @generated - */ - public static AttributeUsage get(String literal) - { - for (int i = 0; i < VALUES_ARRAY.length; ++i) - { - AttributeUsage result = VALUES_ARRAY[i]; - if (result.toString().equals(literal)) - { - return result; - } - } - return null; - } - - /** - * Returns the '<em><b>Attribute Usage</b></em>' literal with the specified name. - * <!-- begin-user-doc --> - * @param name - * @return the attribute usage - * <!-- end-user-doc --> - * @generated - */ - public static AttributeUsage getByName(String name) - { - for (int i = 0; i < VALUES_ARRAY.length; ++i) - { - AttributeUsage result = VALUES_ARRAY[i]; - if (result.getName().equals(name)) - { - return result; - } - } - return null; - } - - /** - * Returns the '<em><b>Attribute Usage</b></em>' literal with the specified integer value. - * <!-- begin-user-doc --> - * @param value - * @return the attribute usage - * <!-- end-user-doc --> - * @generated - */ - public static AttributeUsage get(int value) - { - switch (value) - { - case OPTIONAL_VALUE: return OPTIONAL; - case REQUIRED_VALUE: return REQUIRED; - case FIXED_VALUE: return FIXED; - case PROHIBITED_VALUE: return PROHIBITED; - } - return null; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private final int value; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private final String name; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private final String literal; - - /** - * Only this class can construct instances. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private AttributeUsage(int value, String name, String literal) - { - this.value = value; - this.name = name; - this.literal = literal; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public int getValue() - { - return value; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getName() - { - return name; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getLiteral() - { - return literal; - } - - /** - * Returns the literal value of the enumerator, which is its string representation. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public String toString() - { - return literal; - } - -} //AttributeUsage diff --git a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/addtagmd/ElementData.java b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/addtagmd/ElementData.java deleted file mode 100644 index 2e0d68f70..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/addtagmd/ElementData.java +++ /dev/null @@ -1,75 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: ElementData.java,v 1.1 2010/03/08 18:49:41 cbateman Exp $ - */ -package org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd; - -import org.eclipse.emf.common.util.EList; - -import org.eclipse.emf.ecore.EObject; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Element Data</b></em>'. - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.ElementData#getName <em>Name</em>}</li> - * <li>{@link org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.ElementData#getAttributes <em>Attributes</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.AddTagMDPackage#getElementData() - * @model - * @generated - */ -public interface ElementData extends EObject -{ - /** - * Returns the value of the '<em><b>Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Name</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Name</em>' attribute. - * @see #setName(String) - * @see org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.AddTagMDPackage#getElementData_Name() - * @model extendedMetaData="kind='element' name='name'" - * @generated - */ - String getName(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.ElementData#getName <em>Name</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Name</em>' attribute. - * @see #getName() - * @generated - */ - void setName(String value); - - /** - * Returns the value of the '<em><b>Attributes</b></em>' containment reference list. - * The list contents are of type {@link org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.AttributeData}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Attributes</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>Attributes</em>' containment reference list. - * @see org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.AddTagMDPackage#getElementData_Attributes() - * @model containment="true" - * extendedMetaData="kind='element' name='attribute'" - * @generated - */ - EList<AttributeData> getAttributes(); - -} // ElementData diff --git a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/addtagmd/impl/AddTagMDFactoryImpl.java b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/addtagmd/impl/AddTagMDFactoryImpl.java deleted file mode 100644 index 44fc5553c..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/addtagmd/impl/AddTagMDFactoryImpl.java +++ /dev/null @@ -1,187 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: AddTagMDFactoryImpl.java,v 1.1 2010/03/08 18:49:41 cbateman Exp $ - */ -package org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.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.facelet.core.internal.cm.addtagmd.*; - -/** - * <!-- begin-user-doc --> - * An implementation of the model <b>Factory</b>. - * <!-- end-user-doc --> - * @generated - */ -public class AddTagMDFactoryImpl extends EFactoryImpl implements AddTagMDFactory -{ - /** - * Creates the default factory implementation. - * <!-- begin-user-doc --> - * @return the factory - * <!-- end-user-doc --> - * @generated - */ - public static AddTagMDFactory init() - { - try - { - AddTagMDFactory theAddTagMDFactory = (AddTagMDFactory)EPackage.Registry.INSTANCE.getEFactory("http://org.eclipse.jst.jsf.facelet.core/additionalTagMetadata.ecore"); //$NON-NLS-1$ - if (theAddTagMDFactory != null) - { - return theAddTagMDFactory; - } - } - catch (Exception exception) - { - EcorePlugin.INSTANCE.log(exception); - } - return new AddTagMDFactoryImpl(); - } - - /** - * Creates an instance of the factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public AddTagMDFactoryImpl() - { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public EObject create(EClass eClass) - { - switch (eClass.getClassifierID()) - { - case AddTagMDPackage.ELEMENT_DATA: return createElementData(); - case AddTagMDPackage.ATTRIBUTE_DATA: return createAttributeData(); - 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 AddTagMDPackage.ATTRIBUTE_USAGE: - return createAttributeUsageFromString(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 AddTagMDPackage.ATTRIBUTE_USAGE: - return convertAttributeUsageToString(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 ElementData createElementData() - { - ElementDataImpl elementData = new ElementDataImpl(); - return elementData; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public AttributeData createAttributeData() - { - AttributeDataImpl attributeData = new AttributeDataImpl(); - return attributeData; - } - - /** - * <!-- begin-user-doc --> - * @param eDataType - * @param initialValue - * @return the attribute usage - * <!-- end-user-doc --> - * @generated - */ - public AttributeUsage createAttributeUsageFromString(EDataType eDataType, String initialValue) - { - AttributeUsage result = AttributeUsage.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 usage string - * <!-- end-user-doc --> - * @generated - */ - public String convertAttributeUsageToString(EDataType eDataType, Object instanceValue) - { - return instanceValue == null ? null : instanceValue.toString(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public AddTagMDPackage getAddTagMDPackage() - { - return (AddTagMDPackage)getEPackage(); - } - - /** - * <!-- begin-user-doc --> - * @return the package - * <!-- end-user-doc --> - * @deprecated - * @generated - */ - @Deprecated - public static AddTagMDPackage getPackage() - { - return AddTagMDPackage.eINSTANCE; - } - -} //AddTagMDFactoryImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/addtagmd/impl/AddTagMDPackageImpl.java b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/addtagmd/impl/AddTagMDPackageImpl.java deleted file mode 100644 index 743afa086..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/addtagmd/impl/AddTagMDPackageImpl.java +++ /dev/null @@ -1,352 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: AddTagMDPackageImpl.java,v 1.1 2010/03/08 18:49:41 cbateman Exp $ - */ -package org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.impl; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EEnum; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; - -import org.eclipse.emf.ecore.impl.EPackageImpl; - -import org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.AddTagMDFactory; -import org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.AddTagMDPackage; -import org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.AttributeData; -import org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.AttributeUsage; -import org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.ElementData; - -/** - * <!-- begin-user-doc --> - * An implementation of the model <b>Package</b>. - * <!-- end-user-doc --> - * @generated - */ -public class AddTagMDPackageImpl extends EPackageImpl implements AddTagMDPackage -{ - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass elementDataEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass attributeDataEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EEnum attributeUsageEEnum = 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.facelet.core.internal.cm.addtagmd.AddTagMDPackage#eNS_URI - * @see #init() - * @generated - */ - private AddTagMDPackageImpl() - { - super(eNS_URI, AddTagMDFactory.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 package - * <!-- end-user-doc --> - * @see #eNS_URI - * @see #createPackageContents() - * @see #initializePackageContents() - * @generated - */ - public static AddTagMDPackage init() - { - if (isInited) return (AddTagMDPackage)EPackage.Registry.INSTANCE.getEPackage(AddTagMDPackage.eNS_URI); - - // Obtain or create and register package - AddTagMDPackageImpl theAddTagMDPackage = (AddTagMDPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(eNS_URI) instanceof AddTagMDPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(eNS_URI) : new AddTagMDPackageImpl()); - - isInited = true; - - // Create package meta-data objects - theAddTagMDPackage.createPackageContents(); - - // Initialize created meta-data - theAddTagMDPackage.initializePackageContents(); - - // Mark meta-data to indicate it can't be changed - theAddTagMDPackage.freeze(); - - return theAddTagMDPackage; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getElementData() - { - return elementDataEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getElementData_Name() - { - return (EAttribute)elementDataEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getElementData_Attributes() - { - return (EReference)elementDataEClass.getEStructuralFeatures().get(1); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getAttributeData() - { - return attributeDataEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getAttributeData_Name() - { - return (EAttribute)attributeDataEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getAttributeData_Usage() - { - return (EAttribute)attributeDataEClass.getEStructuralFeatures().get(1); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getAttributeData_Description() - { - return (EAttribute)attributeDataEClass.getEStructuralFeatures().get(2); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EEnum getAttributeUsage() - { - return attributeUsageEEnum; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public AddTagMDFactory getAddTagMDFactory() - { - return (AddTagMDFactory)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 - elementDataEClass = createEClass(ELEMENT_DATA); - createEAttribute(elementDataEClass, ELEMENT_DATA__NAME); - createEReference(elementDataEClass, ELEMENT_DATA__ATTRIBUTES); - - attributeDataEClass = createEClass(ATTRIBUTE_DATA); - createEAttribute(attributeDataEClass, ATTRIBUTE_DATA__NAME); - createEAttribute(attributeDataEClass, ATTRIBUTE_DATA__USAGE); - createEAttribute(attributeDataEClass, ATTRIBUTE_DATA__DESCRIPTION); - - // Create enums - attributeUsageEEnum = createEEnum(ATTRIBUTE_USAGE); - } - - /** - * <!-- 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 - - // Initialize classes and features; add operations and parameters - initEClass(elementDataEClass, ElementData.class, "ElementData", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEAttribute(getElementData_Name(), ecorePackage.getEString(), "name", null, 0, 1, ElementData.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEReference(getElementData_Attributes(), this.getAttributeData(), null, "attributes", null, 0, -1, ElementData.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - - initEClass(attributeDataEClass, AttributeData.class, "AttributeData", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEAttribute(getAttributeData_Name(), ecorePackage.getEString(), "name", null, 0, 1, AttributeData.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEAttribute(getAttributeData_Usage(), this.getAttributeUsage(), "usage", null, 0, 1, AttributeData.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEAttribute(getAttributeData_Description(), ecorePackage.getEString(), "description", null, 0, 1, AttributeData.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - - // Initialize enums and add enum literals - initEEnum(attributeUsageEEnum, AttributeUsage.class, "AttributeUsage"); //$NON-NLS-1$ - addEEnumLiteral(attributeUsageEEnum, AttributeUsage.OPTIONAL); - addEEnumLiteral(attributeUsageEEnum, AttributeUsage.REQUIRED); - addEEnumLiteral(attributeUsageEEnum, AttributeUsage.FIXED); - addEEnumLiteral(attributeUsageEEnum, AttributeUsage.PROHIBITED); - - // 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 - (getElementData_Name(), - source, - new String[] - { - "kind", "element", //$NON-NLS-1$ //$NON-NLS-2$ - "name", "name" //$NON-NLS-1$ //$NON-NLS-2$ - }); - addAnnotation - (getElementData_Attributes(), - source, - new String[] - { - "kind", "element", //$NON-NLS-1$ //$NON-NLS-2$ - "name", "attribute" //$NON-NLS-1$ //$NON-NLS-2$ - }); - addAnnotation - (getAttributeData_Name(), - source, - new String[] - { - "kind", "element", //$NON-NLS-1$ //$NON-NLS-2$ - "name", "name" //$NON-NLS-1$ //$NON-NLS-2$ - }); - addAnnotation - (getAttributeData_Usage(), - source, - new String[] - { - "kind", "element", //$NON-NLS-1$ //$NON-NLS-2$ - "name", "usage" //$NON-NLS-1$ //$NON-NLS-2$ - }); - addAnnotation - (getAttributeData_Description(), - source, - new String[] - { - "kind", "element", //$NON-NLS-1$ //$NON-NLS-2$ - "name", "description" //$NON-NLS-1$ //$NON-NLS-2$ - }); - } - -} //AddTagMDPackageImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/addtagmd/impl/AttributeDataImpl.java b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/addtagmd/impl/AttributeDataImpl.java deleted file mode 100644 index 6e47d33bb..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/addtagmd/impl/AttributeDataImpl.java +++ /dev/null @@ -1,294 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: AttributeDataImpl.java,v 1.1 2010/03/08 18:49:41 cbateman Exp $ - */ -package org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.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.facelet.core.internal.cm.addtagmd.AddTagMDPackage; -import org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.AttributeData; -import org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.AttributeUsage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Attribute Data</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.impl.AttributeDataImpl#getName <em>Name</em>}</li> - * <li>{@link org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.impl.AttributeDataImpl#getUsage <em>Usage</em>}</li> - * <li>{@link org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.impl.AttributeDataImpl#getDescription <em>Description</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class AttributeDataImpl extends EObjectImpl implements AttributeData -{ - /** - * 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 #getUsage() <em>Usage</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getUsage() - * @generated - * @ordered - */ - protected static final AttributeUsage USAGE_EDEFAULT = AttributeUsage.OPTIONAL; - - /** - * The cached value of the '{@link #getUsage() <em>Usage</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getUsage() - * @generated - * @ordered - */ - protected AttributeUsage usage = USAGE_EDEFAULT; - - /** - * The default value of the '{@link #getDescription() <em>Description</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getDescription() - * @generated - * @ordered - */ - protected static final String DESCRIPTION_EDEFAULT = null; - - /** - * The cached value of the '{@link #getDescription() <em>Description</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getDescription() - * @generated - * @ordered - */ - protected String description = DESCRIPTION_EDEFAULT; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected AttributeDataImpl() - { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() - { - return AddTagMDPackage.Literals.ATTRIBUTE_DATA; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getName() - { - return name; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setName(String newName) - { - String oldName = name; - name = newName; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, AddTagMDPackage.ATTRIBUTE_DATA__NAME, oldName, name)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public AttributeUsage getUsage() - { - return usage; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setUsage(AttributeUsage newUsage) - { - AttributeUsage oldUsage = usage; - usage = newUsage == null ? USAGE_EDEFAULT : newUsage; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, AddTagMDPackage.ATTRIBUTE_DATA__USAGE, oldUsage, usage)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getDescription() - { - return description; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setDescription(String newDescription) - { - String oldDescription = description; - description = newDescription; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, AddTagMDPackage.ATTRIBUTE_DATA__DESCRIPTION, oldDescription, description)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) - { - switch (featureID) - { - case AddTagMDPackage.ATTRIBUTE_DATA__NAME: - return getName(); - case AddTagMDPackage.ATTRIBUTE_DATA__USAGE: - return getUsage(); - case AddTagMDPackage.ATTRIBUTE_DATA__DESCRIPTION: - return getDescription(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eSet(int featureID, Object newValue) - { - switch (featureID) - { - case AddTagMDPackage.ATTRIBUTE_DATA__NAME: - setName((String)newValue); - return; - case AddTagMDPackage.ATTRIBUTE_DATA__USAGE: - setUsage((AttributeUsage)newValue); - return; - case AddTagMDPackage.ATTRIBUTE_DATA__DESCRIPTION: - setDescription((String)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) - { - switch (featureID) - { - case AddTagMDPackage.ATTRIBUTE_DATA__NAME: - setName(NAME_EDEFAULT); - return; - case AddTagMDPackage.ATTRIBUTE_DATA__USAGE: - setUsage(USAGE_EDEFAULT); - return; - case AddTagMDPackage.ATTRIBUTE_DATA__DESCRIPTION: - setDescription(DESCRIPTION_EDEFAULT); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) - { - switch (featureID) - { - case AddTagMDPackage.ATTRIBUTE_DATA__NAME: - return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); - case AddTagMDPackage.ATTRIBUTE_DATA__USAGE: - return usage != USAGE_EDEFAULT; - case AddTagMDPackage.ATTRIBUTE_DATA__DESCRIPTION: - return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description); - } - 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(" (name: "); //$NON-NLS-1$ - result.append(name); - result.append(", usage: "); //$NON-NLS-1$ - result.append(usage); - result.append(", description: "); //$NON-NLS-1$ - result.append(description); - result.append(')'); - return result.toString(); - } - -} //AttributeDataImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/addtagmd/impl/ElementDataImpl.java b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/addtagmd/impl/ElementDataImpl.java deleted file mode 100644 index 4860f62d2..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/addtagmd/impl/ElementDataImpl.java +++ /dev/null @@ -1,239 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: ElementDataImpl.java,v 1.1 2010/03/08 18:49:41 cbateman Exp $ - */ -package org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.impl; - -import java.util.Collection; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.NotificationChain; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.InternalEObject; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.impl.EObjectImpl; -import org.eclipse.emf.ecore.util.EObjectContainmentEList; -import org.eclipse.emf.ecore.util.InternalEList; -import org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.AddTagMDPackage; -import org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.AttributeData; -import org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.ElementData; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Element Data</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.impl.ElementDataImpl#getName <em>Name</em>}</li> - * <li>{@link org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.impl.ElementDataImpl#getAttributes <em>Attributes</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class ElementDataImpl extends EObjectImpl implements ElementData -{ - /** - * 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 #getAttributes() <em>Attributes</em>}' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getAttributes() - * @generated - * @ordered - */ - protected EList<AttributeData> attributes; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ElementDataImpl() - { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() - { - return AddTagMDPackage.Literals.ELEMENT_DATA; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getName() - { - return name; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setName(String newName) - { - String oldName = name; - name = newName; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, AddTagMDPackage.ELEMENT_DATA__NAME, oldName, name)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EList<AttributeData> getAttributes() - { - if (attributes == null) - { - attributes = new EObjectContainmentEList<AttributeData>(AttributeData.class, this, AddTagMDPackage.ELEMENT_DATA__ATTRIBUTES); - } - return attributes; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) - { - switch (featureID) - { - case AddTagMDPackage.ELEMENT_DATA__ATTRIBUTES: - return ((InternalEList<?>)getAttributes()).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 AddTagMDPackage.ELEMENT_DATA__NAME: - return getName(); - case AddTagMDPackage.ELEMENT_DATA__ATTRIBUTES: - return getAttributes(); - } - 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 AddTagMDPackage.ELEMENT_DATA__NAME: - setName((String)newValue); - return; - case AddTagMDPackage.ELEMENT_DATA__ATTRIBUTES: - getAttributes().clear(); - getAttributes().addAll((Collection<? extends AttributeData>)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) - { - switch (featureID) - { - case AddTagMDPackage.ELEMENT_DATA__NAME: - setName(NAME_EDEFAULT); - return; - case AddTagMDPackage.ELEMENT_DATA__ATTRIBUTES: - getAttributes().clear(); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) - { - switch (featureID) - { - case AddTagMDPackage.ELEMENT_DATA__NAME: - return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); - case AddTagMDPackage.ELEMENT_DATA__ATTRIBUTES: - return attributes != null && !attributes.isEmpty(); - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public String toString() - { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (name: "); //$NON-NLS-1$ - result.append(name); - result.append(')'); - return result.toString(); - } - -} //ElementDataImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/addtagmd/provider/AddTagMDItemProviderAdapterFactory.java b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/addtagmd/provider/AddTagMDItemProviderAdapterFactory.java deleted file mode 100644 index 4d23f22ea..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/addtagmd/provider/AddTagMDItemProviderAdapterFactory.java +++ /dev/null @@ -1,246 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: AddTagMDItemProviderAdapterFactory.java,v 1.1 2010/03/08 18:49:40 cbateman Exp $ - */ -package org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.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.facelet.core.internal.cm.addtagmd.util.AddTagMDAdapterFactory; - -/** - * 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 AddTagMDItemProviderAdapterFactory extends AddTagMDAdapterFactory implements ComposeableAdapterFactory, IChangeNotifier, IDisposable -{ - /** - * 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<Object> supportedTypes = new ArrayList<Object>(); - - /** - * This constructs an instance. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - public AddTagMDItemProviderAdapterFactory() - { - supportedTypes.add(IEditingDomainItemProvider.class); - supportedTypes.add(IStructuredItemContentProvider.class); - supportedTypes.add(ITreeItemContentProvider.class); - supportedTypes.add(IItemLabelProvider.class); - supportedTypes.add(IItemPropertySource.class); - supportedTypes.add(IResourceProvider.class); - } - - /** - * This keeps track of the one adapter used for all {@link org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.ElementData} instances. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ElementDataItemProvider elementDataItemProvider; - - /** - * This creates an adapter for a {@link org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.ElementData}. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Adapter createElementDataAdapter() - { - if (elementDataItemProvider == null) - { - elementDataItemProvider = new ElementDataItemProvider(this); - } - - return elementDataItemProvider; - } - - /** - * This keeps track of the one adapter used for all {@link org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.AttributeData} instances. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected AttributeDataItemProvider attributeDataItemProvider; - - /** - * This creates an adapter for a {@link org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.AttributeData}. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Adapter createAttributeDataAdapter() - { - if (attributeDataItemProvider == null) - { - attributeDataItemProvider = new AttributeDataItemProvider(this); - } - - return attributeDataItemProvider; - } - - /** - * This returns the root adapter factory that contains this factory. - * <!-- begin-user-doc --> - * <!-- 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 --> - * <!-- end-user-doc --> - * @generated - */ - public void setParentAdapterFactory(ComposedAdapterFactory parentAdapterFactory) - { - this.parentAdapterFactory = parentAdapterFactory; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - 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 --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Adapter adapt(Notifier notifier, Object type) - { - return super.adapt(notifier, this); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - 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 --> - * <!-- end-user-doc --> - * @generated - */ - public void addListener(INotifyChangedListener notifyChangedListener) - { - changeNotifier.addListener(notifyChangedListener); - } - - /** - * This removes a listener. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void removeListener(INotifyChangedListener notifyChangedListener) - { - changeNotifier.removeListener(notifyChangedListener); - } - - /** - * This delegates to {@link #changeNotifier} and to {@link #parentAdapterFactory}. - * <!-- begin-user-doc --> - * <!-- 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 (elementDataItemProvider != null) elementDataItemProvider.dispose(); - if (attributeDataItemProvider != null) attributeDataItemProvider.dispose(); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/addtagmd/provider/AttributeDataItemProvider.java b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/addtagmd/provider/AttributeDataItemProvider.java deleted file mode 100644 index 1bc1152a7..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/addtagmd/provider/AttributeDataItemProvider.java +++ /dev/null @@ -1,258 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: AttributeDataItemProvider.java,v 1.1 2010/03/08 18:49:40 cbateman Exp $ - */ -package org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.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.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -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.IItemPropertyDescriptor; -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.metadata.Trait; -import org.eclipse.jst.jsf.common.metadata.internal.TraitValueHelper; -import org.eclipse.jst.jsf.facelet.core.internal.FaceletCorePlugin; - -import org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.AddTagMDPackage; -import org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.AttributeData; - -/** - * This is the item provider adapter for a {@link org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.AttributeData} object. - * <!-- begin-user-doc --> - * @extends IResourceProvider - * <!-- end-user-doc --> - * @generated - */ -public class AttributeDataItemProvider - extends ItemProviderAdapter - implements - IEditingDomainItemProvider, - IStructuredItemContentProvider, - ITreeItemContentProvider, - IItemLabelProvider, - IItemPropertySource, - IResourceProvider -{ - /** - * This constructs an instance from a factory and a notifier. - * <!-- begin-user-doc --> - * @param adapterFactory - * <!-- end-user-doc --> - * @generated - */ - public AttributeDataItemProvider(AdapterFactory adapterFactory) - { - super(adapterFactory); - } - - /** - * This returns the property descriptors for the adapted class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) - { - if (itemPropertyDescriptors == null) - { - super.getPropertyDescriptors(object); - - addNamePropertyDescriptor(object); - addUsagePropertyDescriptor(object); - addDescriptionPropertyDescriptor(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_AttributeData_name_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_AttributeData_name_feature", "_UI_AttributeData_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - AddTagMDPackage.Literals.ATTRIBUTE_DATA__NAME, - true, - false, - false, - ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, - null, - null)); - } - - /** - * This adds a property descriptor for the Usage feature. - * <!-- begin-user-doc --> - * @param object - * <!-- end-user-doc --> - * @generated - */ - protected void addUsagePropertyDescriptor(Object object) - { - itemPropertyDescriptors.add - (createItemPropertyDescriptor - (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), - getResourceLocator(), - getString("_UI_AttributeData_usage_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_AttributeData_usage_feature", "_UI_AttributeData_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - AddTagMDPackage.Literals.ATTRIBUTE_DATA__USAGE, - true, - false, - false, - ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, - null, - null)); - } - - /** - * This adds a property descriptor for the Description feature. - * <!-- begin-user-doc --> - * @param object - * <!-- end-user-doc --> - * @generated - */ - protected void addDescriptionPropertyDescriptor(Object object) - { - itemPropertyDescriptors.add - (createItemPropertyDescriptor - (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), - getResourceLocator(), - getString("_UI_AttributeData_description_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_AttributeData_description_feature", "_UI_AttributeData_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - AddTagMDPackage.Literals.ATTRIBUTE_DATA__DESCRIPTION, - true, - false, - false, - ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, - null, - null)); - } - - /** - * This returns AttributeData.gif. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object getImage(Object object) - { - return overlayImage(object, getResourceLocator().getImage("full/obj16/AttributeData")); //$NON-NLS-1$ - } - - /** - * This returns the label text for the adapted class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public String getText(Object object) - { - String label = ((AttributeData)object).getName(); - return label == null || label.length() == 0 ? - getString("_UI_AttributeData_type") : //$NON-NLS-1$ - getString("_UI_AttributeData_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * This handles model notifications by calling {@link #updateChildren} to update any cached - * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void notifyChanged(Notification notification) - { - updateChildren(notification); - - switch (notification.getFeatureID(AttributeData.class)) - { - case AddTagMDPackage.ATTRIBUTE_DATA__NAME: - case AddTagMDPackage.ATTRIBUTE_DATA__USAGE: - case AddTagMDPackage.ATTRIBUTE_DATA__DESCRIPTION: - 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 - */ - @Override - protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) - { - super.collectNewChildDescriptors(newChildDescriptors, object); - } - - /** - * Return the resource locator for this item provider's resources. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public ResourceLocator getResourceLocator() - { - return FaceletCorePlugin.INSTANCE; - } - - public String getTranslatedString(EObject object, EStructuralFeature feature) - { - Object value = object.eGet(feature); - - if (value != null) - { - EObject testObject = object; - - while (! (testObject instanceof Trait) - && testObject != null) - { - testObject = testObject.eContainer(); - } - - if (testObject instanceof Trait) - { - Trait trait = (Trait) testObject; - value = TraitValueHelper.getNLSValue(trait, value.toString()); - } - return value.toString(); - } - - return object.toString(); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/addtagmd/provider/ElementDataItemProvider.java b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/addtagmd/provider/ElementDataItemProvider.java deleted file mode 100644 index 9aeae53ea..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/addtagmd/provider/ElementDataItemProvider.java +++ /dev/null @@ -1,228 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: ElementDataItemProvider.java,v 1.1 2010/03/08 18:49:40 cbateman Exp $ - */ -package org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.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.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -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.IItemPropertyDescriptor; -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.metadata.Trait; -import org.eclipse.jst.jsf.common.metadata.internal.TraitValueHelper; -import org.eclipse.jst.jsf.facelet.core.internal.FaceletCorePlugin; -import org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.AddTagMDPackage; -import org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.ElementData; - -/** - * This is the item provider adapter for a {@link org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.ElementData} object. - * <!-- begin-user-doc --> - * @extends IResourceProvider - * <!-- end-user-doc --> - * @generated - */ -public class ElementDataItemProvider - extends ItemProviderAdapter - implements - IEditingDomainItemProvider, - IStructuredItemContentProvider, - ITreeItemContentProvider, - IItemLabelProvider, - IItemPropertySource, - IResourceProvider -{ - /** - * This constructs an instance from a factory and a notifier. - * <!-- begin-user-doc --> - * @param adapterFactory - * <!-- end-user-doc --> - * @generated - */ - public ElementDataItemProvider(AdapterFactory adapterFactory) - { - super(adapterFactory); - } - - /** - * This returns the property descriptors for the adapted class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) - { - if (itemPropertyDescriptors == null) - { - super.getPropertyDescriptors(object); - - addNamePropertyDescriptor(object); - addAttributesPropertyDescriptor(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_ElementData_name_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_ElementData_name_feature", "_UI_ElementData_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - AddTagMDPackage.Literals.ELEMENT_DATA__NAME, - true, - false, - false, - ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, - null, - null)); - } - - /** - * This adds a property descriptor for the Attributes feature. - * <!-- begin-user-doc --> - * @param object - * <!-- end-user-doc --> - * @generated - */ - protected void addAttributesPropertyDescriptor(Object object) - { - itemPropertyDescriptors.add - (createItemPropertyDescriptor - (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), - getResourceLocator(), - getString("_UI_ElementData_attributes_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_ElementData_attributes_feature", "_UI_ElementData_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - AddTagMDPackage.Literals.ELEMENT_DATA__ATTRIBUTES, - true, - false, - true, - null, - null, - null)); - } - - /** - * This returns ElementData.gif. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object getImage(Object object) - { - return overlayImage(object, getResourceLocator().getImage("full/obj16/ElementData")); //$NON-NLS-1$ - } - - /** - * This returns the label text for the adapted class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public String getText(Object object) - { - String label = ((ElementData)object).getName(); - return label == null || label.length() == 0 ? - getString("_UI_ElementData_type") : //$NON-NLS-1$ - getString("_UI_ElementData_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * This handles model notifications by calling {@link #updateChildren} to update any cached - * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void notifyChanged(Notification notification) - { - updateChildren(notification); - - switch (notification.getFeatureID(ElementData.class)) - { - case AddTagMDPackage.ELEMENT_DATA__NAME: - 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 - */ - @Override - protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) - { - super.collectNewChildDescriptors(newChildDescriptors, object); - } - - /** - * Return the resource locator for this item provider's resources. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public ResourceLocator getResourceLocator() - { - return FaceletCorePlugin.INSTANCE; - } - - public String getTranslatedString(EObject object, EStructuralFeature feature) - { - Object value = object.eGet(feature); - - if (value != null) - { - EObject testObject = object; - - while (! (testObject instanceof Trait) - && testObject != null) - { - testObject = testObject.eContainer(); - } - - if (testObject instanceof Trait) - { - Trait trait = (Trait) testObject; - value = TraitValueHelper.getNLSValue(trait, value.toString()); - } - return value.toString(); - } - - return object.toString(); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/addtagmd/provider/IResourceProvider.java b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/addtagmd/provider/IResourceProvider.java deleted file mode 100644 index d441f590c..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/addtagmd/provider/IResourceProvider.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.provider; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; - -/** - * A translated string provider. - * - * @author cbateman - * - */ -public interface IResourceProvider -{ - /** - * @param object - * @param feature - * @return the string value of object.eGet(feature) - */ - String getTranslatedString(final EObject object, - final EStructuralFeature feature); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/addtagmd/util/AddTagMDAdapterFactory.java b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/addtagmd/util/AddTagMDAdapterFactory.java deleted file mode 100644 index 0ec5f7206..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/addtagmd/util/AddTagMDAdapterFactory.java +++ /dev/null @@ -1,156 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: AddTagMDAdapterFactory.java,v 1.1 2010/03/08 18:49:42 cbateman Exp $ - */ -package org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.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.facelet.core.internal.cm.addtagmd.*; - -/** - * <!-- 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.facelet.core.internal.cm.addtagmd.AddTagMDPackage - * @generated - */ -public class AddTagMDAdapterFactory extends AdapterFactoryImpl -{ - /** - * The cached model package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected static AddTagMDPackage modelPackage; - - /** - * Creates an instance of the adapter factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public AddTagMDAdapterFactory() - { - if (modelPackage == null) - { - modelPackage = AddTagMDPackage.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 AddTagMDSwitch<Adapter> modelSwitch = - new AddTagMDSwitch<Adapter>() - { - @Override - public Adapter caseElementData(ElementData object) - { - return createElementDataAdapter(); - } - @Override - public Adapter caseAttributeData(AttributeData object) - { - return createAttributeDataAdapter(); - } - @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.facelet.core.internal.cm.addtagmd.ElementData <em>Element Data</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.facelet.core.internal.cm.addtagmd.ElementData - * @generated - */ - public Adapter createElementDataAdapter() - { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.AttributeData <em>Attribute Data</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.facelet.core.internal.cm.addtagmd.AttributeData - * @generated - */ - public Adapter createAttributeDataAdapter() - { - 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; - } - -} //AddTagMDAdapterFactory diff --git a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/addtagmd/util/AddTagMDSwitch.java b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/addtagmd/util/AddTagMDSwitch.java deleted file mode 100644 index e15cffd81..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/addtagmd/util/AddTagMDSwitch.java +++ /dev/null @@ -1,168 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: AddTagMDSwitch.java,v 1.1 2010/03/08 18:49:42 cbateman Exp $ - */ -package org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.util; - -import java.util.List; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; - -import org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.*; - -/** - * <!-- begin-user-doc --> - * The <b>Switch</b> for the model's inheritance hierarchy. - * It supports the call {@link #doSwitch(EObject) doSwitch(object)} - * to invoke the <code>caseXXX</code> method for each class of the model, - * starting with the actual class of the object - * and proceeding up the inheritance hierarchy - * until a non-null result is returned, - * which is the result of the switch. - * @param <T> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.AddTagMDPackage - * @generated - */ -public class AddTagMDSwitch<T> -{ - /** - * The cached model package - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected static AddTagMDPackage modelPackage; - - /** - * Creates an instance of the switch. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public AddTagMDSwitch() - { - if (modelPackage == null) - { - modelPackage = AddTagMDPackage.eINSTANCE; - } - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * @param theEObject - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - public T doSwitch(EObject theEObject) - { - return doSwitch(theEObject.eClass(), theEObject); - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * @param theEClass - * @param theEObject - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - protected T doSwitch(EClass theEClass, EObject theEObject) - { - if (theEClass.eContainer() == modelPackage) - { - return doSwitch(theEClass.getClassifierID(), theEObject); - } - List<EClass> eSuperTypes = theEClass.getESuperTypes(); - return - eSuperTypes.isEmpty() ? - defaultCase(theEObject) : - doSwitch(eSuperTypes.get(0), theEObject); - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * @param classifierID - * @param theEObject - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - protected T doSwitch(int classifierID, EObject theEObject) - { - switch (classifierID) - { - case AddTagMDPackage.ELEMENT_DATA: - { - ElementData elementData = (ElementData)theEObject; - T result = caseElementData(elementData); - if (result == null) result = defaultCase(theEObject); - return result; - } - case AddTagMDPackage.ATTRIBUTE_DATA: - { - AttributeData attributeData = (AttributeData)theEObject; - T result = caseAttributeData(attributeData); - if (result == null) result = defaultCase(theEObject); - return result; - } - default: return defaultCase(theEObject); - } - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Element Data</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>Element Data</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseElementData(ElementData object) - { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Attribute Data</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Attribute Data</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseAttributeData(AttributeData object) - { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch, but this is the last case anyway. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>EObject</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) - * @generated - */ - public T defaultCase(EObject object) - { - return null; - } - -} //AddTagMDSwitch diff --git a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/attributevalues/TemplateWebPathType.java b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/attributevalues/TemplateWebPathType.java deleted file mode 100644 index 572d7d55d..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/attributevalues/TemplateWebPathType.java +++ /dev/null @@ -1,179 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facelet.core.internal.cm.attributevalues; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.jst.jsf.context.resolver.structureddocument.IDOMContextResolver; -import org.eclipse.jst.jsf.context.resolver.structureddocument.IStructuredDocumentContextResolverFactory; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext; -import org.eclipse.jst.jsf.facelet.core.internal.FaceletCorePlugin; -import org.eclipse.jst.jsf.metadataprocessors.features.IPossibleValues; -import org.eclipse.jst.jsf.metadataprocessors.features.PossibleValue; -import org.eclipse.jst.jsf.taglibprocessing.attributevalues.WebPathType; -import org.eclipse.wst.common.componentcore.ComponentCore; -import org.eclipse.wst.common.componentcore.resources.IVirtualContainer; -import org.eclipse.wst.common.componentcore.resources.IVirtualResource; -import org.w3c.dom.Attr; -import org.w3c.dom.Node; - -/** - * Web-path attribute value type that adds possible values support - * - * @author cbateman - * - */ -public class TemplateWebPathType extends WebPathType implements IPossibleValues -{ - - public List getPossibleValues() - { - final IStructuredDocumentContext context = getStructuredDocumentContext(); - final IDOMContextResolver resolver = IStructuredDocumentContextResolverFactory.INSTANCE - .getDOMContextResolver(context); - if (resolver != null) - { - final Node node = resolver.getNode(); - if (node instanceof Attr) - { - return createPossibleValues((Attr) node); - } - } - return Collections.EMPTY_LIST; - } - - private List createPossibleValues(final Attr node) - { - String currentPathString = node.getNodeValue(); - - final List possibleValues = new ArrayList(); - - if (currentPathString == null || "".equals(currentPathString.trim())) //$NON-NLS-1$ - { - currentPathString = "/"; //$NON-NLS-1$ - } - - final IPath currentPath = new Path(currentPathString); - - final IVirtualContainer webRoot = getWebRoot(); - - final IVirtualResource deepestElement = findDeepestCommonElement( - currentPath, webRoot); - - if (deepestElement == null) - { - // empty - return possibleValues; - } - - final IResource[] allResources = deepestElement - .getUnderlyingResources(); - for (final IResource res : allResources) - { - if (res instanceof IContainer) - { - try - { - for (final IResource child : ((IContainer) res).members()) - { - if (child.exists()) - { - IPath childPath = child.getProjectRelativePath(); - int numLeadingSegments = webRoot - .getProjectRelativePath() - .matchingFirstSegments(childPath); - childPath = childPath - .removeFirstSegments(numLeadingSegments); - String pathName = null; - if (currentPath.isAbsolute()) - { - pathName = childPath.makeAbsolute() - .toString(); - } - else - { - pathName = childPath.makeRelative().toString(); - } - - final PossibleValue pv = new PossibleValue( - pathName, pathName); - possibleValues.add(pv); - } - } - } - catch (final CoreException ce) - { - FaceletCorePlugin.log("While trying possible values", ce); //$NON-NLS-1$ - } - } - } - return possibleValues; - } - - private IVirtualResource findDeepestCommonElement( - final IPath currentPath, final IVirtualContainer webRoot) - { - final String[] segments = currentPath.segments(); - IVirtualResource deepestElement = null; - if (segments != null) - { - IPath longestSubPath = new Path(""); //$NON-NLS-1$ - for (final String segment : segments) - { - longestSubPath = longestSubPath.append(segment); - deepestElement = webRoot.findMember(longestSubPath); - if (deepestElement == null) - { - longestSubPath = longestSubPath.removeLastSegments(1); - break; - } - } - - deepestElement = webRoot.findMember(longestSubPath); - if (deepestElement == null) - { - deepestElement = webRoot; - } - else - { - int avoidInfiniteLoopCount = 0; - while(avoidInfiniteLoopCount < 1000 && // we timeout in cause of circular chains. - deepestElement != null && - ! (deepestElement.getUnderlyingResource() instanceof IContainer)) - { - deepestElement = deepestElement.getParent(); - } - - if (avoidInfiniteLoopCount == 1000) - { - throw new IllegalStateException(); - } - } - } - return deepestElement; - } - - private IVirtualContainer getWebRoot() - - { - final IVirtualContainer webRoot = ComponentCore.createComponent( - getProject()).getRootFolder(); - - return webRoot; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/strategy/AbstractExternalMetadataStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/strategy/AbstractExternalMetadataStrategy.java deleted file mode 100644 index 3a46644f9..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/strategy/AbstractExternalMetadataStrategy.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facelet.core.internal.cm.strategy; - -import org.eclipse.jst.jsf.common.dom.TagIdentifier; -import org.eclipse.jst.jsf.facelet.core.internal.cm.ExternalTagInfo; -import org.eclipse.jst.jsf.facelet.core.internal.cm.TagInfo; - -/** - * Super class of all external meta-data strategy. - * - * @author cbateman - * - */ -/* package */abstract class AbstractExternalMetadataStrategy implements -IExternalMetadataStrategy -{ - private final String _displayName; - private final String _id; - - protected AbstractExternalMetadataStrategy(final String id, - final String displayName) - { - _id = id; - _displayName = displayName; - } - - public final TagInfo getNoResult() - { - // this value must be "==" comparable - return ExternalTagInfo.NULL_INSTANCE; - } - - public abstract TagInfo perform(TagIdentifier input) throws Exception; - - public final String getDisplayName() - { - return _displayName; - } - - public String getId() - { - return _id; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/strategy/FaceletExternalMetadataStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/strategy/FaceletExternalMetadataStrategy.java deleted file mode 100644 index 149c34112..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/strategy/FaceletExternalMetadataStrategy.java +++ /dev/null @@ -1,138 +0,0 @@ -package org.eclipse.jst.jsf.facelet.core.internal.cm.strategy; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.Map; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.jsf.common.dom.TagIdentifier; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagAttribute; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagElement; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.Namespace; -import org.eclipse.jst.jsf.designtime.internal.view.model.ITagRegistry; -import org.eclipse.jst.jsf.facelet.core.internal.cm.AttributeCMAdapter; -import org.eclipse.jst.jsf.facelet.core.internal.cm.TagInfo; -import org.eclipse.jst.jsf.facelet.core.internal.util.ViewUtil; -import org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap; -import org.eclipse.wst.xml.core.internal.contentmodel.CMNode; - -/** - * The - * @author cbateman - * - */ -public class FaceletExternalMetadataStrategy extends - AbstractExternalMetadataStrategy -{ - /** - * The unique identifier for the strategy. - */ - public final static String STRATEGY_ID = "org.eclipse.jst.jsf.facelet.core.internal.cm.strategy.FaceletExternalMetadataStrategy"; //$NON-NLS-1$ - private final IProject _project; - - /** - * @param project - */ - public FaceletExternalMetadataStrategy(final IProject project) - { - super(STRATEGY_ID, Messages.FaceletExternalMetadataStrategy_0); - _project = project; - } - - @Override - public TagInfo perform(TagIdentifier input) throws Exception - { - final ITagRegistry tagRegistry = ViewUtil.getTagRegistry(_project); - - if (tagRegistry != null) - { - Namespace tagLibrary = tagRegistry.getTagLibrary(input.getUri()); - if (tagLibrary != null) - { - return new FaceletInternalInfo(tagLibrary); - } - } - return getNoResult(); - } - - private static class FaceletInternalInfo extends TagInfo - { - private final Namespace _namespace; - - public FaceletInternalInfo(final Namespace namespace) - { - _namespace = namespace; - } - - @Override - public Object getTagProperty(String tagName, String key) - { - if ("description".equals(key)) //$NON-NLS-1$ - { - // TODO: - } - return null; - } - - @Override - public CMNamedNodeMap getAttributes(String tagName) - { - ITagElement viewElement = _namespace.getViewElement(tagName); - if (viewElement != null) - { - return new MyNodeNameMap(viewElement); - } - return null; - } - - private static class MyNodeNameMap implements CMNamedNodeMap - { - private final ITagElement _tagElement; - private final ArrayList<CMNode> _attrs; - - public MyNodeNameMap(final ITagElement tagElement) - { - super(); - _tagElement = tagElement; - _attrs = new ArrayList<CMNode>(); - for (final Map.Entry<String, ? extends ITagAttribute> entry : _tagElement.getAttributes().entrySet()) - { - final ITagAttribute attr = entry.getValue(); - _attrs.add(new AttributeCMAdapter(attr)); - } - } - - public int getLength() - { - return _attrs.size(); - } - - public CMNode getNamedItem(String name) - { - if (name == null) - { - return null; - } - for (final CMNode cmNode : _attrs) - { - if (name.equals(cmNode.getNodeName())) - { - return cmNode; - } - } - return null; - } - - public CMNode item(int index) - { - return _attrs.get(index); - } - - public Iterator iterator() - { - return Collections.unmodifiableList(_attrs).iterator(); - } - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/strategy/IExternalMetadataStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/strategy/IExternalMetadataStrategy.java deleted file mode 100644 index 320e824ab..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/strategy/IExternalMetadataStrategy.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facelet.core.internal.cm.strategy; - -import org.eclipse.jst.jsf.common.dom.TagIdentifier; -import org.eclipse.jst.jsf.common.internal.strategy.IIdentifiableStrategy; -import org.eclipse.jst.jsf.facelet.core.internal.cm.ExternalTagInfo; -import org.eclipse.jst.jsf.facelet.core.internal.cm.TagInfo; - -/** - * A strategy whose algorithm loads the tag CM data for a tag. - * - * @author cbateman - * - */ -public interface IExternalMetadataStrategy extends - IIdentifiableStrategy<TagIdentifier, TagInfo, String> -{ - - /** - * A null strategy that returns no result for all queries - * @author cbateman - * - */ - static class NullExternalMetadataStrategy implements IExternalMetadataStrategy - { - - public TagInfo getNoResult() - { - return ExternalTagInfo.NULL_INSTANCE; - } - - public TagInfo perform(TagIdentifier input) throws Exception - { - return getNoResult(); - } - - public String getDisplayName() - { - return "NULL instance; you shouldn't see this label!"; //$NON-NLS-1$ - } - - public String getId() - { - return "NULL Strategy"; //$NON-NLS-1$ - } - - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/strategy/InternalNamedNodeMap.java b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/strategy/InternalNamedNodeMap.java deleted file mode 100644 index f92b8c7ec..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/strategy/InternalNamedNodeMap.java +++ /dev/null @@ -1,96 +0,0 @@ -package org.eclipse.jst.jsf.facelet.core.internal.cm.strategy; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap; -import org.eclipse.wst.xml.core.internal.contentmodel.CMNode; - -/*package*/ class InternalNamedNodeMap implements CMNamedNodeMap -{ - private final List<CMNode> _nodes = new ArrayList<CMNode>(); - - /** - * Add a node to the map. This is not on the CMNamedNodeMap and is used - * to populate the map. - * - * @param node - */ - public void add(final CMNode node) - { - _nodes.add(node); - } - - public int getLength() - { - return _nodes.size(); - } - - public CMNode getNamedItem(final String name) - { - for (final CMNode foundNode : _nodes) - { - if (name.equals(foundNode.getNodeName())) - { - return foundNode; - } - } - return null; - } - - public CMNode item(final int index) - { - if (index < _nodes.size()) - { - return _nodes.get(index); - } - return null; - } - - public Iterator<?> iterator() - { - return Collections.unmodifiableList(_nodes).iterator(); - } - - /** - * A null instance object for InternalNamedNodeMap - * - */ - public static class NullInternalNamedNodeMap extends InternalNamedNodeMap - { - - @Override - public void add(final CMNode node) - { - // do nothing - } - - @Override - public int getLength() - { - // always empty - return 0; - } - - @Override - public CMNode getNamedItem(final String name) - { - return null; - } - - @Override - public CMNode item(final int index) - { - return null; - } - - @Override - public Iterator<?> iterator() - { - return Collections.EMPTY_LIST.iterator(); - } - - } -}
\ No newline at end of file diff --git a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/strategy/JSPExternalMetadataStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/strategy/JSPExternalMetadataStrategy.java deleted file mode 100644 index e704e03ac..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/strategy/JSPExternalMetadataStrategy.java +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facelet.core.internal.cm.strategy; - -import org.eclipse.jst.jsf.common.dom.TagIdentifier; -import org.eclipse.jst.jsf.facelet.core.internal.cm.ExternalTagInfo; -import org.eclipse.jst.jsf.facelet.core.internal.cm.TagInfo; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDDocument; -import org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration; -import org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap; - -/** - * A metadata strategy that uses JSP TLD metadata. - * - * @author cbateman - * - */ -public class JSPExternalMetadataStrategy extends - AbstractExternalMetadataStrategy -{ - private final TLDDocument _doc; - /** - * The unique identifier for the strategy. - */ - public final static String STRATEGY_ID = "org.eclipse.jst.jsf.facelet.core.internal.cm.strategy.JSPExternalMetadataStrategy"; //$NON-NLS-1$ - - /** - * @param doc - */ - public JSPExternalMetadataStrategy(final TLDDocument doc) - { - super(STRATEGY_ID, Messages.JSPExternalMetadataStrategy_DisplayName); - _doc = doc; - } - - @Override - public TagInfo perform(final TagIdentifier input) throws Exception - { - if (_doc != null) - { - return new TLDMetadataExternalInfo(_doc); - } - return getNoResult(); - } - - private static class TLDMetadataExternalInfo extends ExternalTagInfo - { - private final TLDDocument _doc; - - public TLDMetadataExternalInfo(final TLDDocument doc) - { - _doc = doc; - } - - @Override - public CMNamedNodeMap getAttributes(final String tagName) - { - final CMElementDeclaration element = (CMElementDeclaration) _doc - .getElements().getNamedItem(tagName); - - if (element != null) - { - return element.getAttributes(); - } - return null; - } - - @Override - public Object getTagProperty(final String tagName, final String key) - { - final CMElementDeclaration element = (CMElementDeclaration) _doc - .getElements().getNamedItem(tagName); - if (element != null) - { - return element.getProperty(key); - } - return null; - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/strategy/MDExternalMetadataStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/strategy/MDExternalMetadataStrategy.java deleted file mode 100644 index b7b2b21db..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/strategy/MDExternalMetadataStrategy.java +++ /dev/null @@ -1,416 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facelet.core.internal.cm.strategy; - -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.atomic.AtomicBoolean; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.ISafeRunnable; -import org.eclipse.emf.edit.provider.ComposedAdapterFactory; -import org.eclipse.jface.util.SafeRunnable; -import org.eclipse.jst.jsf.common.dom.TagIdentifier; -import org.eclipse.jst.jsf.common.internal.managedobject.IManagedObject; -import org.eclipse.jst.jsf.common.internal.managedobject.ObjectManager.ManagedObjectException; -import org.eclipse.jst.jsf.common.internal.resource.ResourceSingletonObjectManager; -import org.eclipse.jst.jsf.facelet.core.internal.FaceletCorePlugin; -import org.eclipse.jst.jsf.facelet.core.internal.cm.AttributeCMAdapter; -import org.eclipse.jst.jsf.facelet.core.internal.cm.ExternalTagInfo; -import org.eclipse.jst.jsf.facelet.core.internal.cm.TagInfo; -import org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.AddTagMDPackage; -import org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.AttributeData; -import org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.AttributeUsage; -import org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.ElementData; -import org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd.provider.IResourceProvider; -import org.eclipse.jst.jsf.facelet.core.internal.cm.strategy.InternalNamedNodeMap.NullInternalNamedNodeMap; -import org.eclipse.jst.jsf.facelet.core.internal.util.TagMetadataLoader; -import org.eclipse.wst.xml.core.internal.contentmodel.CMAttributeDeclaration; -import org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap; - -/** - * An external meta-data strategy that uses the JSF meta-data framework. - * - * @author cbateman - * - */ -public class MDExternalMetadataStrategy extends - AbstractExternalMetadataStrategy implements IManagedObject -{ - private static MySingletonManager MANAGER = new MySingletonManager(); - - /** - * @param project - * @return the instance of the strategy for project or - */ - public static IExternalMetadataStrategy create(final IProject project) - { - try - { - return MANAGER.getInstance(project); - } - catch (final ManagedObjectException e) - { - FaceletCorePlugin.log( - "Getting managed instance of tag metadata strategy", e); //$NON-NLS-1$ - } - return new NullExternalMetadataStrategy(); - } - - /** - * The unique identifier for the strategy. - */ - public final static String STRATEGY_ID = "org.eclipse.jst.jsf.facelet.core.internal.cm.strategy.MDExternalMetadataStrategy"; //$NON-NLS-1$ - - // private static final String VAR = "var"; //$NON-NLS-1$ - // private static final String VALUE = "value"; //$NON-NLS-1$ - // private static final String SRC = "src"; //$NON-NLS-1$ - // private static final String NAME = "name"; //$NON-NLS-1$ - // private static final String HOTKEY = "hotkey"; //$NON-NLS-1$ - // private static final String TEMPLATE = "template"; //$NON-NLS-1$ - // private static final String BINDING = "binding"; //$NON-NLS-1$ - // private static final String ID = "id"; //$NON-NLS-1$ - - private final IProject _project; - private final TagMetadataLoader _tagMetadataLoader; - private final Map<String, MDExternalTagInfo> _cached; - private final AtomicBoolean _isDisposed = new AtomicBoolean( - false); - - /** - * Default constructor - * - * @param project - */ - private MDExternalMetadataStrategy(final IProject project) - { - super(STRATEGY_ID, Messages.MDExternalMetadataStrategy_DisplayName); - _project = project; - _tagMetadataLoader = new TagMetadataLoader(_project); - _cached = new HashMap<String, MDExternalTagInfo>(); - } - - public void checkpoint() - { - // do nothing - } - - public void destroy() - { - // currently no persistent state, so just dispose - } - - public void dispose() - { - if (_isDisposed.compareAndSet(false, true)) - { - _cached.clear(); - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.jsf.facelet.core.internal.cm.strategy. - * AbstractExternalMetadataStrategy - * #perform(org.eclipse.jst.jsf.common.dom.TagIdentifier) - */ - @Override - public TagInfo perform(final TagIdentifier input) throws Exception - { - MDExternalTagInfo tagInfo = _cached.get(input.getUri()); - - if (tagInfo == null) - { - tagInfo = new MDExternalTagInfo(input.getUri(), _tagMetadataLoader); - _cached.put(input.getUri(), tagInfo); - } - return tagInfo; - } - - private static class MDExternalTagInfo extends ExternalTagInfo - { - private final String _uri; - private final TagMetadataLoader _tagMetadataLoader; - private final Map<String, InternalNamedNodeMap> _attributes; - - public MDExternalTagInfo(final String uri, - final TagMetadataLoader tagMetadataLoader) - { - _uri = uri; - _tagMetadataLoader = tagMetadataLoader; - _attributes = new HashMap<String, InternalNamedNodeMap>(); - } - - @Override - public CMNamedNodeMap getAttributes(final String tagName) - { - final InternalNamedNodeMap nodeMap = _attributes.get(tagName); - final InternalNamedNodeMap[] innerClassNodeMap = new InternalNamedNodeMap[1]; - innerClassNodeMap[0] = nodeMap; - - if (nodeMap == null) - { - SafeRunnable.run(new ISafeRunnable() - { - public void run() - { - final ElementData data = _tagMetadataLoader - .getElementData(_uri, tagName); - - if (data != null) - { - innerClassNodeMap[0] = new InternalNamedNodeMap(); - - for (final AttributeData attribute : data - .getAttributes()) - { - innerClassNodeMap[0] - .add(createAttribute(attribute)); - } - _attributes.put(tagName, innerClassNodeMap[0]); - } - // no meta-data found for this tag, so mark as null - // instance so future calls don't bother a re-lookup. - else - { - _attributes.put(tagName, - MDExternalMetadataStrategy.NULL_INSTANCE); - } - } - - public void handleException(final Throwable exception) - { - FaceletCorePlugin.log( - "While loading attribute meta-data", exception); //$NON-NLS-1$ - } - }); - } - - // don't return the null map instance - if (innerClassNodeMap[0] == MDExternalMetadataStrategy.NULL_INSTANCE) - { - return null; - } - return innerClassNodeMap[0]; - } - - @Override - public Object getTagProperty(final String tagName, final String key) - { - final Object[] value = new Object[1]; - value[0] = null; - - SafeRunnable.run(new ISafeRunnable() - { - public void run() - { - if ("description".equals(key)) //$NON-NLS-1$ - { - value[0] = _tagMetadataLoader.getDescription(_uri, - tagName); - } - } - - public void handleException(final Throwable exception) - { - FaceletCorePlugin.log( - "While loading tag property meta-data", exception); //$NON-NLS-1$ - } - }); - return value[0]; - } - } - - private final static NullInternalNamedNodeMap NULL_INSTANCE = new NullInternalNamedNodeMap(); - - - - // temporary: transfer out to metadata - final static Map<String, InternalNamedNodeMap> _faceletData; - - static - { - // final String ID_DESCRIPTION = - // Messages.MDExternalMetadataStrategy_ID_DESCRIPTION; - // final String BINDING_DESCRIPTION = - // Messages.MDExternalMetadataStrategy_BINDING_DESCRIPTION; - // final String TEMPLATE_DESCRIPTION = - // Messages.MDExternalMetadataStrategy_TEMPLATE_DESCRIPTION; - // final String HOTKEY_DESCRIPTION = - // Messages.MDExternalMetadataStrategy_HOTKEY_DESCRIPTION; - // final String DEFINE_NAME_DESCRIPTION = - // Messages.MDExternalMetadataStrategy_DEFINE_NAME_DESCRIPTION; - // final String SRC_DESCRIPTION = - // Messages.MDExternalMetadataStrategy_SRC_DESCRIPTION; - // final String INSERT_NAME_DESCRIPTION = - // Messages.MDExternalMetadataStrategy_INSERT_NAME_DESCRIPTION; - // final String PARAM_NAME_DESCRIPTION = - // Messages.MDExternalMetadataStrategy_PARAM_NAME_DESCRIPTION; - // final String PARAM_VALUE_DESCRIPTION = - // Messages.MDExternalMetadataStrategy_PARAM_VALUE_DESCRIPTION; - // final String REPEAT_VAR_DESCRIPTION = - // Messages.MDExternalMetadataStrategy_REPEAT_VAR_DESCRIPTION; - // final String REPEAT_VALUE_DESCRIPTION = - // Messages.MDExternalMetadataStrategy_REPEAT_VALUE_DESCRIPTION; - - final Map<String, InternalNamedNodeMap> map = new HashMap<String, InternalNamedNodeMap>(); - // component - // InternalNamedNodeMap nodeMap = new InternalNamedNodeMap(); - // nodeMap.add(createAttribute(ID, CMAttributeDeclaration.OPTIONAL, - // ID_DESCRIPTION)); - // nodeMap.add(createAttribute(BINDING, CMAttributeDeclaration.OPTIONAL, - // BINDING_DESCRIPTION)); - // map.put(IFaceletTagConstants.TAG_COMPONENT, nodeMap); - // - // // composition - // nodeMap = new InternalNamedNodeMap(); - // nodeMap.add(createAttribute(TEMPLATE, - // CMAttributeDeclaration.OPTIONAL, - // TEMPLATE_DESCRIPTION)); - // map.put(IFaceletTagConstants.TAG_COMPOSITION, nodeMap); - - // debug - // nodeMap = new InternalNamedNodeMap(); - // nodeMap.add(createAttribute(HOTKEY, CMAttributeDeclaration.OPTIONAL, - // HOTKEY_DESCRIPTION)); - // map.put(IFaceletTagConstants.TAG_DEBUG, nodeMap); - - // decorate - // nodeMap = new InternalNamedNodeMap(); - // nodeMap.add(createAttribute(TEMPLATE, - // CMAttributeDeclaration.REQUIRED, - // TEMPLATE_DESCRIPTION)); - // map.put(IFaceletTagConstants.TAG_DECORATE, nodeMap); - - // define - // nodeMap = new InternalNamedNodeMap(); - // nodeMap.add(createAttribute(NAME, CMAttributeDeclaration.REQUIRED, - // DEFINE_NAME_DESCRIPTION)); - // map.put(IFaceletTagConstants.TAG_DEFINE, nodeMap); - - // fragment - // nodeMap = new InternalNamedNodeMap(); - // nodeMap.add(createAttribute(ID, CMAttributeDeclaration.OPTIONAL, - // ID_DESCRIPTION)); - // nodeMap.add(createAttribute(BINDING, CMAttributeDeclaration.OPTIONAL, - // BINDING_DESCRIPTION)); - // map.put(IFaceletTagConstants.TAG_FRAGMENT, nodeMap); - - // include - // nodeMap = new InternalNamedNodeMap(); - // nodeMap.add(createAttribute(SRC, CMAttributeDeclaration.REQUIRED, - // SRC_DESCRIPTION)); - // map.put(IFaceletTagConstants.TAG_INCLUDE, nodeMap); - - // insert - // nodeMap = new InternalNamedNodeMap(); - // nodeMap.add(createAttribute(NAME, CMAttributeDeclaration.OPTIONAL, - // INSERT_NAME_DESCRIPTION)); - // map.put(IFaceletTagConstants.TAG_INSERT, nodeMap); - - // param - // nodeMap = new InternalNamedNodeMap(); - // nodeMap.add(createAttribute(NAME, CMAttributeDeclaration.REQUIRED, - // PARAM_NAME_DESCRIPTION)); - // nodeMap.add(createAttribute(VALUE, CMAttributeDeclaration.REQUIRED, - // PARAM_VALUE_DESCRIPTION)); - // map.put(IFaceletTagConstants.TAG_PARAM, nodeMap); - - // remove - // nodeMap = new InternalNamedNodeMap(); - // // no attributes - // map.put(IFaceletTagConstants.TAG_PARAM, nodeMap); - - // repeat - // nodeMap = new InternalNamedNodeMap(); - // nodeMap.add(createAttribute(VALUE, CMAttributeDeclaration.REQUIRED, - // REPEAT_VALUE_DESCRIPTION)); - // nodeMap.add(createAttribute(VAR, CMAttributeDeclaration.REQUIRED, - // REPEAT_VAR_DESCRIPTION)); - // map.put(IFaceletTagConstants.TAG_REPEAT, nodeMap); - - _faceletData = Collections.unmodifiableMap(map); - } - - private static CMAttributeDeclaration createAttribute( - final AttributeData attributeData) - { - final AttributeCMAdapter attribute = new AttributeCMAdapter( - attributeData.getName(), convertUsageEnum(attributeData - .getUsage())); - - final ComposedAdapterFactory factory = new ComposedAdapterFactory( - ComposedAdapterFactory.Descriptor.Registry.INSTANCE); - - final Object provider = factory.adapt(attributeData, - IResourceProvider.class); - - // get the description from meta-data and feed through the provider - // for possible translation - String description = attributeData.getDescription(); - - if (provider instanceof IResourceProvider) - { - final IResourceProvider resProvider = (IResourceProvider) provider; - final String translated = resProvider.getTranslatedString( - attributeData, AddTagMDPackage.eINSTANCE - .getAttributeData_Description()); - description = translated != null ? translated : description; - } - - attribute.setDescription(description); - return attribute; - } - - private static int convertUsageEnum(final AttributeUsage usage) - { - switch (usage) - { - case OPTIONAL: - return CMAttributeDeclaration.OPTIONAL; - case REQUIRED: - return CMAttributeDeclaration.REQUIRED; - case FIXED: - return CMAttributeDeclaration.FIXED; - case PROHIBITED: - return CMAttributeDeclaration.PROHIBITED; - default: - return CMAttributeDeclaration.OPTIONAL; - } - } - - private static class MySingletonManager - extends - ResourceSingletonObjectManager<MDExternalMetadataStrategy, IProject> - { - - protected MySingletonManager() - { - super(ResourcesPlugin.getWorkspace()); - } - - @Override - protected MDExternalMetadataStrategy createNewInstance( - final IProject resource) - { - return new MDExternalMetadataStrategy(resource); - } - - } - - public boolean isDisposed() - { - return _isDisposed.get(); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/strategy/Messages.java b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/strategy/Messages.java deleted file mode 100644 index 484f0cd47..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/strategy/Messages.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facelet.core.internal.cm.strategy; - -import org.eclipse.osgi.util.NLS; - -/** - * - * @author cbateman - * - */ -/*package*/ class Messages extends NLS -{ - private static final String BUNDLE_NAME = "org.eclipse.jst.jsf.facelet.core.internal.cm.strategy.messages"; //$NON-NLS-1$ - - - public static String FaceletExternalMetadataStrategy_0; - - - public static String JSPExternalMetadataStrategy_DisplayName; - - - /** - * Display name for MDExternalMetadataStrategy - */ - public static String MDExternalMetadataStrategy_DisplayName; - - public static String MDExternalMetadataStrategy_BINDING_DESCRIPTION; - public static String MDExternalMetadataStrategy_DEFINE_NAME_DESCRIPTION; - public static String MDExternalMetadataStrategy_HOTKEY_DESCRIPTION; - public static String MDExternalMetadataStrategy_ID_DESCRIPTION; - public static String MDExternalMetadataStrategy_INSERT_NAME_DESCRIPTION; - public static String MDExternalMetadataStrategy_PARAM_NAME_DESCRIPTION; - public static String MDExternalMetadataStrategy_PARAM_VALUE_DESCRIPTION; - public static String MDExternalMetadataStrategy_REPEAT_VALUE_DESCRIPTION; - public static String MDExternalMetadataStrategy_REPEAT_VAR_DESCRIPTION; - public static String MDExternalMetadataStrategy_SRC_DESCRIPTION; - public static String MDExternalMetadataStrategy_TEMPLATE_DESCRIPTION; - - - static - { - // initialize resource bundle - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } - - private Messages() - { - // no external instantiation - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/strategy/TagInfoStrategyComposite.java b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/strategy/TagInfoStrategyComposite.java deleted file mode 100644 index b2f2a3d1c..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/strategy/TagInfoStrategyComposite.java +++ /dev/null @@ -1,79 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facelet.core.internal.cm.strategy; - -import java.util.Collection; -import java.util.Iterator; - -import org.eclipse.jst.jsf.common.dom.TagIdentifier; -import org.eclipse.jst.jsf.common.internal.policy.IdentifierOrderedIteratorPolicy; -import org.eclipse.jst.jsf.common.internal.strategy.IteratorPolicyBasedStrategyComposite; -import org.eclipse.jst.jsf.facelet.core.internal.cm.ExternalTagInfo; -import org.eclipse.jst.jsf.facelet.core.internal.cm.TagInfo; - -/** - * A composite of strategies for deriving external tag metadata. - * - * @author cbateman - * - */ -public class TagInfoStrategyComposite - extends - IteratorPolicyBasedStrategyComposite<TagIdentifier, TagInfo, TagInfo, String, IExternalMetadataStrategy> -{ - private final Iterable<String> _policyOrder; - - /** - * @param policyOrder - */ - public TagInfoStrategyComposite(final Iterable<String> policyOrder) - { - super(new MyIteratorPolicy(policyOrder)); - _policyOrder = policyOrder; - } - - @Override - public TagInfo getNoResult() - { - return ExternalTagInfo.NULL_INSTANCE; - } - - /** - * - */ - public void resetIterator() - { - setPolicy(new MyIteratorPolicy(_policyOrder)); - } - - private static class MyIteratorPolicy extends - IdentifierOrderedIteratorPolicy<String> - { - private Iterator<String> _iterator; - - public MyIteratorPolicy(final Iterable<String> policyOrder) - { - super(policyOrder); - setExcludeNonExplicitValues(true); - } - - @Override - public Iterator<String> getIterator( - final Collection<String> forCollection) - { - if (_iterator == null) - { - _iterator = super.getIterator(forCollection); - } - return _iterator; - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/strategy/messages.properties b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/strategy/messages.properties deleted file mode 100644 index 8e410920c..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/strategy/messages.properties +++ /dev/null @@ -1,14 +0,0 @@ -FaceletExternalMetadataStrategy_0=Facelet metadata strategy -JSPExternalMetadataStrategy_DisplayName=JSP TLD meta-data -MDExternalMetadataStrategy_DisplayName=Tag meta-data from MD framework -MDExternalMetadataStrategy_BINDING_DESCRIPTION=A method binding of the form of the form \#{bean.binding} where 'binding' has the signature <b>UIComponent binding()</b>, that returns the component instance to use. If not present, Facelets will automatically instantiate one. -MDExternalMetadataStrategy_DEFINE_NAME_DESCRIPTION=The name of a template area. This name is referenced in instance documents using the insert tag -MDExternalMetadataStrategy_HOTKEY_DESCRIPTION=The key in combination with CTRL-SHIFT to use to launch the debug viewer -MDExternalMetadataStrategy_ID_DESCRIPTION=Assign a unique idea to generated component. If not present, Facelets will automatically generate one. -MDExternalMetadataStrategy_INSERT_NAME_DESCRIPTION=The name of a template area to insert (defined in the template using the define tag). If not specified, the entire template will be inserted. -MDExternalMetadataStrategy_PARAM_NAME_DESCRIPTION=The name of the new EL variable to declare -MDExternalMetadataStrategy_PARAM_VALUE_DESCRIPTION=The literal or EL value to assign to the new variable -MDExternalMetadataStrategy_REPEAT_VALUE_DESCRIPTION=The EL expression used to derive the list of items to repeat over -MDExternalMetadataStrategy_REPEAT_VAR_DESCRIPTION=The name of the EL variable to use as the iterator -MDExternalMetadataStrategy_SRC_DESCRIPTION=The path, absolute or relative to the original request, to another Facelet to include. May be EL. e.g. 'headerPage.xhtml' -MDExternalMetadataStrategy_TEMPLATE_DESCRIPTION=A uri that points to the template to use. e.g. /WEB-INF/templates/mytemplate.xhtml |