Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/strategy')
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/strategy/AbstractExternalMetadataStrategy.java53
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/strategy/FaceletExternalMetadataStrategy.java138
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/strategy/IExternalMetadataStrategy.java57
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/strategy/InternalNamedNodeMap.java96
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/strategy/JSPExternalMetadataStrategy.java88
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/strategy/MDExternalMetadataStrategy.java416
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/strategy/Messages.java59
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/strategy/TagInfoStrategyComposite.java79
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/strategy/messages.properties14
9 files changed, 0 insertions, 1000 deletions
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

Back to the top