diff options
Diffstat (limited to 'jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view')
87 files changed, 0 insertions, 16588 deletions
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/AbstractDTViewHandler.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/AbstractDTViewHandler.java deleted file mode 100644 index bf38fe899..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/AbstractDTViewHandler.java +++ /dev/null @@ -1,327 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view; - -import java.util.Collections; -import java.util.Map; -import java.util.concurrent.atomic.AtomicBoolean; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IPath; -import org.eclipse.jst.jsf.common.internal.resource.ImmutableLifecycleListener; -import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentTypeInfo; -import org.eclipse.jst.jsf.context.symbol.ISymbol; -import org.eclipse.jst.jsf.designtime.context.DTFacesContext; -import org.eclipse.jst.jsf.designtime.internal.view.DTUIViewRoot.StalenessAdvisor; -import org.eclipse.jst.jsf.designtime.internal.view.DTUIViewRoot.StalenessListener; -import org.eclipse.jst.jsf.designtime.internal.view.DTUIViewRoot.VersionStamp; -import org.eclipse.jst.jsf.designtime.internal.view.IDTViewHandler.ViewHandlerException.Cause; -import org.eclipse.wst.common.componentcore.ComponentCore; - -/** - * All IDTViewHandler's must sub-class this abstract class. - * - * @author cbateman - * - */ -public abstract class AbstractDTViewHandler implements IDTViewHandler -{ - private final AtomicBoolean _isDisposed = new AtomicBoolean(false); - - /** - * the path separator - */ - public static final String PATH_SEPARATOR = "/"; //$NON-NLS-1$ - - public abstract String calculateLocale(DTFacesContext context) - throws ViewHandlerException; - - public final DTUIViewRoot createView(final DTFacesContext facesContext, - final String viewId) throws ViewHandlerException - { - if (_isDisposed.get()) - { - throw new IllegalStateException("View handler is disposed"); //$NON-NLS-1$ - } - - final DTUIViewRoot viewRoot = internalCreateView(facesContext, viewId); - - if (viewRoot == null) - { - throw new ViewHandlerException("Problem in createView", Cause.UNABLE_TO_CREATE_VIEW); //$NON-NLS-1$ - } - viewRoot.setViewId(viewId); - final VersionStamp versionStamp = createVersionStamp(facesContext, - viewId); - if (versionStamp == null) - { - throw new ViewHandlerException(new Throwable( - "Bad version stamp detected"), Cause.BAD_VERSION_STAMP); //$NON-NLS-1$ - } - viewRoot.setVersionStamp(versionStamp); - - final StalenessAdvisor advisor = createStalenessAdvisor(viewRoot, - facesContext, viewId); - - if (advisor == null) - { - throw new ViewHandlerException(new Throwable( - "Bad staleness advisor"), Cause.BAD_STALENESS_ADVISOR); //$NON-NLS-1$ - } - viewRoot.setStalenessAdvisor(advisor); - - // lock down the tree - viewRoot.setSubtreeProtected(); - - registerView(viewRoot, facesContext, viewId); - - return viewRoot; - } - - /** - * @param facesContext - * @param viewId - * @return internal construction of the view root. - */ - protected abstract DTUIViewRoot internalCreateView( - final DTFacesContext facesContext, final String viewId); - - public abstract IResource getActionDefinition(DTFacesContext context, - String viewId) throws ViewHandlerException; - - public abstract IPath getActionURL(DTFacesContext context, - IResource resource, IPath requestPath) throws ViewHandlerException; - - public abstract IPath getRelativeActionPath(DTFacesContext context, - String relativeToViewId, String uri) throws ViewHandlerException; - - public abstract IViewDefnAdapterFactory getViewMetadataAdapterFactory( - DTFacesContext context) throws ViewHandlerException; - - public abstract boolean supportsViewDefinition(IFile file); - - - public abstract void setLifecycleListener(ImmutableLifecycleListener listener); - - public final void dispose() - { - if (_isDisposed.compareAndSet(false, true)) - { - doDispose(); - } - } - - /** - * Sub-classes should override to add disposal tasks - */ - protected void doDispose() - { - // do nothing by default - } - - /** - * IMPORTANT: this method must not return null. All view creation will fail - * for this handler when createVersionStamp() returns null. create() will - * throw ViewHandlerException. - * - * @param facesContext - * @param viewId - * @return a new version stamp for the facesContext/viewId. The version - * stamp needs to be unique for all instances of viewId only, not - * all instances of component trees everywhere in the system. - */ - protected abstract VersionStamp createVersionStamp( - final DTFacesContext facesContext, final String viewId); - - /** - * IMPORTANT: this method must not return null. All view creation will fail - * for this handler when createStalenessAdvisor returns null. - * - * @param viewRoot - * @param facesContext - * @param viewId - * @return a new staleness advisor. - */ - protected abstract StalenessAdvisor createStalenessAdvisor( - final DTUIViewRoot viewRoot, DTFacesContext facesContext, - String viewId); - - /** - * Called by createView immediately before returning. Provides sub-class - * a chance to register a fully initialized view root with any stateful - * activities such as automatic change tracking and caching. - * - * @param viewRoot - * @param context - * @param viewId - */ - protected void registerView(DTUIViewRoot viewRoot, final DTFacesContext context, final String viewId) - { - // do nothing by default - } - - public String getViewId(final DTFacesContext context, final IResource res) - { - // TODO: sync with WebrootUtil? - String strWebrootPath = ""; //$NON-NLS-1$ - final IProject project = res.getProject(); - final IPath path = res.getFullPath(); - final IPath webContentPath = getWebContentPath(project); - if (webContentPath != null && webContentPath.isPrefixOf(path)) - { - final int start = path.matchingFirstSegments(webContentPath); - final String[] segments = path.segments(); - for (int i = start, n = path.segmentCount(); i < n; i++) - { - strWebrootPath = strWebrootPath + PATH_SEPARATOR + segments[i]; - } - } - return strWebrootPath; - } - - private IPath getWebContentPath(final IProject project) - { - if (project != null) - { - return ComponentCore.createComponent(project).getRootFolder() - .getUnderlyingFolder().getFullPath(); - } - return null; - } - - /** - * A default DTUIViewRoot that represents an uncreatable or uninitializable - * view root. - * - */ - protected static final class NullViewRoot extends DTUIViewRoot - { - /** - * - */ - private static final long serialVersionUID = 1187035338610719171L; - - /** - */ - protected NullViewRoot() - { - super(null, null, new ComponentTypeInfo("", "", "","")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - } - - @Override - public IAdaptable getServices() - { - return new IAdaptable() - { - public Object getAdapter(Class adapter) - { - // no services - return null; - } - }; - } - - @Override - protected Map<String, ISymbol> doGetMapForScope(int scopeMask) { - return Collections.emptyMap(); - } - - } - - /** - * Provides a simple time-based stamp that makes almost impossible to create - * the same timestamp twice. To do so, two threads would need to get the - * same system simulataneously and get same number back from the same - * gaussian distribution. - * - * @author cbateman - * - */ - protected static class TimeBasedVersionStamp extends VersionStamp - { - /** - * - */ - private static final long serialVersionUID = 5557828245936568977L; - private final long timestamp; - private final long randomStamp; - - /** - * - */ - public TimeBasedVersionStamp() - { - super(); - // use the millisecond time, since it is offset from a known - // point on all platform, whereas no guarantee is made about - // the nano time value. - this.timestamp = System.currentTimeMillis(); - // this protects against two threads constructing two time - // stamp objects "simulataneously" and having the same time based - // stamp. Math.random is thread-safe. - this.randomStamp = (long) (Long.MAX_VALUE * Math.random()); - } - - @Override - public int hashCode() - { - return (int) (timestamp ^ randomStamp); - } - - @Override - protected boolean isEqual(final VersionStamp other) - { - return other instanceof TimeBasedVersionStamp - && (timestamp == ((TimeBasedVersionStamp) other).timestamp) - && (randomStamp == ((TimeBasedVersionStamp) other).randomStamp); - } - } - - /** - * Returns a default staleness advisor that always returns false. - * - * @author cbateman - * - */ - protected static final class NullStalenessAdvisor extends StalenessAdvisor - { - /** - * - */ - private static final long serialVersionUID = 5946420948320047613L; - - @Override - public boolean isStale() - { - return false; - } - - @Override - public void addListener(final StalenessListener listener) - { - // do nothing - } - - @Override - public void removeListener(final StalenessListener listener) - { - // do nothing - } - - public boolean isAccessible() - { - return true; - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/AbstractViewDefnAdapter.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/AbstractViewDefnAdapter.java deleted file mode 100644 index a7e620d15..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/AbstractViewDefnAdapter.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view; - -import java.util.List; - -import org.eclipse.jst.jsf.common.runtime.internal.model.ViewObject; -import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentInfo; -import org.eclipse.jst.jsf.common.runtime.internal.model.datatypes.ELExpression; -import org.eclipse.jst.jsf.context.IModelContext; -import org.eclipse.jst.jsf.designtime.context.DTFacesContext; -import org.eclipse.jst.jsf.designtime.internal.view.IDTViewHandler.ViewHandlerException; - -/** - * All view definition adapters must sub-class this abstract class. - * - * @author cbateman - * @param <VIEW_DEFN_BASE_TYPE> - * @param <VIEW_CONTAINER_TYPE> - * - */ -public abstract class AbstractViewDefnAdapter<VIEW_DEFN_BASE_TYPE, VIEW_CONTAINER_TYPE> - implements IViewDefnAdapter<VIEW_DEFN_BASE_TYPE, VIEW_CONTAINER_TYPE> -{ - public abstract ViewObject mapToViewObject( - VIEW_DEFN_BASE_TYPE viewDefnObject, - ViewObjectConstructionStrategy<? extends VIEW_DEFN_BASE_TYPE> constructionData, - VIEW_CONTAINER_TYPE viewContainer); - - public abstract String getId(VIEW_DEFN_BASE_TYPE viewDefnObject) - throws IllegalArgumentException; - - public abstract VIEW_CONTAINER_TYPE getContainer(DTFacesContext context, - String viewId); - - public abstract List<VIEW_DEFN_BASE_TYPE> getViewDefnRoots( - VIEW_CONTAINER_TYPE container); - - public abstract ELExpression getELExpression(final IModelContext context) - throws ViewHandlerException; - - public abstract ViewObject findViewObject(VIEW_DEFN_BASE_TYPE viewDefnObject, - ComponentInfo root); - - public abstract VIEW_DEFN_BASE_TYPE findViewDefn(ViewObject viewObject, - ComponentInfo root); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/AbstractViewDefnAdapterFactory.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/AbstractViewDefnAdapterFactory.java deleted file mode 100644 index 5c5fdf230..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/AbstractViewDefnAdapterFactory.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.content.IContentType; -import org.eclipse.core.runtime.content.IContentTypeManager; -import org.eclipse.jst.jsf.core.internal.CompositeTagRegistryFactory; -import org.eclipse.jst.jsf.core.internal.CompositeTagRegistryFactory.TagRegistryIdentifier; -import org.eclipse.jst.jsf.designtime.context.DTFacesContext; -import org.eclipse.jst.jsf.designtime.internal.view.model.ITagRegistry; - -/** - * Factories that create view definition adapters must extend this - * class. - * - * @author cbateman - * - */ -public abstract class AbstractViewDefnAdapterFactory implements IViewDefnAdapterFactory -{ - /** - * @param context - * @param viewId - * @return a view adapter for the viewid or null if this factory - * cannot produce an adapter for the underlying view definition. - */ - public abstract IViewDefnAdapter createAdapter(DTFacesContext context, String viewId); - - /** - * TODO: since this implicitly, XML-specific, perhaps this belongs - * in a util class - * Sub-classes may use to locate a tag registry for their view adapter - * @param file - * @return a tag registry for the file (based on class path and - * content type) or null if none. - */ - protected final ITagRegistry findTagRegistry(final IFile file) - { - final IContentTypeManager typeManager = Platform.getContentTypeManager(); - final IContentType contentType = - typeManager.findContentTypeFor(file.getName()); - ITagRegistry tagRegistry = null; - if (contentType != null) - { - final TagRegistryIdentifier id = - new TagRegistryIdentifier(file.getProject(), contentType); - tagRegistry = CompositeTagRegistryFactory.getInstance().getRegistry(id); - } - return tagRegistry; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/ComponentConstructionData.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/ComponentConstructionData.java deleted file mode 100644 index 914f7efbf..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/ComponentConstructionData.java +++ /dev/null @@ -1,102 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jface.text.IDocument; -import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentInfo; - -/** - * Encapsulates information required to construct a component - * - * @author cbateman - * - */ -public class ComponentConstructionData -{ - private ComponentInfo _parent; - private int _idCounter; - private final IProject _project; - private final IDocument _document; - /** - * @param idCounter - * @param parent - * @param project - * @param document - */ - public ComponentConstructionData(final int idCounter, - final ComponentInfo parent, final IProject project, final IDocument document) - { - _parent = parent; - _idCounter = idCounter; - _project = project; - _document = document; - } - - /** - * @return the parent id - */ - public final ComponentInfo getParent() - { - return _parent; - } - - /** - * @return the id counter - */ - public final int getIdCounter() - { - return _idCounter; - } - - /** - * Increment the counter by 1 and return the old value - * - * @return the old value - */ - public final int increment() - { - return _idCounter++; - } - - /** - * @param parent - */ - public final void setParent(final ComponentInfo parent) - { - _parent = parent; - } - - /** - * @param idCounter - */ - public final void setIdCounter(final int idCounter) - { - _idCounter = idCounter; - } - - /** - * @return the project that this component construction is associated with - */ - public final IProject getProject() - { - return _project; - } - - /** - * @return the document context for the construction - */ - public final IDocument getDocument() - { - return _document; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/ComponentTreeConstructionStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/ComponentTreeConstructionStrategy.java deleted file mode 100644 index 53763daa6..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/ComponentTreeConstructionStrategy.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view; - -import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentInfo; -import org.eclipse.jst.jsf.designtime.context.DTFacesContext; - -/** - * @author cbateman - * - * @param <VIEW_DEFN_BASE_TYPE> - * @param <VIEW_CONTAINER_TYPE> - */ -public abstract class ComponentTreeConstructionStrategy<VIEW_DEFN_BASE_TYPE, VIEW_CONTAINER_TYPE> -{ - /** - * @param context - * @param viewRoot - * @return a component tree rooted - * XXX: need to accommodate different cases of fragments, invalid multiple roots - * etc, perhaps with special surrogate root type - */ - public abstract ComponentInfo createComponentTree(DTFacesContext context, DTUIViewRoot viewRoot); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/DTComponentIntrospector.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/DTComponentIntrospector.java deleted file mode 100644 index 66763f4e8..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/DTComponentIntrospector.java +++ /dev/null @@ -1,402 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jem.internal.proxy.core.IBeanTypeProxy; -import org.eclipse.jem.internal.proxy.core.IConfigurationContributor; -import org.eclipse.jem.internal.proxy.core.IStandardBeanTypeProxyFactory; -import org.eclipse.jem.internal.proxy.core.ProxyFactoryRegistry; -import org.eclipse.jem.internal.proxy.ide.IDERegistration; -import org.eclipse.jst.jsf.common.internal.types.TypeInfoCache; -import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentTypeInfo; -import org.eclipse.jst.jsf.common.runtime.internal.model.decorator.ConverterTypeInfo; -import org.eclipse.jst.jsf.common.runtime.internal.model.decorator.ValidatorTypeInfo; -import org.eclipse.jst.jsf.common.util.JDTBeanIntrospector; -import org.eclipse.jst.jsf.common.util.JDTBeanProperty; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.core.internal.JSFCoreTraceOptions; -import org.eclipse.jst.jsf.core.internal.jem.BeanProxyUtil.BeanProxyWrapper; -import org.eclipse.jst.jsf.core.internal.jem.BeanProxyUtil.ProxyException; -import org.eclipse.jst.jsf.core.jsfappconfig.internal.IJSFAppConfigManager; -import org.eclipse.jst.jsf.core.jsfappconfig.internal.JSFAppConfigManagerFactory; -import org.eclipse.jst.jsf.facesconfig.emf.ComponentType; -import org.eclipse.jst.jsf.facesconfig.emf.ConverterType; -import org.eclipse.jst.jsf.facesconfig.emf.ValidatorType; - -/** - * Utility class for finding and bean introspecting component and related - * classes. - * - * @author cbateman - * - */ -public final class DTComponentIntrospector -{ - /** - * A shared type cache for doing tag class introspection. The cache stores - * type hierarchies and updates them on detected changes to reduce the - * overhead of doing such lookups - */ - private static TypeInfoCache TYPE_CACHE; // lazily created, don't access - - // directly - - /** - * @return the type cache used by all DTComponentIntrospector internally. - */ - public static TypeInfoCache getSharedTypeCache() - { - if (TYPE_CACHE == null) - { - TYPE_CACHE = TypeInfoCache.createNewInstance(); - } - return TYPE_CACHE; - } - - /** - * @param classType - * @param className - * @param project - * @param contributors may be null - * @return the component type info for the class type or null if none. Adds - * contributors to the class path - */ - public static ComponentTypeInfo getComponent(final String classType, - final String className, final IProject project, - final IConfigurationContributor[] contributors) - { - ProxyFactoryRegistry registry = null; - try - { - registry = getProxyFactoryRegistry(project, - contributors); - - if (registry != null) - { - final IStandardBeanTypeProxyFactory factory = registry - .getBeanTypeProxyFactory(); - final IBeanTypeProxy classTypeProxy = factory - .getBeanTypeProxy(className); - final BeanProxyWrapper classTypeWrapper = new BeanProxyWrapper(project, - classTypeProxy); - - String family = null; - String renderer = null; - try - { - classTypeWrapper.init(); - family = classTypeWrapper.callStringMethod("getFamily"); //$NON-NLS-1$ - renderer = classTypeWrapper.callStringMethod("getRendererType"); //$NON-NLS-1$ - } - catch (ProxyException e1) - { - // fall through - if (JSFCoreTraceOptions.TRACE_JSPTAGINTROSPECTOR) - { - JSFCoreTraceOptions.log("DTComponentIntrospector.getComponent:", e1); //$NON-NLS-1$ - } - } - - IType type = null; - - try - { - type = JavaCore.create(project).findType(className); - } - catch (JavaModelException e) - { - // fall through; - } - - List<String> interfaces = new ArrayList<String>(); - List<String> superClasses = new ArrayList<String>(); - - if (type != null) - { - TypeInfoCache typeCache = getSharedTypeCache(); - - IType[] interfaceTypes = typeCache.cacheInterfaceTypesFor(type); - for (IType interfaze : interfaceTypes) - { - interfaces.add(interfaze.getFullyQualifiedName()); - } - - IType[] superClassTypes = typeCache.cacheSupertypesFor(type); - - for (IType superClass : superClassTypes) - { - superClasses.add(superClass.getFullyQualifiedName()); - } - } - - return new ComponentTypeInfo(classType, className, superClasses - .toArray(new String[0]), interfaces.toArray(new String[0]), - family, renderer); - } - } - finally - { - if (registry != null) - { - registry.terminateRegistry(true); - } - } - return null; - } - - /** - * @param classType - * @param className - * @param project - * @return the component type info with no additional classpath - * contributions. May return null; - */ - public static ComponentTypeInfo getComponent(final String classType, - final String className, final IProject project) - { - return getComponent(classType, className, project, null); - } - - /** - * @param converterId - * @param converterClass - * @return a new converter type info for the converter id. - */ - public static ConverterTypeInfo getConverter(final String converterId, - final String converterClass) - { - return new ConverterTypeInfo(converterClass, converterId); - } - - /** - * @param validatorId - * @param validatorClass - * @return a new validator type info for the validator id - */ - public static ValidatorTypeInfo getValidator(final String validatorId, - final String validatorClass) - { - return new ValidatorTypeInfo(validatorClass, validatorId); - } - - /** - * @param componentType - * @param project - * @return the configured class name for the JSF component type id or null - * if not found. - */ - public static String findComponentClass(final String componentType, - final IProject project) - { - final IJSFAppConfigManager manager = JSFAppConfigManagerFactory - .getJSFAppConfigManagerInstance(project); - final List<ComponentType> components = manager.getComponents(); - - for (final ComponentType component : components) - { - final String type = component.getComponentType().getTextContent() - .trim(); - - if (componentType.equals(type)) - { - return component.getComponentClass().getTextContent().trim(); - } - } - return null; - } - - /** - * @param converterId - * @param project - * @return a fully qualified class name corresponding to converterId or null - * if none. - */ - public static String findConverterClass(final String converterId, - final IProject project) - { - final IJSFAppConfigManager manager = JSFAppConfigManagerFactory - .getJSFAppConfigManagerInstance(project); - final List<ConverterType> converters = manager.getConverters(); - - for (final ConverterType converter : converters) - { - if (converter != null && converter.getConverterId() != null - && converter.getConverterId().getTextContent() != null) - { - final String type = converter.getConverterId().getTextContent() - .trim(); - - if (converterId.equals(type)) - { - if (converter.getConverterClass() != null && converter.getConverterClass().getTextContent()!=null) - { - return converter.getConverterClass().getTextContent() - .trim(); - } - return null; - } - } - } - return null; - } - - /** - * @param validatorId - * @param project - * @return a fully qualified class name corresponding to the validatorId or - * null if none. - */ - public static String findValidatorClass(final String validatorId, - final IProject project) - { - final IJSFAppConfigManager manager = JSFAppConfigManagerFactory - .getJSFAppConfigManagerInstance(project); - final List<ValidatorType> validators = manager.getValidators(); - - for (final ValidatorType validatorType : validators) - { - if (validatorType != null && validatorType.getValidatorId() != null && - validatorType.getValidatorId().getTextContent() != null) - { - final String type = validatorType.getValidatorId().getTextContent() - .trim(); - - if (validatorId.equals(type)) - { - return validatorType.getValidatorClass().getTextContent() - .trim(); - } - } - } - return null; - } - - /** - * @param type - * @param checkInstanceOf - * @return true if type resolves to a type that is an instance of one of the - * types in checkInstanceOf. - */ - public static boolean isTypeNameInstanceOfClass(final IType type, - final Set<String> checkInstanceOf) - { - if (checkInstanceOf == null) - { - throw new AssertionError(); - } - if (type != null) - { - // first and foremost, are these exactly droids you're - // looking for and not just their predecessors? - if (checkInstanceOf.contains(type.getFullyQualifiedName())) - { - return true; - } - - for (final IType supertype : getSharedTypeCache() - .cacheSupertypesFor(type)) - { - if (checkInstanceOf.contains(supertype.getFullyQualifiedName())) - { - return true; - } - } - - for (final IType interfaces : getSharedTypeCache() - .cacheInterfaceTypesFor(type)) - { - if (checkInstanceOf - .contains(interfaces.getFullyQualifiedName())) - { - return true; - } - } - } - - return false; - } - - /** - * @param typeInfo - * @param project - * @return a list of all bean properties (using the POJO method) on - * typeInfo. List may be empty, never null. - */ - public static Map<String, JDTBeanProperty> getBeanProperties( - final ComponentTypeInfo typeInfo, final IProject project) - { - Map<String, JDTBeanProperty> properties = new HashMap<String, JDTBeanProperty>(); - - IJavaProject javaProject = JavaCore.create(project); - try - { - IType type = javaProject.findType(typeInfo.getClassName()); - - if (type != null) - { - // TODO: should be able to use type cache for this - final JDTBeanIntrospector introspector = new JDTBeanIntrospector( - type); - properties = introspector.getProperties(); - } - } - catch (JavaModelException e) - { - JSFCorePlugin.log("Error finding component type", e); //$NON-NLS-1$ - } - - return properties; - } - - /** - * @param project - * @return a new proxy factory registry or null; - * - * TODO: caching? - */ - private static ProxyFactoryRegistry getProxyFactoryRegistry( - final IProject project, final IConfigurationContributor[] contributors) - { - try - { - return IDERegistration.startAnImplementation(contributors, false, project, - project.getName(), JSFCorePlugin.PLUGIN_ID, - new NullProgressMonitor()); - } - catch (final CoreException e) - { - JSFCorePlugin.log("Error starting vm for project: " //$NON-NLS-1$ - + project.getName(), e); - } - - return null; - } - - private DTComponentIntrospector() - { - // no external instantiation - } - - // private static class -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/DTUIViewRoot.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/DTUIViewRoot.java deleted file mode 100644 index 5d8b7ae10..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/DTUIViewRoot.java +++ /dev/null @@ -1,335 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view; - -import java.io.Serializable; -import java.util.Collections; -import java.util.Map; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentInfo; -import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentTypeInfo; -import org.eclipse.jst.jsf.context.symbol.ISymbol; -import org.eclipse.jst.jsf.context.symbol.source.ISymbolConstants; - -/** - * The interface for all design view root objects. - * - */ -public abstract class DTUIViewRoot extends ComponentInfo -{ - private StalenessAdvisor _stalenessAdvisor; - - private String _viewId; - private VersionStamp _versionStamp; - - /** - * - */ - private static final long serialVersionUID = -6375907116774572269L; - - /** - * @param id - * @param parent - * @param componentTypeInfo - */ - protected DTUIViewRoot(final String id, final ComponentInfo parent, - final ComponentTypeInfo componentTypeInfo) - { - super(id, parent, componentTypeInfo, true); - } - - /** - * @return the view id - */ - public final String getViewId() - { - return _viewId; - } - - /** - * @param viewId - * - */ - final void setViewId(final String viewId) - { - _viewId = viewId; - } - - /** - * <p> - * Clients may use the version stamp to determine if their instance of a - * view root is out of date. For example, if a client has cached an instance - * of a view root and wants to quickly checked if there is a newer version, - * it may request a new copy and compare version stamps - * </p> - * - * <p> - * The version stamp must be calculated so that given two instance of a view - * root for the same view id, v1 and v2: - * </p> - * - * <p> - * if v1.getVersionStamp().equals(v2.getVersionStamp()) then v1 and v2 are - * the same even if v1 != v2. Note that this uniqueness must hold true - * across multiple sessions of the IDE, since v1 or v2 may have been - * restored from permanent storage. For this reason, running counts should - * are discouraged unless they too can be reliably stored. Better is - * something that relies on large random numbers combined with a time stamp - * or workspace modification stamp - * </p> - * - * @return the unique version stamp of this view root. This may be used as - * quick check as to whether to view roots are not equal. - */ - public final VersionStamp getVersionStamp() - { - return delegateVersionStamp(); - } - - VersionStamp delegateVersionStamp() - { - return _versionStamp; - } - - final void setVersionStamp(VersionStamp versionStamp) - { - _versionStamp = versionStamp; - } - - - /** - * @return a map of ISymbols representing the currently available - * view scope variables. Never null, empty if no symbols - * Map is unmodifiable (throws exception on mutation operations) - */ - public final Map<String, ISymbol> getViewMap() { - return Collections.unmodifiableMap(doGetMapForScope(ISymbolConstants.SYMBOL_SCOPE_VIEW)); - } - - /** - * @param scopeMask - * @return Map of symbols - */ - protected abstract Map<String, ISymbol> doGetMapForScope(final int scopeMask); - - /** - * @return true if the view root is out of sync with its view source. - */ - public final boolean isStale() - { - return _stalenessAdvisor.isStale(); - } - - final void setStalenessAdvisor(final StalenessAdvisor stalenessAdvisor) - { - _stalenessAdvisor = stalenessAdvisor; - } - - /** - * Implementations must ensure that listeners are only added if they are - * not already present. - * - * @param listener - */ - public final void addListener(final StalenessListener listener) - { - _stalenessAdvisor.addListener(listener); - } - - /** - * @param listener - */ - public final void removeListener(final StalenessListener listener) - { - _stalenessAdvisor.removeListener(listener); - } - - /** - * @return an adapter that can be used to request additional services from - * the view root instance. This can be used to get services that are - * not specific to all view roots such as mappings between view - * definition artifacts and their view objects. Value may be null if - * a view root chooses not to expose any services. - */ - public abstract IAdaptable getServices(); - - /** - * An abstract versioning stamp that can be used to uniquely identify a - * version of a DTUIViewRoot. - * - * @author cbateman - * - */ - public abstract static class VersionStamp implements Serializable - { - /** - * - */ - private static final long serialVersionUID = -7869336223178326584L; - - /** - * Called by equals to determine absolute equality. - * - * @param other - * @return true if and only if other represents the exact same version - * as this. Hashcode must be reimplemented in a way to guarantee - * that the equals() contract is respected. - */ - protected abstract boolean isEqual(final VersionStamp other); - - /** - * Must reimplement hashCode to match isEqual - */ - public abstract int hashCode(); - - @Override - public final boolean equals(Object obj) - { - if (this == obj) - { - return true; - } - - // NOTE: instanceof covers obj == null check. - if (obj instanceof VersionStamp) - { - return isEqual((VersionStamp) obj); - } - return false; - } - } - - /** - * An advisor which allows a view root to bridge to its source to see if its - * out-of-sync, while keeping it decoupled from what specifically its source - * is. - * - * @author cbateman - * - */ - public static abstract class StalenessAdvisor implements Serializable - { - /** - * - */ - private static final long serialVersionUID = 3449240686744169430L; - - /** - * Implementations must ensure that listeners are only added if they are - * not already present. - * @param listener - */ - public abstract void addListener(StalenessListener listener); - - /** - * @param listener - */ - public abstract void removeListener(StalenessListener listener); - - /** - * NOTE: it is very dangerous to have an advisor that always returns - * stale == true since many clients will rely on the staleness flag to - * determine if they should try to update the model. - * - * @return true if we are out of sync with the source that this tree was - * constructed from. - */ - public abstract boolean isStale(); - - /** - * @return a flag similar to IResource.isAccessible that indicates if - * the underlying view definition is no longer accessible either - * due it being deleted or it's source file being unaccessible - * due to project closure or other issues. - */ - public abstract boolean isAccessible(); - } - - /** - * A listener that is informed of model staleness events - * - */ - public static abstract class StalenessListener - { - /** - * @param event - */ - protected abstract void stalenessChanged(StalenessEvent event); - } - - /** - * An event that is fied when a model's staleness changes. - * - */ - public final static class StalenessEvent - { - private final ChangeType _type; - - /** - * @param type - */ - protected StalenessEvent(final ChangeType type) - { - _type = type; - } - - /** - * @return true if the event source is now stale. - */ - public final ChangeType getChangeType() - { - return _type; - } - - /** - * The type of staleness change - * - */ - /** - * @author cbateman - * - */ - public enum ChangeType - { - /** - * Indicates that the view definition has been changed in a way that - * will make existing DTUIViewRoot's stale. - */ - VIEW_DEFN_CHANGED, - - /** - * Inidicates that the view definition has been deleted. - */ - VIEW_DEFN_DELETED, - - /** - * Indicates that the view definition's enclosing project will be - * closed, causing the definition to be made unavailable for an - * indeterminate amount of time. - */ - VIEW_DEFN_PROJECT_CLOSED, - - /** - * Indicates that a view root has been invalid due to a project - * clean. View root should generally be forcibly updated on - * a project clean even if other staleness preconditions haven't - * been met. - */ - PROJECT_CLEANED - } - - /** - * - */ - private static final long serialVersionUID = 6765346004772568514L; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/DefaultDTUIViewRoot.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/DefaultDTUIViewRoot.java deleted file mode 100644 index 75985be23..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/DefaultDTUIViewRoot.java +++ /dev/null @@ -1,104 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; -import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentTypeInfo; -import org.eclipse.jst.jsf.context.symbol.ISymbol; -import org.eclipse.jst.jsf.context.symbol.source.ISymbolSourceProvider; -import org.eclipse.jst.jsf.context.symbol.source.ISymbolSourceProviderFactory; -import org.eclipse.jst.jsf.designtime.context.DTFacesContext; - -/** - * The default view root implementation. Assumes an XML view definition. - * - * @author cbateman - * - */ -public class DefaultDTUIViewRoot extends DTUIViewRoot -{ - /** - * serializable - */ - private static final long serialVersionUID = -6948413077931237435L; - private final DefaultServices _defaultServices; - private DTFacesContext _facesContext; - - /** - * @param facesContext - */ - public DefaultDTUIViewRoot(final DTFacesContext facesContext) - { - // TODO: refactor constants - super(null, null, new ComponentTypeInfo("javax.faces.ViewRoot", //$NON-NLS-1$ - "javax.faces.component.UIViewRoot", "javax.faces.ViewRoot", //$NON-NLS-1$ //$NON-NLS-2$ - null)); - _defaultServices = new DefaultServices(); - _facesContext = facesContext; - } - - @Override - public IAdaptable getServices() - { - return _defaultServices; - } - - private class DefaultServices implements IAdaptable, Serializable - { - /** - * - */ - private static final long serialVersionUID = -5220371377352799212L; - private final XMLViewObjectMappingService _xmlViewObjectMappingService; - - private DefaultServices() - { - _xmlViewObjectMappingService = new XMLViewObjectMappingService(); - } - - public Object getAdapter(final Class adapter) - { - if (adapter.equals(XMLViewObjectMappingService.class)) - { - return _xmlViewObjectMappingService; - } - return null; - } - } - - @Override - protected Map<String, ISymbol> doGetMapForScope(final int scopeMask) { - final Map<String, ISymbol> map = new HashMap<String, ISymbol>(); - - IProject project = _facesContext.adaptContextObject().getProject(); - for (final Iterator it = JSFCommonPlugin.getSymbolSourceProviders().iterator(); it.hasNext();) - { - final ISymbolSourceProviderFactory factory = (ISymbolSourceProviderFactory) it.next(); - final ISymbolSourceProvider provider = factory.createInstance(project); - - final ISymbol[] symbols = provider.getSymbols(_facesContext.adaptContextObject(), scopeMask); - - for (int i = 0; i < symbols.length; i++) - { - map.put(symbols[i].getName(), symbols[i]); - } - } - - return map; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/DefaultDTViewHandler.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/DefaultDTViewHandler.java deleted file mode 100644 index 4f94b6c27..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/DefaultDTViewHandler.java +++ /dev/null @@ -1,614 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.CopyOnWriteArrayList; -import java.util.concurrent.atomic.AtomicBoolean; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IResourceChangeEvent; -import org.eclipse.core.resources.IResourceChangeListener; -import org.eclipse.core.resources.IWorkspace; -import org.eclipse.core.resources.IncrementalProjectBuilder; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jface.text.IDocument; -import org.eclipse.jst.jsf.common.internal.JSPUtil; -import org.eclipse.jst.jsf.common.internal.resource.EventResult; -import org.eclipse.jst.jsf.common.internal.resource.IResourceLifecycleListener; -import org.eclipse.jst.jsf.common.internal.resource.ImmutableLifecycleListener; -import org.eclipse.jst.jsf.common.internal.resource.ResourceLifecycleEvent; -import org.eclipse.jst.jsf.common.internal.resource.ResourceLifecycleEvent.ReasonType; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.designtime.context.DTFacesContext; -import org.eclipse.jst.jsf.designtime.internal.view.DTUIViewRoot.StalenessAdvisor; -import org.eclipse.jst.jsf.designtime.internal.view.DTUIViewRoot.StalenessEvent; -import org.eclipse.jst.jsf.designtime.internal.view.DTUIViewRoot.StalenessEvent.ChangeType; -import org.eclipse.jst.jsf.designtime.internal.view.DTUIViewRoot.StalenessListener; -import org.eclipse.jst.jsf.designtime.internal.view.DTUIViewRoot.VersionStamp; -import org.eclipse.jst.jsf.designtime.internal.view.model.ITagRegistry; -import org.w3c.dom.Node; - -/** - * A default implementation of the design time view handler meant to parallel - * the default runtime ViewHandler required by the JSF spec. - * - */ -public class DefaultDTViewHandler extends AbstractDTViewHandler -{ - private final MyLifecycleManager _lifecycleManager = new MyLifecycleManager(); - - @Override - public String calculateLocale(final DTFacesContext context) - throws ViewHandlerException - { - // TODO Auto-generated method stub - return null; - } - - @Override - public IResource getActionDefinition(final DTFacesContext context, - final String viewId) throws ViewHandlerException - { - // TODO: this seems like a bit of a cop out... - return context.adaptContextObject(); - } - - @Override - public IPath getActionURL(final DTFacesContext context, - final IResource resource, final IPath requestPath) - throws ViewHandlerException - { - // TODO Auto-generated method stub - return null; - } - - @Override - public IPath getRelativeActionPath(final DTFacesContext context, - final String relativeToViewId, final String uri) - throws ViewHandlerException - { - // TODO Auto-generated method stub - return null; - } - - @Override - public IViewDefnAdapterFactory getViewMetadataAdapterFactory( - final DTFacesContext context) throws ViewHandlerException - { - return internalGetViewMetadataAdapterFactory(context); - } - - /** - * @param context - * @return the DefaultViewDefnAdapterFactory - * - */ - protected IViewDefnAdapterFactory getDefaultViewMetadataAdapterFactory( - final DTFacesContext context) - { - return internalGetViewMetadataAdapterFactory(context); - } - - private IViewDefnAdapterFactory internalGetViewMetadataAdapterFactory (final DTFacesContext context) { - final IResource res = context.adaptContextObject(); - - if (res instanceof IFile) - { - return new DefaultViewDefnAdapterFactory(this); - } - - return null; - } - - @Override - protected VersionStamp createVersionStamp( - final DTFacesContext facesContext, final String viewId) - { - return new TimeBasedVersionStamp(); - } - - static class DefaultViewDefnAdapterFactory extends - AbstractViewDefnAdapterFactory - { - private final DefaultDTViewHandler _myViewHandler; - - DefaultViewDefnAdapterFactory(final DefaultDTViewHandler viewHandler) - { - _myViewHandler = viewHandler; - } - - @Override - public IViewDefnAdapter<Node, IDocument> createAdapter( - final DTFacesContext context, final String viewId) - { - try - { - final IResource res = _myViewHandler.getActionDefinition( - context, viewId); - - if (res instanceof IFile) - { - final IFile srcFile = (IFile) res; - final ITagRegistry registry = findTagRegistry(srcFile); - if (JSPUtil.isJSPContentType(srcFile) && registry != null) - { - // if we have a jsp file, then return the default - // adapter - return new JSPViewDefnAdapter(registry); - } - } - } - catch (final ViewHandlerException vhe) - { - JSFCorePlugin.log(vhe, "While acquiring view adapter"); //$NON-NLS-1$ - } - - // not found or failed - return null; - } - } - - @Override - protected DTUIViewRoot internalCreateView( - final DTFacesContext facesContext, final String viewId) - { - IViewDefnAdapterFactory factory; - try - { - factory = getViewMetadataAdapterFactory(facesContext); - if (factory != null) - { - final IViewDefnAdapter<?, ?> adapter = factory.createAdapter( - facesContext, viewId); - if (adapter instanceof XMLViewDefnAdapter) - { - final IResource res = facesContext.adaptContextObject(); - final DTUIViewRoot root = newView(facesContext, viewId); - final XMLComponentTreeConstructionStrategy constructionStrategy = createTreeConstructionStrategy( - (XMLViewDefnAdapter) adapter, res.getProject()); - - constructionStrategy - .createComponentTree(facesContext, root); - return root; - } - JSFCorePlugin - .log( - IStatus.WARNING, - String - .format( - "Could not get view adapter to construct design time view root for %s", //$NON-NLS-1$ - viewId)); - } - else - { - JSFCorePlugin - .log( - IStatus.WARNING, - String - .format( - "Could not get view adapter factory toconstruct design time view root for %s", //$NON-NLS-1$ - viewId)); - } - } - catch (final ViewHandlerException e) - { - JSFCorePlugin.log(e, "While acquiring view defn adapter factory"); //$NON-NLS-1$ - // fall-through - } - - return new NullViewRoot(); - } - - /** - * By default, returns DefaultDTUIViewRoot. - * - * @param facesContext - * @param viewId - * @return a new instance of a view. Override to change the implementation - * or configuration of DTUIViewRoot that is used by - * internalCreateView. - */ - protected DTUIViewRoot newView(final DTFacesContext facesContext, - final String viewId) - { - return new DefaultDTUIViewRoot(facesContext); - } - - @Override - protected void registerView(final DTUIViewRoot viewRoot, - final DTFacesContext facesContext, final String viewId) - { - final IResource res = facesContext.adaptContextObject(); - _lifecycleManager.addViewInfo(viewId, res); - } - - /** - * Sub-classes may override to provide a different strategy. - * - * @param adapter - * @param project - * @return the construction strategy used to create this view's component - * tree - */ - protected XMLComponentTreeConstructionStrategy createTreeConstructionStrategy( - final XMLViewDefnAdapter adapter, final IProject project) - { - return new XMLComponentTreeConstructionStrategy(adapter, project); - } - - @Override - public boolean supportsViewDefinition(final IFile file) - { - // currently only JSP content type is supported - return (JSPUtil.isJSPContentType(file)); - } - - @Override - protected StalenessAdvisor createStalenessAdvisor( - final DTUIViewRoot viewRoot, final DTFacesContext facesContext, - final String viewId) - { - final IResource res = facesContext.adaptContextObject(); - // if the view root is null or the res is null fall through - // and use the null staleness advisor - if (!(viewRoot instanceof NullViewRoot) && res != null) - { - return new ResourceModStampStalenessAdvisor(viewRoot, res, viewId); - } - return new NullStalenessAdvisor(); - } - - /** - * Measures the staleness of a view by comparing the modification stamp on - * the resource at construction with the current value when isStale is - * called. - * - * @author cbateman - * - */ - protected final class ResourceModStampStalenessAdvisor extends - StalenessAdvisor implements Serializable - { - /** - * version id - */ - private static final long serialVersionUID = -4982206388722638735L; - private final long _modificationStamp; - - private transient final IResource _res; - private transient final AtomicBoolean _forcedStale; - private transient final StalenessListener _myListener; - - /** - * @param viewRoot - * @param file - * @param viewId - */ - public ResourceModStampStalenessAdvisor(final DTUIViewRoot viewRoot, - final IResource file, final String viewId) - { - _res = file; - _modificationStamp = file.getModificationStamp(); - _forcedStale = new AtomicBoolean(false); - _myListener = new StalenessListener() - { - @Override - protected void stalenessChanged(final StalenessEvent event) - { - if (event.getChangeType() == ChangeType.PROJECT_CLEANED) - { - if (_forcedStale.compareAndSet(false, true)) - { - _lifecycleManager.removeListener(_res, _myListener); - } - } - } - }; - _lifecycleManager.addViewInfo(viewId, _res); - _lifecycleManager.addListener(_res, _myListener); - } - - @Override - public boolean isStale() - { - if (!_forcedStale.get()) - { - final long curStamp = _res.getModificationStamp(); - return curStamp != _modificationStamp; - } - // else forced stale - return true; - } - - @Override - public void addListener(final StalenessListener listener) - { - _lifecycleManager.addListener(_res, listener); - } - - @Override - public void removeListener(final StalenessListener listener) - { - _lifecycleManager.removeListener(_res, listener); - } - - @Override - public boolean isAccessible() - { - return _res.isAccessible(); - } - } - - @Override - public final void setLifecycleListener(final ImmutableLifecycleListener listener) - { - _lifecycleManager.update(listener); - } - - @Override - protected final void doDispose() - { - _lifecycleManager.dispose(); - } - - private class MyLifecycleManager implements IResourceLifecycleListener - { - private ImmutableLifecycleListener _listener; - private final Map<IResource, ViewInfo> _stalenessListeners; - private final IResourceChangeListener _buildListener; - - public MyLifecycleManager() - { - _stalenessListeners = new HashMap<IResource, ViewInfo>(); - _buildListener = new IResourceChangeListener() - { - // on a clean build request, fire staleness for all project-related - // resources. - public void resourceChanged(final IResourceChangeEvent event) - { - if (event.getType() == IResourceChangeEvent.PRE_BUILD) - { - if (event.getBuildKind() == IncrementalProjectBuilder.CLEAN_BUILD) - { - if (event.getSource() instanceof IProject) - { - cleanProject((IProject) event.getSource()); - } - else if (event.getSource() instanceof IWorkspace) - { - cleanAll(); - } - } - } - } - }; - ResourcesPlugin.getWorkspace().addResourceChangeListener(_buildListener, - IResourceChangeEvent.PRE_BUILD); - } - - public void addListener(final IResource res, final StalenessListener listener) - { - final ViewInfo viewInfo = getViewInfo(res); - viewInfo.getListeners().addIfAbsent(listener); - } - - public void removeListener(final IResource res, final StalenessListener listener) - { - final ViewInfo viewInfo = getViewInfo(res); - viewInfo.getListeners().remove(listener); - } - - public EventResult acceptEvent(final ResourceLifecycleEvent event) - { - switch (event.getEventType()) - { - case RESOURCE_CHANGED: - { - return handleContentChangeEvent(event); - } - - case RESOURCE_INACCESSIBLE: - { - return handleInaccessibleChangeEvent(event); - } - - default: - // do nothing with other types - } - - return EventResult.getDefaultEventResult(); - } - - private EventResult handleContentChangeEvent( - final ResourceLifecycleEvent event) - { - if (event.getReasonType() != ReasonType.RESOURCE_CHANGED_CONTENTS) - { - return EventResult.getDefaultEventResult(); - } - - final IResource res = event.getAffectedResource(); - final List<StalenessListener> stalenessListeners = getListeners(res); - - if (stalenessListeners != null) - { - for (final StalenessListener listener : stalenessListeners) - { - listener.stalenessChanged(new StalenessEvent( - ChangeType.VIEW_DEFN_CHANGED)); - } - } - return EventResult.getDefaultEventResult(); - } - - private EventResult handleInaccessibleChangeEvent( - final ResourceLifecycleEvent event) - { - final IResource res = event.getAffectedResource(); - final ReasonType reasonType = event.getReasonType(); - ChangeType changeType = null; - if (reasonType == ReasonType.RESOURCE_PROJECT_CLOSED) - { - changeType = ChangeType.VIEW_DEFN_PROJECT_CLOSED; - } - else if (reasonType == ReasonType.RESOURCE_DELETED) - { - changeType = ChangeType.VIEW_DEFN_DELETED; - } - else - { - return EventResult.getDefaultEventResult(); - } - - final List<StalenessListener> listeners = getListeners(res); - - if (listeners != null) - { - for (final StalenessListener listener : listeners) - { - listener.stalenessChanged(new StalenessEvent( - changeType)); - } - } - return EventResult.getDefaultEventResult(); - } - - private void cleanAll() - { - final StalenessEvent event = new StalenessEvent(ChangeType.PROJECT_CLEANED); - for (final Map.Entry<IResource, ViewInfo> entry : _stalenessListeners.entrySet()) - { - final ViewInfo info = entry.getValue(); - for (final StalenessListener listener : info.getListeners()) - { - listener.stalenessChanged(event); - } - } - } - - private void cleanProject(final IProject project) - { - final StalenessEvent event = new StalenessEvent(ChangeType.PROJECT_CLEANED); - for (final Map.Entry<IResource, ViewInfo> entry : _stalenessListeners.entrySet()) - { - final IResource res = entry.getKey(); - - if (res.getProject().equals(project)) - { - final ViewInfo info = entry.getValue(); - for (final StalenessListener listener : info.getListeners()) - { - listener.stalenessChanged(event); - } - } - } - } - - private List<StalenessListener> getListeners(final IResource res) - { - List<StalenessListener> stalenessListeners = null; - - synchronized (this) - { - final ViewInfo viewInfo = _stalenessListeners.get(res); - - if (viewInfo != null) - { - stalenessListeners = viewInfo.getListeners(); - } - } - return stalenessListeners; - } - - public synchronized void addViewInfo(final String viewId, - final IResource res) - { - ViewInfo viewInfo = _stalenessListeners.get(res); - - if (viewInfo == null) - { - viewInfo = new ViewInfo(viewId); - _stalenessListeners.put(res, viewInfo); - } - } - - public synchronized ViewInfo getViewInfo(final IResource res) - { - return _stalenessListeners.get(res); - } - - public synchronized void dispose() - { - // updating with null effectively deregisters any existing listener - // and doesn't register a new one. - ResourcesPlugin.getWorkspace().removeResourceChangeListener(_buildListener); - update(null); - } - - public synchronized void update( - final ImmutableLifecycleListener listener) - { - if (listener == _listener) - { - return; - } - - final ImmutableLifecycleListener oldListener = _listener; - - if (oldListener != null) - { - oldListener.removeListener(this); - } - - _listener = listener; - - if (_listener != null) - { - _listener.addListener(this); - } - } - } - - private static class ViewInfo - { - private final CopyOnWriteArrayList<StalenessListener> _listeners; -// private final String _viewId; - - /** - * @param listeners - * @param res - */ - private ViewInfo(final String viewId) - { - super(); - _listeners = new CopyOnWriteArrayList<StalenessListener>(); -// _viewId = viewId; - } - - protected final CopyOnWriteArrayList<StalenessListener> getListeners() - { - return _listeners; - } - -// protected final String getViewId() -// { -// return _viewId; -// } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/IDTViewHandler.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/IDTViewHandler.java deleted file mode 100644 index 81e4be6a4..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/IDTViewHandler.java +++ /dev/null @@ -1,255 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.IPath; -import org.eclipse.jst.jsf.common.internal.resource.ImmutableLifecycleListener; -import org.eclipse.jst.jsf.designtime.context.DTFacesContext; - -/** - * <p> - * Defines the basic interface for all design time view handlers that parallel - * custom runtime view handlers (extenders of ViewHandler). - * </p> - * - * @author cbateman - * - */ -public interface IDTViewHandler -{ - /** - * <p> - * Creates and returns the view root. This method <i>may</i> optionally - * intialize the view root with any data that need only be done once per - * instance. Generally, this will include providing the root access to - * itself or its IViewDefnAdapterFactory so that it can refresh itself. - * </p> - * - * @param facesContext - * @param viewId - * @return a designtime view root instance of viewId under the given faces - * context - * @throws ViewHandlerException - */ - DTUIViewRoot createView(DTFacesContext facesContext, String viewId) - throws ViewHandlerException; - - /** - * Calculate the locale for the current view context. The return string must - * conform to the standard format proscribed by java.util.Locale. - * - * @param context - * @return the locale string for the view definition referred to by context - * @throws ViewHandlerException - */ - String calculateLocale(DTFacesContext context) throws ViewHandlerException; - - /** - * Given that resource is the view definition source and requestPath is the - * current servlet uri for a request relative to the web content root, map - * it to the actual request uri that would be required at runtime to invoke - * the view definition in resource. DTFacesContext will contain an external - * context that may be used to derive servlet mapping configuration. - * - * @param context - * @param resource - * @param requestPath - * @return the IPath representing the newly mapped request path - * @throws ViewHandlerException - */ - IPath getActionURL(DTFacesContext context, IResource resource, - IPath requestPath) throws ViewHandlerException; - - /** - * TODO: if we already have context, must we already know what the source - * is? - * - * The IResource need not exist. - * - * @param context - * @param viewId - * @return the resource containing the view definition for viewId. - * @throws ViewHandlerException - */ - IResource getActionDefinition(DTFacesContext context, String viewId) - throws ViewHandlerException; - - /** - * Given that a request is made for uri from within the view named by - * relativeToViewId at runtime, return the path to the resource containing - * that view definition. The path need not point to a resource that - * currently exists. - * - * @param context - * @param relativeToViewId - * @param uri - * @return the path to the resource named by uri relative to the view named - * by relativeToViewId - * @throws ViewHandlerException - */ - IPath getRelativeActionPath(DTFacesContext context, - String relativeToViewId, String uri) throws ViewHandlerException; - - /** - * Translate a workspace resource to the view id it will have at runtime. - * - * @param context - * @param res - * @return the view id for res or null if there is no meaningful value - */ - String getViewId(DTFacesContext context, IResource res); - - /** - * @param context - * @return a view definition adapter - * @throws ViewHandlerException - */ - IViewDefnAdapterFactory getViewMetadataAdapterFactory(DTFacesContext context) - throws ViewHandlerException; - - /** - * @param file - * @return true if the contents of the file is of a format that this view - * handler supports. Generally, this is decided by a combination of - * content type and, in the case of XML formats, schema. - */ - boolean supportsViewDefinition(final IFile file); - - /** - * Releases the handler's in-memory image. - */ - void dispose(); - - /** - * Called by design time app manager to set a global resource listener - * for the view handler to use. View handlers should generally use this - * listener to reduce the overhead of extra resouce change listeners. - * - * @param listener - */ - void setLifecycleListener(final ImmutableLifecycleListener listener); - - /** - * General exception class for problems that a custom view handler wants to - * propagate to the framework in a well-defined way. - * - */ - public static final class ViewHandlerException extends Exception - { - private final Cause _causeCode; - - /** - * Enumerates the known failure causes - * - */ - public enum Cause - { - /** - * thrown from getELExpression when the context passed does not - * refer to a parsable EL expression in the view definition - */ - EL_NOT_FOUND, - /** - * thrown from getELExpression when an exception occurs during EL - * parsing. The ViewHandlerException should wrap the causing - * exception in this cause - */ - EL_EXCEPTION_CAUGHT_WHILE_PARSING, - /** - * an undefined exception cause indicating something not foreseen by - * the framework. - */ - UNDEFINED, - - /** - * indicates that a bad or null version stamp was encountered. The - * wrapped exception may provide tracing information to the cause. - */ - BAD_VERSION_STAMP, - - /** - * indicates that a bad or null staleness advisor was encountered. - * The wrapped exception may provide tracing information to the - * cause. - */ - BAD_STALENESS_ADVISOR, - - /** - * a general failure by the view creation to create a new view root. - */ - UNABLE_TO_CREATE_VIEW - } - - /** - * - */ - private static final long serialVersionUID = 2109525340402345111L; - - /** - * Construct an exception with an undefined cause - */ - public ViewHandlerException() - { - this(Cause.UNDEFINED); - } - - /** - * @param cause - */ - public ViewHandlerException(final Cause cause) - { - super(); - _causeCode = cause; - } - - /** - * @param message - * @param caught - * @param cause - */ - public ViewHandlerException(final String message, - final Throwable caught, final Cause cause) - { - super(message, caught); - _causeCode = cause; - } - - /** - * @param message - * @param cause - */ - public ViewHandlerException(final String message, final Cause cause) - { - super(message); - _causeCode = cause; - } - - /** - * @param caught - * @param cause - */ - public ViewHandlerException(final Throwable caught, final Cause cause) - { - super(caught); - _causeCode = cause; - } - - /** - * @return the cause code - */ - public final Cause getCauseCode() - { - return _causeCode; - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/IViewDefnAdapter.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/IViewDefnAdapter.java deleted file mode 100644 index 676643a74..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/IViewDefnAdapter.java +++ /dev/null @@ -1,128 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view; - -import java.util.List; - -import org.eclipse.jst.jsf.common.runtime.internal.model.ViewObject; -import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentInfo; -import org.eclipse.jst.jsf.common.runtime.internal.model.datatypes.ELExpression; -import org.eclipse.jst.jsf.context.IModelContext; -import org.eclipse.jst.jsf.designtime.context.DTFacesContext; -import org.eclipse.jst.jsf.designtime.internal.view.IDTViewHandler.ViewHandlerException; - -/** - * <p> - * A generic adapter used to adapt arbitrary view definitions to framework - * objects. - * </p> - * - * @author cbateman - * @param <VIEW_DEFN_BASE_TYPE> - * the base type of all view definition objects - * @param <VIEW_CONTAINER_TYPE> - * the type of the container that is expeccted to hold the view defn - * - */ -public interface IViewDefnAdapter<VIEW_DEFN_BASE_TYPE, VIEW_CONTAINER_TYPE> -{ - /** - * @param viewDefnObject - * @param constructionData - * @param viewContainer - * @return a view object corresponding to the viewDefnBaseType object or - * null if none. - */ - ViewObject mapToViewObject( - VIEW_DEFN_BASE_TYPE viewDefnObject, - ViewObjectConstructionStrategy<? extends VIEW_DEFN_BASE_TYPE> constructionData, - VIEW_CONTAINER_TYPE viewContainer); - - /** - * This method may be expensive. - * - * @param viewDefnObject - * @param root - * @return the view object corresponding to viewDefnObject in the - * component sub-tree rooted at root. - * <b>May return null if isn't found or can't be found</b> - */ - ViewObject findViewObject(VIEW_DEFN_BASE_TYPE viewDefnObject, ComponentInfo root); - - /** - * @param viewObject - * @param root - * @return the view definition object that viewObject was derived from - * using root as the component sub-tree root to search in. - * <b>May return null if isn't found or can't be found</b> - */ - VIEW_DEFN_BASE_TYPE findViewDefn(ViewObject viewObject, ComponentInfo root); - - /** - * @param viewDefnObject - * @return the id for the viewDefnObject or null if none. Generally, null - * should indicate that no id is present but could be. This is - * distinct from the case where viewDefnObject can never define an - * id, in which case IllegalArgumentException should be thrown. - * - * @throws IllegalArgumentException - * may be thrown to indicate that viewDefnObject does not - * correspond to a ViewObject type that has an id. - * - */ - String getId(VIEW_DEFN_BASE_TYPE viewDefnObject) - throws IllegalArgumentException; - - /** - * Normally this is a workspace resource (IFile) or higher level document - * type like an IDocument. - * - * @param context - * @param viewId - * @return the container resource for the viewId in context. - */ - VIEW_CONTAINER_TYPE getContainer(DTFacesContext context, String viewId); - - /** - * @param container - * @return the view roots for the definition in container or empty if none. - * MUST NOT BE NULL. - */ - List<VIEW_DEFN_BASE_TYPE> getViewDefnRoots(VIEW_CONTAINER_TYPE container); - - /** - * <p> - * The view definition adapter must be able to extract all EL expressions - * from a view definition. Given a model context that points into the view - * definition it must return the EL expression in that context. - * </p> - * - * <p> - * If the model context provided does not refer to a valid view definition - * for this handler, then ViewHandlerException(EL_NOT_FOUND) should be - * thrown. If an exception occurs while trying to extract the EL expression - * at context, then ViewHandlerException(caughtException, - * EL_EXCEPTION_CAUGHT_WHILE_PARSING) should be thrown. - * </p> - * - * <p> - * Note that any reference to parsing here means extraction from the - * document and not building an AST for the expression itself.</p> - * - * @param context - * @return the text (stripped of any escaping such as #{} in JSP) of the EL - * expression referred to by context or null if there is no valid EL - * expression at context. - * @throws ViewHandlerException - */ - ELExpression getELExpression(IModelContext context) throws ViewHandlerException; - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/IViewDefnAdapterFactory.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/IViewDefnAdapterFactory.java deleted file mode 100644 index b0aa0f06e..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/IViewDefnAdapterFactory.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view; - -import org.eclipse.jst.jsf.designtime.context.DTFacesContext; - -/** - * <p>Interface for a factory that creates view definition adapters.</p> - * - * @author cbateman - * - */ -public interface IViewDefnAdapterFactory -{ - /** - * @param context - * @param viewId - * @return a view adapter for the viewid or null if this factory - * cannot produce an adapter for the underlying view definition. - */ - IViewDefnAdapter<?,?> createAdapter(DTFacesContext context, String viewId); -}
\ No newline at end of file diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/IViewRootHandle.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/IViewRootHandle.java deleted file mode 100644 index c8d37630c..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/IViewRootHandle.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view; - -import org.eclipse.jst.jsf.designtime.internal.view.DTUIViewRoot.StalenessListener; - -/** - * A handle to a view root. - * - * @author cbateman - * - */ -public interface IViewRootHandle -{ - /** - * <p> - * This returns the copy of the view root cached by the faces context. If - * updateViewRoot has never been called (or if it was called but never - * succeeded) it may return null. - * </p> - * - * <p> - * This method should be cheap and avoid blocking - * </p> - * - * return null if the value of the view root - * - * @return the cached view root. May be null. - */ - DTUIViewRoot getCachedViewRoot(); - - /** - * NOTE: this method may be long running. If you can tolerate a possibly - * stale value more quickly, use getCachedViewRoot(). NEVER run this method - * on the main UI thread. - * - * A good strategy for invoking is as follows: - * - * DTUIViewRoot viewRoot = handle.getCachedViewRoot(); - * - * <pre> - * if (viewRoot == null || viewRoot.isStale()) - * { - * spawnTread that calls updateViewRoot - * } - * - * </pre> - * - * @return the view root for the associated context object or null if there - * is no context object. - */ - DTUIViewRoot updateViewRoot(); - - /** - * Adds a staleness listener to the currently cached view root. If there - * currently is no cached view root, then the listener will be stored - * until a updateViewRoot is successfully called. - * @param listener - */ - void addListener(final StalenessListener listener); - - /** - * Removes a staleness listener from the currently cached view root. If - * there is no currently cached root, then the listener will be stored - * until one is found. The call will then attempt to remove it. - * @param listener - */ - void removeListener(final StalenessListener listener); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/JSPViewDefnAdapter.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/JSPViewDefnAdapter.java deleted file mode 100644 index da8825cf2..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/JSPViewDefnAdapter.java +++ /dev/null @@ -1,229 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view; - -import java.io.IOException; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jface.text.IDocument; -import org.eclipse.jst.jsf.context.IModelContext; -import org.eclipse.jst.jsf.context.resolver.structureddocument.IStructuredDocumentContextResolverFactory; -import org.eclipse.jst.jsf.context.resolver.structureddocument.internal.ITextRegionContextResolver; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContextFactory; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.designtime.context.DTFacesContext; -import org.eclipse.jst.jsf.designtime.internal.view.IDTViewHandler.ViewHandlerException; -import org.eclipse.jst.jsf.designtime.internal.view.IDTViewHandler.ViewHandlerException.Cause; -import org.eclipse.jst.jsf.designtime.internal.view.model.ITagRegistry; -import org.eclipse.jst.jsp.core.internal.contentmodel.TaglibController; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.TLDCMDocumentManager; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.TaglibTracker; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDDocument; -import org.eclipse.jst.jsp.core.internal.domdocument.DOMModelForJSP; -import org.eclipse.jst.jsp.core.internal.regions.DOMJSPRegionContexts; -import org.eclipse.wst.sse.core.StructuredModelManager; -import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; -import org.eclipse.wst.xml.core.internal.contentmodel.CMDocument; -import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext; -import org.w3c.dom.Element; - -/** - * <p> - * A view definition adapter that adapts JSF view definitions based on the - * standard JSP view description language. - * </p> - * - * @author cbateman - * - */ -public class JSPViewDefnAdapter extends TaglibBasedViewDefnAdapter -{ - JSPViewDefnAdapter(final ITagRegistry tldTagRegistry) - { - super(tldTagRegistry); - } - - @Override - public IDocument getContainer(final DTFacesContext context, - final String viewId) - { - final IResource viewDefn = context.adaptContextObject(); - - if (viewDefn instanceof IFile) - { - final IFile viewDefnFile = (IFile) viewDefn; - IStructuredModel model = null; - try - { - model = - StructuredModelManager.getModelManager() - .getModelForRead(viewDefnFile); - - if (model instanceof DOMModelForJSP) - { - return model.getStructuredDocument(); - } - } - catch (final IOException e) - { - JSFCorePlugin.log(e, "Acquiring model for view root"); //$NON-NLS-1$ - } - catch (final CoreException e) - { - JSFCorePlugin.log(e, "Acquiring model for view root"); //$NON-NLS-1$ - } - finally - { - if (model != null) - { - model.releaseFromRead(); - } - } - } - return null; - } - - @Override - public final String getNamespace(final Element element, - final IDocument doc) - { - final String prefix = element.getPrefix(); - - // TODO: merge back with JSPUtil.findUri() - final TLDCMDocumentManager m = - TaglibController.getTLDCMDocumentManager(doc); - - if (prefix == null || m == null) - { - return null; - } - final List<?> trackers = m.getTaglibTrackers(); - for (final Object name : trackers) - { - final TaglibTracker tracker = (TaglibTracker) name; - if (prefix.equals(tracker.getPrefix())) - { - return tracker.getURI(); - } - } - return null; - } - - - @Override - public DTELExpression getELExpression(final IModelContext genericContext) - throws ViewHandlerException - { - final IStructuredDocumentContext context = - (IStructuredDocumentContext) genericContext - .getAdapter(IStructuredDocumentContext.class); - - if (context == null) - { - throw new ViewHandlerException(Cause.EL_NOT_FOUND); - } - - ITextRegionContextResolver resolver = - IStructuredDocumentContextResolverFactory.INSTANCE - .getTextRegionResolver(context); - - String elText = null; - - if (resolver != null) - { - final String regionType = resolver.getRegionType(); - - if (regionType != null && resolver.matchesRelative(new String[] - { DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE })) - { - // if we are in the EL content, then get the current region - // text - if (DOMJSPRegionContexts.JSP_VBL_CONTENT.equals(regionType)) - { - elText = resolver.getRegionText(); - } - // otherwise, we may be at the end of a content region but - // at - // the beginning of a closing brace so check to see if the - // previous - // region was a VBL_CONTENT - else if (regionType.equals(DOMJSPRegionContexts.JSP_VBL_CLOSE)) - { - final IStructuredDocumentContext previousContext = - resolver.getPreviousContext(); - - final ITextRegionContextResolver prevResolver = - IStructuredDocumentContextResolverFactory.INSTANCE - .getTextRegionResolver(previousContext); - - if (prevResolver != null) - { - if (DOMJSPRegionContexts.JSP_VBL_CONTENT - .equals(prevResolver.getRegionType())) - { - resolver = prevResolver; - elText = prevResolver.getRegionText(); - } - else if (DOMJSPRegionContexts.JSP_VBL_OPEN - .equals(prevResolver.getRegionType())) - { - elText = ""; //$NON-NLS-1$ - } - } - } - } - } - - if (elText != null) - { - final IStructuredDocumentContext elContext = - IStructuredDocumentContextFactory.INSTANCE.getContext( - context.getStructuredDocument(), resolver - .getStartOffset()); - return new DTELExpression(elContext, elText); - } - return null; - } - - @Override - public String getGeneratedIdPrefix() - { - return "_idJsp"; //$NON-NLS-1$ - } - - @Override - public String getPrefix(String namespace, IDocument doc) - { - TLDCMDocumentManager m = TaglibController.getTLDCMDocumentManager(doc); - if (m == null) - return null; - List trackers = m.getTaglibTrackers(); - for (Iterator iter = trackers.iterator(); iter.hasNext();) { - TaglibTracker tracker = (TaglibTracker) iter.next(); - if (namespace.equals(tracker.getURI())) { - return tracker.getPrefix(); - } - - CMDocument cmdoc = tracker.getDocument(); - if (cmdoc instanceof TLDDocument - && namespace.equals(((TLDDocument) cmdoc).getUri())) { - return tracker.getPrefix(); - } - } - return null; - - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/TaglibBasedViewDefnAdapter.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/TaglibBasedViewDefnAdapter.java deleted file mode 100644 index f24c405eb..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/TaglibBasedViewDefnAdapter.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view; - -import org.eclipse.jface.text.IDocument; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagElement; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.Namespace; -import org.eclipse.jst.jsf.designtime.internal.view.model.ITagRegistry; -import org.w3c.dom.Element; - -/** - * A view defintion adapter for XML-based view definition formats that use - * a well defined tag library system, with associated ITagRegistry, to define - * tag handlers. Most common view handlers (JSP, Facelets) should use this. - * - * @author cbateman - * - */ -public abstract class TaglibBasedViewDefnAdapter extends XMLViewDefnAdapter -{ - private final ITagRegistry _tagRegistry; - - /** - * @param tagRegistry - */ - protected TaglibBasedViewDefnAdapter(final ITagRegistry tagRegistry) - { - _tagRegistry = tagRegistry; - } - - /** - * @param node - * @param document - * @return the tag element for node or null if none. - */ - @Override - protected ITagElement findTagElement(final Element node, - final IDocument document) - { - final String uri = getNamespace(node, document); - final String tagName = node.getLocalName(); - - if (uri != null) - { - final Namespace lib = getTagRegistry().getTagLibrary(uri); - - if (lib != null) - { - return findTagElement(tagName, lib); - } - } - return null; - } - - /** - * @return the tag registry - */ - protected final ITagRegistry getTagRegistry() - { - return _tagRegistry; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/ViewObjectConstructionStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/ViewObjectConstructionStrategy.java deleted file mode 100644 index ad3a7a231..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/ViewObjectConstructionStrategy.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view; - -import org.eclipse.jst.jsf.common.runtime.internal.model.ViewObject; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagElement; - -/** - * A strategy for constructing a new view object from a tag element - * @author cbateman - * @param <VIEW_DEFN_BASE_TYPE> - * - */ -public abstract class ViewObjectConstructionStrategy<VIEW_DEFN_BASE_TYPE> -{ - /** - * For a tag element return the corresponding view object or null if - * there is no such object. XMLViewObjectMappingService must be updated - * if not null with any attribute->property mappings. - * - * @param viewBase the source object in the source - * @param tagElement - * @return a new view object or null if we can't do so - */ - public abstract ViewObject createViewObject(VIEW_DEFN_BASE_TYPE viewBase, - ITagElement tagElement); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/XMLComponentTreeConstructionStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/XMLComponentTreeConstructionStrategy.java deleted file mode 100644 index 49737f55f..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/XMLComponentTreeConstructionStrategy.java +++ /dev/null @@ -1,193 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view; - -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.jface.text.IDocument; -import org.eclipse.jst.jsf.common.runtime.internal.model.ViewObject; -import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentFactory; -import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentInfo; -import org.eclipse.jst.jsf.designtime.context.DTFacesContext; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - -/** - * A component tree construction strategy based on XML view definition - * - * @author cbateman - * - */ -public class XMLComponentTreeConstructionStrategy extends - ComponentTreeConstructionStrategy<Node, IDocument> -{ - private final XMLViewDefnAdapter _adapter; - // private final XMLViewObjectConstructionStrategy - // _objectConstructionStrategy; - private final IProject _project; - - /** - * @param adapter - * @param project - */ - public XMLComponentTreeConstructionStrategy( - final XMLViewDefnAdapter adapter, final IProject project) - { - _adapter = adapter; - _project = project; - } - - @Override - public ComponentInfo createComponentTree(final DTFacesContext context, - final DTUIViewRoot viewRoot) - { - final IDocument container = _adapter.getContainer(context, viewRoot - .getViewId()); - final List<Node> roots = _adapter.getViewDefnRoots(container); - - if (roots.size() > 0) - { - final IAdaptable adaptable = viewRoot.getServices(); - - XMLViewObjectMappingService tagMappingService = null; - if (adaptable != null) - { - tagMappingService = (XMLViewObjectMappingService) adaptable - .getAdapter(XMLViewObjectMappingService.class); - } - final XMLViewObjectConstructionStrategy objectConstructionStrategy = - new XMLViewObjectConstructionStrategy( - _adapter, new ComponentConstructionData(0, null, _project, - container), tagMappingService); - - objectConstructionStrategy.getConstructionData().setIdCounter(0); - // can only handle a single root for XML; should be the DOM root - return buildComponentTree(roots.get(0), viewRoot, container, - objectConstructionStrategy); - } - - return viewRoot; - } - - private ComponentInfo buildComponentTree(final Node root, - final DTUIViewRoot viewRoot, final IDocument document, - final XMLViewObjectConstructionStrategy objectConstructionStrategy) - { - final ComponentInfo dummyRoot = ComponentFactory.createComponentInfo( - null, null, null, true); - // populate the dummy root - recurseDOMModel(root, dummyRoot, document, objectConstructionStrategy); - - // try to extract the view defined root from the dummyRoot and update - // 'root' with its children. - populateViewRoot(viewRoot, dummyRoot.getChildren()); - return viewRoot; - } - - /** - * Tries to find the view defined view root in children and use it populate - * viewRoot. Children may sub-class to a different algorithm or, in some - * cases create an implicit (i.e. Facelets does this) view root if one is - * not explicitly created by the view definition. - * - * Regardless of the strategy, the following post-conditions must be true - * - * To the extend that children represent the top-level objects in the view - * under the presumed root, viewRoot must be populated with them either - * directly if the creation of a view root is implicit (i.e. Facelets) or - * through a valid view root declaration found in the view definition (i.e. - * f:view in JSP) found the children list. - * - * The default behaviour assumes the JSP case. - * - * TODO: add validation cases for missing view roots in JSP. - * - * @param viewRoot - * @param children - */ - protected void populateViewRoot(final DTUIViewRoot viewRoot, - final List children) - { - ComponentInfo foundRoot = null; - // TODO: additional cases: - // 1) Valid case: view is a fragment and has one or more non-view root - // children - // 2) Invalid case: not a fragment and has no view root - // 3) Invalid case: any definition and has more than one view root - // 4) Invalid case: any definition and has component siblings to the - // view root - FIND_VIEWROOT: for (final Iterator it = children.iterator(); it - .hasNext();) - { - final ComponentInfo topLevelChild = (ComponentInfo) it.next(); - - if ("javax.faces.ViewRoot".equals(topLevelChild //$NON-NLS-1$ - .getComponentTypeInfo().getComponentType())) - { - foundRoot = topLevelChild; - break FIND_VIEWROOT; - } - } - - if (foundRoot != null) - { - for (final Iterator it = foundRoot.getChildren().iterator(); it - .hasNext();) - { - final ComponentInfo child = (ComponentInfo) it.next(); - final String facetName = foundRoot.getFacetName(child); - - // if not a facet, add as a normal child - if (facetName == null) - { - viewRoot.addChild(child); - } - // if it is a facet, add as a facet - else - { - viewRoot.addFacet(facetName, child); - } - } - } - } - - private void recurseDOMModel(final Node node, final ComponentInfo parent, - final IDocument document, - XMLViewObjectConstructionStrategy objectConstructionStrategy) - { - ViewObject mappedObject = null; - - objectConstructionStrategy.getConstructionData().setParent(parent); - - mappedObject = _adapter.mapToViewObject(node, - objectConstructionStrategy, document); - - ComponentInfo newParent = parent; - - if (mappedObject instanceof ComponentInfo) - { - parent.addChild((ComponentInfo) mappedObject); - newParent = (ComponentInfo) mappedObject; - } - - final NodeList children = node.getChildNodes(); - final int numChildren = children.getLength(); - - for (int i = 0; i < numChildren; i++) - { - recurseDOMModel(children.item(i), newParent, document, - objectConstructionStrategy); - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/XMLViewDefnAdapter.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/XMLViewDefnAdapter.java deleted file mode 100644 index c7e727b74..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/XMLViewDefnAdapter.java +++ /dev/null @@ -1,319 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.jface.text.IDocument; -import org.eclipse.jst.jsf.common.runtime.internal.model.ViewObject; -import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentInfo; -import org.eclipse.jst.jsf.common.runtime.internal.model.datatypes.ELExpression; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagElement; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.Namespace; -import org.eclipse.jst.jsf.context.IModelContext; -import org.eclipse.jst.jsf.context.resolver.structureddocument.IDOMContextResolver; -import org.eclipse.jst.jsf.context.resolver.structureddocument.IStructuredDocumentContextResolverFactory; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContextFactory; -import org.eclipse.jst.jsf.designtime.context.DTFacesContext; -import org.eclipse.jst.jsf.designtime.internal.view.IDTViewHandler.ViewHandlerException; -import org.eclipse.jst.jsf.designtime.internal.view.XMLViewObjectMappingService.ElementData; -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode; -import org.w3c.dom.Attr; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; - -/** - * A view definition adapter base class for view definition that use XML to - * define the view. - * - * @author cbateman - * - */ -public abstract class XMLViewDefnAdapter extends - AbstractViewDefnAdapter<Node, IDocument> -{ - private static final String GENERATED_ID = "_generatedId"; //$NON-NLS-1$ - - @Override - public abstract IDocument getContainer(DTFacesContext context, String viewId); - - @Override - public String getId(final Node viewDefnObject) - throws IllegalArgumentException - { - if (viewDefnObject instanceof Element) - { - return ((Element) viewDefnObject).getAttribute("id"); //$NON-NLS-1$ - } - throw new IllegalArgumentException( - "Only Elements can define view object ids"); //$NON-NLS-1$ - } - - @Override - public ViewObject mapToViewObject( - final Node viewDefnObject, - final ViewObjectConstructionStrategy<? extends Node> constructionData, - final IDocument document) - { - switch (viewDefnObject.getNodeType()) - { - case Node.ELEMENT_NODE: - return createFromElement( - (Element) viewDefnObject, - (ViewObjectConstructionStrategy<Element>) constructionData, - document); - } - - return null; - } - - /** - * @param viewDefnObject - * @param viewContainer - * @return the tag element corresponding to viewDefnObject in the context of - * viewContainer or null if not found. Node must be an Element in - * order for this work. - */ - public ITagElement mapToTagElement(final Node viewDefnObject, - final IDocument viewContainer) - { - if (viewDefnObject instanceof Element) - { - return findTagElement((Element) viewDefnObject, viewContainer); - } - return null; - } - - @Override - public List<Node> getViewDefnRoots(final IDocument container) - { - final List<Node> roots = new ArrayList<Node>(); - - final IStructuredDocumentContext context = IStructuredDocumentContextFactory.INSTANCE - .getContext(container, -1); - - if (context != null) - { - final IDOMContextResolver resolver = IStructuredDocumentContextResolverFactory.INSTANCE - .getDOMContextResolver(context); - - if (resolver != null) - { - final Document doc = resolver.getDOMDocument(); - - if (doc != null) - { - roots.add(doc); - } - } - } - - return roots; - } - - @Override - public ViewObject findViewObject(final Node viewDefnObject, - final ComponentInfo root) - { - if (root instanceof DTUIViewRoot && viewDefnObject instanceof Element) - { - final IAdaptable services = ((DTUIViewRoot) root).getServices(); - final Object serviceAdapter = services - .getAdapter(XMLViewObjectMappingService.class); - if (serviceAdapter instanceof XMLViewObjectMappingService) - { - final IStructuredDocumentContext context = getContext(viewDefnObject); - - if (context != null) - { - final String uri = getNamespace((Element) viewDefnObject, - context.getStructuredDocument()); - final ElementData elementData = XMLViewObjectMappingService - .createElementData(uri, viewDefnObject - .getLocalName(), context, - Collections.EMPTY_MAP); - return ((XMLViewObjectMappingService) serviceAdapter) - .findViewObject(elementData); - } - } - } - return null; - } - - private IStructuredDocumentContext getContext(final Node viewDefnObject) - { - if (viewDefnObject instanceof IDOMNode) - { - final IStructuredDocument sdoc = ((IDOMNode) viewDefnObject) - .getStructuredDocument(); - return IStructuredDocumentContextFactory.INSTANCE.getContext(sdoc, - viewDefnObject); - } - return null; - } - - @Override - public Node findViewDefn(final ViewObject viewObject, - final ComponentInfo root) - { - // TODO Auto-generated method stub - return null; - } - - @Override - public abstract DTELExpression getELExpression(IModelContext context) - throws ViewHandlerException; - - // TODO: need to extend to other objects - /** - * @param element - * @param constructionData - * @param document - * @return the component info for element - */ - protected ViewObject createFromElement(final Element element, - final ViewObjectConstructionStrategy<Element> constructionData, - final IDocument document) - { - final ITagElement tagElement = findTagElement(element, document); - return constructionData.createViewObject(element, tagElement); - } - - /** - * @param element - * @param doc - * @return the namespace uri for element in doc - */ - public abstract String getNamespace(Element element, IDocument doc); - - /** - * @param namespace - * @param doc - * @return the prefix in doc for namespace or null if none. - */ - public abstract String getPrefix(final String namespace, IDocument doc); - - /** - * @param node - * @param document - * @return the tag element for node in document or null if none - */ - protected abstract ITagElement findTagElement(final Element node, - final IDocument document); - - /** - * @param nodeName - * @param lib - * @return the tag element with local name nodeName in lib or null if none. - */ - protected static ITagElement findTagElement(final String nodeName, - final Namespace lib) - { - return lib.getViewElement(nodeName); - } - - /** - * @param namespaces - * @param uri - * @return the namespace object in namespaces with uri, 'uri', or null if - * none. - */ - protected static Namespace getTaglib( - final Collection<? extends Namespace> namespaces, final String uri) - { - for (final Namespace namespace : namespaces) - { - if (uri.equals(namespace.getNSUri())) - { - return namespace; - } - } - return null; - } - - /** - * @return the prefix string to which a running count will be added to - * produced the default generated id - */ - public String getGeneratedIdPrefix() - { - return GENERATED_ID; - } - - /** - * @param element - * @param componentAttrName - * @return the attribute on element matching the component attribute called - * componentAttrName or null if not found (this may indicate either - * no such attribute or that it simply not populated on element; no - * guarantee is made as to which it is) - */ - public Attr mapAttributeToComponent(final Element element, - final String componentAttrName) - { - // TODO: need to make meta-data type driven and validate bad conversion - -// final boolean mapByBeanName = true; // TODO: getMetadata for mapping - // instead - -// if (mapByBeanName) -// { - return element.getAttributeNode(componentAttrName); -// } - -// return null; - } - - /** - * A design time EL expression - * - */ - public static class DTELExpression extends ELExpression - { - private final IStructuredDocumentContext _documentContext; - private final String _originalText; - - /** - * @param doc - * @param text - */ - public DTELExpression(final IStructuredDocumentContext doc, - final String text) - { - _documentContext = doc; - _originalText = text; - } - - @Override - public String getText() - { - return _originalText; - } - - /** - * @return the document context. The document relative position of the - * start of the EL expression is used - * - */ - public IStructuredDocumentContext getDocumentContext() - { - return _documentContext; - } - - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/XMLViewObjectConstructionStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/XMLViewObjectConstructionStrategy.java deleted file mode 100644 index fcff0bac0..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/XMLViewObjectConstructionStrategy.java +++ /dev/null @@ -1,525 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import org.eclipse.jdt.core.Signature; -import org.eclipse.jface.text.IDocument; -import org.eclipse.jst.jsf.common.internal.types.TypeConstants; -import org.eclipse.jst.jsf.common.runtime.internal.model.ViewObject; -import org.eclipse.jst.jsf.common.runtime.internal.model.behavioural.ActionSourceInfo; -import org.eclipse.jst.jsf.common.runtime.internal.model.behavioural.ActionSourceInfo2; -import org.eclipse.jst.jsf.common.runtime.internal.model.behavioural.EditableValueHolderInfo; -import org.eclipse.jst.jsf.common.runtime.internal.model.behavioural.INamingContainerInfo; -import org.eclipse.jst.jsf.common.runtime.internal.model.behavioural.ValueHolderInfo; -import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentFactory; -import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentInfo; -import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentTypeInfo; -import org.eclipse.jst.jsf.common.runtime.internal.model.decorator.ConverterDecorator; -import org.eclipse.jst.jsf.common.runtime.internal.model.decorator.ConverterTypeInfo; -import org.eclipse.jst.jsf.common.runtime.internal.model.decorator.ValidatorDecorator; -import org.eclipse.jst.jsf.common.runtime.internal.model.decorator.ValidatorTypeInfo; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.IComponentPropertyHandler; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.IComponentTagElement; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.IConverterTagElement; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagAttributeHandler; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagElement; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.IValidatorTagElement; -import org.eclipse.jst.jsf.common.util.JDTBeanProperty; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContextFactory; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.designtime.internal.view.XMLViewObjectMappingService.ElementData; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.ICustomViewMapper; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.ICustomViewMapper.PropertyMapping; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.CustomViewMapperExtensionLoader; -import org.w3c.dom.Attr; -import org.w3c.dom.Element; -import org.w3c.dom.NamedNodeMap; - -/** - * A strategy for constructing view objects. - * - * @author cbateman - * - */ -public class XMLViewObjectConstructionStrategy extends - ViewObjectConstructionStrategy<Element> -{ - private static final String GENERATED_ID = "_generatedId"; //$NON-NLS-1$ - private final ComponentConstructionData _constructionData; - private final XMLViewDefnAdapter _adapter; - private final XMLViewObjectMappingService _mappingService; - - /** - * @param adapter - * MUST NOT BE NULL - * @param constructionData - * MUST NOT BE NULL - * @param mappingService - * MAY BE NULL - */ - public XMLViewObjectConstructionStrategy(final XMLViewDefnAdapter adapter, - final ComponentConstructionData constructionData, - final XMLViewObjectMappingService mappingService) - { - super(); - if (adapter == null || constructionData == null) - { - throw new IllegalArgumentException( - "adapter and constructionData must not be null"); //$NON-NLS-1$ - } - _constructionData = constructionData; - _adapter = adapter; - _mappingService = mappingService; - } - - @Override - public ViewObject createViewObject(final Element element, - final ITagElement tagElement) - { - try - { - if (tagElement instanceof IComponentTagElement) - { - String id = null; - - // only generate ids for non-viewroot components. This will - // make the generated id's more faithful to runtime since the - // running count won't be incremented for view roots (as they - // won't at runtime). - final ComponentTypeInfo typeInfo = ((IComponentTagElement) tagElement) - .getComponent(); - - if (!"javax.faces.ViewRoot".equals(typeInfo.getComponentType())) //$NON-NLS-1$ - { - id = calculateId(element, _constructionData); - } - return findBestComponent(tagElement.getUri(), element, id, - (IComponentTagElement) tagElement); - } - else if (tagElement instanceof IConverterTagElement) - { - final ConverterTypeInfo typeInfo = ((IConverterTagElement) tagElement) - .getConverter(); - // TODO: validate when no parent - ComponentInfo parent = _constructionData.getParent(); - parent = findFirstParent( - ComponentFactory.INTERFACE_VALUEHOLDER, parent); - if (parent != null) - { - parent.addDecorator( - new ConverterDecorator(parent, typeInfo), - ComponentFactory.CONVERTER); - } - // TODO: else validate problem - } - else if (tagElement instanceof IValidatorTagElement) - { - final ValidatorTypeInfo typeInfo = ((IValidatorTagElement) tagElement) - .getValidator(); - ComponentInfo parent = _constructionData.getParent(); - parent = findFirstParent( - ComponentFactory.INTERFACE_EDITABLEVALUEHOLDER, parent); - if (parent != null) - { - parent.addDecorator( - new ValidatorDecorator(parent, typeInfo), - ComponentFactory.VALIDATOR); - } - // TODO :else validate problem - } - } - catch (final Exception e) - { - // log and ignore if an individual construction fails - JSFCorePlugin.log(e, "Error constructing view object"); //$NON-NLS-1$ - } - return null; - } - - private ComponentInfo findFirstParent(final String matchingType, - final ComponentInfo start) - { - ComponentInfo parent = start; - - while (parent != null && parent.getComponentTypeInfo() != null - && !parent.getComponentTypeInfo().isInstanceOf(matchingType)) - { - parent = parent.getParent(); - } - return parent; - } - - private ComponentInfo findBestComponent(final String uri, - final Element srcElement, final String id, - final IComponentTagElement tagElement) - { - ComponentInfo bestComponent = null; - - final ComponentInfo parent = _constructionData.getParent(); - - final Map<String, Object> initMap = new HashMap<String, Object>(); - final Map<String, String> attributeToPropertyMap = new HashMap<String, String>(); - populateInitMap(uri, initMap, srcElement, tagElement, - attributeToPropertyMap); - - if (initMap.get("id") == null) //$NON-NLS-1$ - { - // id must be set - initMap.put("id", id); //$NON-NLS-1$ - } - - final ComponentTypeInfo typeInfo = tagElement.getComponent(); - - // if we have a well-established base type, try that first - // sub-classes must occur before superclasses to ensure most accurate - // detection. - if (typeInfo.isInstanceOf(ComponentFactory.BASE_CLASS_UIINPUT)) - { - bestComponent = ComponentFactory.createUIInputInfo(parent, - typeInfo, initMap); - } - else if (typeInfo.isInstanceOf(ComponentFactory.BASE_CLASS_UIOUTPUT)) - { - bestComponent = ComponentFactory.createUIOutputInfo(parent, - typeInfo, initMap); - } - else if (typeInfo.isInstanceOf(ComponentFactory.BASE_CLASS_UICOMMAND)) - { - bestComponent = ComponentFactory.createUICommandInfo(parent, - typeInfo, initMap); - } - else if (typeInfo.isInstanceOf(ComponentFactory.BASE_CLASS_UIDATA)) - { - bestComponent = ComponentFactory.createUIDataInfo(parent, typeInfo, - initMap); - } - else if (typeInfo.isInstanceOf(ComponentFactory.BASE_CLASS_UIFORM)) - { - // TODO: how handle prepend ids? - bestComponent = ComponentFactory.createUIFormInfo(parent, typeInfo, - initMap); - } - else - { - // default - bestComponent = ComponentFactory.createComponentInfo( - _constructionData.getParent(), typeInfo, initMap); - } - - addTypeAdapters(bestComponent); - maybeMapXMLToViewObjects(bestComponent, srcElement, - attributeToPropertyMap, _constructionData.getDocument()); - maybeUpdateViewObject(bestComponent, srcElement, tagElement); - return bestComponent; - } - - // TODO: move to view definition adapter? - private void populateInitMap(final String uri, - final Map<String, Object> initMap, final Element srcElement, - final IComponentTagElement tagElement, - final Map<String, String> attributeToPropertyMap) - { - final ComponentTypeInfo typeInfo = tagElement.getComponent(); - final Map<String, ITagAttributeHandler> attributeHandlers = tagElement - .getAttributeHandlers(); - - final NamedNodeMap nodeMap = srcElement.getAttributes(); - - if (nodeMap != null && attributeHandlers != null) - { - Map<String, JDTBeanProperty> properties = null; - - for (int i = 0; i < nodeMap.getLength(); i++) - { - final Attr attr = (Attr) nodeMap.item(i); - if (attr != null) - { - final String name = attr.getLocalName(); - - if (name != null) - { - final ITagAttributeHandler attrHandler = attributeHandlers - .get(name); - if (attrHandler instanceof IComponentPropertyHandler) - { - if (properties == null) - { - properties = DTComponentIntrospector.getBeanProperties(typeInfo, _constructionData.getProject()); - } - mapComponentProperty(uri, srcElement, properties, - (IComponentPropertyHandler) attrHandler, - attr, name, initMap, attributeHandlers, - attributeToPropertyMap); - } - } - } - } - } - } - - private void mapComponentProperty(final String uri, - final Element srcElement, - final Map<String, JDTBeanProperty> properties, - final IComponentPropertyHandler attrHandler, final Attr attr, - final String attributeName, final Map initMap, - final Map<String, ITagAttributeHandler> attributeHandlers, - final Map<String, String> attributeToPropertyMap) - { - final String propertyName = attrHandler.getPropertyName(); - if (properties.containsKey(propertyName)) - { - final String id = attrHandler.getCustomHandler(); - - ICustomViewMapper mapper = null; - - if (id != null) - { - mapper = CustomViewMapperExtensionLoader - .getCustomViewMapper(id); - if (mapper != null) - { - final PropertyMapping mapping = mapper - .mapToComponentProperty(uri, srcElement, attr); - if (mapping != null) - { - initMap.put(mapping.getName(), mapping.getProperty()); - attributeToPropertyMap.put(attributeName, mapping - .getName()); - return; - } - } - } - - final String value = attr.getValue(); - if (value != null) - { - final Object convertedValue = convertFromString(value, - properties.get(propertyName)); - initMap.put(propertyName, convertedValue); - } - attributeToPropertyMap.put(attributeName, propertyName); - } - } - - private void maybeMapXMLToViewObjects(final ViewObject mappedObject, - final Element node, - final Map<String, String> attributeToProperties, - final IDocument document) - { - if (mappedObject != null && _mappingService != null) - { - final String uri = _adapter.getNamespace(node, document); - final IStructuredDocumentContext context = IStructuredDocumentContextFactory.INSTANCE - .getContext(document, node); - final ElementData elementData = XMLViewObjectMappingService - .createElementData(uri, node.getLocalName(), context, - attributeToProperties); - //Bug 269050 - IllegalArgumentException in createMapping() method - if (elementData != null) { - _mappingService.createMapping(elementData, mappedObject); - } - } - } - - private void maybeUpdateViewObject(final ComponentInfo bestComponent, - final Element srcElement, final ITagElement tagElement) - { - if (srcElement.getAttributes() == null) - return; - - for (int i = 0; i < srcElement.getAttributes().getLength(); i++) - { - final Attr attr = (Attr) srcElement.getAttributes().item(i); - final Map<String, ITagAttributeHandler> attributeHandlers = tagElement - .getAttributeHandlers(); - - if (attributeHandlers != null) - { - final ITagAttributeHandler handler = attributeHandlers.get(attr - .getLocalName()); - - if (handler != null) - { - final String id = handler.getCustomHandler(); - - ICustomViewMapper mapper = null; - - if (id != null) - { - mapper = CustomViewMapperExtensionLoader - .getCustomViewMapper(id); - if (mapper != null) - { - mapper.doAttributeActions(bestComponent, - srcElement, attr); - } - } - } - } - } - } - - private Object convertFromString(final String convertValue, - final JDTBeanProperty ofThisType) - { - final String signature = ofThisType.getTypeSignature(); - - Object result = null; - switch (Signature.getTypeSignatureKind(signature)) - { - case Signature.BASE_TYPE_SIGNATURE: - result = convertFromBaseType(convertValue, signature); - break; - - case Signature.CLASS_TYPE_SIGNATURE: - if (TypeConstants.TYPE_STRING.equals(signature)) - { - result = convertValue; - } - else if (TypeConstants.TYPE_JAVAOBJECT.equals(signature)) - { - result = convertValue; - } - break; - } - - return result; - } - - // TODO: does this belong somewhere else? - private Object convertFromBaseType(final String convertValue, - final String signature) - { - if (Signature.SIG_BOOLEAN.equals(signature)) - { - return Boolean.valueOf(convertValue); - } - else if (Signature.SIG_INT.equals(signature) - || Signature.SIG_BYTE.equals(signature) - || Signature.SIG_SHORT.equals(signature)) - { - try - { - return Integer.valueOf(convertValue); - } - catch (final NumberFormatException nfe) - { - return null; - } - } - else if (Signature.SIG_LONG.equals(convertValue)) - { - try - { - return Long.valueOf(convertValue); - } - catch (final NumberFormatException nfe) - { - return null; - } - } - - return null; - } - - private void addTypeAdapters(final ComponentInfo component) - { - final String[] interfaceNames = component.getComponentTypeInfo() - .getInterfaces(); - final Set interfaceNameSets = new HashSet(); - - for (final String interfaceName : interfaceNames) - { - interfaceNameSets.add(interfaceName); - } - - // don't replace intrinsic adapters - if (interfaceNameSets.contains(ComponentFactory.INTERFACE_ACTIONSOURCE)) - { - // an ActionSource2 is-a ActionSource - if (interfaceNameSets - .contains(ComponentFactory.INTERFACE_ACTIONSOURCE2) - && component.getAdapter(ComponentFactory.ACTION_SOURCE2) == null) - { - component.addAdapter(ComponentFactory.ACTION_SOURCE2, - new ActionSourceInfo2(null, null, false, null)); - } - - if (component.getAdapter(ComponentFactory.ACTION_SOURCE) == null) - { - component.addAdapter(ComponentFactory.ACTION_SOURCE, - new ActionSourceInfo(null, null, false)); - } - } - - if (interfaceNameSets.contains(ComponentFactory.INTERFACE_VALUEHOLDER)) - { - // a EditableValueHolder is-a ValueHolder - if (interfaceNameSets - .contains(ComponentFactory.INTERFACE_EDITABLEVALUEHOLDER) - && component - .getAdapter(ComponentFactory.EDITABLE_VALUE_HOLDER) == null) - { - component.addAdapter(ComponentFactory.EDITABLE_VALUE_HOLDER, - new EditableValueHolderInfo(null, null, null, false, - false, true, false, null, null, null)); - } - - if (component.getAdapter(ComponentFactory.VALUE_HOLDER) == null) - { - component.addAdapter(ComponentFactory.VALUE_HOLDER, - new ValueHolderInfo(null, null, null)); - } - } - - if (interfaceNameSets - .contains(ComponentFactory.INTERFACE_NAMINGCONTAINER) - && component.getAdapter(ComponentFactory.NAMING_CONTAINER) == null) - { - component.addAdapter(ComponentFactory.NAMING_CONTAINER, - INamingContainerInfo.ADAPTER); - } - } - - /** - * @param element - * @param constructionData - * @return the id for element either derived from the element using getId or - * if not present, using a generation algorithm - */ - protected String calculateId(final Element element, - final ComponentConstructionData constructionData) - { - final String id = _adapter.getId(element); - if (id != null) - { - return id; - } - // TODO: improve this - final String prefix = _adapter.getGeneratedIdPrefix(); - return (prefix != null ? prefix : GENERATED_ID) - + constructionData.increment(); - } - - /** - * @return the construction data for this strategy - */ - public final ComponentConstructionData getConstructionData() - { - return _constructionData; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/XMLViewObjectMappingService.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/XMLViewObjectMappingService.java deleted file mode 100644 index 855aad4ca..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/XMLViewObjectMappingService.java +++ /dev/null @@ -1,382 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view; - -import java.io.IOException; -import java.io.Serializable; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.Path; -import org.eclipse.jst.jsf.common.dom.TagIdentifier; -import org.eclipse.jst.jsf.common.runtime.internal.model.ViewObject; -import org.eclipse.jst.jsf.context.resolver.structureddocument.IStructuredDocumentContextResolverFactory; -import org.eclipse.jst.jsf.context.resolver.structureddocument.IWorkspaceContextResolver; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.core.internal.region.Region2ElementAdapter; -import org.eclipse.jst.jsf.core.internal.region.Region2ElementAdapter.NoElementException; -import org.eclipse.jst.jsf.core.internal.tld.TagIdentifierFactory; -import org.eclipse.wst.sse.core.StructuredModelManager; -import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument; -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion; -import org.w3c.dom.Element; - -/** - * @author cbateman - * - */ -public final class XMLViewObjectMappingService implements Serializable -{ - /** - * - */ - private static final long serialVersionUID = -5371998199186683997L; - private final Map<ElementData, ViewObject> _elementToViewObjMap; - private final Map<ViewObject, ElementData> _viewObjToElementMap; - - /** - * - */ - public XMLViewObjectMappingService() - { - _elementToViewObjMap = new HashMap<ElementData, ViewObject>(); - _viewObjToElementMap = new HashMap<ViewObject, ElementData>(); - } - - /** - * @param elementData - * @param viewObject - */ - public void createMapping(final ElementData elementData, - final ViewObject viewObject) - { - if (elementData == null) - { - throw new IllegalArgumentException("elementData cannot be null"); //$NON-NLS-1$ - } - else if (viewObject == null) - { - throw new IllegalArgumentException("viewObject cannot be null"); //$NON-NLS-1$ - } - - synchronized(this) - { - _elementToViewObjMap.put(elementData, viewObject); - _viewObjToElementMap.put(viewObject, elementData); - } - } - - /** - * Remove all mappings - */ - public void clearMappings() - { - synchronized (this) - { - _elementToViewObjMap.clear(); - _viewObjToElementMap.clear(); - } - } - - /** - * @param elementData - * @return the view object for which the mapping was removed - */ - public ViewObject removeMapping(final ElementData elementData) - { - if (elementData == null) - { - throw new IllegalArgumentException("elementData mustn't be null"); //$NON-NLS-1$ - } - - ViewObject viewObject = null; - synchronized(this) - { - viewObject = _elementToViewObjMap.remove(elementData); - if (viewObject != null) - { - _viewObjToElementMap.remove(viewObject); - } - } - return viewObject; - } - - /** - * @param viewObject - * @return the element data for which the mapping was removed - */ - public ElementData removeMapping(final ViewObject viewObject) - { - if (viewObject == null) - { - throw new IllegalArgumentException("elementData mustn't be null"); //$NON-NLS-1$ - } - - ElementData elementData = null; - synchronized(this) - { - elementData = _viewObjToElementMap.remove(viewObject); - if (elementData != null) - { - _elementToViewObjMap.remove(elementData); - } - } - return elementData; - } - - /** - * @param viewObject - * @return the element data for the view object - */ - public synchronized ElementData findElementData(final ViewObject viewObject) - { - return _viewObjToElementMap.get(viewObject); - } - - /** - * @param viewObject - * @return the element for the viewObject - */ - public Element findElement(final ViewObject viewObject) - { - final ElementData elementData = findElementData(viewObject); - - if (elementData != null) - { - final IFile file = ResourcesPlugin.getWorkspace().getRoot() - .getFile(new Path(elementData.getDocumentPath())); - - if (file != null && file.isAccessible()) - { - IStructuredModel model = null; - try - { - model = StructuredModelManager.getModelManager() - .getModelForRead(file); - final IStructuredDocument sDoc = model - .getStructuredDocument(); - final IStructuredDocumentRegion region = sDoc - .getRegionAtCharacterOffset(elementData - .getStartOffset()); - final Region2ElementAdapter adapter = new Region2ElementAdapter( - region); - final TagIdentifier tagId = adapter.getTagId(); - if (tagId.equals(elementData.getTagId())) - { - return adapter.getElement(); - } - } - catch (CoreException ce) - { - JSFCorePlugin.log(ce, - "While finding element for viewObject: " //$NON-NLS-1$ - + viewObject.toString() + " in " //$NON-NLS-1$ - + file.getFullPath()); - } - catch (IOException e) - { - JSFCorePlugin.log(e, - "While finding element for viewObject: " //$NON-NLS-1$ - + viewObject.toString() + " in " //$NON-NLS-1$ - + file.getFullPath()); - } - catch (NoElementException e) - { - JSFCorePlugin.log(e, - "While finding element for viewObject: " //$NON-NLS-1$ - + viewObject.toString() + " in " //$NON-NLS-1$ - + file.getFullPath()); - } - finally - { - if (model != null) - { - model.releaseFromRead(); - } - } - } - } - return null; - } - - /** - * @param elementData - * @return the mapped view object for elementData or null if not found. - */ - public synchronized ViewObject findViewObject(final ElementData elementData) - { - return _elementToViewObjMap.get(elementData); - } - - /** - * @param namespace - * @param tagName - * @param context - * @param attributeToPropertyMap - * @return a new Element data for the namespace/element name in 'context' - */ - public static ElementData createElementData(final String namespace, - final String tagName, final IStructuredDocumentContext context, - final Map<String, String> attributeToPropertyMap) - { - final IFile file = getFile(context); - final int offset = context.getDocumentPosition(); - - if (file != null && file.isAccessible() && offset > -1 - && tagName != null && namespace != null) - { - return new ElementData(offset, file.getFullPath().toString(), - TagIdentifierFactory - .createJSPTagWrapper(namespace, tagName), - attributeToPropertyMap); - } - return null; - } - - private static IFile getFile(final IStructuredDocumentContext context) - { - final IWorkspaceContextResolver resolver = IStructuredDocumentContextResolverFactory.INSTANCE - .getWorkspaceContextResolver(context); - IResource res = resolver.getResource(); - if (res instanceof IFile) - { - return (IFile) res; - } - // fall through. - return null; - } - - /** - * Describes enough information about an element instance to look it up - * again, without storing possibly transient references to it. - * - * @author cbateman - * - */ - public final static class ElementData implements Serializable - { - /** - * serializable id - */ - private static final long serialVersionUID = 7937312530318827977L; - - private transient TagIdentifier _tagId; - private Map<String, String> _attributeToPropertyMap; - private String _documentPath; - private int _startOffset; - - /** - * @param startOffset - * @param documentPath - * @param tagId - * @param attributeToPropertyMap constructor takes copy of map - */ - private ElementData(final int startOffset, final String documentPath, - final TagIdentifier tagId, Map<String, String> attributeToPropertyMap) - { - super(); - _startOffset = startOffset; - - _tagId = tagId; - _documentPath = documentPath; - _attributeToPropertyMap = Collections.unmodifiableMap( - new HashMap<String,String>(attributeToPropertyMap)); - } - - /** - * Default constructor - */ - protected ElementData() - { - // for serialization - } - - /** - * @return the tag identifier for this element - */ - public final TagIdentifier getTagId() - { - return _tagId; - } - - /** - * @param forTagAttribute - * @return the name of the view object property that forTagAttribute - * maps to on this element or null if none. - */ - public final String getPropertyName(final String forTagAttribute) - { - return _attributeToPropertyMap.get(forTagAttribute); - } - - final int getStartOffset() - { - return _startOffset; - } - - final String getDocumentPath() - { - return _documentPath; - } - - private void writeObject(final java.io.ObjectOutputStream out) - throws IOException - { - out.defaultWriteObject(); - out.writeObject(_tagId.getUri()); - out.writeObject(_tagId.getTagName()); - } - - private void readObject(final java.io.ObjectInputStream in) - throws IOException, ClassNotFoundException - { - in.defaultReadObject(); - final String uri = (String) in.readObject(); - final String tagName = (String) in.readObject(); - _tagId = TagIdentifierFactory.createJSPTagWrapper(uri, tagName); - } - - @Override - public boolean equals(final Object obj) - { - if (this == obj) - { - return true; - } - if (obj instanceof ElementData) - { - final ElementData other = (ElementData) obj; - return _startOffset == other._startOffset - && _documentPath.equals(other._documentPath) - && _tagId.equals(other._tagId); - } - return false; - } - - @Override - public int hashCode() - { - int hashCode = _tagId.hashCode(); - hashCode ^= _documentPath.hashCode(); - // startOffsets will generally fit in the first 10 bits, so mix - // it up a bit. - hashCode ^= ~(_startOffset * 104551); - return hashCode; - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/AbstractCustomViewMapper.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/AbstractCustomViewMapper.java deleted file mode 100644 index f50a460e8..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/AbstractCustomViewMapper.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.mapping; - -import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentInfo; -import org.w3c.dom.Attr; -import org.w3c.dom.Element; - -/** - * Must be sub-classed by all ICustomViewMapper's. - * - * @author cbateman - * - */ -public abstract class AbstractCustomViewMapper implements ICustomViewMapper -{ - public abstract PropertyMapping mapToComponentProperty(final String uri, - final Element srcElement, final Attr attr); - - public abstract void doAttributeActions(final ComponentInfo bestComponent, - final Element srcElement, final Attr attr); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/CustomViewMappingAdapter.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/CustomViewMappingAdapter.java deleted file mode 100644 index 4d3830bf3..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/CustomViewMappingAdapter.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.mapping; - -import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentInfo; -import org.w3c.dom.Attr; -import org.w3c.dom.Element; - -/** - * A no-op implementation that sub-classes can selectively override. - * - * @author cbateman - * - */ -public class CustomViewMappingAdapter extends AbstractCustomViewMapper -{ - - @Override - public void doAttributeActions(ComponentInfo bestComponent, - Element srcElement, Attr attr) - { - // do nothing - } - - @Override - public PropertyMapping mapToComponentProperty(String uri, - Element srcElement, Attr attr) - { - // no mappings - return null; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/ICustomViewMapper.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/ICustomViewMapper.java deleted file mode 100644 index 954167e59..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/ICustomViewMapper.java +++ /dev/null @@ -1,83 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.mapping; - -import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentInfo; -import org.w3c.dom.Attr; -import org.w3c.dom.Element; - -/** - * A custom view mapper to map from elements and attributes to view objects and - * properties. - * - * @author cbateman - * - */ -public interface ICustomViewMapper -{ - /** - * @param uri - * @param srcElement - * @param attr - * @return the name/value of the component property or null if no mapping. - */ - PropertyMapping mapToComponentProperty(final String uri, - final Element srcElement, final Attr attr); - - /** - * Allows a mapper to make updates to a component based on its attribute. - * May choose to do nothing. - * - * @param bestComponent - * @param srcElement - * @param attr - */ - void doAttributeActions(ComponentInfo bestComponent, Element srcElement, - Attr attr); - - /** - * The name/value pair of a component property mapping. - * - * @author cbateman - * - */ - public static class PropertyMapping - { - private final String _name; - private final Object _property; - - /** - * @param name - * @param property - */ - public PropertyMapping(final String name, final Object property) - { - _name = name; - _property = property; - } - - /** - * @return the property name - */ - public final String getName() - { - return _name; - } - - /** - * @return the property value - */ - public final Object getProperty() - { - return _property; - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/ViewMetadataGenerator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/ViewMetadataGenerator.java deleted file mode 100644 index 975775f50..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/ViewMetadataGenerator.java +++ /dev/null @@ -1,202 +0,0 @@ -package org.eclipse.jst.jsf.designtime.internal.view.mapping; - -import java.io.IOException; -import java.io.OutputStream; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; -import org.eclipse.emf.ecore.util.BasicExtendedMetaData; -import org.eclipse.emf.ecore.util.ExtendedMetaData; -import org.eclipse.emf.ecore.xmi.XMLHelper; -import org.eclipse.emf.ecore.xmi.XMLResource; -import org.eclipse.emf.ecore.xmi.impl.XMLHelperImpl; -import org.eclipse.emf.ecore.xmi.impl.XMLResourceFactoryImpl; -import org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl; -import org.eclipse.jst.jsf.common.metadata.Entity; -import org.eclipse.jst.jsf.common.metadata.MetadataFactory; -import org.eclipse.jst.jsf.common.metadata.MetadataPackage; -import org.eclipse.jst.jsf.common.metadata.Model; -import org.eclipse.jst.jsf.common.metadata.Trait; -import org.eclipse.jst.jsf.common.runtime.internal.model.types.ClassTypeInfo; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ClassTypeInfo_; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingFactory; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagMapping; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagToViewObjectMapping; - -/** - * Generates View metadata from common.runtime objects. - * - * @author cbateman - * - */ -public class ViewMetadataGenerator -{ - private final ResourceSet _resourceSet; - private final ExtendedMetaData _extendedMetadata; - private final Model _root; - private final ViewMetadataMapper _mapper; - - /** - * @param uri - */ - public ViewMetadataGenerator(final String uri) - { - _root = MetadataFactory.eINSTANCE.createModel(); - _root.setId(uri); - _root.setType("tagFile"); //$NON-NLS-1$ - _resourceSet = new ResourceSetImpl(); - _mapper = new ViewMetadataMapper(); - _extendedMetadata = new BasicExtendedMetaData(_resourceSet - .getPackageRegistry()); - - // Register the appropriate resource factory to handle all file - // extensions. - // - _resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap() - .put(Resource.Factory.Registry.DEFAULT_EXTENSION, - new XMLResourceFactoryImpl()); - } - - /** - * The format of the strings should match OSGI version: - * - * MAJOR . MINOR . BUILD . QUALIFIER - * - * @param tagName - * @param typeInfo - * @param minJSFVersion - * the minimum JSF version, null for DEFAULT. - * @param minLibVersion - * the minimum library version, null for NONE. - */ - public void addTagToViewObjectMapping(final String tagName, - final ClassTypeInfo typeInfo, final String minJSFVersion, - final String minLibVersion) - { - final ClassTypeInfo_ metadata = _mapper.mapToMetadata(typeInfo); - - if (metadata != null) - { - final TagToViewObjectMapping viewMapping = - ComponentMappingFactory.eINSTANCE.createTagToViewObjectMapping(); - if (minJSFVersion != null) - { - viewMapping.setMinJSFVersion(minJSFVersion); - } - viewMapping.setMinLibraryVersion(minLibVersion); - viewMapping.setTypeInfo(metadata); - - final TagMapping tagMapping = findOrCreateTagMapping(tagName); - tagMapping.getVersionedTagToViewMappings().add(viewMapping); - - final Trait trait = MetadataFactory.eINSTANCE.createTrait(); - trait.setId(ViewMetadataMapper.DEFAULT_MAPPING_TRAIT_ID); - trait.setValue(tagMapping); - - final Entity entity = MetadataFactory.eINSTANCE.createEntity(); - entity.setId(tagName); - entity.setType("tag"); //$NON-NLS-1$ - entity.getTraits().add(trait); - - _root.getChildEntities().add(entity); - } - } - - private TagMapping findOrCreateTagMapping(final String tagName) - { - for (final Entity entity : (List<Entity>)_root.getChildEntities()) - { - if (entity.getId().equals(tagName)) - { - for (final Trait trait : (List<Trait>)entity.getTraits()) - { - if (trait.getId().equals(ViewMetadataMapper.DEFAULT_MAPPING_TRAIT_ID)) - { - return (TagMapping) trait.getValue(); - } - } - } - } - return ComponentMappingFactory.eINSTANCE.createTagMapping(); - } - - /** - * @param out - * @throws IOException - */ - public void save(final OutputStream out) throws IOException - { - final Resource res = new XMLResourceImpl() - { - @Override - protected XMLHelper createXMLHelper() - { - return new XMLHelperImpl() - { - public String getHREF(EObject obj) - { - return ComponentMappingPackage.eNS_URI; - } - - @Override - public EPackage getNoNamespacePackage() - { - return MetadataPackage.eINSTANCE; - } - }; - } - };// _resourceSet.createResource(URI.createURI("foo.xml")); - res.getContents().add(_root); - // res.setURI(uri); - // resourceSet.getResources().add(res); - // setLoadOptions(res); - Map options = new HashMap(); - options.put(XMLResource.OPTION_SCHEMA_LOCATION, Boolean.TRUE); - options.put(XMLResource.OPTION_EXTENDED_META_DATA, _extendedMetadata); - // options.put(XMLResource.OPTION_RESOURCE_HANDLER, res); - options.put(XMLResource.OPTION_LAX_FEATURE_PROCESSING, Boolean.TRUE); - options.put(XMLResource.OPTION_RECORD_UNKNOWN_FEATURE, Boolean.FALSE);// turning - // this - // off - // so - // that - // res.getErrors() - // has - // values - // to - // check! - // bizarre - // that - // I - // should - // need - // to - // do - // this. - res.save(out, options); - } - - // private void printHeader(final OutputStream out) throws IOException - // { - // final String header = "<md:metadatamodel \n" - // + "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" - // + "xmlns:ecore=\"http://www.eclipse.org/emf/2002/Ecore\"" - // + - // "xmlns:md=\"http://org.eclipse.jst.jsf.common.metadata/metadata.ecore\"" - // + - // "xmlns:mdt=\"http://org.eclipse.jst.jsf.common.metadata/metadataTraitTypes.ecore\" - // " - // + - // "xmlns:viewMap=\"http://org.eclipse.jst.jsf.core/componentMapping.ecore\"" - // + "id=\"http://java.sun.com/jsf/html\"" - // + "type\"tagFile\">"; - // out.write(header.getBytes()); - // } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/ViewMetadataLoader.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/ViewMetadataLoader.java deleted file mode 100644 index d892bddc6..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/ViewMetadataLoader.java +++ /dev/null @@ -1,96 +0,0 @@ -package org.eclipse.jst.jsf.designtime.internal.view.mapping; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.jsf.common.dom.TagIdentifier; -import org.eclipse.jst.jsf.common.metadata.Entity; -import org.eclipse.jst.jsf.common.metadata.Trait; -import org.eclipse.jst.jsf.common.metadata.query.ITaglibDomainMetaDataModelContext; -import org.eclipse.jst.jsf.common.metadata.query.TaglibDomainMetaDataQueryHelper; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.AttributeToPropertyMapping; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagMapping; - -/** - * Loader class for view metadata. - * - * @author cbateman - * - */ -public class ViewMetadataLoader -{ - private final IProject _project; - private final Map<String, ITaglibDomainMetaDataModelContext> _metadataContexts; - - /** - * @param project - */ - public ViewMetadataLoader(final IProject project) - { - _project = project; - _metadataContexts = new HashMap<String, ITaglibDomainMetaDataModelContext>(); - } - - /** - * @param tagId - * @return the tag to view object mapping metadata for a tag in a particular - * metadata context or null if not found. - */ - public TagMapping getTagToViewMapping(final TagIdentifier tagId) - { - final ITaglibDomainMetaDataModelContext modelContext = createMetadataContext(tagId - .getUri()); - final Entity entity = TaglibDomainMetaDataQueryHelper.getEntity( - modelContext, tagId.getTagName()); - if (entity != null) - { - final Trait trait = TaglibDomainMetaDataQueryHelper.getTrait( - entity, ViewMetadataMapper.DEFAULT_MAPPING_TRAIT_ID); - if (trait != null) - { - return (TagMapping) trait.getValue(); - } - } - return null; - } - - private ITaglibDomainMetaDataModelContext createMetadataContext( - final String uri) - { - ITaglibDomainMetaDataModelContext modelContext = _metadataContexts - .get(uri); - - if (modelContext == null) - { - modelContext = TaglibDomainMetaDataQueryHelper - .createMetaDataModelContext(_project, uri); - _metadataContexts.put(uri, modelContext); - } - return modelContext; - } - - /** - * @param tagId - * @param name - * @return the attribute mapping for name on tagId or null if known - */ - public AttributeToPropertyMapping getAttributeMapping( - final TagIdentifier tagId, final String name) - { - final ITaglibDomainMetaDataModelContext modelContext = createMetadataContext(tagId - .getUri()); - final Entity entity = TaglibDomainMetaDataQueryHelper.getEntity( - modelContext, tagId.getTagName()+"/"+name); //$NON-NLS-1$ - if (entity != null) - { - final Trait trait = TaglibDomainMetaDataQueryHelper.getTrait( - entity, ViewMetadataMapper.DEFAULT_ATTRIBUTE_TRAIT_ID); - if (trait != null) - { - return (AttributeToPropertyMapping) trait.getValue(); - } - } - return null; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/ViewMetadataMapper.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/ViewMetadataMapper.java deleted file mode 100644 index a4bb00f8b..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/ViewMetadataMapper.java +++ /dev/null @@ -1,170 +0,0 @@ -package org.eclipse.jst.jsf.designtime.internal.view.mapping; - -import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentTypeInfo; -import org.eclipse.jst.jsf.common.runtime.internal.model.decorator.ConverterTypeInfo; -import org.eclipse.jst.jsf.common.runtime.internal.model.decorator.ValidatorTypeInfo; -import org.eclipse.jst.jsf.common.runtime.internal.model.types.ClassTypeInfo; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ClassTypeInfo_; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingFactory; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentTypeInfo_; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ConverterTypeInfo_; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ValidatorTypeInfo_; - -/** - * Maps meta-data to and from common.runtime data. In future, we may eliminate - * this class by making the EMF meta-data structures into the common.runtime - * data. - * - * @author cbateman - * - */ -public final class ViewMetadataMapper -{ - - /** - * The default trait id where meta-data will annotated - */ - public final static String DEFAULT_MAPPING_TRAIT_ID = "viewElementMapping"; //$NON-NLS-1$ - /** - * The default trait id where meta-data will be annotated. - */ - public final static String DEFAULT_ATTRIBUTE_TRAIT_ID = "attributeMapping"; //$NON-NLS-1$ - - /** - * @param classTypeInfo - * @return a framework ClassTypeInfo equivalent to classTypeInfo or null if - * none. - */ - public ClassTypeInfo mapToFrameworkData(final ClassTypeInfo_ classTypeInfo) - { - if (classTypeInfo instanceof ComponentTypeInfo_) - { - return createComponentTypeInfo_((ComponentTypeInfo_) classTypeInfo); - } - else if (classTypeInfo instanceof ConverterTypeInfo_) - { - return createConverterTypeInfo_((ConverterTypeInfo_) classTypeInfo); - } - else if (classTypeInfo instanceof ValidatorTypeInfo_) - { - return createValidatorTypeInfo_((ValidatorTypeInfo_) classTypeInfo); - } - return null; - } - - private ClassTypeInfo createValidatorTypeInfo_( - ValidatorTypeInfo_ classTypeInfo) - { - final String[] superClasses = classTypeInfo.getSuperClasses().toArray( - new String[0]); - final String[] interfaces = classTypeInfo.getInterfaces().toArray( - new String[0]); - if (classTypeInfo.getClassName()==null && classTypeInfo.getValidatorId() == null) - { - return ValidatorTypeInfo.UNKNOWN; - } - - return new ValidatorTypeInfo(classTypeInfo.getClassName(), - superClasses, interfaces, classTypeInfo.getValidatorId()); - } - - private ClassTypeInfo createConverterTypeInfo_( - ConverterTypeInfo_ classTypeInfo) - { - final String[] superClasses = classTypeInfo.getSuperClasses().toArray( - new String[0]); - final String[] interfaces = classTypeInfo.getInterfaces().toArray( - new String[0]); - if (classTypeInfo.getClassName() == null - && classTypeInfo.getConverterId() == null) - { - return ConverterTypeInfo.UNKNOWN; - } - final String[] forClasses = classTypeInfo.getForClasses().toArray( - new String[0]); - return new ConverterTypeInfo(classTypeInfo.getClassName(), - superClasses, interfaces, classTypeInfo.getConverterId(), - forClasses); - } - - private ClassTypeInfo createComponentTypeInfo_( - ComponentTypeInfo_ classTypeInfo) - { - final String[] superClasses = classTypeInfo.getSuperClasses().toArray( - new String[0]); - final String[] interfaces = classTypeInfo.getInterfaces().toArray( - new String[0]); - return new ComponentTypeInfo(classTypeInfo.getComponentType(), - classTypeInfo.getClassName(), superClasses, interfaces, - classTypeInfo.getComponentFamily(), classTypeInfo - .getRenderType()); - } - - /** - * @param classTypeInfo - * @return a metadata type info matching classTypeInfo or null if - * classTypeInfo isn't of a supported concrete type. - */ - public ClassTypeInfo_ mapToMetadata(final ClassTypeInfo classTypeInfo) - { - if (classTypeInfo instanceof ComponentTypeInfo) - { - return createComponentTypeInfo((ComponentTypeInfo) classTypeInfo); - } - else if (classTypeInfo instanceof ConverterTypeInfo) - { - return createConverterTypeInfo((ConverterTypeInfo) classTypeInfo); - } - else if (classTypeInfo instanceof ValidatorTypeInfo) - { - return createValidatorTypeInfo((ValidatorTypeInfo) classTypeInfo); - } - return null; - } - - private ClassTypeInfo_ createComponentTypeInfo( - final ComponentTypeInfo typeInfo) - { - final ComponentTypeInfo_ metadata = ComponentMappingFactory.eINSTANCE - .createComponentTypeInfo_(); - metadata.setComponentFamily(typeInfo.getComponentFamily()); - metadata.setComponentType(typeInfo.getComponentType()); - metadata.setRenderType(typeInfo.getRenderFamily()); - copy(typeInfo, metadata); - return metadata; - } - - private ClassTypeInfo_ createConverterTypeInfo( - final ConverterTypeInfo typeInfo) - { - final ConverterTypeInfo_ metadata = ComponentMappingFactory.eINSTANCE - .createConverterTypeInfo_(); - copy(typeInfo, metadata); - metadata.setConverterId(typeInfo.getConverterId()); - return metadata; - } - - private ClassTypeInfo_ createValidatorTypeInfo( - final ValidatorTypeInfo typeInfo) - { - final ValidatorTypeInfo_ metadata = ComponentMappingFactory.eINSTANCE - .createValidatorTypeInfo_(); - copy(typeInfo, metadata); - metadata.setValidatorId(typeInfo.getValidatorId()); - return metadata; - } - - private void copy(ClassTypeInfo source, ClassTypeInfo_ dest) - { - dest.setClassName(source.getClassName()); - for (final String interfaze : source.getInterfaces()) - { - dest.getInterfaces().add(interfaze); - } - - for (final String superClass : source.getSuperClasses()) - { - dest.getSuperClasses().add(superClass); - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/mappers/ValueHolderAttributeMapper.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/mappers/ValueHolderAttributeMapper.java deleted file mode 100644 index 016b82107..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/mappers/ValueHolderAttributeMapper.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.mapping.mappers; - -import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentFactory; -import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentInfo; -import org.eclipse.jst.jsf.common.runtime.internal.model.decorator.ConverterDecorator; -import org.eclipse.jst.jsf.common.runtime.internal.model.decorator.ConverterTypeInfo; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.CustomViewMappingAdapter; -import org.w3c.dom.Attr; -import org.w3c.dom.Element; - -/** - * Default mapper for value holders. - * - * @author cbateman - * - */ -public class ValueHolderAttributeMapper extends CustomViewMappingAdapter -{ - @Override - public void doAttributeActions(ComponentInfo bestComponent, - Element srcElement, Attr attr) - { - final String name = attr.getNodeName(); - - if ("converter".equals(name) //$NON-NLS-1$ - && bestComponent.getComponentTypeInfo().isInstanceOf( - ComponentFactory.INTERFACE_VALUEHOLDER)) - { - final String value = attr.getValue(); - - if (value != null) - { - ConverterTypeInfo typeInfo = null; - - if (!value.startsWith("#{")) //$NON-NLS-1$ - { - typeInfo = new ConverterTypeInfo(null, value); - - } - else - { - typeInfo = ConverterTypeInfo.UNKNOWN; - } - ConverterDecorator decorator = new ConverterDecorator( - bestComponent, typeInfo); - bestComponent.addDecorator(decorator, - ComponentFactory.CONVERTER); - } - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/AttributeToPropertyMapping.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/AttributeToPropertyMapping.java deleted file mode 100644 index a30491531..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/AttributeToPropertyMapping.java +++ /dev/null @@ -1,111 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: AttributeToPropertyMapping.java,v 1.1 2008/05/12 17:42:19 cbateman Exp $ - */ -package org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping; - -import org.eclipse.emf.ecore.EObject; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Attribute To Property Mapping</b></em>'. - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.AttributeToPropertyMapping#getPropertyName <em>Property Name</em>}</li> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.AttributeToPropertyMapping#isElAllowed <em>El Allowed</em>}</li> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.AttributeToPropertyMapping#getCustomConversionFactoryId <em>Custom Conversion Factory Id</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage#getAttributeToPropertyMapping() - * @model - * @generated - */ -public interface AttributeToPropertyMapping extends EObject -{ - /** - * Returns the value of the '<em><b>Property Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Property Name</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Property Name</em>' attribute. - * @see #setPropertyName(String) - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage#getAttributeToPropertyMapping_PropertyName() - * @model extendedMetaData="kind='element' name='propertyName'" - * @generated - */ - String getPropertyName(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.AttributeToPropertyMapping#getPropertyName <em>Property Name</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Property Name</em>' attribute. - * @see #getPropertyName() - * @generated - */ - void setPropertyName(String value); - - /** - * Returns the value of the '<em><b>El Allowed</b></em>' attribute. - * The default value is <code>"true"</code>. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>El Allowed</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>El Allowed</em>' attribute. - * @see #setElAllowed(boolean) - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage#getAttributeToPropertyMapping_ElAllowed() - * @model default="true" - * extendedMetaData="kind='element' name='elAllowed'" - * @generated - */ - boolean isElAllowed(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.AttributeToPropertyMapping#isElAllowed <em>El Allowed</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>El Allowed</em>' attribute. - * @see #isElAllowed() - * @generated - */ - void setElAllowed(boolean value); - - /** - * Returns the value of the '<em><b>Custom Conversion Factory Id</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Custom Conversion Factory Id</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Custom Conversion Factory Id</em>' attribute. - * @see #setCustomConversionFactoryId(String) - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage#getAttributeToPropertyMapping_CustomConversionFactoryId() - * @model extendedMetaData="kind='element' name='customConversionFactoryId'" - * @generated - */ - String getCustomConversionFactoryId(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.AttributeToPropertyMapping#getCustomConversionFactoryId <em>Custom Conversion Factory Id</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Custom Conversion Factory Id</em>' attribute. - * @see #getCustomConversionFactoryId() - * @generated - */ - void setCustomConversionFactoryId(String value); - -} // AttributeToPropertyMapping diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/ClassTypeInfo_.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/ClassTypeInfo_.java deleted file mode 100644 index bad26512d..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/ClassTypeInfo_.java +++ /dev/null @@ -1,91 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: ClassTypeInfo_.java,v 1.1 2008/05/12 17:42:19 cbateman Exp $ - */ -package org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping; - -import org.eclipse.emf.common.util.EList; - -import org.eclipse.emf.ecore.EObject; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Class Type Info </b></em>'. - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ClassTypeInfo_#getClassName <em>Class Name</em>}</li> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ClassTypeInfo_#getSuperClasses <em>Super Classes</em>}</li> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ClassTypeInfo_#getInterfaces <em>Interfaces</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage#getClassTypeInfo_() - * @model - * @generated - */ -public interface ClassTypeInfo_ extends EObject -{ - /** - * Returns the value of the '<em><b>Class Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Class Name</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Class Name</em>' attribute. - * @see #setClassName(String) - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage#getClassTypeInfo__ClassName() - * @model extendedMetaData="kind='element' name='className'" - * @generated - */ - String getClassName(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ClassTypeInfo_#getClassName <em>Class Name</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Class Name</em>' attribute. - * @see #getClassName() - * @generated - */ - void setClassName(String value); - - /** - * Returns the value of the '<em><b>Super Classes</b></em>' attribute list. - * The list contents are of type {@link java.lang.String}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Super Classes</em>' attribute list isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Super Classes</em>' attribute list. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage#getClassTypeInfo__SuperClasses() - * @model extendedMetaData="kind='element' name='superClasses'" - * @generated - */ - EList<String> getSuperClasses(); - - /** - * Returns the value of the '<em><b>Interfaces</b></em>' attribute list. - * The list contents are of type {@link java.lang.String}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Interfaces</em>' attribute list isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Interfaces</em>' attribute list. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage#getClassTypeInfo__Interfaces() - * @model extendedMetaData="kind='element' name='interfaces'" - * @generated - */ - EList<String> getInterfaces(); - -} // ClassTypeInfo_ diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/ComponentMappingFactory.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/ComponentMappingFactory.java deleted file mode 100644 index 9a45fa050..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/ComponentMappingFactory.java +++ /dev/null @@ -1,101 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: ComponentMappingFactory.java,v 1.1 2008/05/12 17:42:19 cbateman Exp $ - */ -package org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping; - -import org.eclipse.emf.ecore.EFactory; - -/** - * <!-- begin-user-doc --> - * The <b>Factory</b> for the model. - * It provides a create method for each non-abstract class of the model. - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage - * @generated - */ -public interface ComponentMappingFactory extends EFactory -{ - /** - * The singleton instance of the factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - ComponentMappingFactory eINSTANCE = org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ComponentMappingFactoryImpl.init(); - - /** - * Returns a new object of class '<em>Tag Mapping</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Tag Mapping</em>'. - * @generated - */ - TagMapping createTagMapping(); - - /** - * Returns a new object of class '<em>Tag To View Object Mapping</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Tag To View Object Mapping</em>'. - * @generated - */ - TagToViewObjectMapping createTagToViewObjectMapping(); - - /** - * Returns a new object of class '<em>Class Type Info </em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Class Type Info </em>'. - * @generated - */ - ClassTypeInfo_ createClassTypeInfo_(); - - /** - * Returns a new object of class '<em>Component Type Info </em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Component Type Info </em>'. - * @generated - */ - ComponentTypeInfo_ createComponentTypeInfo_(); - - /** - * Returns a new object of class '<em>Converter Type Info </em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Converter Type Info </em>'. - * @generated - */ - ConverterTypeInfo_ createConverterTypeInfo_(); - - /** - * Returns a new object of class '<em>Validator Type Info </em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Validator Type Info </em>'. - * @generated - */ - ValidatorTypeInfo_ createValidatorTypeInfo_(); - - /** - * Returns a new object of class '<em>Attribute To Property Mapping</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Attribute To Property Mapping</em>'. - * @generated - */ - AttributeToPropertyMapping createAttributeToPropertyMapping(); - - /** - * Returns the package supported by this factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the package supported by this factory. - * @generated - */ - ComponentMappingPackage getComponentMappingPackage(); - -} //ComponentMappingFactory diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/ComponentMappingPackage.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/ComponentMappingPackage.java deleted file mode 100644 index 886250790..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/ComponentMappingPackage.java +++ /dev/null @@ -1,949 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: ComponentMappingPackage.java,v 1.2 2008/11/18 22:24:15 gkessler Exp $ - */ -package org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; - -/** - * <!-- begin-user-doc --> - * The <b>Package</b> for the model. - * It contains accessors for the meta objects to represent - * <ul> - * <li>each class,</li> - * <li>each feature of each class,</li> - * <li>each enum,</li> - * <li>and each data type</li> - * </ul> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingFactory - * @model kind="package" - * @generated - */ -public interface ComponentMappingPackage extends EPackage -{ - /** - * The package name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNAME = "viewmapping"; //$NON-NLS-1$ - - /** - * The package namespace URI. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNS_URI = "http://org.eclipse.jst.jsf.core/componentMapping.ecore"; //$NON-NLS-1$ - - /** - * The package namespace name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNS_PREFIX = "viewMap"; //$NON-NLS-1$ - - /** - * The singleton instance of the package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - ComponentMappingPackage eINSTANCE = org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ComponentMappingPackageImpl.init(); - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.TagMappingImpl <em>Tag Mapping</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.TagMappingImpl - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ComponentMappingPackageImpl#getTagMapping() - * @generated - */ - int TAG_MAPPING = 0; - - /** - * The feature id for the '<em><b>Versioned Tag To View Mappings</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int TAG_MAPPING__VERSIONED_TAG_TO_VIEW_MAPPINGS = 0; - - /** - * The feature id for the '<em><b>Custom Conversion Factory Id</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int TAG_MAPPING__CUSTOM_CONVERSION_FACTORY_ID = 1; - - /** - * The feature id for the '<em><b>Bean Mapped Properties</b></em>' attribute list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int TAG_MAPPING__BEAN_MAPPED_PROPERTIES = 2; - - /** - * The number of structural features of the '<em>Tag Mapping</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int TAG_MAPPING_FEATURE_COUNT = 3; - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.TagToViewObjectMappingImpl <em>Tag To View Object Mapping</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.TagToViewObjectMappingImpl - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ComponentMappingPackageImpl#getTagToViewObjectMapping() - * @generated - */ - int TAG_TO_VIEW_OBJECT_MAPPING = 1; - - /** - * The feature id for the '<em><b>Type Info</b></em>' containment reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int TAG_TO_VIEW_OBJECT_MAPPING__TYPE_INFO = 0; - - /** - * The feature id for the '<em><b>Min JSF Version</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int TAG_TO_VIEW_OBJECT_MAPPING__MIN_JSF_VERSION = 1; - - /** - * The feature id for the '<em><b>Min Library Version</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int TAG_TO_VIEW_OBJECT_MAPPING__MIN_LIBRARY_VERSION = 2; - - /** - * The number of structural features of the '<em>Tag To View Object Mapping</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int TAG_TO_VIEW_OBJECT_MAPPING_FEATURE_COUNT = 3; - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ClassTypeInfo_Impl <em>Class Type Info </em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ClassTypeInfo_Impl - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ComponentMappingPackageImpl#getClassTypeInfo_() - * @generated - */ - int CLASS_TYPE_INFO_ = 2; - - /** - * The feature id for the '<em><b>Class Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int CLASS_TYPE_INFO___CLASS_NAME = 0; - - /** - * The feature id for the '<em><b>Super Classes</b></em>' attribute list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int CLASS_TYPE_INFO___SUPER_CLASSES = 1; - - /** - * The feature id for the '<em><b>Interfaces</b></em>' attribute list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int CLASS_TYPE_INFO___INTERFACES = 2; - - /** - * The number of structural features of the '<em>Class Type Info </em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int CLASS_TYPE_INFO__FEATURE_COUNT = 3; - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ComponentTypeInfo_Impl <em>Component Type Info </em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ComponentTypeInfo_Impl - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ComponentMappingPackageImpl#getComponentTypeInfo_() - * @generated - */ - int COMPONENT_TYPE_INFO_ = 3; - - /** - * The feature id for the '<em><b>Class Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int COMPONENT_TYPE_INFO___CLASS_NAME = CLASS_TYPE_INFO___CLASS_NAME; - - /** - * The feature id for the '<em><b>Super Classes</b></em>' attribute list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int COMPONENT_TYPE_INFO___SUPER_CLASSES = CLASS_TYPE_INFO___SUPER_CLASSES; - - /** - * The feature id for the '<em><b>Interfaces</b></em>' attribute list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int COMPONENT_TYPE_INFO___INTERFACES = CLASS_TYPE_INFO___INTERFACES; - - /** - * The feature id for the '<em><b>Component Type</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int COMPONENT_TYPE_INFO___COMPONENT_TYPE = CLASS_TYPE_INFO__FEATURE_COUNT + 0; - - /** - * The feature id for the '<em><b>Component Family</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int COMPONENT_TYPE_INFO___COMPONENT_FAMILY = CLASS_TYPE_INFO__FEATURE_COUNT + 1; - - /** - * The feature id for the '<em><b>Render Type</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int COMPONENT_TYPE_INFO___RENDER_TYPE = CLASS_TYPE_INFO__FEATURE_COUNT + 2; - - /** - * The number of structural features of the '<em>Component Type Info </em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int COMPONENT_TYPE_INFO__FEATURE_COUNT = CLASS_TYPE_INFO__FEATURE_COUNT + 3; - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ConverterTypeInfo_Impl <em>Converter Type Info </em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ConverterTypeInfo_Impl - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ComponentMappingPackageImpl#getConverterTypeInfo_() - * @generated - */ - int CONVERTER_TYPE_INFO_ = 4; - - /** - * The feature id for the '<em><b>Class Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int CONVERTER_TYPE_INFO___CLASS_NAME = CLASS_TYPE_INFO___CLASS_NAME; - - /** - * The feature id for the '<em><b>Super Classes</b></em>' attribute list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int CONVERTER_TYPE_INFO___SUPER_CLASSES = CLASS_TYPE_INFO___SUPER_CLASSES; - - /** - * The feature id for the '<em><b>Interfaces</b></em>' attribute list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int CONVERTER_TYPE_INFO___INTERFACES = CLASS_TYPE_INFO___INTERFACES; - - /** - * The feature id for the '<em><b>Converter Id</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int CONVERTER_TYPE_INFO___CONVERTER_ID = CLASS_TYPE_INFO__FEATURE_COUNT + 0; - - /** - * The feature id for the '<em><b>For Classes</b></em>' attribute list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int CONVERTER_TYPE_INFO___FOR_CLASSES = CLASS_TYPE_INFO__FEATURE_COUNT + 1; - - /** - * The number of structural features of the '<em>Converter Type Info </em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int CONVERTER_TYPE_INFO__FEATURE_COUNT = CLASS_TYPE_INFO__FEATURE_COUNT + 2; - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ValidatorTypeInfo_Impl <em>Validator Type Info </em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ValidatorTypeInfo_Impl - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ComponentMappingPackageImpl#getValidatorTypeInfo_() - * @generated - */ - int VALIDATOR_TYPE_INFO_ = 5; - - /** - * The feature id for the '<em><b>Class Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int VALIDATOR_TYPE_INFO___CLASS_NAME = CLASS_TYPE_INFO___CLASS_NAME; - - /** - * The feature id for the '<em><b>Super Classes</b></em>' attribute list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int VALIDATOR_TYPE_INFO___SUPER_CLASSES = CLASS_TYPE_INFO___SUPER_CLASSES; - - /** - * The feature id for the '<em><b>Interfaces</b></em>' attribute list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int VALIDATOR_TYPE_INFO___INTERFACES = CLASS_TYPE_INFO___INTERFACES; - - /** - * The feature id for the '<em><b>Validator Id</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int VALIDATOR_TYPE_INFO___VALIDATOR_ID = CLASS_TYPE_INFO__FEATURE_COUNT + 0; - - /** - * The number of structural features of the '<em>Validator Type Info </em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int VALIDATOR_TYPE_INFO__FEATURE_COUNT = CLASS_TYPE_INFO__FEATURE_COUNT + 1; - - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.AttributeToPropertyMappingImpl <em>Attribute To Property Mapping</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.AttributeToPropertyMappingImpl - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ComponentMappingPackageImpl#getAttributeToPropertyMapping() - * @generated - */ - int ATTRIBUTE_TO_PROPERTY_MAPPING = 6; - - /** - * The feature id for the '<em><b>Property Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ATTRIBUTE_TO_PROPERTY_MAPPING__PROPERTY_NAME = 0; - - /** - * The feature id for the '<em><b>El Allowed</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ATTRIBUTE_TO_PROPERTY_MAPPING__EL_ALLOWED = 1; - - /** - * The feature id for the '<em><b>Custom Conversion Factory Id</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ATTRIBUTE_TO_PROPERTY_MAPPING__CUSTOM_CONVERSION_FACTORY_ID = 2; - - /** - * The number of structural features of the '<em>Attribute To Property Mapping</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ATTRIBUTE_TO_PROPERTY_MAPPING_FEATURE_COUNT = 3; - - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagMapping <em>Tag Mapping</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Tag Mapping</em>'. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagMapping - * @generated - */ - EClass getTagMapping(); - - /** - * Returns the meta object for the containment reference list '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagMapping#getVersionedTagToViewMappings <em>Versioned Tag To View Mappings</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the containment reference list '<em>Versioned Tag To View Mappings</em>'. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagMapping#getVersionedTagToViewMappings() - * @see #getTagMapping() - * @generated - */ - EReference getTagMapping_VersionedTagToViewMappings(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagMapping#getCustomConversionFactoryId <em>Custom Conversion Factory Id</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Custom Conversion Factory Id</em>'. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagMapping#getCustomConversionFactoryId() - * @see #getTagMapping() - * @generated - */ - EAttribute getTagMapping_CustomConversionFactoryId(); - - /** - * Returns the meta object for the attribute list '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagMapping#getBeanMappedProperties <em>Bean Mapped Properties</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute list '<em>Bean Mapped Properties</em>'. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagMapping#getBeanMappedProperties() - * @see #getTagMapping() - * @generated - */ - EAttribute getTagMapping_BeanMappedProperties(); - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagToViewObjectMapping <em>Tag To View Object Mapping</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Tag To View Object Mapping</em>'. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagToViewObjectMapping - * @generated - */ - EClass getTagToViewObjectMapping(); - - /** - * Returns the meta object for the containment reference '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagToViewObjectMapping#getTypeInfo <em>Type Info</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the containment reference '<em>Type Info</em>'. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagToViewObjectMapping#getTypeInfo() - * @see #getTagToViewObjectMapping() - * @generated - */ - EReference getTagToViewObjectMapping_TypeInfo(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagToViewObjectMapping#getMinJSFVersion <em>Min JSF Version</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Min JSF Version</em>'. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagToViewObjectMapping#getMinJSFVersion() - * @see #getTagToViewObjectMapping() - * @generated - */ - EAttribute getTagToViewObjectMapping_MinJSFVersion(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagToViewObjectMapping#getMinLibraryVersion <em>Min Library Version</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Min Library Version</em>'. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagToViewObjectMapping#getMinLibraryVersion() - * @see #getTagToViewObjectMapping() - * @generated - */ - EAttribute getTagToViewObjectMapping_MinLibraryVersion(); - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ClassTypeInfo_ <em>Class Type Info </em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Class Type Info </em>'. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ClassTypeInfo_ - * @generated - */ - EClass getClassTypeInfo_(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ClassTypeInfo_#getClassName <em>Class Name</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Class Name</em>'. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ClassTypeInfo_#getClassName() - * @see #getClassTypeInfo_() - * @generated - */ - EAttribute getClassTypeInfo__ClassName(); - - /** - * Returns the meta object for the attribute list '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ClassTypeInfo_#getSuperClasses <em>Super Classes</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute list '<em>Super Classes</em>'. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ClassTypeInfo_#getSuperClasses() - * @see #getClassTypeInfo_() - * @generated - */ - EAttribute getClassTypeInfo__SuperClasses(); - - /** - * Returns the meta object for the attribute list '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ClassTypeInfo_#getInterfaces <em>Interfaces</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute list '<em>Interfaces</em>'. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ClassTypeInfo_#getInterfaces() - * @see #getClassTypeInfo_() - * @generated - */ - EAttribute getClassTypeInfo__Interfaces(); - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentTypeInfo_ <em>Component Type Info </em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Component Type Info </em>'. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentTypeInfo_ - * @generated - */ - EClass getComponentTypeInfo_(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentTypeInfo_#getComponentType <em>Component Type</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Component Type</em>'. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentTypeInfo_#getComponentType() - * @see #getComponentTypeInfo_() - * @generated - */ - EAttribute getComponentTypeInfo__ComponentType(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentTypeInfo_#getComponentFamily <em>Component Family</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Component Family</em>'. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentTypeInfo_#getComponentFamily() - * @see #getComponentTypeInfo_() - * @generated - */ - EAttribute getComponentTypeInfo__ComponentFamily(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentTypeInfo_#getRenderType <em>Render Type</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Render Type</em>'. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentTypeInfo_#getRenderType() - * @see #getComponentTypeInfo_() - * @generated - */ - EAttribute getComponentTypeInfo__RenderType(); - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ConverterTypeInfo_ <em>Converter Type Info </em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Converter Type Info </em>'. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ConverterTypeInfo_ - * @generated - */ - EClass getConverterTypeInfo_(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ConverterTypeInfo_#getConverterId <em>Converter Id</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Converter Id</em>'. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ConverterTypeInfo_#getConverterId() - * @see #getConverterTypeInfo_() - * @generated - */ - EAttribute getConverterTypeInfo__ConverterId(); - - /** - * Returns the meta object for the attribute list '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ConverterTypeInfo_#getForClasses <em>For Classes</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute list '<em>For Classes</em>'. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ConverterTypeInfo_#getForClasses() - * @see #getConverterTypeInfo_() - * @generated - */ - EAttribute getConverterTypeInfo__ForClasses(); - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ValidatorTypeInfo_ <em>Validator Type Info </em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Validator Type Info </em>'. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ValidatorTypeInfo_ - * @generated - */ - EClass getValidatorTypeInfo_(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ValidatorTypeInfo_#getValidatorId <em>Validator Id</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Validator Id</em>'. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ValidatorTypeInfo_#getValidatorId() - * @see #getValidatorTypeInfo_() - * @generated - */ - EAttribute getValidatorTypeInfo__ValidatorId(); - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.AttributeToPropertyMapping <em>Attribute To Property Mapping</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Attribute To Property Mapping</em>'. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.AttributeToPropertyMapping - * @generated - */ - EClass getAttributeToPropertyMapping(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.AttributeToPropertyMapping#getPropertyName <em>Property Name</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Property Name</em>'. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.AttributeToPropertyMapping#getPropertyName() - * @see #getAttributeToPropertyMapping() - * @generated - */ - EAttribute getAttributeToPropertyMapping_PropertyName(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.AttributeToPropertyMapping#isElAllowed <em>El Allowed</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>El Allowed</em>'. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.AttributeToPropertyMapping#isElAllowed() - * @see #getAttributeToPropertyMapping() - * @generated - */ - EAttribute getAttributeToPropertyMapping_ElAllowed(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.AttributeToPropertyMapping#getCustomConversionFactoryId <em>Custom Conversion Factory Id</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Custom Conversion Factory Id</em>'. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.AttributeToPropertyMapping#getCustomConversionFactoryId() - * @see #getAttributeToPropertyMapping() - * @generated - */ - EAttribute getAttributeToPropertyMapping_CustomConversionFactoryId(); - - /** - * Returns the factory that creates the instances of the model. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the factory that creates the instances of the model. - * @generated - */ - ComponentMappingFactory getComponentMappingFactory(); - - /** - * <!-- begin-user-doc --> - * Defines literals for the meta objects that represent - * <ul> - * <li>each class,</li> - * <li>each feature of each class,</li> - * <li>each enum,</li> - * <li>and each data type</li> - * </ul> - * <!-- end-user-doc --> - * @generated - */ - @SuppressWarnings("hiding") - interface Literals - { - /** - * The meta object literal for the '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.TagMappingImpl <em>Tag Mapping</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.TagMappingImpl - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ComponentMappingPackageImpl#getTagMapping() - * @generated - */ - EClass TAG_MAPPING = eINSTANCE.getTagMapping(); - - /** - * The meta object literal for the '<em><b>Versioned Tag To View Mappings</b></em>' containment reference list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference TAG_MAPPING__VERSIONED_TAG_TO_VIEW_MAPPINGS = eINSTANCE.getTagMapping_VersionedTagToViewMappings(); - - /** - * The meta object literal for the '<em><b>Custom Conversion Factory Id</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute TAG_MAPPING__CUSTOM_CONVERSION_FACTORY_ID = eINSTANCE.getTagMapping_CustomConversionFactoryId(); - - /** - * The meta object literal for the '<em><b>Bean Mapped Properties</b></em>' attribute list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute TAG_MAPPING__BEAN_MAPPED_PROPERTIES = eINSTANCE.getTagMapping_BeanMappedProperties(); - - /** - * The meta object literal for the '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.TagToViewObjectMappingImpl <em>Tag To View Object Mapping</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.TagToViewObjectMappingImpl - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ComponentMappingPackageImpl#getTagToViewObjectMapping() - * @generated - */ - EClass TAG_TO_VIEW_OBJECT_MAPPING = eINSTANCE.getTagToViewObjectMapping(); - - /** - * The meta object literal for the '<em><b>Type Info</b></em>' containment reference feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference TAG_TO_VIEW_OBJECT_MAPPING__TYPE_INFO = eINSTANCE.getTagToViewObjectMapping_TypeInfo(); - - /** - * The meta object literal for the '<em><b>Min JSF Version</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute TAG_TO_VIEW_OBJECT_MAPPING__MIN_JSF_VERSION = eINSTANCE.getTagToViewObjectMapping_MinJSFVersion(); - - /** - * The meta object literal for the '<em><b>Min Library Version</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute TAG_TO_VIEW_OBJECT_MAPPING__MIN_LIBRARY_VERSION = eINSTANCE.getTagToViewObjectMapping_MinLibraryVersion(); - - /** - * The meta object literal for the '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ClassTypeInfo_Impl <em>Class Type Info </em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ClassTypeInfo_Impl - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ComponentMappingPackageImpl#getClassTypeInfo_() - * @generated - */ - EClass CLASS_TYPE_INFO_ = eINSTANCE.getClassTypeInfo_(); - - /** - * The meta object literal for the '<em><b>Class Name</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute CLASS_TYPE_INFO___CLASS_NAME = eINSTANCE.getClassTypeInfo__ClassName(); - - /** - * The meta object literal for the '<em><b>Super Classes</b></em>' attribute list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute CLASS_TYPE_INFO___SUPER_CLASSES = eINSTANCE.getClassTypeInfo__SuperClasses(); - - /** - * The meta object literal for the '<em><b>Interfaces</b></em>' attribute list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute CLASS_TYPE_INFO___INTERFACES = eINSTANCE.getClassTypeInfo__Interfaces(); - - /** - * The meta object literal for the '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ComponentTypeInfo_Impl <em>Component Type Info </em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ComponentTypeInfo_Impl - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ComponentMappingPackageImpl#getComponentTypeInfo_() - * @generated - */ - EClass COMPONENT_TYPE_INFO_ = eINSTANCE.getComponentTypeInfo_(); - - /** - * The meta object literal for the '<em><b>Component Type</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute COMPONENT_TYPE_INFO___COMPONENT_TYPE = eINSTANCE.getComponentTypeInfo__ComponentType(); - - /** - * The meta object literal for the '<em><b>Component Family</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute COMPONENT_TYPE_INFO___COMPONENT_FAMILY = eINSTANCE.getComponentTypeInfo__ComponentFamily(); - - /** - * The meta object literal for the '<em><b>Render Type</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute COMPONENT_TYPE_INFO___RENDER_TYPE = eINSTANCE.getComponentTypeInfo__RenderType(); - - /** - * The meta object literal for the '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ConverterTypeInfo_Impl <em>Converter Type Info </em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ConverterTypeInfo_Impl - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ComponentMappingPackageImpl#getConverterTypeInfo_() - * @generated - */ - EClass CONVERTER_TYPE_INFO_ = eINSTANCE.getConverterTypeInfo_(); - - /** - * The meta object literal for the '<em><b>Converter Id</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute CONVERTER_TYPE_INFO___CONVERTER_ID = eINSTANCE.getConverterTypeInfo__ConverterId(); - - /** - * The meta object literal for the '<em><b>For Classes</b></em>' attribute list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute CONVERTER_TYPE_INFO___FOR_CLASSES = eINSTANCE.getConverterTypeInfo__ForClasses(); - - /** - * The meta object literal for the '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ValidatorTypeInfo_Impl <em>Validator Type Info </em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ValidatorTypeInfo_Impl - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ComponentMappingPackageImpl#getValidatorTypeInfo_() - * @generated - */ - EClass VALIDATOR_TYPE_INFO_ = eINSTANCE.getValidatorTypeInfo_(); - - /** - * The meta object literal for the '<em><b>Validator Id</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute VALIDATOR_TYPE_INFO___VALIDATOR_ID = eINSTANCE.getValidatorTypeInfo__ValidatorId(); - - /** - * The meta object literal for the '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.AttributeToPropertyMappingImpl <em>Attribute To Property Mapping</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.AttributeToPropertyMappingImpl - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ComponentMappingPackageImpl#getAttributeToPropertyMapping() - * @generated - */ - EClass ATTRIBUTE_TO_PROPERTY_MAPPING = eINSTANCE.getAttributeToPropertyMapping(); - - /** - * The meta object literal for the '<em><b>Property Name</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute ATTRIBUTE_TO_PROPERTY_MAPPING__PROPERTY_NAME = eINSTANCE.getAttributeToPropertyMapping_PropertyName(); - - /** - * The meta object literal for the '<em><b>El Allowed</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute ATTRIBUTE_TO_PROPERTY_MAPPING__EL_ALLOWED = eINSTANCE.getAttributeToPropertyMapping_ElAllowed(); - - /** - * The meta object literal for the '<em><b>Custom Conversion Factory Id</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute ATTRIBUTE_TO_PROPERTY_MAPPING__CUSTOM_CONVERSION_FACTORY_ID = eINSTANCE.getAttributeToPropertyMapping_CustomConversionFactoryId(); - - } - -} //ComponentMappingPackage diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/ComponentTypeInfo_.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/ComponentTypeInfo_.java deleted file mode 100644 index e537498e1..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/ComponentTypeInfo_.java +++ /dev/null @@ -1,108 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: ComponentTypeInfo_.java,v 1.1 2008/05/12 17:42:19 cbateman Exp $ - */ -package org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping; - - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Component Type Info </b></em>'. - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentTypeInfo_#getComponentType <em>Component Type</em>}</li> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentTypeInfo_#getComponentFamily <em>Component Family</em>}</li> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentTypeInfo_#getRenderType <em>Render Type</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage#getComponentTypeInfo_() - * @model - * @generated - */ -public interface ComponentTypeInfo_ extends ClassTypeInfo_ -{ - /** - * Returns the value of the '<em><b>Component Type</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Component Type</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Component Type</em>' attribute. - * @see #setComponentType(String) - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage#getComponentTypeInfo__ComponentType() - * @model extendedMetaData="kind='element' name='componentType'" - * @generated - */ - String getComponentType(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentTypeInfo_#getComponentType <em>Component Type</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Component Type</em>' attribute. - * @see #getComponentType() - * @generated - */ - void setComponentType(String value); - - /** - * Returns the value of the '<em><b>Component Family</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Component Family</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Component Family</em>' attribute. - * @see #setComponentFamily(String) - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage#getComponentTypeInfo__ComponentFamily() - * @model extendedMetaData="kind='element' name='componentFamily'" - * @generated - */ - String getComponentFamily(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentTypeInfo_#getComponentFamily <em>Component Family</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Component Family</em>' attribute. - * @see #getComponentFamily() - * @generated - */ - void setComponentFamily(String value); - - /** - * Returns the value of the '<em><b>Render Type</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Render Type</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Render Type</em>' attribute. - * @see #setRenderType(String) - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage#getComponentTypeInfo__RenderType() - * @model extendedMetaData="kind='element' name='renderType'" - * @generated - */ - String getRenderType(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentTypeInfo_#getRenderType <em>Render Type</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Render Type</em>' attribute. - * @see #getRenderType() - * @generated - */ - void setRenderType(String value); - -} // ComponentTypeInfo_ diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/ConverterTypeInfo_.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/ConverterTypeInfo_.java deleted file mode 100644 index d7dbc5484..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/ConverterTypeInfo_.java +++ /dev/null @@ -1,73 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: ConverterTypeInfo_.java,v 1.1 2008/05/12 17:42:19 cbateman Exp $ - */ -package org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping; - -import org.eclipse.emf.common.util.EList; - - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Converter Type Info </b></em>'. - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ConverterTypeInfo_#getConverterId <em>Converter Id</em>}</li> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ConverterTypeInfo_#getForClasses <em>For Classes</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage#getConverterTypeInfo_() - * @model - * @generated - */ -public interface ConverterTypeInfo_ extends ClassTypeInfo_ -{ - /** - * Returns the value of the '<em><b>Converter Id</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Converter Id</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Converter Id</em>' attribute. - * @see #setConverterId(String) - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage#getConverterTypeInfo__ConverterId() - * @model extendedMetaData="kind='element' name='converterId'" - * @generated - */ - String getConverterId(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ConverterTypeInfo_#getConverterId <em>Converter Id</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Converter Id</em>' attribute. - * @see #getConverterId() - * @generated - */ - void setConverterId(String value); - - /** - * Returns the value of the '<em><b>For Classes</b></em>' attribute list. - * The list contents are of type {@link java.lang.String}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>For Classes</em>' attribute list isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>For Classes</em>' attribute list. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage#getConverterTypeInfo__ForClasses() - * @model extendedMetaData="kind='element' name='forClass'" - * @generated - */ - EList<String> getForClasses(); - -} // ConverterTypeInfo_ diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/CustomViewMapperExtensionLoader.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/CustomViewMapperExtensionLoader.java deleted file mode 100644 index 5e9de9062..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/CustomViewMapperExtensionLoader.java +++ /dev/null @@ -1,100 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping; - -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtension; -import org.eclipse.core.runtime.IExtensionPoint; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.ICustomViewMapper; - -/** - * @author cbateman - * - */ -public class CustomViewMapperExtensionLoader -{ - private final static String EXTENSION_ID = "customViewMapper"; //$NON-NLS-1$ - private final static String ELEMENT_NAME = "customViewMapper"; //$NON-NLS-1$ - - private static Map<String, ICustomViewMapper> _extensions; - - /** - * @param id - * @return the list of handlers. The list is not modifiable and will throw - * exceptions if it is attempted. - */ - public static synchronized ICustomViewMapper getCustomViewMapper( - final String id) - { - if (_extensions == null) - { - _extensions = Collections.unmodifiableMap(readAllHandlers()); - } - return _extensions.get(id); - } - - private static Map<String, ICustomViewMapper> readAllHandlers() - { - final Map<String, ICustomViewMapper> handlers = new HashMap<String, ICustomViewMapper>(); - final IExtensionPoint extensionPoint = JSFCorePlugin.getDefault() - .getExtension(EXTENSION_ID); - final IExtension[] extensions = extensionPoint.getExtensions(); - - for (final IExtension ext : extensions) - { - final IConfigurationElement[] configElements = ext - .getConfigurationElements(); - - for (final IConfigurationElement element : configElements) - { - if (ELEMENT_NAME.equals(element.getName())) - { - try - { - final String pluginId = element.getContributor() - .getName(); - final String name = element.getAttribute("id"); //$NON-NLS-1$ - final Object customHandler = element - .createExecutableExtension("class"); //$NON-NLS-1$ - if (customHandler instanceof ICustomViewMapper - && name != null) - { - handlers.put(pluginId + "." + name, //$NON-NLS-1$ - (ICustomViewMapper) customHandler); - } - else - { - JSFCorePlugin.log( - "Error loading tag registry extension: " //$NON-NLS-1$ - + element.getContributor().getName() - + "." + element.getAttribute("id") //$NON-NLS-1$ //$NON-NLS-2$ - , new Throwable("No exception: stack trace only")); //$NON-NLS-1$ - } - } - catch (final CoreException e) - { - JSFCorePlugin.log(e, - "Error loading tag registry extension: " //$NON-NLS-1$ - + element.getContributor().getName() - + "." + element.getAttribute("id")); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - } - } - return handlers; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/TagMapping.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/TagMapping.java deleted file mode 100644 index 4f824a1ea..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/TagMapping.java +++ /dev/null @@ -1,103 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: TagMapping.java,v 1.1 2008/05/12 17:42:19 cbateman Exp $ - */ -package org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping; - -import org.eclipse.emf.common.util.EList; - -import org.eclipse.emf.ecore.EObject; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Tag Mapping</b></em>'. - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagMapping#getVersionedTagToViewMappings <em>Versioned Tag To View Mappings</em>}</li> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagMapping#getCustomConversionFactoryId <em>Custom Conversion Factory Id</em>}</li> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagMapping#getBeanMappedProperties <em>Bean Mapped Properties</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage#getTagMapping() - * @model - * @generated - */ -public interface TagMapping extends EObject -{ - /** - * Returns the value of the '<em><b>Versioned Tag To View Mappings</b></em>' containment reference list. - * The list contents are of type {@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagToViewObjectMapping}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Versioned Tag To View Mappings</em>' containment reference list isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Versioned Tag To View Mappings</em>' containment reference list. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage#getTagMapping_VersionedTagToViewMappings() - * @model containment="true" - * extendedMetaData="kind='element' name='versionedTagToViewMappings'" - * @generated - */ - EList<TagToViewObjectMapping> getVersionedTagToViewMappings(); - - /** - * Returns the value of the '<em><b>Custom Conversion Factory Id</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Custom Conversion Factory Id</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Custom Conversion Factory Id</em>' attribute. - * @see #setCustomConversionFactoryId(String) - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage#getTagMapping_CustomConversionFactoryId() - * @model extendedMetaData="kind='element' name='customConversionFactoryId'" - * @generated - */ - String getCustomConversionFactoryId(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagMapping#getCustomConversionFactoryId <em>Custom Conversion Factory Id</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Custom Conversion Factory Id</em>' attribute. - * @see #getCustomConversionFactoryId() - * @generated - */ - void setCustomConversionFactoryId(String value); - - /** - * Returns the value of the '<em><b>Bean Mapped Properties</b></em>' attribute list. - * The list contents are of type {@link java.lang.String}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Bean Mapped Properties</em>' attribute list isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Bean Mapped Properties</em>' attribute list. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage#getTagMapping_BeanMappedProperties() - * @model default="" - * extendedMetaData="kind='element' name='beanMappedProperties'" - * @generated - */ - EList<String> getBeanMappedProperties(); - - /** - * <!-- begin-user-doc --> - * @param jsfVersion - * @param libVersion - * <!-- end-user-doc --> - * @model - * @generated - */ - void findBestMapping(String jsfVersion, String libVersion); - -} // TagMapping diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/TagToViewObjectMapping.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/TagToViewObjectMapping.java deleted file mode 100644 index 608ba0f16..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/TagToViewObjectMapping.java +++ /dev/null @@ -1,114 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: TagToViewObjectMapping.java,v 1.1 2008/05/12 17:42:19 cbateman Exp $ - */ -package org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping; - -import org.eclipse.emf.ecore.EObject; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Tag To View Object Mapping</b></em>'. - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagToViewObjectMapping#getTypeInfo <em>Type Info</em>}</li> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagToViewObjectMapping#getMinJSFVersion <em>Min JSF Version</em>}</li> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagToViewObjectMapping#getMinLibraryVersion <em>Min Library Version</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage#getTagToViewObjectMapping() - * @model - * @generated - */ -public interface TagToViewObjectMapping extends EObject -{ - /** - * Returns the value of the '<em><b>Type Info</b></em>' containment reference. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Type Info</em>' reference isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Type Info</em>' containment reference. - * @see #setTypeInfo(ClassTypeInfo_) - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage#getTagToViewObjectMapping_TypeInfo() - * @model containment="true" - * extendedMetaData="kind='element' name='typeInfo'" - * @generated - */ - ClassTypeInfo_ getTypeInfo(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagToViewObjectMapping#getTypeInfo <em>Type Info</em>}' containment reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Type Info</em>' containment reference. - * @see #getTypeInfo() - * @generated - */ - void setTypeInfo(ClassTypeInfo_ value); - - /** - * Returns the value of the '<em><b>Min JSF Version</b></em>' attribute. - * The default value is <code>"1.1"</code>. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Min JSF Version</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Min JSF Version</em>' attribute. - * @see #setMinJSFVersion(String) - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage#getTagToViewObjectMapping_MinJSFVersion() - * @model default="1.1" - * extendedMetaData="kind='element' name='minVersion'" - * @generated - */ - String getMinJSFVersion(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagToViewObjectMapping#getMinJSFVersion <em>Min JSF Version</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Min JSF Version</em>' attribute. - * @see #getMinJSFVersion() - * @generated - */ - void setMinJSFVersion(String value); - - /** - * Returns the value of the '<em><b>Min Library Version</b></em>' attribute. - * The default value is <code>""</code>. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Min Library Version</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Min Library Version</em>' attribute. - * @see #setMinLibraryVersion(String) - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage#getTagToViewObjectMapping_MinLibraryVersion() - * @model default="" - * extendedMetaData="kind='element' name='minLibraryVersion'" - * @generated - */ - String getMinLibraryVersion(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagToViewObjectMapping#getMinLibraryVersion <em>Min Library Version</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Min Library Version</em>' attribute. - * @see #getMinLibraryVersion() - * @generated - */ - void setMinLibraryVersion(String value); - -} // TagToViewObjectMapping diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/ValidatorTypeInfo_.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/ValidatorTypeInfo_.java deleted file mode 100644 index 608568431..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/ValidatorTypeInfo_.java +++ /dev/null @@ -1,54 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: ValidatorTypeInfo_.java,v 1.1 2008/05/12 17:42:19 cbateman Exp $ - */ -package org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping; - - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Validator Type Info </b></em>'. - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ValidatorTypeInfo_#getValidatorId <em>Validator Id</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage#getValidatorTypeInfo_() - * @model - * @generated - */ -public interface ValidatorTypeInfo_ extends ClassTypeInfo_ -{ - /** - * Returns the value of the '<em><b>Validator Id</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Validator Id</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Validator Id</em>' attribute. - * @see #setValidatorId(String) - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage#getValidatorTypeInfo__ValidatorId() - * @model extendedMetaData="kind='element' name='validatorId'" - * @generated - */ - String getValidatorId(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ValidatorTypeInfo_#getValidatorId <em>Validator Id</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Validator Id</em>' attribute. - * @see #getValidatorId() - * @generated - */ - void setValidatorId(String value); - -} // ValidatorTypeInfo_ diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/impl/AttributeToPropertyMappingImpl.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/impl/AttributeToPropertyMappingImpl.java deleted file mode 100644 index 953109921..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/impl/AttributeToPropertyMappingImpl.java +++ /dev/null @@ -1,293 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: AttributeToPropertyMappingImpl.java,v 1.2 2008/11/18 22:23:57 gkessler Exp $ - */ -package org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl; - -import org.eclipse.emf.common.notify.Notification; - -import org.eclipse.emf.ecore.EClass; - -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.impl.EObjectImpl; - -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.AttributeToPropertyMapping; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Attribute To Property Mapping</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.AttributeToPropertyMappingImpl#getPropertyName <em>Property Name</em>}</li> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.AttributeToPropertyMappingImpl#isElAllowed <em>El Allowed</em>}</li> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.AttributeToPropertyMappingImpl#getCustomConversionFactoryId <em>Custom Conversion Factory Id</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class AttributeToPropertyMappingImpl extends EObjectImpl implements AttributeToPropertyMapping -{ - /** - * The default value of the '{@link #getPropertyName() <em>Property Name</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getPropertyName() - * @generated - * @ordered - */ - protected static final String PROPERTY_NAME_EDEFAULT = null; - - /** - * The cached value of the '{@link #getPropertyName() <em>Property Name</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getPropertyName() - * @generated - * @ordered - */ - protected String propertyName = PROPERTY_NAME_EDEFAULT; - - /** - * The default value of the '{@link #isElAllowed() <em>El Allowed</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isElAllowed() - * @generated - * @ordered - */ - protected static final boolean EL_ALLOWED_EDEFAULT = true; - - /** - * The cached value of the '{@link #isElAllowed() <em>El Allowed</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isElAllowed() - * @generated - * @ordered - */ - protected boolean elAllowed = EL_ALLOWED_EDEFAULT; - - /** - * The default value of the '{@link #getCustomConversionFactoryId() <em>Custom Conversion Factory Id</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getCustomConversionFactoryId() - * @generated - * @ordered - */ - protected static final String CUSTOM_CONVERSION_FACTORY_ID_EDEFAULT = null; - - /** - * The cached value of the '{@link #getCustomConversionFactoryId() <em>Custom Conversion Factory Id</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getCustomConversionFactoryId() - * @generated - * @ordered - */ - protected String customConversionFactoryId = CUSTOM_CONVERSION_FACTORY_ID_EDEFAULT; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected AttributeToPropertyMappingImpl() - { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() - { - return ComponentMappingPackage.Literals.ATTRIBUTE_TO_PROPERTY_MAPPING; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getPropertyName() - { - return propertyName; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setPropertyName(String newPropertyName) - { - String oldPropertyName = propertyName; - propertyName = newPropertyName; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, ComponentMappingPackage.ATTRIBUTE_TO_PROPERTY_MAPPING__PROPERTY_NAME, oldPropertyName, propertyName)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean isElAllowed() - { - return elAllowed; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setElAllowed(boolean newElAllowed) - { - boolean oldElAllowed = elAllowed; - elAllowed = newElAllowed; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, ComponentMappingPackage.ATTRIBUTE_TO_PROPERTY_MAPPING__EL_ALLOWED, oldElAllowed, elAllowed)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getCustomConversionFactoryId() - { - return customConversionFactoryId; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setCustomConversionFactoryId(String newCustomConversionFactoryId) - { - String oldCustomConversionFactoryId = customConversionFactoryId; - customConversionFactoryId = newCustomConversionFactoryId; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, ComponentMappingPackage.ATTRIBUTE_TO_PROPERTY_MAPPING__CUSTOM_CONVERSION_FACTORY_ID, oldCustomConversionFactoryId, customConversionFactoryId)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) - { - switch (featureID) - { - case ComponentMappingPackage.ATTRIBUTE_TO_PROPERTY_MAPPING__PROPERTY_NAME: - return getPropertyName(); - case ComponentMappingPackage.ATTRIBUTE_TO_PROPERTY_MAPPING__EL_ALLOWED: - return isElAllowed() ? Boolean.TRUE : Boolean.FALSE; - case ComponentMappingPackage.ATTRIBUTE_TO_PROPERTY_MAPPING__CUSTOM_CONVERSION_FACTORY_ID: - return getCustomConversionFactoryId(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eSet(int featureID, Object newValue) - { - switch (featureID) - { - case ComponentMappingPackage.ATTRIBUTE_TO_PROPERTY_MAPPING__PROPERTY_NAME: - setPropertyName((String)newValue); - return; - case ComponentMappingPackage.ATTRIBUTE_TO_PROPERTY_MAPPING__EL_ALLOWED: - setElAllowed(((Boolean)newValue).booleanValue()); - return; - case ComponentMappingPackage.ATTRIBUTE_TO_PROPERTY_MAPPING__CUSTOM_CONVERSION_FACTORY_ID: - setCustomConversionFactoryId((String)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) - { - switch (featureID) - { - case ComponentMappingPackage.ATTRIBUTE_TO_PROPERTY_MAPPING__PROPERTY_NAME: - setPropertyName(PROPERTY_NAME_EDEFAULT); - return; - case ComponentMappingPackage.ATTRIBUTE_TO_PROPERTY_MAPPING__EL_ALLOWED: - setElAllowed(EL_ALLOWED_EDEFAULT); - return; - case ComponentMappingPackage.ATTRIBUTE_TO_PROPERTY_MAPPING__CUSTOM_CONVERSION_FACTORY_ID: - setCustomConversionFactoryId(CUSTOM_CONVERSION_FACTORY_ID_EDEFAULT); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) - { - switch (featureID) - { - case ComponentMappingPackage.ATTRIBUTE_TO_PROPERTY_MAPPING__PROPERTY_NAME: - return PROPERTY_NAME_EDEFAULT == null ? propertyName != null : !PROPERTY_NAME_EDEFAULT.equals(propertyName); - case ComponentMappingPackage.ATTRIBUTE_TO_PROPERTY_MAPPING__EL_ALLOWED: - return elAllowed != EL_ALLOWED_EDEFAULT; - case ComponentMappingPackage.ATTRIBUTE_TO_PROPERTY_MAPPING__CUSTOM_CONVERSION_FACTORY_ID: - return CUSTOM_CONVERSION_FACTORY_ID_EDEFAULT == null ? customConversionFactoryId != null : !CUSTOM_CONVERSION_FACTORY_ID_EDEFAULT.equals(customConversionFactoryId); - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public String toString() - { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (propertyName: "); //$NON-NLS-1$ - result.append(propertyName); - result.append(", elAllowed: "); //$NON-NLS-1$ - result.append(elAllowed); - result.append(", customConversionFactoryId: "); //$NON-NLS-1$ - result.append(customConversionFactoryId); - result.append(')'); - return result.toString(); - } - -} //AttributeToPropertyMappingImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/impl/ClassTypeInfo_Impl.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/impl/ClassTypeInfo_Impl.java deleted file mode 100644 index c81344b9e..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/impl/ClassTypeInfo_Impl.java +++ /dev/null @@ -1,264 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: ClassTypeInfo_Impl.java,v 1.2 2008/11/18 22:23:57 gkessler Exp $ - */ -package org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl; - -import java.util.Collection; - -import org.eclipse.emf.common.notify.Notification; - -import org.eclipse.emf.common.util.EList; - -import org.eclipse.emf.ecore.EClass; - -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.impl.EObjectImpl; - -import org.eclipse.emf.ecore.util.EDataTypeUniqueEList; - -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ClassTypeInfo_; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Class Type Info </b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ClassTypeInfo_Impl#getClassName <em>Class Name</em>}</li> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ClassTypeInfo_Impl#getSuperClasses <em>Super Classes</em>}</li> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ClassTypeInfo_Impl#getInterfaces <em>Interfaces</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class ClassTypeInfo_Impl extends EObjectImpl implements ClassTypeInfo_ -{ - /** - * The default value of the '{@link #getClassName() <em>Class Name</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getClassName() - * @generated - * @ordered - */ - protected static final String CLASS_NAME_EDEFAULT = null; - - /** - * The cached value of the '{@link #getClassName() <em>Class Name</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getClassName() - * @generated - * @ordered - */ - protected String className = CLASS_NAME_EDEFAULT; - - /** - * The cached value of the '{@link #getSuperClasses() <em>Super Classes</em>}' attribute list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getSuperClasses() - * @generated - * @ordered - */ - protected EList<String> superClasses; - - /** - * The cached value of the '{@link #getInterfaces() <em>Interfaces</em>}' attribute list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getInterfaces() - * @generated - * @ordered - */ - protected EList<String> interfaces; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ClassTypeInfo_Impl() - { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() - { - return ComponentMappingPackage.Literals.CLASS_TYPE_INFO_; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getClassName() - { - return className; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setClassName(String newClassName) - { - String oldClassName = className; - className = newClassName; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, ComponentMappingPackage.CLASS_TYPE_INFO___CLASS_NAME, oldClassName, className)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EList<String> getSuperClasses() - { - if (superClasses == null) - { - superClasses = new EDataTypeUniqueEList<String>(String.class, this, ComponentMappingPackage.CLASS_TYPE_INFO___SUPER_CLASSES); - } - return superClasses; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EList<String> getInterfaces() - { - if (interfaces == null) - { - interfaces = new EDataTypeUniqueEList<String>(String.class, this, ComponentMappingPackage.CLASS_TYPE_INFO___INTERFACES); - } - return interfaces; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) - { - switch (featureID) - { - case ComponentMappingPackage.CLASS_TYPE_INFO___CLASS_NAME: - return getClassName(); - case ComponentMappingPackage.CLASS_TYPE_INFO___SUPER_CLASSES: - return getSuperClasses(); - case ComponentMappingPackage.CLASS_TYPE_INFO___INTERFACES: - return getInterfaces(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @SuppressWarnings("unchecked") - @Override - public void eSet(int featureID, Object newValue) - { - switch (featureID) - { - case ComponentMappingPackage.CLASS_TYPE_INFO___CLASS_NAME: - setClassName((String)newValue); - return; - case ComponentMappingPackage.CLASS_TYPE_INFO___SUPER_CLASSES: - getSuperClasses().clear(); - getSuperClasses().addAll((Collection<? extends String>)newValue); - return; - case ComponentMappingPackage.CLASS_TYPE_INFO___INTERFACES: - getInterfaces().clear(); - getInterfaces().addAll((Collection<? extends String>)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) - { - switch (featureID) - { - case ComponentMappingPackage.CLASS_TYPE_INFO___CLASS_NAME: - setClassName(CLASS_NAME_EDEFAULT); - return; - case ComponentMappingPackage.CLASS_TYPE_INFO___SUPER_CLASSES: - getSuperClasses().clear(); - return; - case ComponentMappingPackage.CLASS_TYPE_INFO___INTERFACES: - getInterfaces().clear(); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) - { - switch (featureID) - { - case ComponentMappingPackage.CLASS_TYPE_INFO___CLASS_NAME: - return CLASS_NAME_EDEFAULT == null ? className != null : !CLASS_NAME_EDEFAULT.equals(className); - case ComponentMappingPackage.CLASS_TYPE_INFO___SUPER_CLASSES: - return superClasses != null && !superClasses.isEmpty(); - case ComponentMappingPackage.CLASS_TYPE_INFO___INTERFACES: - return interfaces != null && !interfaces.isEmpty(); - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public String toString() - { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (className: "); //$NON-NLS-1$ - result.append(className); - result.append(", superClasses: "); //$NON-NLS-1$ - result.append(superClasses); - result.append(", interfaces: "); //$NON-NLS-1$ - result.append(interfaces); - result.append(')'); - return result.toString(); - } - -} //ClassTypeInfo_Impl diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/impl/ComponentMappingFactoryImpl.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/impl/ComponentMappingFactoryImpl.java deleted file mode 100644 index 82bce6e36..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/impl/ComponentMappingFactoryImpl.java +++ /dev/null @@ -1,184 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: ComponentMappingFactoryImpl.java,v 1.2 2008/11/18 22:23:57 gkessler Exp $ - */ -package org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; - -import org.eclipse.emf.ecore.impl.EFactoryImpl; - -import org.eclipse.emf.ecore.plugin.EcorePlugin; - -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.*; - -/** - * <!-- begin-user-doc --> - * An implementation of the model <b>Factory</b>. - * <!-- end-user-doc --> - * @generated - */ -public class ComponentMappingFactoryImpl extends EFactoryImpl implements ComponentMappingFactory -{ - /** - * Creates the default factory implementation. - * <!-- begin-user-doc --> - * @return the factory - * <!-- end-user-doc --> - * @generated - */ - public static ComponentMappingFactory init() - { - try - { - ComponentMappingFactory theComponentMappingFactory = (ComponentMappingFactory)EPackage.Registry.INSTANCE.getEFactory("http://org.eclipse.jst.jsf.core/componentMapping.ecore"); //$NON-NLS-1$ - if (theComponentMappingFactory != null) - { - return theComponentMappingFactory; - } - } - catch (Exception exception) - { - EcorePlugin.INSTANCE.log(exception); - } - return new ComponentMappingFactoryImpl(); - } - - /** - * Creates an instance of the factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ComponentMappingFactoryImpl() - { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public EObject create(EClass eClass) - { - switch (eClass.getClassifierID()) - { - case ComponentMappingPackage.TAG_MAPPING: return createTagMapping(); - case ComponentMappingPackage.TAG_TO_VIEW_OBJECT_MAPPING: return createTagToViewObjectMapping(); - case ComponentMappingPackage.CLASS_TYPE_INFO_: return createClassTypeInfo_(); - case ComponentMappingPackage.COMPONENT_TYPE_INFO_: return createComponentTypeInfo_(); - case ComponentMappingPackage.CONVERTER_TYPE_INFO_: return createConverterTypeInfo_(); - case ComponentMappingPackage.VALIDATOR_TYPE_INFO_: return createValidatorTypeInfo_(); - case ComponentMappingPackage.ATTRIBUTE_TO_PROPERTY_MAPPING: return createAttributeToPropertyMapping(); - default: - throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public TagMapping createTagMapping() - { - TagMappingImpl tagMapping = new TagMappingImpl(); - return tagMapping; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public TagToViewObjectMapping createTagToViewObjectMapping() - { - TagToViewObjectMappingImpl tagToViewObjectMapping = new TagToViewObjectMappingImpl(); - return tagToViewObjectMapping; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ClassTypeInfo_ createClassTypeInfo_() - { - ClassTypeInfo_Impl classTypeInfo_ = new ClassTypeInfo_Impl(); - return classTypeInfo_; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ComponentTypeInfo_ createComponentTypeInfo_() - { - ComponentTypeInfo_Impl componentTypeInfo_ = new ComponentTypeInfo_Impl(); - return componentTypeInfo_; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ConverterTypeInfo_ createConverterTypeInfo_() - { - ConverterTypeInfo_Impl converterTypeInfo_ = new ConverterTypeInfo_Impl(); - return converterTypeInfo_; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ValidatorTypeInfo_ createValidatorTypeInfo_() - { - ValidatorTypeInfo_Impl validatorTypeInfo_ = new ValidatorTypeInfo_Impl(); - return validatorTypeInfo_; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public AttributeToPropertyMapping createAttributeToPropertyMapping() - { - AttributeToPropertyMappingImpl attributeToPropertyMapping = new AttributeToPropertyMappingImpl(); - return attributeToPropertyMapping; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ComponentMappingPackage getComponentMappingPackage() - { - return (ComponentMappingPackage)getEPackage(); - } - - /** - * <!-- begin-user-doc --> - * @return the package - * <!-- end-user-doc --> - * @deprecated - * @generated - */ - @Deprecated - public static ComponentMappingPackage getPackage() - { - return ComponentMappingPackage.eINSTANCE; - } - -} //ComponentMappingFactoryImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/impl/ComponentMappingPackageImpl.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/impl/ComponentMappingPackageImpl.java deleted file mode 100644 index 3debd70fc..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/impl/ComponentMappingPackageImpl.java +++ /dev/null @@ -1,699 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: ComponentMappingPackageImpl.java,v 1.2 2008/11/18 22:23:57 gkessler Exp $ - */ -package org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EOperation; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.ecore.impl.EPackageImpl; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.AttributeToPropertyMapping; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ClassTypeInfo_; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingFactory; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentTypeInfo_; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ConverterTypeInfo_; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagMapping; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagToViewObjectMapping; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ValidatorTypeInfo_; - -/** - * <!-- begin-user-doc --> - * An implementation of the model <b>Package</b>. - * <!-- end-user-doc --> - * @generated - */ -public class ComponentMappingPackageImpl extends EPackageImpl implements ComponentMappingPackage -{ - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass tagMappingEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass tagToViewObjectMappingEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass classTypeInfo_EClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass componentTypeInfo_EClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass converterTypeInfo_EClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass validatorTypeInfo_EClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass attributeToPropertyMappingEClass = null; - - /** - * Creates an instance of the model <b>Package</b>, registered with - * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package - * package URI value. - * <p>Note: the correct way to create the package is via the static - * factory method {@link #init init()}, which also performs - * initialization of the package, or returns the registered package, - * if one already exists. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.ecore.EPackage.Registry - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage#eNS_URI - * @see #init() - * @generated - */ - private ComponentMappingPackageImpl() - { - super(eNS_URI, ComponentMappingFactory.eINSTANCE); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private static boolean isInited = false; - - /** - * Creates, registers, and initializes the <b>Package</b> for this - * model, and for any others upon which it depends. Simple - * dependencies are satisfied by calling this method on all - * dependent packages before doing anything else. This method drives - * initialization for interdependent packages directly, in parallel - * with this package, itself. - * <p>Of this package and its interdependencies, all packages which - * have not yet been registered by their URI values are first created - * and registered. The packages are then initialized in two steps: - * meta-model objects for all of the packages are created before any - * are initialized, since one package's meta-model objects may refer to - * those of another. - * <p>Invocation of this method will not affect any packages that have - * already been initialized. - * <!-- begin-user-doc --> - * @return the initialized package - * <!-- end-user-doc --> - * @see #eNS_URI - * @see #createPackageContents() - * @see #initializePackageContents() - * @generated - */ - public static ComponentMappingPackage init() - { - if (isInited) return (ComponentMappingPackage)EPackage.Registry.INSTANCE.getEPackage(ComponentMappingPackage.eNS_URI); - - // Obtain or create and register package - ComponentMappingPackageImpl theComponentMappingPackage = (ComponentMappingPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(eNS_URI) instanceof ComponentMappingPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(eNS_URI) : new ComponentMappingPackageImpl()); - - isInited = true; - - // Create package meta-data objects - theComponentMappingPackage.createPackageContents(); - - // Initialize created meta-data - theComponentMappingPackage.initializePackageContents(); - - // Mark meta-data to indicate it can't be changed - theComponentMappingPackage.freeze(); - - return theComponentMappingPackage; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getTagMapping() - { - return tagMappingEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getTagMapping_VersionedTagToViewMappings() - { - return (EReference)tagMappingEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getTagMapping_CustomConversionFactoryId() - { - return (EAttribute)tagMappingEClass.getEStructuralFeatures().get(1); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getTagMapping_BeanMappedProperties() - { - return (EAttribute)tagMappingEClass.getEStructuralFeatures().get(2); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getTagToViewObjectMapping() - { - return tagToViewObjectMappingEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getTagToViewObjectMapping_TypeInfo() - { - return (EReference)tagToViewObjectMappingEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getTagToViewObjectMapping_MinJSFVersion() - { - return (EAttribute)tagToViewObjectMappingEClass.getEStructuralFeatures().get(1); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getTagToViewObjectMapping_MinLibraryVersion() - { - return (EAttribute)tagToViewObjectMappingEClass.getEStructuralFeatures().get(2); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getClassTypeInfo_() - { - return classTypeInfo_EClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getClassTypeInfo__ClassName() - { - return (EAttribute)classTypeInfo_EClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getClassTypeInfo__SuperClasses() - { - return (EAttribute)classTypeInfo_EClass.getEStructuralFeatures().get(1); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getClassTypeInfo__Interfaces() - { - return (EAttribute)classTypeInfo_EClass.getEStructuralFeatures().get(2); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getComponentTypeInfo_() - { - return componentTypeInfo_EClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getComponentTypeInfo__ComponentType() - { - return (EAttribute)componentTypeInfo_EClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getComponentTypeInfo__ComponentFamily() - { - return (EAttribute)componentTypeInfo_EClass.getEStructuralFeatures().get(1); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getComponentTypeInfo__RenderType() - { - return (EAttribute)componentTypeInfo_EClass.getEStructuralFeatures().get(2); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getConverterTypeInfo_() - { - return converterTypeInfo_EClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getConverterTypeInfo__ConverterId() - { - return (EAttribute)converterTypeInfo_EClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getConverterTypeInfo__ForClasses() - { - return (EAttribute)converterTypeInfo_EClass.getEStructuralFeatures().get(1); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getValidatorTypeInfo_() - { - return validatorTypeInfo_EClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getValidatorTypeInfo__ValidatorId() - { - return (EAttribute)validatorTypeInfo_EClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getAttributeToPropertyMapping() - { - return attributeToPropertyMappingEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getAttributeToPropertyMapping_PropertyName() - { - return (EAttribute)attributeToPropertyMappingEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getAttributeToPropertyMapping_ElAllowed() - { - return (EAttribute)attributeToPropertyMappingEClass.getEStructuralFeatures().get(1); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getAttributeToPropertyMapping_CustomConversionFactoryId() - { - return (EAttribute)attributeToPropertyMappingEClass.getEStructuralFeatures().get(2); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ComponentMappingFactory getComponentMappingFactory() - { - return (ComponentMappingFactory)getEFactoryInstance(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private boolean isCreated = false; - - /** - * Creates the meta-model objects for the package. This method is - * guarded to have no affect on any invocation but its first. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void createPackageContents() - { - if (isCreated) return; - isCreated = true; - - // Create classes and their features - tagMappingEClass = createEClass(TAG_MAPPING); - createEReference(tagMappingEClass, TAG_MAPPING__VERSIONED_TAG_TO_VIEW_MAPPINGS); - createEAttribute(tagMappingEClass, TAG_MAPPING__CUSTOM_CONVERSION_FACTORY_ID); - createEAttribute(tagMappingEClass, TAG_MAPPING__BEAN_MAPPED_PROPERTIES); - - tagToViewObjectMappingEClass = createEClass(TAG_TO_VIEW_OBJECT_MAPPING); - createEReference(tagToViewObjectMappingEClass, TAG_TO_VIEW_OBJECT_MAPPING__TYPE_INFO); - createEAttribute(tagToViewObjectMappingEClass, TAG_TO_VIEW_OBJECT_MAPPING__MIN_JSF_VERSION); - createEAttribute(tagToViewObjectMappingEClass, TAG_TO_VIEW_OBJECT_MAPPING__MIN_LIBRARY_VERSION); - - classTypeInfo_EClass = createEClass(CLASS_TYPE_INFO_); - createEAttribute(classTypeInfo_EClass, CLASS_TYPE_INFO___CLASS_NAME); - createEAttribute(classTypeInfo_EClass, CLASS_TYPE_INFO___SUPER_CLASSES); - createEAttribute(classTypeInfo_EClass, CLASS_TYPE_INFO___INTERFACES); - - componentTypeInfo_EClass = createEClass(COMPONENT_TYPE_INFO_); - createEAttribute(componentTypeInfo_EClass, COMPONENT_TYPE_INFO___COMPONENT_TYPE); - createEAttribute(componentTypeInfo_EClass, COMPONENT_TYPE_INFO___COMPONENT_FAMILY); - createEAttribute(componentTypeInfo_EClass, COMPONENT_TYPE_INFO___RENDER_TYPE); - - converterTypeInfo_EClass = createEClass(CONVERTER_TYPE_INFO_); - createEAttribute(converterTypeInfo_EClass, CONVERTER_TYPE_INFO___CONVERTER_ID); - createEAttribute(converterTypeInfo_EClass, CONVERTER_TYPE_INFO___FOR_CLASSES); - - validatorTypeInfo_EClass = createEClass(VALIDATOR_TYPE_INFO_); - createEAttribute(validatorTypeInfo_EClass, VALIDATOR_TYPE_INFO___VALIDATOR_ID); - - attributeToPropertyMappingEClass = createEClass(ATTRIBUTE_TO_PROPERTY_MAPPING); - createEAttribute(attributeToPropertyMappingEClass, ATTRIBUTE_TO_PROPERTY_MAPPING__PROPERTY_NAME); - createEAttribute(attributeToPropertyMappingEClass, ATTRIBUTE_TO_PROPERTY_MAPPING__EL_ALLOWED); - createEAttribute(attributeToPropertyMappingEClass, ATTRIBUTE_TO_PROPERTY_MAPPING__CUSTOM_CONVERSION_FACTORY_ID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private boolean isInitialized = false; - - /** - * Complete the initialization of the package and its meta-model. This - * method is guarded to have no affect on any invocation but its first. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void initializePackageContents() - { - if (isInitialized) return; - isInitialized = true; - - // Initialize package - setName(eNAME); - setNsPrefix(eNS_PREFIX); - setNsURI(eNS_URI); - - // Create type parameters - - // Set bounds for type parameters - - // Add supertypes to classes - componentTypeInfo_EClass.getESuperTypes().add(this.getClassTypeInfo_()); - converterTypeInfo_EClass.getESuperTypes().add(this.getClassTypeInfo_()); - validatorTypeInfo_EClass.getESuperTypes().add(this.getClassTypeInfo_()); - - // Initialize classes and features; add operations and parameters - initEClass(tagMappingEClass, TagMapping.class, "TagMapping", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEReference(getTagMapping_VersionedTagToViewMappings(), this.getTagToViewObjectMapping(), null, "versionedTagToViewMappings", null, 0, -1, TagMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEAttribute(getTagMapping_CustomConversionFactoryId(), ecorePackage.getEString(), "customConversionFactoryId", null, 0, 1, TagMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEAttribute(getTagMapping_BeanMappedProperties(), ecorePackage.getEString(), "beanMappedProperties", "", 0, -1, TagMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ //$NON-NLS-2$ - - EOperation op = addEOperation(tagMappingEClass, null, "findBestMapping", 0, 1, IS_UNIQUE, IS_ORDERED); //$NON-NLS-1$ - addEParameter(op, ecorePackage.getEString(), "jsfVersion", 0, 1, IS_UNIQUE, IS_ORDERED); //$NON-NLS-1$ - addEParameter(op, ecorePackage.getEString(), "libVersion", 0, 1, IS_UNIQUE, IS_ORDERED); //$NON-NLS-1$ - - initEClass(tagToViewObjectMappingEClass, TagToViewObjectMapping.class, "TagToViewObjectMapping", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEReference(getTagToViewObjectMapping_TypeInfo(), this.getClassTypeInfo_(), null, "typeInfo", null, 0, 1, TagToViewObjectMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEAttribute(getTagToViewObjectMapping_MinJSFVersion(), ecorePackage.getEString(), "minJSFVersion", "1.1", 0, 1, TagToViewObjectMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ //$NON-NLS-2$ - initEAttribute(getTagToViewObjectMapping_MinLibraryVersion(), ecorePackage.getEString(), "minLibraryVersion", "", 0, 1, TagToViewObjectMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ //$NON-NLS-2$ - - initEClass(classTypeInfo_EClass, ClassTypeInfo_.class, "ClassTypeInfo_", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEAttribute(getClassTypeInfo__ClassName(), ecorePackage.getEString(), "className", null, 0, 1, ClassTypeInfo_.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEAttribute(getClassTypeInfo__SuperClasses(), ecorePackage.getEString(), "superClasses", null, 0, -1, ClassTypeInfo_.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEAttribute(getClassTypeInfo__Interfaces(), ecorePackage.getEString(), "interfaces", null, 0, -1, ClassTypeInfo_.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - - initEClass(componentTypeInfo_EClass, ComponentTypeInfo_.class, "ComponentTypeInfo_", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEAttribute(getComponentTypeInfo__ComponentType(), ecorePackage.getEString(), "componentType", null, 0, 1, ComponentTypeInfo_.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEAttribute(getComponentTypeInfo__ComponentFamily(), ecorePackage.getEString(), "componentFamily", null, 0, 1, ComponentTypeInfo_.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEAttribute(getComponentTypeInfo__RenderType(), ecorePackage.getEString(), "renderType", null, 0, 1, ComponentTypeInfo_.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - - initEClass(converterTypeInfo_EClass, ConverterTypeInfo_.class, "ConverterTypeInfo_", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEAttribute(getConverterTypeInfo__ConverterId(), ecorePackage.getEString(), "converterId", null, 0, 1, ConverterTypeInfo_.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEAttribute(getConverterTypeInfo__ForClasses(), ecorePackage.getEString(), "forClasses", null, 0, -1, ConverterTypeInfo_.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - - initEClass(validatorTypeInfo_EClass, ValidatorTypeInfo_.class, "ValidatorTypeInfo_", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEAttribute(getValidatorTypeInfo__ValidatorId(), ecorePackage.getEString(), "validatorId", null, 0, 1, ValidatorTypeInfo_.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - - initEClass(attributeToPropertyMappingEClass, AttributeToPropertyMapping.class, "AttributeToPropertyMapping", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEAttribute(getAttributeToPropertyMapping_PropertyName(), ecorePackage.getEString(), "propertyName", null, 0, 1, AttributeToPropertyMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEAttribute(getAttributeToPropertyMapping_ElAllowed(), ecorePackage.getEBoolean(), "elAllowed", "true", 0, 1, AttributeToPropertyMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ //$NON-NLS-2$ - initEAttribute(getAttributeToPropertyMapping_CustomConversionFactoryId(), ecorePackage.getEString(), "customConversionFactoryId", null, 0, 1, AttributeToPropertyMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - - // Create resource - createResource(eNS_URI); - - // Create annotations - // http:///org/eclipse/emf/ecore/util/ExtendedMetaData - createExtendedMetaDataAnnotations(); - } - - /** - * Initializes the annotations for <b>http:///org/eclipse/emf/ecore/util/ExtendedMetaData</b>. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void createExtendedMetaDataAnnotations() - { - String source = "http:///org/eclipse/emf/ecore/util/ExtendedMetaData"; //$NON-NLS-1$ - addAnnotation - (getTagMapping_VersionedTagToViewMappings(), - source, - new String[] - { - "kind", "element", //$NON-NLS-1$ //$NON-NLS-2$ - "name", "versionedTagToViewMappings" //$NON-NLS-1$ //$NON-NLS-2$ - }); - addAnnotation - (getTagMapping_CustomConversionFactoryId(), - source, - new String[] - { - "kind", "element", //$NON-NLS-1$ //$NON-NLS-2$ - "name", "customConversionFactoryId" //$NON-NLS-1$ //$NON-NLS-2$ - }); - addAnnotation - (getTagMapping_BeanMappedProperties(), - source, - new String[] - { - "kind", "element", //$NON-NLS-1$ //$NON-NLS-2$ - "name", "beanMappedProperties" //$NON-NLS-1$ //$NON-NLS-2$ - }); - addAnnotation - (getTagToViewObjectMapping_TypeInfo(), - source, - new String[] - { - "kind", "element", //$NON-NLS-1$ //$NON-NLS-2$ - "name", "typeInfo" //$NON-NLS-1$ //$NON-NLS-2$ - }); - addAnnotation - (getTagToViewObjectMapping_MinJSFVersion(), - source, - new String[] - { - "kind", "element", //$NON-NLS-1$ //$NON-NLS-2$ - "name", "minVersion" //$NON-NLS-1$ //$NON-NLS-2$ - }); - addAnnotation - (getTagToViewObjectMapping_MinLibraryVersion(), - source, - new String[] - { - "kind", "element", //$NON-NLS-1$ //$NON-NLS-2$ - "name", "minLibraryVersion" //$NON-NLS-1$ //$NON-NLS-2$ - }); - addAnnotation - (getClassTypeInfo__ClassName(), - source, - new String[] - { - "kind", "element", //$NON-NLS-1$ //$NON-NLS-2$ - "name", "className" //$NON-NLS-1$ //$NON-NLS-2$ - }); - addAnnotation - (getClassTypeInfo__SuperClasses(), - source, - new String[] - { - "kind", "element", //$NON-NLS-1$ //$NON-NLS-2$ - "name", "superClasses" //$NON-NLS-1$ //$NON-NLS-2$ - }); - addAnnotation - (getClassTypeInfo__Interfaces(), - source, - new String[] - { - "kind", "element", //$NON-NLS-1$ //$NON-NLS-2$ - "name", "interfaces" //$NON-NLS-1$ //$NON-NLS-2$ - }); - addAnnotation - (getComponentTypeInfo__ComponentType(), - source, - new String[] - { - "kind", "element", //$NON-NLS-1$ //$NON-NLS-2$ - "name", "componentType" //$NON-NLS-1$ //$NON-NLS-2$ - }); - addAnnotation - (getComponentTypeInfo__ComponentFamily(), - source, - new String[] - { - "kind", "element", //$NON-NLS-1$ //$NON-NLS-2$ - "name", "componentFamily" //$NON-NLS-1$ //$NON-NLS-2$ - }); - addAnnotation - (getComponentTypeInfo__RenderType(), - source, - new String[] - { - "kind", "element", //$NON-NLS-1$ //$NON-NLS-2$ - "name", "renderType" //$NON-NLS-1$ //$NON-NLS-2$ - }); - addAnnotation - (getConverterTypeInfo__ConverterId(), - source, - new String[] - { - "kind", "element", //$NON-NLS-1$ //$NON-NLS-2$ - "name", "converterId" //$NON-NLS-1$ //$NON-NLS-2$ - }); - addAnnotation - (getConverterTypeInfo__ForClasses(), - source, - new String[] - { - "kind", "element", //$NON-NLS-1$ //$NON-NLS-2$ - "name", "forClass" //$NON-NLS-1$ //$NON-NLS-2$ - }); - addAnnotation - (getValidatorTypeInfo__ValidatorId(), - source, - new String[] - { - "kind", "element", //$NON-NLS-1$ //$NON-NLS-2$ - "name", "validatorId" //$NON-NLS-1$ //$NON-NLS-2$ - }); - addAnnotation - (getAttributeToPropertyMapping_PropertyName(), - source, - new String[] - { - "kind", "element", //$NON-NLS-1$ //$NON-NLS-2$ - "name", "propertyName" //$NON-NLS-1$ //$NON-NLS-2$ - }); - addAnnotation - (getAttributeToPropertyMapping_ElAllowed(), - source, - new String[] - { - "kind", "element", //$NON-NLS-1$ //$NON-NLS-2$ - "name", "elAllowed" //$NON-NLS-1$ //$NON-NLS-2$ - }); - addAnnotation - (getAttributeToPropertyMapping_CustomConversionFactoryId(), - source, - new String[] - { - "kind", "element", //$NON-NLS-1$ //$NON-NLS-2$ - "name", "customConversionFactoryId" //$NON-NLS-1$ //$NON-NLS-2$ - }); - } - -} //ComponentMappingPackageImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/impl/ComponentTypeInfo_Impl.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/impl/ComponentTypeInfo_Impl.java deleted file mode 100644 index ac318c8dd..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/impl/ComponentTypeInfo_Impl.java +++ /dev/null @@ -1,292 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: ComponentTypeInfo_Impl.java,v 1.2 2008/11/18 22:23:57 gkessler Exp $ - */ -package org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl; - -import org.eclipse.emf.common.notify.Notification; - -import org.eclipse.emf.ecore.EClass; - -import org.eclipse.emf.ecore.impl.ENotificationImpl; - -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentTypeInfo_; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Component Type Info </b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ComponentTypeInfo_Impl#getComponentType <em>Component Type</em>}</li> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ComponentTypeInfo_Impl#getComponentFamily <em>Component Family</em>}</li> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ComponentTypeInfo_Impl#getRenderType <em>Render Type</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class ComponentTypeInfo_Impl extends ClassTypeInfo_Impl implements ComponentTypeInfo_ -{ - /** - * The default value of the '{@link #getComponentType() <em>Component Type</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getComponentType() - * @generated - * @ordered - */ - protected static final String COMPONENT_TYPE_EDEFAULT = null; - - /** - * The cached value of the '{@link #getComponentType() <em>Component Type</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getComponentType() - * @generated - * @ordered - */ - protected String componentType = COMPONENT_TYPE_EDEFAULT; - - /** - * The default value of the '{@link #getComponentFamily() <em>Component Family</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getComponentFamily() - * @generated - * @ordered - */ - protected static final String COMPONENT_FAMILY_EDEFAULT = null; - - /** - * The cached value of the '{@link #getComponentFamily() <em>Component Family</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getComponentFamily() - * @generated - * @ordered - */ - protected String componentFamily = COMPONENT_FAMILY_EDEFAULT; - - /** - * The default value of the '{@link #getRenderType() <em>Render Type</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getRenderType() - * @generated - * @ordered - */ - protected static final String RENDER_TYPE_EDEFAULT = null; - - /** - * The cached value of the '{@link #getRenderType() <em>Render Type</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getRenderType() - * @generated - * @ordered - */ - protected String renderType = RENDER_TYPE_EDEFAULT; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ComponentTypeInfo_Impl() - { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() - { - return ComponentMappingPackage.Literals.COMPONENT_TYPE_INFO_; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getComponentType() - { - return componentType; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setComponentType(String newComponentType) - { - String oldComponentType = componentType; - componentType = newComponentType; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, ComponentMappingPackage.COMPONENT_TYPE_INFO___COMPONENT_TYPE, oldComponentType, componentType)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getComponentFamily() - { - return componentFamily; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setComponentFamily(String newComponentFamily) - { - String oldComponentFamily = componentFamily; - componentFamily = newComponentFamily; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, ComponentMappingPackage.COMPONENT_TYPE_INFO___COMPONENT_FAMILY, oldComponentFamily, componentFamily)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getRenderType() - { - return renderType; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setRenderType(String newRenderType) - { - String oldRenderType = renderType; - renderType = newRenderType; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, ComponentMappingPackage.COMPONENT_TYPE_INFO___RENDER_TYPE, oldRenderType, renderType)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) - { - switch (featureID) - { - case ComponentMappingPackage.COMPONENT_TYPE_INFO___COMPONENT_TYPE: - return getComponentType(); - case ComponentMappingPackage.COMPONENT_TYPE_INFO___COMPONENT_FAMILY: - return getComponentFamily(); - case ComponentMappingPackage.COMPONENT_TYPE_INFO___RENDER_TYPE: - return getRenderType(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eSet(int featureID, Object newValue) - { - switch (featureID) - { - case ComponentMappingPackage.COMPONENT_TYPE_INFO___COMPONENT_TYPE: - setComponentType((String)newValue); - return; - case ComponentMappingPackage.COMPONENT_TYPE_INFO___COMPONENT_FAMILY: - setComponentFamily((String)newValue); - return; - case ComponentMappingPackage.COMPONENT_TYPE_INFO___RENDER_TYPE: - setRenderType((String)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) - { - switch (featureID) - { - case ComponentMappingPackage.COMPONENT_TYPE_INFO___COMPONENT_TYPE: - setComponentType(COMPONENT_TYPE_EDEFAULT); - return; - case ComponentMappingPackage.COMPONENT_TYPE_INFO___COMPONENT_FAMILY: - setComponentFamily(COMPONENT_FAMILY_EDEFAULT); - return; - case ComponentMappingPackage.COMPONENT_TYPE_INFO___RENDER_TYPE: - setRenderType(RENDER_TYPE_EDEFAULT); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) - { - switch (featureID) - { - case ComponentMappingPackage.COMPONENT_TYPE_INFO___COMPONENT_TYPE: - return COMPONENT_TYPE_EDEFAULT == null ? componentType != null : !COMPONENT_TYPE_EDEFAULT.equals(componentType); - case ComponentMappingPackage.COMPONENT_TYPE_INFO___COMPONENT_FAMILY: - return COMPONENT_FAMILY_EDEFAULT == null ? componentFamily != null : !COMPONENT_FAMILY_EDEFAULT.equals(componentFamily); - case ComponentMappingPackage.COMPONENT_TYPE_INFO___RENDER_TYPE: - return RENDER_TYPE_EDEFAULT == null ? renderType != null : !RENDER_TYPE_EDEFAULT.equals(renderType); - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public String toString() - { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (componentType: "); //$NON-NLS-1$ - result.append(componentType); - result.append(", componentFamily: "); //$NON-NLS-1$ - result.append(componentFamily); - result.append(", renderType: "); //$NON-NLS-1$ - result.append(renderType); - result.append(')'); - return result.toString(); - } - -} //ComponentTypeInfo_Impl diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/impl/ConverterTypeInfo_Impl.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/impl/ConverterTypeInfo_Impl.java deleted file mode 100644 index 53387ea0d..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/impl/ConverterTypeInfo_Impl.java +++ /dev/null @@ -1,222 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: ConverterTypeInfo_Impl.java,v 1.2 2008/11/18 22:23:57 gkessler Exp $ - */ -package org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl; - -import java.util.Collection; -import org.eclipse.emf.common.notify.Notification; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EClass; - -import org.eclipse.emf.ecore.impl.ENotificationImpl; - -import org.eclipse.emf.ecore.util.EDataTypeUniqueEList; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ConverterTypeInfo_; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Converter Type Info </b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ConverterTypeInfo_Impl#getConverterId <em>Converter Id</em>}</li> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ConverterTypeInfo_Impl#getForClasses <em>For Classes</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class ConverterTypeInfo_Impl extends ClassTypeInfo_Impl implements ConverterTypeInfo_ -{ - /** - * The default value of the '{@link #getConverterId() <em>Converter Id</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getConverterId() - * @generated - * @ordered - */ - protected static final String CONVERTER_ID_EDEFAULT = null; - - /** - * The cached value of the '{@link #getConverterId() <em>Converter Id</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getConverterId() - * @generated - * @ordered - */ - protected String converterId = CONVERTER_ID_EDEFAULT; - - /** - * The cached value of the '{@link #getForClasses() <em>For Classes</em>}' attribute list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getForClasses() - * @generated - * @ordered - */ - protected EList<String> forClasses; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ConverterTypeInfo_Impl() - { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() - { - return ComponentMappingPackage.Literals.CONVERTER_TYPE_INFO_; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getConverterId() - { - return converterId; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setConverterId(String newConverterId) - { - String oldConverterId = converterId; - converterId = newConverterId; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, ComponentMappingPackage.CONVERTER_TYPE_INFO___CONVERTER_ID, oldConverterId, converterId)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EList<String> getForClasses() - { - if (forClasses == null) - { - forClasses = new EDataTypeUniqueEList<String>(String.class, this, ComponentMappingPackage.CONVERTER_TYPE_INFO___FOR_CLASSES); - } - return forClasses; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) - { - switch (featureID) - { - case ComponentMappingPackage.CONVERTER_TYPE_INFO___CONVERTER_ID: - return getConverterId(); - case ComponentMappingPackage.CONVERTER_TYPE_INFO___FOR_CLASSES: - return getForClasses(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @SuppressWarnings("unchecked") - @Override - public void eSet(int featureID, Object newValue) - { - switch (featureID) - { - case ComponentMappingPackage.CONVERTER_TYPE_INFO___CONVERTER_ID: - setConverterId((String)newValue); - return; - case ComponentMappingPackage.CONVERTER_TYPE_INFO___FOR_CLASSES: - getForClasses().clear(); - getForClasses().addAll((Collection<? extends String>)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) - { - switch (featureID) - { - case ComponentMappingPackage.CONVERTER_TYPE_INFO___CONVERTER_ID: - setConverterId(CONVERTER_ID_EDEFAULT); - return; - case ComponentMappingPackage.CONVERTER_TYPE_INFO___FOR_CLASSES: - getForClasses().clear(); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) - { - switch (featureID) - { - case ComponentMappingPackage.CONVERTER_TYPE_INFO___CONVERTER_ID: - return CONVERTER_ID_EDEFAULT == null ? converterId != null : !CONVERTER_ID_EDEFAULT.equals(converterId); - case ComponentMappingPackage.CONVERTER_TYPE_INFO___FOR_CLASSES: - return forClasses != null && !forClasses.isEmpty(); - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public String toString() - { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (converterId: "); //$NON-NLS-1$ - result.append(converterId); - result.append(", forClasses: "); //$NON-NLS-1$ - result.append(forClasses); - result.append(')'); - return result.toString(); - } - -} //ConverterTypeInfo_Impl diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/impl/TagMappingImpl.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/impl/TagMappingImpl.java deleted file mode 100644 index 44f32b5ce..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/impl/TagMappingImpl.java +++ /dev/null @@ -1,294 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: TagMappingImpl.java,v 1.2 2008/11/18 22:23:57 gkessler Exp $ - */ -package org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl; - -import java.util.Collection; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.NotificationChain; - -import org.eclipse.emf.common.util.EList; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.InternalEObject; - -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.impl.EObjectImpl; - -import org.eclipse.emf.ecore.util.EDataTypeUniqueEList; -import org.eclipse.emf.ecore.util.EObjectContainmentEList; -import org.eclipse.emf.ecore.util.InternalEList; - -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagMapping; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagToViewObjectMapping; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Tag Mapping</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.TagMappingImpl#getVersionedTagToViewMappings <em>Versioned Tag To View Mappings</em>}</li> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.TagMappingImpl#getCustomConversionFactoryId <em>Custom Conversion Factory Id</em>}</li> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.TagMappingImpl#getBeanMappedProperties <em>Bean Mapped Properties</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class TagMappingImpl extends EObjectImpl implements TagMapping -{ - /** - * The cached value of the '{@link #getVersionedTagToViewMappings() <em>Versioned Tag To View Mappings</em>}' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getVersionedTagToViewMappings() - * @generated - * @ordered - */ - protected EList<TagToViewObjectMapping> versionedTagToViewMappings; - - /** - * The default value of the '{@link #getCustomConversionFactoryId() <em>Custom Conversion Factory Id</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getCustomConversionFactoryId() - * @generated - * @ordered - */ - protected static final String CUSTOM_CONVERSION_FACTORY_ID_EDEFAULT = null; - /** - * The cached value of the '{@link #getCustomConversionFactoryId() <em>Custom Conversion Factory Id</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getCustomConversionFactoryId() - * @generated - * @ordered - */ - protected String customConversionFactoryId = CUSTOM_CONVERSION_FACTORY_ID_EDEFAULT; - - /** - * The cached value of the '{@link #getBeanMappedProperties() <em>Bean Mapped Properties</em>}' attribute list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getBeanMappedProperties() - * @generated - * @ordered - */ - protected EList<String> beanMappedProperties; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TagMappingImpl() - { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() - { - return ComponentMappingPackage.Literals.TAG_MAPPING; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EList<TagToViewObjectMapping> getVersionedTagToViewMappings() - { - if (versionedTagToViewMappings == null) - { - versionedTagToViewMappings = new EObjectContainmentEList<TagToViewObjectMapping>(TagToViewObjectMapping.class, this, ComponentMappingPackage.TAG_MAPPING__VERSIONED_TAG_TO_VIEW_MAPPINGS); - } - return versionedTagToViewMappings; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getCustomConversionFactoryId() - { - return customConversionFactoryId; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setCustomConversionFactoryId(String newCustomConversionFactoryId) - { - String oldCustomConversionFactoryId = customConversionFactoryId; - customConversionFactoryId = newCustomConversionFactoryId; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, ComponentMappingPackage.TAG_MAPPING__CUSTOM_CONVERSION_FACTORY_ID, oldCustomConversionFactoryId, customConversionFactoryId)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EList<String> getBeanMappedProperties() - { - if (beanMappedProperties == null) - { - beanMappedProperties = new EDataTypeUniqueEList<String>(String.class, this, ComponentMappingPackage.TAG_MAPPING__BEAN_MAPPED_PROPERTIES); - } - return beanMappedProperties; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void findBestMapping(String jsfVersion, String libVersion) - { - // TODO: implement this method - // Ensure that you remove @generated or mark it @generated NOT - throw new UnsupportedOperationException(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) - { - switch (featureID) - { - case ComponentMappingPackage.TAG_MAPPING__VERSIONED_TAG_TO_VIEW_MAPPINGS: - return ((InternalEList<?>)getVersionedTagToViewMappings()).basicRemove(otherEnd, msgs); - } - return super.eInverseRemove(otherEnd, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) - { - switch (featureID) - { - case ComponentMappingPackage.TAG_MAPPING__VERSIONED_TAG_TO_VIEW_MAPPINGS: - return getVersionedTagToViewMappings(); - case ComponentMappingPackage.TAG_MAPPING__CUSTOM_CONVERSION_FACTORY_ID: - return getCustomConversionFactoryId(); - case ComponentMappingPackage.TAG_MAPPING__BEAN_MAPPED_PROPERTIES: - return getBeanMappedProperties(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @SuppressWarnings("unchecked") - @Override - public void eSet(int featureID, Object newValue) - { - switch (featureID) - { - case ComponentMappingPackage.TAG_MAPPING__VERSIONED_TAG_TO_VIEW_MAPPINGS: - getVersionedTagToViewMappings().clear(); - getVersionedTagToViewMappings().addAll((Collection<? extends TagToViewObjectMapping>)newValue); - return; - case ComponentMappingPackage.TAG_MAPPING__CUSTOM_CONVERSION_FACTORY_ID: - setCustomConversionFactoryId((String)newValue); - return; - case ComponentMappingPackage.TAG_MAPPING__BEAN_MAPPED_PROPERTIES: - getBeanMappedProperties().clear(); - getBeanMappedProperties().addAll((Collection<? extends String>)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) - { - switch (featureID) - { - case ComponentMappingPackage.TAG_MAPPING__VERSIONED_TAG_TO_VIEW_MAPPINGS: - getVersionedTagToViewMappings().clear(); - return; - case ComponentMappingPackage.TAG_MAPPING__CUSTOM_CONVERSION_FACTORY_ID: - setCustomConversionFactoryId(CUSTOM_CONVERSION_FACTORY_ID_EDEFAULT); - return; - case ComponentMappingPackage.TAG_MAPPING__BEAN_MAPPED_PROPERTIES: - getBeanMappedProperties().clear(); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) - { - switch (featureID) - { - case ComponentMappingPackage.TAG_MAPPING__VERSIONED_TAG_TO_VIEW_MAPPINGS: - return versionedTagToViewMappings != null && !versionedTagToViewMappings.isEmpty(); - case ComponentMappingPackage.TAG_MAPPING__CUSTOM_CONVERSION_FACTORY_ID: - return CUSTOM_CONVERSION_FACTORY_ID_EDEFAULT == null ? customConversionFactoryId != null : !CUSTOM_CONVERSION_FACTORY_ID_EDEFAULT.equals(customConversionFactoryId); - case ComponentMappingPackage.TAG_MAPPING__BEAN_MAPPED_PROPERTIES: - return beanMappedProperties != null && !beanMappedProperties.isEmpty(); - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public String toString() - { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (customConversionFactoryId: "); //$NON-NLS-1$ - result.append(customConversionFactoryId); - result.append(", beanMappedProperties: "); //$NON-NLS-1$ - result.append(beanMappedProperties); - result.append(')'); - return result.toString(); - } - -} //TagMappingImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/impl/TagToViewObjectMappingImpl.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/impl/TagToViewObjectMappingImpl.java deleted file mode 100644 index de7b3321e..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/impl/TagToViewObjectMappingImpl.java +++ /dev/null @@ -1,314 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: TagToViewObjectMappingImpl.java,v 1.2 2008/11/18 22:23:57 gkessler Exp $ - */ -package org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl; - -import org.eclipse.emf.common.notify.Notification; - -import org.eclipse.emf.common.notify.NotificationChain; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.InternalEObject; - -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.impl.EObjectImpl; - -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ClassTypeInfo_; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagToViewObjectMapping; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Tag To View Object Mapping</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.TagToViewObjectMappingImpl#getTypeInfo <em>Type Info</em>}</li> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.TagToViewObjectMappingImpl#getMinJSFVersion <em>Min JSF Version</em>}</li> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.TagToViewObjectMappingImpl#getMinLibraryVersion <em>Min Library Version</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class TagToViewObjectMappingImpl extends EObjectImpl implements TagToViewObjectMapping -{ - /** - * The cached value of the '{@link #getTypeInfo() <em>Type Info</em>}' containment reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getTypeInfo() - * @generated - * @ordered - */ - protected ClassTypeInfo_ typeInfo; - - /** - * The default value of the '{@link #getMinJSFVersion() <em>Min JSF Version</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getMinJSFVersion() - * @generated - * @ordered - */ - protected static final String MIN_JSF_VERSION_EDEFAULT = "1.1"; //$NON-NLS-1$ - - /** - * The cached value of the '{@link #getMinJSFVersion() <em>Min JSF Version</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getMinJSFVersion() - * @generated - * @ordered - */ - protected String minJSFVersion = MIN_JSF_VERSION_EDEFAULT; - - /** - * The default value of the '{@link #getMinLibraryVersion() <em>Min Library Version</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getMinLibraryVersion() - * @generated - * @ordered - */ - protected static final String MIN_LIBRARY_VERSION_EDEFAULT = ""; //$NON-NLS-1$ - - /** - * The cached value of the '{@link #getMinLibraryVersion() <em>Min Library Version</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getMinLibraryVersion() - * @generated - * @ordered - */ - protected String minLibraryVersion = MIN_LIBRARY_VERSION_EDEFAULT; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TagToViewObjectMappingImpl() - { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() - { - return ComponentMappingPackage.Literals.TAG_TO_VIEW_OBJECT_MAPPING; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ClassTypeInfo_ getTypeInfo() - { - return typeInfo; - } - - /** - * <!-- begin-user-doc --> - * @param newTypeInfo - * @param msgs - * @return the notification chain - * <!-- end-user-doc --> - * @generated - */ - public NotificationChain basicSetTypeInfo(ClassTypeInfo_ newTypeInfo, NotificationChain msgs) - { - ClassTypeInfo_ oldTypeInfo = typeInfo; - typeInfo = newTypeInfo; - if (eNotificationRequired()) - { - ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ComponentMappingPackage.TAG_TO_VIEW_OBJECT_MAPPING__TYPE_INFO, oldTypeInfo, newTypeInfo); - if (msgs == null) msgs = notification; else msgs.add(notification); - } - return msgs; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setTypeInfo(ClassTypeInfo_ newTypeInfo) - { - if (newTypeInfo != typeInfo) - { - NotificationChain msgs = null; - if (typeInfo != null) - msgs = ((InternalEObject)typeInfo).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ComponentMappingPackage.TAG_TO_VIEW_OBJECT_MAPPING__TYPE_INFO, null, msgs); - if (newTypeInfo != null) - msgs = ((InternalEObject)newTypeInfo).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ComponentMappingPackage.TAG_TO_VIEW_OBJECT_MAPPING__TYPE_INFO, null, msgs); - msgs = basicSetTypeInfo(newTypeInfo, msgs); - if (msgs != null) msgs.dispatch(); - } - else if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, ComponentMappingPackage.TAG_TO_VIEW_OBJECT_MAPPING__TYPE_INFO, newTypeInfo, newTypeInfo)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getMinJSFVersion() - { - return minJSFVersion; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setMinJSFVersion(String newMinJSFVersion) - { - String oldMinJSFVersion = minJSFVersion; - minJSFVersion = newMinJSFVersion; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, ComponentMappingPackage.TAG_TO_VIEW_OBJECT_MAPPING__MIN_JSF_VERSION, oldMinJSFVersion, minJSFVersion)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getMinLibraryVersion() - { - return minLibraryVersion; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setMinLibraryVersion(String newMinLibraryVersion) - { - String oldMinLibraryVersion = minLibraryVersion; - minLibraryVersion = newMinLibraryVersion; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, ComponentMappingPackage.TAG_TO_VIEW_OBJECT_MAPPING__MIN_LIBRARY_VERSION, oldMinLibraryVersion, minLibraryVersion)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) - { - switch (featureID) - { - case ComponentMappingPackage.TAG_TO_VIEW_OBJECT_MAPPING__TYPE_INFO: - return basicSetTypeInfo(null, msgs); - } - return super.eInverseRemove(otherEnd, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) - { - switch (featureID) - { - case ComponentMappingPackage.TAG_TO_VIEW_OBJECT_MAPPING__TYPE_INFO: - return getTypeInfo(); - case ComponentMappingPackage.TAG_TO_VIEW_OBJECT_MAPPING__MIN_JSF_VERSION: - return getMinJSFVersion(); - case ComponentMappingPackage.TAG_TO_VIEW_OBJECT_MAPPING__MIN_LIBRARY_VERSION: - return getMinLibraryVersion(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eSet(int featureID, Object newValue) - { - switch (featureID) - { - case ComponentMappingPackage.TAG_TO_VIEW_OBJECT_MAPPING__TYPE_INFO: - setTypeInfo((ClassTypeInfo_)newValue); - return; - case ComponentMappingPackage.TAG_TO_VIEW_OBJECT_MAPPING__MIN_JSF_VERSION: - setMinJSFVersion((String)newValue); - return; - case ComponentMappingPackage.TAG_TO_VIEW_OBJECT_MAPPING__MIN_LIBRARY_VERSION: - setMinLibraryVersion((String)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) - { - switch (featureID) - { - case ComponentMappingPackage.TAG_TO_VIEW_OBJECT_MAPPING__TYPE_INFO: - setTypeInfo((ClassTypeInfo_)null); - return; - case ComponentMappingPackage.TAG_TO_VIEW_OBJECT_MAPPING__MIN_JSF_VERSION: - setMinJSFVersion(MIN_JSF_VERSION_EDEFAULT); - return; - case ComponentMappingPackage.TAG_TO_VIEW_OBJECT_MAPPING__MIN_LIBRARY_VERSION: - setMinLibraryVersion(MIN_LIBRARY_VERSION_EDEFAULT); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) - { - switch (featureID) - { - case ComponentMappingPackage.TAG_TO_VIEW_OBJECT_MAPPING__TYPE_INFO: - return typeInfo != null; - case ComponentMappingPackage.TAG_TO_VIEW_OBJECT_MAPPING__MIN_JSF_VERSION: - return MIN_JSF_VERSION_EDEFAULT == null ? minJSFVersion != null : !MIN_JSF_VERSION_EDEFAULT.equals(minJSFVersion); - case ComponentMappingPackage.TAG_TO_VIEW_OBJECT_MAPPING__MIN_LIBRARY_VERSION: - return MIN_LIBRARY_VERSION_EDEFAULT == null ? minLibraryVersion != null : !MIN_LIBRARY_VERSION_EDEFAULT.equals(minLibraryVersion); - } - return super.eIsSet(featureID); - } - - @Override - public String toString() - { - return "TagToViewObjectMapping: typeInfo="+getTypeInfo(); //$NON-NLS-1$ - } -} //TagToViewObjectMappingImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/impl/ValidatorTypeInfo_Impl.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/impl/ValidatorTypeInfo_Impl.java deleted file mode 100644 index 2aca75466..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/impl/ValidatorTypeInfo_Impl.java +++ /dev/null @@ -1,180 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: ValidatorTypeInfo_Impl.java,v 1.2 2008/11/18 22:23:57 gkessler Exp $ - */ -package org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl; - -import org.eclipse.emf.common.notify.Notification; - -import org.eclipse.emf.ecore.EClass; - -import org.eclipse.emf.ecore.impl.ENotificationImpl; - -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ValidatorTypeInfo_; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Validator Type Info </b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.impl.ValidatorTypeInfo_Impl#getValidatorId <em>Validator Id</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class ValidatorTypeInfo_Impl extends ClassTypeInfo_Impl implements ValidatorTypeInfo_ -{ - /** - * The default value of the '{@link #getValidatorId() <em>Validator Id</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getValidatorId() - * @generated - * @ordered - */ - protected static final String VALIDATOR_ID_EDEFAULT = null; - - /** - * The cached value of the '{@link #getValidatorId() <em>Validator Id</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getValidatorId() - * @generated - * @ordered - */ - protected String validatorId = VALIDATOR_ID_EDEFAULT; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ValidatorTypeInfo_Impl() - { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() - { - return ComponentMappingPackage.Literals.VALIDATOR_TYPE_INFO_; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getValidatorId() - { - return validatorId; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setValidatorId(String newValidatorId) - { - String oldValidatorId = validatorId; - validatorId = newValidatorId; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, ComponentMappingPackage.VALIDATOR_TYPE_INFO___VALIDATOR_ID, oldValidatorId, validatorId)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) - { - switch (featureID) - { - case ComponentMappingPackage.VALIDATOR_TYPE_INFO___VALIDATOR_ID: - return getValidatorId(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eSet(int featureID, Object newValue) - { - switch (featureID) - { - case ComponentMappingPackage.VALIDATOR_TYPE_INFO___VALIDATOR_ID: - setValidatorId((String)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) - { - switch (featureID) - { - case ComponentMappingPackage.VALIDATOR_TYPE_INFO___VALIDATOR_ID: - setValidatorId(VALIDATOR_ID_EDEFAULT); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) - { - switch (featureID) - { - case ComponentMappingPackage.VALIDATOR_TYPE_INFO___VALIDATOR_ID: - return VALIDATOR_ID_EDEFAULT == null ? validatorId != null : !VALIDATOR_ID_EDEFAULT.equals(validatorId); - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public String toString() - { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (validatorId: "); //$NON-NLS-1$ - result.append(validatorId); - result.append(')'); - return result.toString(); - } - -} //ValidatorTypeInfo_Impl diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/util/ComponentMappingAdapterFactory.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/util/ComponentMappingAdapterFactory.java deleted file mode 100644 index 767687908..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/util/ComponentMappingAdapterFactory.java +++ /dev/null @@ -1,256 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: ComponentMappingAdapterFactory.java,v 1.1 2008/05/12 17:42:21 cbateman Exp $ - */ -package org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.util; - -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.common.notify.Notifier; - -import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; - -import org.eclipse.emf.ecore.EObject; - -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.*; - -/** - * <!-- begin-user-doc --> - * The <b>Adapter Factory</b> for the model. - * It provides an adapter <code>createXXX</code> method for each class of the model. - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage - * @generated - */ -public class ComponentMappingAdapterFactory extends AdapterFactoryImpl -{ - /** - * The cached model package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected static ComponentMappingPackage modelPackage; - - /** - * Creates an instance of the adapter factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ComponentMappingAdapterFactory() - { - if (modelPackage == null) - { - modelPackage = ComponentMappingPackage.eINSTANCE; - } - } - - /** - * Returns whether this factory is applicable for the type of the object. - * <!-- begin-user-doc --> - * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model. - * <!-- end-user-doc --> - * @return whether this factory is applicable for the type of the object. - * @generated - */ - @Override - public boolean isFactoryForType(Object object) - { - if (object == modelPackage) - { - return true; - } - if (object instanceof EObject) - { - return ((EObject)object).eClass().getEPackage() == modelPackage; - } - return false; - } - - /** - * The switch that delegates to the <code>createXXX</code> methods. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ComponentMappingSwitch<Adapter> modelSwitch = - new ComponentMappingSwitch<Adapter>() - { - @Override - public Adapter caseTagMapping(TagMapping object) - { - return createTagMappingAdapter(); - } - @Override - public Adapter caseTagToViewObjectMapping(TagToViewObjectMapping object) - { - return createTagToViewObjectMappingAdapter(); - } - @Override - public Adapter caseClassTypeInfo_(ClassTypeInfo_ object) - { - return createClassTypeInfo_Adapter(); - } - @Override - public Adapter caseComponentTypeInfo_(ComponentTypeInfo_ object) - { - return createComponentTypeInfo_Adapter(); - } - @Override - public Adapter caseConverterTypeInfo_(ConverterTypeInfo_ object) - { - return createConverterTypeInfo_Adapter(); - } - @Override - public Adapter caseValidatorTypeInfo_(ValidatorTypeInfo_ object) - { - return createValidatorTypeInfo_Adapter(); - } - @Override - public Adapter caseAttributeToPropertyMapping(AttributeToPropertyMapping object) - { - return createAttributeToPropertyMappingAdapter(); - } - @Override - public Adapter defaultCase(EObject object) - { - return createEObjectAdapter(); - } - }; - - /** - * Creates an adapter for the <code>target</code>. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param target the object to adapt. - * @return the adapter for the <code>target</code>. - * @generated - */ - @Override - public Adapter createAdapter(Notifier target) - { - return modelSwitch.doSwitch((EObject)target); - } - - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagMapping <em>Tag Mapping</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagMapping - * @generated - */ - public Adapter createTagMappingAdapter() - { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagToViewObjectMapping <em>Tag To View Object Mapping</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagToViewObjectMapping - * @generated - */ - public Adapter createTagToViewObjectMappingAdapter() - { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ClassTypeInfo_ <em>Class Type Info </em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ClassTypeInfo_ - * @generated - */ - public Adapter createClassTypeInfo_Adapter() - { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentTypeInfo_ <em>Component Type Info </em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentTypeInfo_ - * @generated - */ - public Adapter createComponentTypeInfo_Adapter() - { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ConverterTypeInfo_ <em>Converter Type Info </em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ConverterTypeInfo_ - * @generated - */ - public Adapter createConverterTypeInfo_Adapter() - { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ValidatorTypeInfo_ <em>Validator Type Info </em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ValidatorTypeInfo_ - * @generated - */ - public Adapter createValidatorTypeInfo_Adapter() - { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.AttributeToPropertyMapping <em>Attribute To Property Mapping</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.AttributeToPropertyMapping - * @generated - */ - public Adapter createAttributeToPropertyMappingAdapter() - { - return null; - } - - /** - * Creates a new adapter for the default case. - * <!-- begin-user-doc --> - * This default implementation returns null. - * <!-- end-user-doc --> - * @return the new adapter. - * @generated - */ - public Adapter createEObjectAdapter() - { - return null; - } - -} //ComponentMappingAdapterFactory diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/util/ComponentMappingResourceFactoryImpl.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/util/ComponentMappingResourceFactoryImpl.java deleted file mode 100644 index 08f2fbf27..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/util/ComponentMappingResourceFactoryImpl.java +++ /dev/null @@ -1,59 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: ComponentMappingResourceFactoryImpl.java,v 1.1 2008/05/12 17:42:21 cbateman Exp $ - */ -package org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.util; - -import org.eclipse.emf.common.util.URI; - -import org.eclipse.emf.ecore.resource.Resource; - -import org.eclipse.emf.ecore.resource.impl.ResourceFactoryImpl; - -import org.eclipse.emf.ecore.xmi.XMLResource; - -/** - * <!-- begin-user-doc --> - * The <b>Resource Factory</b> associated with the package. - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.util.ComponentMappingResourceImpl - * @generated - */ -public class ComponentMappingResourceFactoryImpl extends ResourceFactoryImpl -{ - /** - * Creates an instance of the resource factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ComponentMappingResourceFactoryImpl() - { - super(); - } - - /** - * Creates an instance of the resource. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Resource createResource(URI uri) - { - XMLResource result = new ComponentMappingResourceImpl(uri); - result.getDefaultSaveOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE); - result.getDefaultLoadOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE); - - result.getDefaultSaveOptions().put(XMLResource.OPTION_SCHEMA_LOCATION, Boolean.TRUE); - - result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, Boolean.TRUE); - result.getDefaultSaveOptions().put(XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, Boolean.TRUE); - - result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_LEXICAL_HANDLER, Boolean.TRUE); - return result; - } - -} //ComponentMappingResourceFactoryImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/util/ComponentMappingResourceImpl.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/util/ComponentMappingResourceImpl.java deleted file mode 100644 index 8d3c819df..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/util/ComponentMappingResourceImpl.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: ComponentMappingResourceImpl.java,v 1.1 2008/05/12 17:42:21 cbateman Exp $ - */ -package org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.util; - -import org.eclipse.emf.common.util.URI; - -import org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl; - -/** - * <!-- begin-user-doc --> - * The <b>Resource </b> associated with the package. - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.util.ComponentMappingResourceFactoryImpl - * @generated - */ -public class ComponentMappingResourceImpl extends XMLResourceImpl -{ - /** - * Creates an instance of the resource. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param uri the URI of the new resource. - * @generated - */ - public ComponentMappingResourceImpl(URI uri) - { - super(uri); - } - -} //ComponentMappingResourceImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/util/ComponentMappingSwitch.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/util/ComponentMappingSwitch.java deleted file mode 100644 index 3de410697..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/util/ComponentMappingSwitch.java +++ /dev/null @@ -1,286 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: ComponentMappingSwitch.java,v 1.1 2008/05/12 17:42:21 cbateman Exp $ - */ -package org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.util; - -import java.util.List; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; - -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.*; - -/** - * <!-- begin-user-doc --> - * The <b>Switch</b> for the model's inheritance hierarchy. - * It supports the call {@link #doSwitch(EObject) doSwitch(object)} - * to invoke the <code>caseXXX</code> method for each class of the model, - * starting with the actual class of the object - * and proceeding up the inheritance hierarchy - * until a non-null result is returned, - * which is the result of the switch. - * @param <T> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage - * @generated - */ -public class ComponentMappingSwitch<T> -{ - /** - * The cached model package - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected static ComponentMappingPackage modelPackage; - - /** - * Creates an instance of the switch. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ComponentMappingSwitch() - { - if (modelPackage == null) - { - modelPackage = ComponentMappingPackage.eINSTANCE; - } - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * @param theEObject - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - public T doSwitch(EObject theEObject) - { - return doSwitch(theEObject.eClass(), theEObject); - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * @param theEClass - * @param theEObject - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - protected T doSwitch(EClass theEClass, EObject theEObject) - { - if (theEClass.eContainer() == modelPackage) - { - return doSwitch(theEClass.getClassifierID(), theEObject); - } - List<EClass> eSuperTypes = theEClass.getESuperTypes(); - return - eSuperTypes.isEmpty() ? - defaultCase(theEObject) : - doSwitch(eSuperTypes.get(0), theEObject); - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * @param classifierID - * @param theEObject - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - protected T doSwitch(int classifierID, EObject theEObject) - { - switch (classifierID) - { - case ComponentMappingPackage.TAG_MAPPING: - { - TagMapping tagMapping = (TagMapping)theEObject; - T result = caseTagMapping(tagMapping); - if (result == null) result = defaultCase(theEObject); - return result; - } - case ComponentMappingPackage.TAG_TO_VIEW_OBJECT_MAPPING: - { - TagToViewObjectMapping tagToViewObjectMapping = (TagToViewObjectMapping)theEObject; - T result = caseTagToViewObjectMapping(tagToViewObjectMapping); - if (result == null) result = defaultCase(theEObject); - return result; - } - case ComponentMappingPackage.CLASS_TYPE_INFO_: - { - ClassTypeInfo_ classTypeInfo_ = (ClassTypeInfo_)theEObject; - T result = caseClassTypeInfo_(classTypeInfo_); - if (result == null) result = defaultCase(theEObject); - return result; - } - case ComponentMappingPackage.COMPONENT_TYPE_INFO_: - { - ComponentTypeInfo_ componentTypeInfo_ = (ComponentTypeInfo_)theEObject; - T result = caseComponentTypeInfo_(componentTypeInfo_); - if (result == null) result = caseClassTypeInfo_(componentTypeInfo_); - if (result == null) result = defaultCase(theEObject); - return result; - } - case ComponentMappingPackage.CONVERTER_TYPE_INFO_: - { - ConverterTypeInfo_ converterTypeInfo_ = (ConverterTypeInfo_)theEObject; - T result = caseConverterTypeInfo_(converterTypeInfo_); - if (result == null) result = caseClassTypeInfo_(converterTypeInfo_); - if (result == null) result = defaultCase(theEObject); - return result; - } - case ComponentMappingPackage.VALIDATOR_TYPE_INFO_: - { - ValidatorTypeInfo_ validatorTypeInfo_ = (ValidatorTypeInfo_)theEObject; - T result = caseValidatorTypeInfo_(validatorTypeInfo_); - if (result == null) result = caseClassTypeInfo_(validatorTypeInfo_); - if (result == null) result = defaultCase(theEObject); - return result; - } - case ComponentMappingPackage.ATTRIBUTE_TO_PROPERTY_MAPPING: - { - AttributeToPropertyMapping attributeToPropertyMapping = (AttributeToPropertyMapping)theEObject; - T result = caseAttributeToPropertyMapping(attributeToPropertyMapping); - if (result == null) result = defaultCase(theEObject); - return result; - } - default: return defaultCase(theEObject); - } - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Tag Mapping</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Tag Mapping</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseTagMapping(TagMapping object) - { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Tag To View Object Mapping</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Tag To View Object Mapping</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseTagToViewObjectMapping(TagToViewObjectMapping object) - { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Class Type Info </em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Class Type Info </em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseClassTypeInfo_(ClassTypeInfo_ object) - { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Component Type Info </em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Component Type Info </em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseComponentTypeInfo_(ComponentTypeInfo_ object) - { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Converter Type Info </em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Converter Type Info </em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseConverterTypeInfo_(ConverterTypeInfo_ object) - { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Validator Type Info </em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Validator Type Info </em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseValidatorTypeInfo_(ValidatorTypeInfo_ object) - { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Attribute To Property Mapping</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Attribute To Property Mapping</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseAttributeToPropertyMapping(AttributeToPropertyMapping object) - { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch, but this is the last case anyway. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>EObject</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) - * @generated - */ - public T defaultCase(EObject object) - { - return null; - } - -} //ComponentMappingSwitch diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/util/ComponentMappingXMLProcessor.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/util/ComponentMappingXMLProcessor.java deleted file mode 100644 index 0280c4e09..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/mapping/viewmapping/util/ComponentMappingXMLProcessor.java +++ /dev/null @@ -1,58 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: ComponentMappingXMLProcessor.java,v 1.1 2008/05/12 17:42:21 cbateman Exp $ - */ -package org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.util; - -import java.util.Map; - -import org.eclipse.emf.ecore.EPackage; - -import org.eclipse.emf.ecore.resource.Resource; - -import org.eclipse.emf.ecore.xmi.util.XMLProcessor; - -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.ComponentMappingPackage; - -/** - * This class contains helper methods to serialize and deserialize XML documents - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -public class ComponentMappingXMLProcessor extends XMLProcessor -{ - - /** - * Public constructor to instantiate the helper. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ComponentMappingXMLProcessor() - { - super((EPackage.Registry.INSTANCE)); - ComponentMappingPackage.eINSTANCE.eClass(); - } - - /** - * Register for "*" and "xml" file extensions the ComponentMappingResourceFactoryImpl factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected Map<String, Resource.Factory> getRegistrations() - { - if (registrations == null) - { - super.getRegistrations(); - registrations.put(XML_EXTENSION, new ComponentMappingResourceFactoryImpl()); - registrations.put(STAR_EXTENSION, new ComponentMappingResourceFactoryImpl()); - } - return registrations; - } - -} //ComponentMappingXMLProcessor diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/AbstractTagRegistry.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/AbstractTagRegistry.java deleted file mode 100644 index 50d932830..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/AbstractTagRegistry.java +++ /dev/null @@ -1,149 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.model; - -import java.util.Collection; -import java.util.List; -import java.util.concurrent.CopyOnWriteArrayList; -import java.util.concurrent.atomic.AtomicBoolean; - -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.jst.jsf.common.internal.RunOnCompletionPattern; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.Namespace; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; - -/** - * The abstract registry that all implementations of ITagRegistry should - * sub-class. - * - * @author cbateman - * - */ -public abstract class AbstractTagRegistry implements ITagRegistry -{ - private final List<ITagRegistryListener> _listeners; - private final AtomicBoolean _isDisposed = new AtomicBoolean( - false); - - /** - * - */ - protected AbstractTagRegistry() - { - super(); - _listeners = new CopyOnWriteArrayList<ITagRegistryListener>(); - } - - public final void addListener(final ITagRegistryListener listener) - { - if (!_listeners.contains(listener)) - { - _listeners.add(listener); - } - } - - public final void removeListener(final ITagRegistryListener listener) - { - _listeners.remove(listener); - } - - /** - * @param event - */ - protected final void fireEvent(final TagRegistryChangeEvent event) - { - for (final ITagRegistryListener listener : _listeners) - { - try - { - listener.registryChanged(event); - } - catch (final Exception e) - { - JSFCorePlugin.log(new Exception(e), - "During change event notification"); //$NON-NLS-1$ - } - } - } - - public abstract Collection<? extends Namespace> getAllTagLibraries(); - - public abstract Namespace getTagLibrary(String uri); - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.jsf.designtime.internal.view.model.jsp.registry.ITagRegistry#isDisposed() - */ - public final boolean isDisposed() - { - return _isDisposed.get(); - } - - /** - * - */ - public final void destroy() - { - cleanupPersistentState(); - dispose(); - } - - /** - * Called by destroy before it calls dispose. Sub-class should - * invalidate, and ideally delete, any persistent state. - * - * NOTE: DO NOT call dispose functionality from this call. The framework - * will call dispose() immediately after cleanupPersistentState. - */ - protected abstract void cleanupPersistentState(); - - /** - * Must be factories or caches when disposing the registry. Instances - * must implement doDispose to provide their specific disposal operations. - */ - public final void dispose() - { - // latch on the isDisposed flag so this block can only ever - // execute once - if (_isDisposed.compareAndSet(false, true)) - { - fireEvent(new TagRegistryChangeEvent(this, - TagRegistryChangeEvent.EventType.REGISTRY_DISPOSED)); - doDispose(); - } - } - - /** - * Implement with instance specific disposal operations. Do do not fire - * the REGISTRY_DISPOSED event from this method (it is done in dispose. - * - * Implementer must assume that this method be called at most once and that - * it is error to access the registry instance after it is called - */ - protected abstract void doDispose(); - - public final void refresh(final Runnable runAfter, final boolean flushCaches) - { - final Job refreshJob = getRefreshJob(flushCaches); - - final RunOnCompletionPattern runPattern = new RunOnCompletionPattern( - refreshJob, runAfter); - runPattern.run(); - } - - /** - * @param flushCaches - * @return a job that, when run, will perform the registry refresh. Job - * must do any necessary synchronizing of internal state. - */ - protected abstract Job getRefreshJob(final boolean flushCaches); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/ITagRegistry.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/ITagRegistry.java deleted file mode 100644 index 7bb3dde8d..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/ITagRegistry.java +++ /dev/null @@ -1,150 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.model; - -import java.util.Collection; -import java.util.Collections; -import java.util.EventListener; -import java.util.EventObject; -import java.util.List; - -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.Namespace; - -/** - * A registry for tags for a given context TODO: generally tied to project, but - * may also need a tie to specific tag-in-use type. For example, if JSPs and - * Facelets are used at the same time? - * - * @author cbateman - * - */ -public interface ITagRegistry -{ - - /** - * @return true if this registry is disposed. It is an error to use a - * disposed registry and behaviour of such a registry is not - * guaranteed. - */ - public abstract boolean isDisposed(); - - /** - * This method may cause long-running operations to be executed. If runAfter - * is non-null, any long running operations will schedule asynchronously on - * a separate thread and on successful completion, runAfter will be executed - * (no assumption should be made about what thread it is run on). - * - * @param runAfter - * @param flushCaches true indicates that any cached data should be flushed. - * - */ - public abstract void refresh(final Runnable runAfter, final boolean flushCaches); - - /** - * Callers should assume the collection is not modifiable. Implementers - * may return a collection whose mutator operations throw exceptions. - * - * @return all tag libraries for a project tag registry - */ - public abstract Collection<? extends Namespace> getAllTagLibraries(); - - /** - * @param uri - * @return the tag library corresponding to uri or null if none. - */ - public abstract Namespace getTagLibrary(final String uri); - - /** - * Adds the listener to the list of objects that receive change events - * from this tag registry instance. If listener is already in the list, - * it will not be added again. - * - * @param listener - */ - public abstract void addListener(ITagRegistryListener listener); - - /** - * Remove listener from the list of objects that receive change events - * from this tag registry instance. - * - * @param listener - */ - public abstract void removeListener(ITagRegistryListener listener); - - - /** - * Marks a listener that receives tag registry change events - * - */ - interface ITagRegistryListener extends EventListener - { - /** - * @param changeEvent - */ - void registryChanged(final TagRegistryChangeEvent changeEvent); - } - - /** - * A change event object that communicates a single type of change to - * a single tag registry - * - */ - static class TagRegistryChangeEvent extends EventObject - { - public enum EventType - { - // if the type is any of these three, then getAffectedObjects() - // will return one or more Namespace objects that have changed. - ADDED_NAMESPACE, - REMOVED_NAMESPACE, - CHANGED_NAMESPACE, - - // if the type is is this one, then the event is being called - // before dispose operation on getSource(). - REGISTRY_DISPOSED - } - /** - * - */ - private static final long serialVersionUID = 6559096306615373552L; - private final List<? extends Namespace> _affectedObjects; - private final EventType _type; - - public TagRegistryChangeEvent(ITagRegistry source, EventType type) - { - this(source, type, Collections.EMPTY_LIST); - } - - public TagRegistryChangeEvent(ITagRegistry source, EventType type, - List<? extends Namespace> affectedObjects) - { - super(source); - _affectedObjects = affectedObjects; - _type = type; - } - - @Override - public ITagRegistry getSource() - { - return (ITagRegistry) super.getSource(); - } - - public List<? extends Namespace> getAffectedObjects() - { - return _affectedObjects; - } - - public EventType getType() - { - return _type; - } - } -}
\ No newline at end of file diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/TagRegistryFactory.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/TagRegistryFactory.java deleted file mode 100644 index ba0f74da1..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/TagRegistryFactory.java +++ /dev/null @@ -1,91 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.model; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.jsf.common.internal.strategy.IIdentifiableStrategy; - -/** - * Creates a tag registry for the given project. The factory may use - * whatever mechanism it chooses and the tag registry may or may not be a - * single instance for project. - * - * @author cbateman - * - */ -public abstract class TagRegistryFactory implements IIdentifiableStrategy<IProject, ITagRegistry, String> -{ - private static final ITagRegistry NO_RESULT = null; - - private static final String ID = "org.eclipse.jst.jsf.designtime.view.model.TagRegistryFactory"; //$NON-NLS-1$ - - /** - * @param project - * @return a tag registry for project. This instance may be a common - * shared per-project singleton. The factory must ensure that the registry - * is cleaned up if the associated project becomes inaccessible (see IProject.isAccessible). - * Return null if none. - * - * @throws TagRegistryFactoryException - */ - public abstract ITagRegistry createTagRegistry(final IProject project) throws TagRegistryFactoryException; - - /** - * @param project - * @return determines whether a particular tag registry is appropriate for - * the project. If there is no valid tag registry for a project (i.e. due - * to lack of facet or bad facet version), return false. - */ - public abstract boolean projectIsValid(final IProject project); - - /** - * Allow - * - * @param project - * @return true if an instance of ITagRegistry already exists for project - */ - public abstract boolean isInstance(final IProject project); - - public final ITagRegistry getNoResult() - { - return NO_RESULT; - } - - public final ITagRegistry perform(IProject project) throws Exception - { - return createTagRegistry(project); - } - - public String getId() - { - return ID; - } - - /** - * Wraps exceptions generated by trying to create a tag registry - */ - public static class TagRegistryFactoryException extends Exception - { - /** - * serializable id - */ - private static final long serialVersionUID = 1361229535611361339L; - - /** - * @param cause - */ - public TagRegistryFactoryException(Throwable cause) - { - super("Problem during tag registry construction", cause); //$NON-NLS-1$ - } - - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/AbstractTagResolvingStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/AbstractTagResolvingStrategy.java deleted file mode 100644 index 637ec963c..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/AbstractTagResolvingStrategy.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.model.jsp; - -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagElement; - -/** - * Implements the tag resolving strategy. - * - * @author cbateman - * - * @param <TLDELEMENT> - * @param <IDTYPE> - */ -public abstract class AbstractTagResolvingStrategy<TLDELEMENT, IDTYPE> - implements ITagResolvingStrategy<TLDELEMENT, IDTYPE> -{ - private final static ITagElement NOT_FOUND_INDICATOR = null; - - public ITagElement getNotFoundIndicator() - { - return NOT_FOUND_INDICATOR; - } - - public abstract ITagElement resolve(TLDELEMENT element); - - public abstract IDTYPE getId(); - - /** - * Must always be the same as resolve. - */ - public final ITagElement perform(TLDELEMENT element) - { - return resolve(element); - } - - /** - * Must always be the same as getNotFoundIndicator. - */ - public final ITagElement getNoResult() - { - return getNotFoundIndicator(); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/CMNodeNamedMapAdapter.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/CMNodeNamedMapAdapter.java deleted file mode 100644 index 1235398ff..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/CMNodeNamedMapAdapter.java +++ /dev/null @@ -1,163 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.model.jsp; - -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.atomic.AtomicBoolean; - -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagAttributeHandler; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.IAttributeAdvisor.UnknownAttributeException; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDElementDeclaration; -import org.eclipse.wst.xml.core.internal.contentmodel.CMAttributeDeclaration; - -/** - * Adapts TLDDocument attributes to a simple map of ITagAttributeHandler. Map is - * unmodifiable. - * - * @author cbateman - * - */ -public class CMNodeNamedMapAdapter implements - Map<String, ITagAttributeHandler> -{ - /** - * serializable id - */ - private static final long serialVersionUID = -4188412823197830484L; - private transient final TLDElementDeclaration _tldElement; - private transient final IAttributeAdvisor _advisor; - private transient final AtomicBoolean _isInitialized = new AtomicBoolean(false); - private final Map<String, ITagAttributeHandler> _cache; - - /** - * @param tldDoc - * @param advisor - */ - public CMNodeNamedMapAdapter(final TLDElementDeclaration tldDoc, - final IAttributeAdvisor advisor) - { - _tldElement = tldDoc; - _advisor = advisor; - _cache = new HashMap<String, ITagAttributeHandler>(); - } - - public boolean containsKey(Object key) - { - ensureAllAttributes(); - return _cache.containsKey(key); - } - - public boolean containsValue(Object value) - { - ensureAllAttributes(); - return _cache.containsValue(value); - } - - public Set<java.util.Map.Entry<String, ITagAttributeHandler>> entrySet() - { - ensureAllAttributes(); - return _cache.entrySet(); - } - - - public ITagAttributeHandler get(Object key) - { - if (key instanceof String) - { - return getOrCreateAttribute((String) key); - } - return null; - } - - public boolean isEmpty() - { - return size() == 0; - } - - public Set<String> keySet() - { - ensureAllAttributes(); - return Collections.unmodifiableSet(_cache.keySet()); - } - - public int size() - { - if (_tldElement != null) - { - return _tldElement.getAttributes().getLength(); - } - return _cache.size(); - } - - public Collection<ITagAttributeHandler> values() - { - ensureAllAttributes(); - return Collections.unmodifiableCollection(_cache.values()); - } - - private synchronized ITagAttributeHandler getOrCreateAttribute(final String name) - { - ITagAttributeHandler tagAttr = _cache.get(name); - - if (tagAttr == null) - { - try - { - tagAttr = _advisor.createAttributeHandler(name); - _cache.put(name, tagAttr); - } - catch (UnknownAttributeException e) - { - JSFCorePlugin.log(e, "Trying to get attribute for "+name); //$NON-NLS-1$ - } - } - - return tagAttr; - } - - private void ensureAllAttributes() - { - if (_isInitialized.compareAndSet(false, true)) - { - for (final Iterator it = _tldElement.getAttributes().iterator(); it.hasNext();) - { - final CMAttributeDeclaration attrDecl = (CMAttributeDeclaration) it.next(); - getOrCreateAttribute(attrDecl.getAttrName()); - } - } - } - - public void clear() - { - throw new UnsupportedOperationException("Cannot modify map"); //$NON-NLS-1$ - } - - public ITagAttributeHandler put(String key, ITagAttributeHandler value) - { - throw new UnsupportedOperationException("Cannot modify map"); //$NON-NLS-1$ - } - - public void putAll(Map<? extends String, ? extends ITagAttributeHandler> t) - { - throw new UnsupportedOperationException("Cannot modify map"); //$NON-NLS-1$ - } - - public ITagAttributeHandler remove(Object key) - { - throw new UnsupportedOperationException("Cannot modify map"); //$NON-NLS-1$ - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/CompositeTagResolvingStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/CompositeTagResolvingStrategy.java deleted file mode 100644 index 8037ff1a2..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/CompositeTagResolvingStrategy.java +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.model.jsp; - -import org.eclipse.jst.jsf.common.internal.policy.IIdentifiable; -import org.eclipse.jst.jsf.common.internal.policy.IIteratorPolicy; -import org.eclipse.jst.jsf.common.internal.strategy.IteratorPolicyBasedStrategyComposite; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagElement; -import org.eclipse.jst.jsf.designtime.internal.Messages; - -/** - * @author cbateman - * - * @param <TLDELEMENT> - */ -public class CompositeTagResolvingStrategy<TLDELEMENT> - extends - IteratorPolicyBasedStrategyComposite<TLDELEMENT, ITagElement, ITagElement, String, ITagResolvingStrategy<TLDELEMENT, String>> - implements IIdentifiable<String>, - ITagResolvingStrategy<TLDELEMENT, String> -{ - private static final String ID = "org.eclipse.jst.jsf.designtime.CompositeTagResolvingStrategy"; //$NON-NLS-1$ - - /** - * @param policy - * - */ - public CompositeTagResolvingStrategy(final IIteratorPolicy<String> policy) - { - super(policy); - } - - public final String getId() - { - return ID; - } - - public final String getDisplayName() - { - return Messages.CompositeTagResolvingStrategy_DisplayName; - } - - @Override - public ITagElement getNoResult() - { - return null; - } - - public final ITagElement getNotFoundIndicator() - { - return getNoResult(); - } - - public final ITagElement resolve(TLDELEMENT element) - { - return perform(element); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/DefaultJSPTagResolver.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/DefaultJSPTagResolver.java deleted file mode 100644 index e34d56d1d..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/DefaultJSPTagResolver.java +++ /dev/null @@ -1,192 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.model.jsp; - -import java.util.Iterator; - -import org.eclipse.core.resources.IProject; -import org.eclipse.emf.common.util.EList; -import org.eclipse.jst.jsf.common.dom.TagIdentifier; -import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentTypeInfo; -import org.eclipse.jst.jsf.common.runtime.internal.model.decorator.ConverterTypeInfo; -import org.eclipse.jst.jsf.common.runtime.internal.model.decorator.ValidatorTypeInfo; -import org.eclipse.jst.jsf.common.runtime.internal.model.types.TypeInfo; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagElement; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.IHandlerTagElement.TagHandlerType; -import org.eclipse.jst.jsf.core.internal.tld.TagIdentifierFactory; -import org.eclipse.jst.jsf.designtime.internal.Messages; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.ViewMetadataLoader; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.ViewMetadataMapper; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagMapping; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagToViewObjectMapping; -import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.IAttributeAdvisor.NullAttributeAdvisor; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDElementDeclaration; -import org.osgi.framework.Version; - -/** - * ** TEMPORARY CLASS UNTIL META-DATA STRATEGY IS AVAILABLE ** - * - * @author cbateman - * - */ -public class DefaultJSPTagResolver extends JSPTagResolvingStrategy -{ - /** - * strategy id - */ - public final static String ID = "org.eclipse.jst.jsf.metadata.DefaultJSPTagResolver"; //$NON-NLS-1$ - /** - * displayable nameb - */ - public final static String DISPLAY_NAME = Messages.DefaultJSPTagResolver_DisplayName; - - private final ViewMetadataLoader _loader; - private final ViewMetadataMapper _mapper; - - /** - * @return the descriptor for this resolver strategy - */ - public static StrategyDescriptor createDescriptor() - { - return new StrategyDescriptor(ID, DISPLAY_NAME); - } - - /** - * @param project - */ - public DefaultJSPTagResolver(final IProject project) - { - _loader = new ViewMetadataLoader(project); - _mapper = new ViewMetadataMapper(); - } - - @Override - public ITagElement resolve(final TLDElementDeclaration elementDecl) - { - // final IProjectFacetVersion version = JSFAppConfigUtils - // .getProjectFacet(_project); - // final String versionAsString = version.getVersionString(); - // final JSFVersion jsfVersion = JSFVersion.valueOfString(versionAsString); - - final TagIdentifier tagId = TagIdentifierFactory - .createTLDTagWrapper(elementDecl); - // final DefaultTagTypeInfo defaultTagTypeInfo = new DefaultTagTypeInfo(); - final TagMapping mapping = _loader.getTagToViewMapping(tagId); - - TypeInfo elementType = null; - if (mapping != null) - { - elementType = findTypeInfo(mapping, "1.1", null); //$NON-NLS-1$ - } - - if (elementType instanceof ComponentTypeInfo) - { - return new TLDComponentTagElement(elementDecl, - (ComponentTypeInfo) elementType, - new MetadataAttributeAdvisor(tagId, _loader, elementDecl)); - } - else if (elementType instanceof ConverterTypeInfo) - { - return new TLDConverterTagElement(elementDecl, - (ConverterTypeInfo) elementType, - new MetadataAttributeAdvisor(tagId, _loader, elementDecl)); - } - else if (elementType instanceof ValidatorTypeInfo) - { - return new TLDValidatorTagElement(elementDecl, - (ValidatorTypeInfo) elementType, - new MetadataAttributeAdvisor(tagId, _loader, elementDecl)); - } - else if (elementType instanceof TagHandlerType) - { - return new TLDTagHandlerElement(elementDecl, - (TagHandlerType) elementType, - new MetadataAttributeAdvisor(tagId, _loader, elementDecl)); - } - else if (DefaultTagTypeInfo.isDefaultLib(tagId.getUri())) - { - return new TLDTagElement(elementDecl, new NullAttributeAdvisor()); - } - - // not found - return null; - } - - private TypeInfo findTypeInfo(final TagMapping mapping, final String jsfVersion, - final String libVersion) - { - final EList list = mapping.getVersionedTagToViewMappings(); - - FIND_BY_VERSION : for (final Iterator<?> it = list.iterator(); it.hasNext();) - { - Object obj = it.next(); - - if (obj instanceof TagToViewObjectMapping) - { - final TagToViewObjectMapping viewMapping = (TagToViewObjectMapping) obj; - - final String minJsfVersionString = viewMapping.getMinJSFVersion(); - if (minJsfVersionString != null) - { - try - { - final Version version = new Version(jsfVersion); - final Version minVersion = Version.parseVersion(minJsfVersionString); - - if (version.compareTo(minVersion) < 0) - { - // my version is less than the minimum specified - // by this meta-data - continue FIND_BY_VERSION; - } - } - catch (final IllegalArgumentException iae) - { - continue FIND_BY_VERSION; - } - } - final String minLibVersionString = viewMapping.getMinLibraryVersion(); - if (libVersion != null && minLibVersionString != null) - { - try - { - final Version version = new Version(libVersion); - final Version minLibVersion = Version.parseVersion(minLibVersionString); - - if (version.compareTo(minLibVersion) < 0) - { - // my lib version is less than the minimum specified - // by the meta-data - continue FIND_BY_VERSION; - } - } - catch (IllegalArgumentException iae) - { - continue FIND_BY_VERSION; - } - } - return _mapper.mapToFrameworkData(viewMapping.getTypeInfo()); - } - } - return null; - } - - @Override - public String getId() - { - return ID; - } - - public String getDisplayName() - { - return DISPLAY_NAME; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/DefaultTagTypeInfo.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/DefaultTagTypeInfo.java deleted file mode 100644 index 6853c82a9..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/DefaultTagTypeInfo.java +++ /dev/null @@ -1,655 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.model.jsp; - -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import org.eclipse.jst.jsf.common.dom.TagIdentifier; -import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentTypeInfo; -import org.eclipse.jst.jsf.common.runtime.internal.model.decorator.ConverterTypeInfo; -import org.eclipse.jst.jsf.common.runtime.internal.model.decorator.ValidatorTypeInfo; -import org.eclipse.jst.jsf.common.runtime.internal.model.types.TypeInfo; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.IHandlerTagElement.TagHandlerType; -import org.eclipse.jst.jsf.core.JSFVersion; -import org.eclipse.jst.jsf.core.internal.tld.IJSFConstants; -import org.eclipse.jst.jsf.core.internal.tld.ITLDConstants; - -/** - * Hard-coded TypeInfo for default core and html JSF tags. - * - * @author cbateman - * - */ -public final class DefaultTagTypeInfo -{ - private final static Set<String> URI_IS_A_JSF_LIB; - - static - { - final Set<String> libs = new HashSet<String>(); - libs.add(ITLDConstants.URI_JSF_CORE); - libs.add(ITLDConstants.URI_JSF_HTML); - URI_IS_A_JSF_LIB = Collections.unmodifiableSet(libs); - } - - /** - * @param tagId - * @param jsfVersion - * @return a type info for the tag id in jsf version or null if none. - */ - public TypeInfo getTypeInfo(final TagIdentifier tagId, - final JSFVersion jsfVersion) - { - - switch (jsfVersion) - { - case V1_0: - case V1_1: - return JSF11_ELEMENTS.get(tagId); - - case V1_2: - return JSF12_ELEMENTS.get(tagId); - - default: - return null; - } - } - - /** - * @param uri - * @return true if uri is covered by this class - */ - public static boolean isDefaultLib(final String uri) - { - return URI_IS_A_JSF_LIB.contains(uri); - } - - private static final ComponentTypeInfo COMPINFO_PARAM = new ComponentTypeInfo( - "javax.faces.Parameter", //$NON-NLS-1$ - "javax.faces.component.UIParameter", //$NON-NLS-1$ - new String[] - { - "javax.faces.component.UIComponentBase", //$NON-NLS-1$ - "javax.faces.component.UIComponent", "java.lang.Object", }, //$NON-NLS-1$ //$NON-NLS-2$ - new String[] - { "javax.faces.component.StateHolder", }, //$NON-NLS-1$ - "javax.faces.Parameter", //$NON-NLS-1$ - null); - - private static final ComponentTypeInfo COMPINFO_SELECTITEM = new ComponentTypeInfo( - "javax.faces.SelectItem", //$NON-NLS-1$ - "javax.faces.component.UISelectItem", //$NON-NLS-1$ - new String[] - { - "javax.faces.component.UIComponentBase", //$NON-NLS-1$ - "javax.faces.component.UIComponent", "java.lang.Object", }, //$NON-NLS-1$ //$NON-NLS-2$ - new String[] - { "javax.faces.component.StateHolder", }, //$NON-NLS-1$ - "javax.faces.SelectItem", //$NON-NLS-1$ - null); - - private static final ComponentTypeInfo COMPINFO_SELECTITEMS = new ComponentTypeInfo( - "javax.faces.SelectItems", //$NON-NLS-1$ - "javax.faces.component.UISelectItems", //$NON-NLS-1$ - new String[] - { - "javax.faces.component.UIComponentBase", //$NON-NLS-1$ - "javax.faces.component.UIComponent", "java.lang.Object", }, //$NON-NLS-1$ //$NON-NLS-2$ - new String[] - { "javax.faces.component.StateHolder", }, //$NON-NLS-1$ - "javax.faces.SelectItems", //$NON-NLS-1$ - null); - - private static final ComponentTypeInfo COMPINFO_SUBVIEW = new ComponentTypeInfo( - "javax.faces.NamingContainer", //$NON-NLS-1$ - "javax.faces.component.UINamingContainer", //$NON-NLS-1$ - new String[] - { - "javax.faces.component.UIComponentBase", //$NON-NLS-1$ - "javax.faces.component.UIComponent", "java.lang.Object", }, //$NON-NLS-1$ //$NON-NLS-2$ - new String[] - { - "javax.faces.component.NamingContainer", //$NON-NLS-1$ - "javax.faces.component.StateHolder", }, //$NON-NLS-1$ - "javax.faces.NamingContainer", //$NON-NLS-1$ - null); - - private static final ComponentTypeInfo COMPINFO_VERBATIM = new ComponentTypeInfo( - "javax.faces.Output", //$NON-NLS-1$ - "javax.faces.component.UIOutput", //$NON-NLS-1$ - new String[] - { - "javax.faces.component.UIComponentBase", //$NON-NLS-1$ - "javax.faces.component.UIComponent", "java.lang.Object", }, //$NON-NLS-1$ //$NON-NLS-2$ - new String[] - { - "javax.faces.component.ValueHolder", //$NON-NLS-1$ - "javax.faces.component.StateHolder", }, //$NON-NLS-1$ - "javax.faces.Output", //$NON-NLS-1$ - "javax.faces.Text"); //$NON-NLS-1$ - - private static final ComponentTypeInfo COMPINFO_VIEW = new ComponentTypeInfo( - "javax.faces.ViewRoot", //$NON-NLS-1$ - "javax.faces.component.UIViewRoot", //$NON-NLS-1$ - new String[] - { - "javax.faces.component.UIComponentBase", //$NON-NLS-1$ - "javax.faces.component.UIComponent", "java.lang.Object", }, //$NON-NLS-1$ //$NON-NLS-2$ - new String[] - { "javax.faces.component.StateHolder", }, //$NON-NLS-1$ - "javax.faces.ViewRoot", //$NON-NLS-1$ - null); - - // expected type info for jsf/html components - private static final ComponentTypeInfo COMPINFO_COLUMN = new ComponentTypeInfo( - "javax.faces.Column", //$NON-NLS-1$ - "javax.faces.component.UIColumn", //$NON-NLS-1$ - new String[] - { - "javax.faces.component.UIComponentBase", //$NON-NLS-1$ - "javax.faces.component.UIComponent", "java.lang.Object" }, //$NON-NLS-1$ //$NON-NLS-2$ - new String[] - { "javax.faces.component.StateHolder" }, //$NON-NLS-1$ - "javax.faces.Column", //$NON-NLS-1$ - null); - private static final ComponentTypeInfo COMPINFO_COMMAND = new ComponentTypeInfo( - "javax.faces.HtmlCommandButton", //$NON-NLS-1$ - "javax.faces.component.html.HtmlCommandButton", //$NON-NLS-1$ - new String[] - { - "javax.faces.component.UICommand", //$NON-NLS-1$ - "javax.faces.component.UIComponentBase", //$NON-NLS-1$ - "javax.faces.component.UIComponent", "java.lang.Object" }, //$NON-NLS-1$ //$NON-NLS-2$ - new String[] - { - "javax.faces.component.ActionSource", //$NON-NLS-1$ - "javax.faces.component.StateHolder" }, //$NON-NLS-1$ - "javax.faces.Command", //$NON-NLS-1$ - "javax.faces.Button"); //$NON-NLS-1$ - private static final ComponentTypeInfo COMPINFO_COMMANDLINK = new ComponentTypeInfo( - "javax.faces.HtmlCommandLink", //$NON-NLS-1$ - "javax.faces.component.html.HtmlCommandLink", //$NON-NLS-1$ - new String[] - { - "javax.faces.component.UICommand", //$NON-NLS-1$ - "javax.faces.component.UIComponentBase", //$NON-NLS-1$ - "javax.faces.component.UIComponent", "java.lang.Object" }, //$NON-NLS-1$ //$NON-NLS-2$ - new String[] - { - "javax.faces.component.ActionSource", //$NON-NLS-1$ - "javax.faces.component.StateHolder" }, //$NON-NLS-1$ - "javax.faces.Command", //$NON-NLS-1$ - "javax.faces.Link"); //$NON-NLS-1$ - private static final ComponentTypeInfo COMPINFO_DATATABLE = new ComponentTypeInfo( - "javax.faces.HtmlDataTable", //$NON-NLS-1$ - "javax.faces.component.html.HtmlDataTable", //$NON-NLS-1$ - new String[] - { - "javax.faces.component.UIData", //$NON-NLS-1$ - "javax.faces.component.UIComponentBase", //$NON-NLS-1$ - "javax.faces.component.UIComponent", "java.lang.Object" }, //$NON-NLS-1$ //$NON-NLS-2$ - new String[] - { - "javax.faces.component.NamingContainer", //$NON-NLS-1$ - "javax.faces.component.StateHolder" }, //$NON-NLS-1$ - "javax.faces.Data", //$NON-NLS-1$ - "javax.faces.Table"); //$NON-NLS-1$ - private static final ComponentTypeInfo COMPINFO_FORM = new ComponentTypeInfo( - "javax.faces.HtmlForm", //$NON-NLS-1$ - "javax.faces.component.html.HtmlForm", //$NON-NLS-1$ - new String[] - { - "javax.faces.component.UIForm", //$NON-NLS-1$ - "javax.faces.component.UIComponentBase", //$NON-NLS-1$ - "javax.faces.component.UIComponent", "java.lang.Object" }, //$NON-NLS-1$ //$NON-NLS-2$ - new String[] - { - "javax.faces.component.NamingContainer", //$NON-NLS-1$ - "javax.faces.component.StateHolder" }, //$NON-NLS-1$ - "javax.faces.Form", //$NON-NLS-1$ - "javax.faces.Form"); //$NON-NLS-1$ - private static final ComponentTypeInfo COMPINFO_GRAPHIC = new ComponentTypeInfo( - "javax.faces.HtmlGraphicImage", //$NON-NLS-1$ - "javax.faces.component.html.HtmlGraphicImage", //$NON-NLS-1$ - new String[] - { - "javax.faces.component.UIGraphic", //$NON-NLS-1$ - "javax.faces.component.UIComponentBase", //$NON-NLS-1$ - "javax.faces.component.UIComponent", "java.lang.Object", }, //$NON-NLS-1$ //$NON-NLS-2$ - new String[] - { "javax.faces.component.StateHolder", }, //$NON-NLS-1$ - "javax.faces.Graphic", //$NON-NLS-1$ - "javax.faces.Image"); //$NON-NLS-1$ - private static final ComponentTypeInfo COMPINFO_HIDDEN = new ComponentTypeInfo( - "javax.faces.HtmlInputHidden", //$NON-NLS-1$ - "javax.faces.component.html.HtmlInputHidden", //$NON-NLS-1$ - new String[] - { - "javax.faces.component.UIInput", "javax.faces.component.UIOutput", //$NON-NLS-1$ //$NON-NLS-2$ - "javax.faces.component.UIComponentBase", //$NON-NLS-1$ - "javax.faces.component.UIComponent", "java.lang.Object", }, //$NON-NLS-1$ //$NON-NLS-2$ - new String[] - { - "javax.faces.component.EditableValueHolder", //$NON-NLS-1$ - "javax.faces.component.ValueHolder", //$NON-NLS-1$ - "javax.faces.component.StateHolder", }, //$NON-NLS-1$ - "javax.faces.Input", //$NON-NLS-1$ - "javax.faces.Hidden"); //$NON-NLS-1$ - private static final ComponentTypeInfo COMPINFO_SECRET = new ComponentTypeInfo( - "javax.faces.HtmlInputSecret", //$NON-NLS-1$ - "javax.faces.component.html.HtmlInputSecret", //$NON-NLS-1$ - new String[] - { - "javax.faces.component.UIInput", "javax.faces.component.UIOutput", //$NON-NLS-1$ //$NON-NLS-2$ - "javax.faces.component.UIComponentBase", //$NON-NLS-1$ - "javax.faces.component.UIComponent", "java.lang.Object", }, //$NON-NLS-1$ //$NON-NLS-2$ - new String[] - { - "javax.faces.component.EditableValueHolder", //$NON-NLS-1$ - "javax.faces.component.ValueHolder", //$NON-NLS-1$ - "javax.faces.component.StateHolder" }, //$NON-NLS-1$ - "javax.faces.Input", //$NON-NLS-1$ - "javax.faces.Secret"); //$NON-NLS-1$ - private static final ComponentTypeInfo COMPINFO_INPUTTEXT = new ComponentTypeInfo( - "javax.faces.HtmlInputText", //$NON-NLS-1$ - "javax.faces.component.html.HtmlInputText", //$NON-NLS-1$ - new String[] - { - "javax.faces.component.UIInput", "javax.faces.component.UIOutput", //$NON-NLS-1$ //$NON-NLS-2$ - "javax.faces.component.UIComponentBase", //$NON-NLS-1$ - "javax.faces.component.UIComponent", "java.lang.Object" }, //$NON-NLS-1$ //$NON-NLS-2$ - new String[] - { - "javax.faces.component.EditableValueHolder", //$NON-NLS-1$ - "javax.faces.component.ValueHolder", //$NON-NLS-1$ - "javax.faces.component.StateHolder" }, //$NON-NLS-1$ - "javax.faces.Input", //$NON-NLS-1$ - "javax.faces.Text"); //$NON-NLS-1$ - private static final ComponentTypeInfo COMPINFO_INPUTTEXTAREA = new ComponentTypeInfo( - "javax.faces.HtmlInputTextarea", //$NON-NLS-1$ - "javax.faces.component.html.HtmlInputTextarea", //$NON-NLS-1$ - new String[] - { - "javax.faces.component.UIInput", "javax.faces.component.UIOutput", //$NON-NLS-1$ //$NON-NLS-2$ - "javax.faces.component.UIComponentBase", //$NON-NLS-1$ - "javax.faces.component.UIComponent", "java.lang.Object", }, //$NON-NLS-1$ //$NON-NLS-2$ - new String[] - { - "javax.faces.component.EditableValueHolder", //$NON-NLS-1$ - "javax.faces.component.ValueHolder", //$NON-NLS-1$ - "javax.faces.component.StateHolder", }, //$NON-NLS-1$ - "javax.faces.Input", //$NON-NLS-1$ - "javax.faces.Textarea"); //$NON-NLS-1$ - private static final ComponentTypeInfo COMPINFO_MESSAGE = new ComponentTypeInfo( - "javax.faces.HtmlMessage", //$NON-NLS-1$ - "javax.faces.component.html.HtmlMessage", //$NON-NLS-1$ - new String[] - { - "javax.faces.component.UIMessage", //$NON-NLS-1$ - "javax.faces.component.UIComponentBase", //$NON-NLS-1$ - "javax.faces.component.UIComponent", "java.lang.Object", }, //$NON-NLS-1$ //$NON-NLS-2$ - new String[] - { "javax.faces.component.StateHolder", }, //$NON-NLS-1$ - "javax.faces.Message", //$NON-NLS-1$ - "javax.faces.Message"); //$NON-NLS-1$ - private static final ComponentTypeInfo COMPINFO_MESSAGES = new ComponentTypeInfo( - "javax.faces.HtmlMessages", //$NON-NLS-1$ - "javax.faces.component.html.HtmlMessages", //$NON-NLS-1$ - new String[] - { - "javax.faces.component.UIMessages", //$NON-NLS-1$ - "javax.faces.component.UIComponentBase", //$NON-NLS-1$ - "javax.faces.component.UIComponent", "java.lang.Object", }, //$NON-NLS-1$ //$NON-NLS-2$ - new String[] - { "javax.faces.component.StateHolder", }, //$NON-NLS-1$ - "javax.faces.Messages", //$NON-NLS-1$ - "javax.faces.Messages"); //$NON-NLS-1$ - private static final ComponentTypeInfo COMPINFO_OUTPUTFORMAT = new ComponentTypeInfo( - "javax.faces.HtmlOutputFormat", //$NON-NLS-1$ - "javax.faces.component.html.HtmlOutputFormat", //$NON-NLS-1$ - new String[] - { - "javax.faces.component.UIOutput", //$NON-NLS-1$ - "javax.faces.component.UIComponentBase", //$NON-NLS-1$ - "javax.faces.component.UIComponent", "java.lang.Object", }, //$NON-NLS-1$ //$NON-NLS-2$ - new String[] - { - "javax.faces.component.ValueHolder", //$NON-NLS-1$ - "javax.faces.component.StateHolder", }, //$NON-NLS-1$ - "javax.faces.Output", //$NON-NLS-1$ - "javax.faces.Format"); //$NON-NLS-1$ - private static final ComponentTypeInfo COMPINFO_OUTPUTLABEL = new ComponentTypeInfo( - "javax.faces.HtmlOutputLabel", //$NON-NLS-1$ - "javax.faces.component.html.HtmlOutputLabel", //$NON-NLS-1$ - new String[] - { - "javax.faces.component.UIOutput", //$NON-NLS-1$ - "javax.faces.component.UIComponentBase", //$NON-NLS-1$ - "javax.faces.component.UIComponent", "java.lang.Object", }, //$NON-NLS-1$ //$NON-NLS-2$ - new String[] - { - "javax.faces.component.ValueHolder", //$NON-NLS-1$ - "javax.faces.component.StateHolder", }, //$NON-NLS-1$ - "javax.faces.Output", //$NON-NLS-1$ - "javax.faces.Label"); //$NON-NLS-1$ - private static final ComponentTypeInfo COMPINFO_OUTPUTLINK = new ComponentTypeInfo( - "javax.faces.HtmlOutputLink", //$NON-NLS-1$ - "javax.faces.component.html.HtmlOutputLink", //$NON-NLS-1$ - new String[] - { - "javax.faces.component.UIOutput", //$NON-NLS-1$ - "javax.faces.component.UIComponentBase", //$NON-NLS-1$ - "javax.faces.component.UIComponent", "java.lang.Object", }, //$NON-NLS-1$ //$NON-NLS-2$ - new String[] - { - "javax.faces.component.ValueHolder", //$NON-NLS-1$ - "javax.faces.component.StateHolder", }, //$NON-NLS-1$ - "javax.faces.Output", //$NON-NLS-1$ - "javax.faces.Link"); //$NON-NLS-1$ - private static final ComponentTypeInfo COMPINFO_OUTPUTTEXT = new ComponentTypeInfo( - "javax.faces.HtmlOutputText", //$NON-NLS-1$ - "javax.faces.component.html.HtmlOutputText", //$NON-NLS-1$ - new String[] - { - "javax.faces.component.UIOutput", //$NON-NLS-1$ - "javax.faces.component.UIComponentBase", //$NON-NLS-1$ - "javax.faces.component.UIComponent", "java.lang.Object", }, //$NON-NLS-1$ //$NON-NLS-2$ - new String[] - { - "javax.faces.component.ValueHolder", //$NON-NLS-1$ - "javax.faces.component.StateHolder", }, //$NON-NLS-1$ - "javax.faces.Output", //$NON-NLS-1$ - "javax.faces.Text"); //$NON-NLS-1$ - private static final ComponentTypeInfo COMPINFO_PANELGRID = new ComponentTypeInfo( - "javax.faces.HtmlPanelGrid", //$NON-NLS-1$ - "javax.faces.component.html.HtmlPanelGrid", //$NON-NLS-1$ - new String[] - { - "javax.faces.component.UIPanel", //$NON-NLS-1$ - "javax.faces.component.UIComponentBase", //$NON-NLS-1$ - "javax.faces.component.UIComponent", "java.lang.Object", }, //$NON-NLS-1$ //$NON-NLS-2$ - new String[] - { "javax.faces.component.StateHolder", }, //$NON-NLS-1$ - "javax.faces.Panel", //$NON-NLS-1$ - "javax.faces.Grid"); //$NON-NLS-1$ - private static final ComponentTypeInfo COMPINFO_PANELGROUP = new ComponentTypeInfo( - "javax.faces.HtmlPanelGroup", //$NON-NLS-1$ - "javax.faces.component.html.HtmlPanelGroup", //$NON-NLS-1$ - new String[] - { - "javax.faces.component.UIPanel", //$NON-NLS-1$ - "javax.faces.component.UIComponentBase", //$NON-NLS-1$ - "javax.faces.component.UIComponent", "java.lang.Object", }, //$NON-NLS-1$ //$NON-NLS-2$ - new String[] - { "javax.faces.component.StateHolder", }, //$NON-NLS-1$ - "javax.faces.Panel", //$NON-NLS-1$ - "javax.faces.Group"); //$NON-NLS-1$ - private static final ComponentTypeInfo COMPINFO_SELECTBOOLEANCHECKBOX = new ComponentTypeInfo( - "javax.faces.HtmlSelectBooleanCheckbox", //$NON-NLS-1$ - "javax.faces.component.html.HtmlSelectBooleanCheckbox", //$NON-NLS-1$ - new String[] - { - "javax.faces.component.UISelectBoolean", //$NON-NLS-1$ - "javax.faces.component.UIInput", "javax.faces.component.UIOutput", //$NON-NLS-1$ //$NON-NLS-2$ - "javax.faces.component.UIComponentBase", //$NON-NLS-1$ - "javax.faces.component.UIComponent", "java.lang.Object", }, //$NON-NLS-1$ //$NON-NLS-2$ - new String[] - { - "javax.faces.component.EditableValueHolder", //$NON-NLS-1$ - "javax.faces.component.ValueHolder", //$NON-NLS-1$ - "javax.faces.component.StateHolder", }, //$NON-NLS-1$ - "javax.faces.SelectBoolean", //$NON-NLS-1$ - "javax.faces.Checkbox"); //$NON-NLS-1$ - private static final ComponentTypeInfo COMPINFO_SELECTMANYCHECKBOX = new ComponentTypeInfo( - "javax.faces.HtmlSelectManyCheckbox", //$NON-NLS-1$ - "javax.faces.component.html.HtmlSelectManyCheckbox", //$NON-NLS-1$ - new String[] - { - "javax.faces.component.UISelectMany", //$NON-NLS-1$ - "javax.faces.component.UIInput", "javax.faces.component.UIOutput", //$NON-NLS-1$ //$NON-NLS-2$ - "javax.faces.component.UIComponentBase", //$NON-NLS-1$ - "javax.faces.component.UIComponent", "java.lang.Object", }, //$NON-NLS-1$ //$NON-NLS-2$ - new String[] - { - "javax.faces.component.EditableValueHolder", //$NON-NLS-1$ - "javax.faces.component.ValueHolder", //$NON-NLS-1$ - "javax.faces.component.StateHolder", }, //$NON-NLS-1$ - "javax.faces.SelectMany", //$NON-NLS-1$ - "javax.faces.Checkbox"); //$NON-NLS-1$ - private static final ComponentTypeInfo COMPINFO_SELECTMANYLISTBOX = new ComponentTypeInfo( - "javax.faces.HtmlSelectManyListbox", //$NON-NLS-1$ - "javax.faces.component.html.HtmlSelectManyListbox", //$NON-NLS-1$ - new String[] - { - "javax.faces.component.UISelectMany", //$NON-NLS-1$ - "javax.faces.component.UIInput", "javax.faces.component.UIOutput", //$NON-NLS-1$ //$NON-NLS-2$ - "javax.faces.component.UIComponentBase", //$NON-NLS-1$ - "javax.faces.component.UIComponent", "java.lang.Object", }, //$NON-NLS-1$ //$NON-NLS-2$ - new String[] - { - "javax.faces.component.EditableValueHolder", //$NON-NLS-1$ - "javax.faces.component.ValueHolder", //$NON-NLS-1$ - "javax.faces.component.StateHolder", }, //$NON-NLS-1$ - "javax.faces.SelectMany", //$NON-NLS-1$ - "javax.faces.Listbox"); //$NON-NLS-1$ - private static final ComponentTypeInfo COMPINFO_SELECTMANYMENU = new ComponentTypeInfo( - "javax.faces.HtmlSelectManyMenu", //$NON-NLS-1$ - "javax.faces.component.html.HtmlSelectManyMenu", //$NON-NLS-1$ - new String[] - { - "javax.faces.component.UISelectMany", //$NON-NLS-1$ - "javax.faces.component.UIInput", "javax.faces.component.UIOutput", //$NON-NLS-1$ //$NON-NLS-2$ - "javax.faces.component.UIComponentBase", //$NON-NLS-1$ - "javax.faces.component.UIComponent", "java.lang.Object", }, //$NON-NLS-1$ //$NON-NLS-2$ - new String[] - { - "javax.faces.component.EditableValueHolder", //$NON-NLS-1$ - "javax.faces.component.ValueHolder", //$NON-NLS-1$ - "javax.faces.component.StateHolder", }, //$NON-NLS-1$ - "javax.faces.SelectMany", //$NON-NLS-1$ - "javax.faces.Menu"); //$NON-NLS-1$ - private static final ComponentTypeInfo COMPINFO_SELECTONELISTBOX = new ComponentTypeInfo( - "javax.faces.HtmlSelectOneListbox", //$NON-NLS-1$ - "javax.faces.component.html.HtmlSelectOneListbox", //$NON-NLS-1$ - new String[] - { - "javax.faces.component.UISelectOne", //$NON-NLS-1$ - "javax.faces.component.UIInput", "javax.faces.component.UIOutput", //$NON-NLS-1$ //$NON-NLS-2$ - "javax.faces.component.UIComponentBase", //$NON-NLS-1$ - "javax.faces.component.UIComponent", "java.lang.Object", }, //$NON-NLS-1$ //$NON-NLS-2$ - new String[] - { - "javax.faces.component.EditableValueHolder", //$NON-NLS-1$ - "javax.faces.component.ValueHolder", //$NON-NLS-1$ - "javax.faces.component.StateHolder", }, //$NON-NLS-1$ - "javax.faces.SelectOne", //$NON-NLS-1$ - "javax.faces.Listbox"); //$NON-NLS-1$ - private static final ComponentTypeInfo COMPINFO_SELECTONEMENU = new ComponentTypeInfo( - "javax.faces.HtmlSelectOneMenu", //$NON-NLS-1$ - "javax.faces.component.html.HtmlSelectOneMenu", //$NON-NLS-1$ - new String[] - { - "javax.faces.component.UISelectOne", //$NON-NLS-1$ - "javax.faces.component.UIInput", "javax.faces.component.UIOutput", //$NON-NLS-1$ //$NON-NLS-2$ - "javax.faces.component.UIComponentBase", //$NON-NLS-1$ - "javax.faces.component.UIComponent", "java.lang.Object", }, //$NON-NLS-1$ //$NON-NLS-2$ - new String[] - { - "javax.faces.component.EditableValueHolder", //$NON-NLS-1$ - "javax.faces.component.ValueHolder", //$NON-NLS-1$ - "javax.faces.component.StateHolder", }, //$NON-NLS-1$ - "javax.faces.SelectOne", //$NON-NLS-1$ - "javax.faces.Menu"); //$NON-NLS-1$ - private static final ComponentTypeInfo COMPINFO_SELECTONERADIO = new ComponentTypeInfo( - "javax.faces.HtmlSelectOneRadio", //$NON-NLS-1$ - "javax.faces.component.html.HtmlSelectOneRadio", //$NON-NLS-1$ - new String[] - { - "javax.faces.component.UISelectOne", //$NON-NLS-1$ - "javax.faces.component.UIInput", "javax.faces.component.UIOutput", //$NON-NLS-1$ //$NON-NLS-2$ - "javax.faces.component.UIComponentBase", //$NON-NLS-1$ - "javax.faces.component.UIComponent", "java.lang.Object", }, //$NON-NLS-1$ //$NON-NLS-2$ - new String[] - { - "javax.faces.component.EditableValueHolder", //$NON-NLS-1$ - "javax.faces.component.ValueHolder", //$NON-NLS-1$ - "javax.faces.component.StateHolder", }, //$NON-NLS-1$ - "javax.faces.SelectOne", //$NON-NLS-1$ - "javax.faces.Radio"); //$NON-NLS-1$ - - // default converters - private static final ConverterTypeInfo CONVERTERINFO_DATETIME = new ConverterTypeInfo( - "javax.faces.convert.DateTimeConverter", //$NON-NLS-1$ - "javax.faces.DateTime"); //$NON-NLS-1$ - - private static final ConverterTypeInfo CONVERTERINFO_NUMBER = new ConverterTypeInfo( - "javax.faces.convert.NumberConverter", //$NON-NLS-1$ - "javax.faces.Number"); //$NON-NLS-1$ - - // default validators - private static final ValidatorTypeInfo VALIDATORINFO_DOUBLERANGE = new ValidatorTypeInfo( - "javax.faces.validator.DoubleRangeValidator", //$NON-NLS-1$ - "javax.faces.DoubleRange"); //$NON-NLS-1$ - - private static final ValidatorTypeInfo VALIDATORINFO_LENGTH = new ValidatorTypeInfo( - "javax.faces.validator.LengthValidator", //$NON-NLS-1$ - "javax.faces.Length"); //$NON-NLS-1$ - - private static final ValidatorTypeInfo VALIDATORINFO_LONGRANGE = new ValidatorTypeInfo( - "javax.faces.validator.LongRangeValidator", //$NON-NLS-1$ - "javax.faces.LongRange"); //$NON-NLS-1$ - - private static Map<TagIdentifier, TypeInfo> JSF11_ELEMENTS; - private static Map<TagIdentifier, TypeInfo> JSF12_ELEMENTS; - - static - { - final Map<TagIdentifier, TypeInfo> commonElements = new HashMap<TagIdentifier, TypeInfo>(); - // IJSFConstants.TAG_IDENTIFIER_PHASELISTENER); - // IJSFConstants.TAG_IDENTIFIER_SETPROPERTYACTIONLISTENER); - - commonElements.put(IJSFConstants.TAG_IDENTIFIER_ACTIONLISTENER, - TagHandlerType.ACTIONLISTENER); - commonElements.put(IJSFConstants.TAG_IDENTIFIER_ATTRIBUTE, - TagHandlerType.ATTRIBUTE); - commonElements.put(IJSFConstants.TAG_IDENTIFIER_CONVERTDATETIME, - CONVERTERINFO_DATETIME); - commonElements.put(IJSFConstants.TAG_IDENTIFIER_CONVERTER, - ConverterTypeInfo.UNKNOWN); - commonElements.put(IJSFConstants.TAG_IDENTIFIER_CONVERTNUMBER, - CONVERTERINFO_NUMBER); - commonElements.put(IJSFConstants.TAG_IDENTIFIER_FACET, TagHandlerType.FACET); - // elements.put(IJSFConstants.TAG_IDENTIFIER_LOADBUNDLE, - // TagHandlerType.); - commonElements.put(IJSFConstants.TAG_IDENTIFIER_PARAM, COMPINFO_PARAM); - commonElements.put(IJSFConstants.TAG_IDENTIFIER_SELECTITEM, - COMPINFO_SELECTITEM); - commonElements.put(IJSFConstants.TAG_IDENTIFIER_SELECTITEMS, - COMPINFO_SELECTITEMS); - commonElements.put(IJSFConstants.TAG_IDENTIFIER_SUBVIEW, COMPINFO_SUBVIEW); - commonElements.put(IJSFConstants.TAG_IDENTIFIER_VALIDATEDOUBLERANGE, - VALIDATORINFO_DOUBLERANGE); - commonElements.put(IJSFConstants.TAG_IDENTIFIER_VALIDATELENGTH, - VALIDATORINFO_LENGTH); - commonElements.put(IJSFConstants.TAG_IDENTIFIER_VALIDATELONGRANGE, - VALIDATORINFO_LONGRANGE); - commonElements.put(IJSFConstants.TAG_IDENTIFIER_VALIDATOR, - ValidatorTypeInfo.UNKNOWN); - commonElements.put(IJSFConstants.TAG_IDENTIFIER_VALUECHANGELISTENER, - TagHandlerType.VALUECHANGELISTENER); - commonElements.put(IJSFConstants.TAG_IDENTIFIER_VERBATIM, COMPINFO_VERBATIM); - commonElements.put(IJSFConstants.TAG_IDENTIFIER_VIEW, COMPINFO_VIEW); - - // JSF 1.2 core elements - // none currently... - - // JSF 1.1/1.2 HTML tags - // html verifier - commonElements.put(IJSFConstants.TAG_IDENTIFIER_COLUMN, COMPINFO_COLUMN); - - commonElements.put(IJSFConstants.TAG_IDENTIFIER_COMMANDBUTTON, - COMPINFO_COMMAND); - - commonElements.put(IJSFConstants.TAG_IDENTIFIER_COMMANDLINK, - COMPINFO_COMMANDLINK); - - commonElements.put(IJSFConstants.TAG_IDENTIFIER_DATA_TABLE, - COMPINFO_DATATABLE); - - commonElements.put(IJSFConstants.TAG_IDENTIFIER_FORM, COMPINFO_FORM); - - commonElements.put(IJSFConstants.TAG_IDENTIFIER_GRAPHICIMAGE, - COMPINFO_GRAPHIC); - - commonElements.put(IJSFConstants.TAG_IDENTIFIER_INPUTHIDDEN, COMPINFO_HIDDEN); - - commonElements.put(IJSFConstants.TAG_IDENTIFIER_INPUTSECRET, COMPINFO_SECRET); - - commonElements - .put(IJSFConstants.TAG_IDENTIFIER_INPUTTEXT, COMPINFO_INPUTTEXT); - - commonElements.put(IJSFConstants.TAG_IDENTIFIER_INPUTTEXTAREA, - COMPINFO_INPUTTEXTAREA); - - commonElements.put(IJSFConstants.TAG_IDENTIFIER_MESSAGE, COMPINFO_MESSAGE); - - commonElements.put(IJSFConstants.TAG_IDENTIFIER_MESSAGES, COMPINFO_MESSAGES); - - commonElements.put(IJSFConstants.TAG_IDENTIFIER_OUTPUTFORMAT, - COMPINFO_OUTPUTFORMAT); - - commonElements.put(IJSFConstants.TAG_IDENTIFIER_OUTPUTLABEL, - COMPINFO_OUTPUTLABEL); - - commonElements.put(IJSFConstants.TAG_IDENTIFIER_OUTPUTLINK, - COMPINFO_OUTPUTLINK); - - commonElements.put(IJSFConstants.TAG_IDENTIFIER_OUTPUTTEXT, - COMPINFO_OUTPUTTEXT); - - commonElements.put(IJSFConstants.TAG_IDENTIFIER_PANEL_GRID, - COMPINFO_PANELGRID); - - commonElements.put(IJSFConstants.TAG_IDENTIFIER_PANEL_GROUP, - COMPINFO_PANELGROUP); - - commonElements.put(IJSFConstants.TAG_IDENTIFIER_SELECTBOOLEANCHECKBOX, - COMPINFO_SELECTBOOLEANCHECKBOX); - - commonElements.put(IJSFConstants.TAG_IDENTIFIER_SELECTMANYCHECKBOX, - COMPINFO_SELECTMANYCHECKBOX); - - commonElements.put(IJSFConstants.TAG_IDENTIFIER_SELECTMANYLISTBOX, - COMPINFO_SELECTMANYLISTBOX); - - commonElements.put(IJSFConstants.TAG_IDENTIFIER_SELECTMANYMENU, - COMPINFO_SELECTMANYMENU); - - commonElements.put(IJSFConstants.TAG_IDENTIFIER_SELECTONELISTBOX, - COMPINFO_SELECTONELISTBOX); - - commonElements.put(IJSFConstants.TAG_IDENTIFIER_SELECTONEMENU, - COMPINFO_SELECTONEMENU); - - commonElements.put(IJSFConstants.TAG_IDENTIFIER_SELECTONERADIO, - COMPINFO_SELECTONERADIO); - - JSF11_ELEMENTS = Collections.unmodifiableMap(commonElements); - - JSF12_ELEMENTS = Collections - .unmodifiableMap(new HashMap<TagIdentifier, TypeInfo>(commonElements)); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/IAttributeAdvisor.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/IAttributeAdvisor.java deleted file mode 100644 index 37596b2a9..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/IAttributeAdvisor.java +++ /dev/null @@ -1,102 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.model.jsp; - -import java.util.Collections; -import java.util.Map; - -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagAttribute; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagAttributeHandler; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.TagAttributeHandler; - -/** - * @author cbateman - * - */ -public interface IAttributeAdvisor -{ - - /** - * @param name - * @return a tag attribute handler for the name. - * @throws UnknownAttributeException if name does not match a known attribute. - */ - ITagAttributeHandler createAttributeHandler(String name) throws UnknownAttributeException; - - /** - * @return a map of attributes indexed by local name - */ - Map<String, ? extends ITagAttribute> getAttributes(); - - /** - * @author cbateman - * - */ - public static class NullAttributeAdvisor implements IAttributeAdvisor - { - public ITagAttributeHandler createAttributeHandler(String name) - throws UnknownAttributeException - { - return new TagAttributeHandler(null, name, false); - } - - public Map<String, ? extends ITagAttribute> getAttributes() - { - return Collections.emptyMap(); - } - } - - /** - * Indicates an unknown attribute was requested or encountered - * @author cbateman - * - */ - public static class UnknownAttributeException extends Exception - { - /** - * - */ - private static final long serialVersionUID = -988838913707929315L; - - /** - * - */ - public UnknownAttributeException() - { - super(); - } - - /** - * @param message - * @param cause - */ - public UnknownAttributeException(String message, Throwable cause) - { - super(message, cause); - } - - /** - * @param message - */ - public UnknownAttributeException(String message) - { - super(message); - } - - /** - * @param cause - */ - public UnknownAttributeException(Throwable cause) - { - super(cause); - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/ITagResolvingStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/ITagResolvingStrategy.java deleted file mode 100644 index 4befb221e..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/ITagResolvingStrategy.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.model.jsp; - -import org.eclipse.jst.jsf.common.internal.strategy.IIdentifiableStrategy; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagElement; - -/** - * Describes an algorithm that can produce ITagElements from <TLD> objects. - * - * @author cbateman - * @param <TLDELEMENT> the object type that describes a tag library. - * @param <IDTYPE> - * - */ -public interface ITagResolvingStrategy<TLDELEMENT, IDTYPE> extends - IIdentifiableStrategy<TLDELEMENT, ITagElement, IDTYPE> -{ - /** - * @param element - * @return a new tag element or {@link #getNotFoundIndicator()} if not found - */ - ITagElement resolve(TLDELEMENT element); - - /** - * @return the ITagElement (may be null) that indicates that - * resolve(TLDELEMENT) could not resolve a tag. The return - * must be testable with standard "==" operator and not equals(). - */ - ITagElement getNotFoundIndicator(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/JSPTagResolvingStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/JSPTagResolvingStrategy.java deleted file mode 100644 index 8f2235db6..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/JSPTagResolvingStrategy.java +++ /dev/null @@ -1,68 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.model.jsp; - -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagElement; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDElementDeclaration; - -/** - * A strategy for resolving JSP TLDs. - * - * @author cbateman - * - */ -public abstract class JSPTagResolvingStrategy extends - AbstractTagResolvingStrategy<TLDElementDeclaration, String> -{ - @Override - public abstract ITagElement resolve(TLDElementDeclaration element); - - public abstract String getId(); - - public abstract String getDisplayName(); - - /** - * A descriptor for JSP tag resolving strategies - * - * @author cbateman - * - */ - public final static class StrategyDescriptor - { - private final String _id; - private final String _displayName; - - /** - * @param id - * @param displayName - */ - public StrategyDescriptor(final String id, final String displayName) - { - _id = id; - _displayName = displayName; - } - - /** - * @return the id of the strategy - */ - public String getId() - { - return _id; - } - /** - * @return the human-readable displayable name of the strategy - */ - public String getDisplayName() - { - return _displayName; - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/Messages.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/Messages.java deleted file mode 100644 index 9d3dcee38..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/Messages.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.eclipse.jst.jsf.designtime.internal.view.model.jsp; - -import org.eclipse.osgi.util.NLS; - -/** - * NLS message getter. - * - * @author cbateman - * - */ -public class Messages extends NLS -{ - private static final String BUNDLE_NAME = "org.eclipse.jst.jsf.designtime.internal.view.model.jsp.messages"; //$NON-NLS-1$ - /** - * see messages.properties - */ - public static String UnresolvedJSPTagResolvingStrategy_1; - static - { - // initialize resource bundle - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } - - private Messages() - { - // no external instantiation - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/MetadataAttributeAdvisor.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/MetadataAttributeAdvisor.java deleted file mode 100644 index df2c7ac1f..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/MetadataAttributeAdvisor.java +++ /dev/null @@ -1,76 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Cameron Bateman - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.model.jsp; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.jst.jsf.common.dom.TagIdentifier; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ComponentPropertyHandler; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagAttribute; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagAttributeHandler; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.TagAttributeHandler; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.ViewMetadataLoader; -import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.AttributeToPropertyMapping; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDAttributeDeclaration; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDElementDeclaration; -import org.eclipse.wst.xml.core.internal.contentmodel.CMNode; - -/* package */class MetadataAttributeAdvisor implements IAttributeAdvisor -{ - private final TagIdentifier _tagId; - private final ViewMetadataLoader _loader; - private final TLDElementDeclaration _tldElement; - - public MetadataAttributeAdvisor(final TagIdentifier tagId, - final ViewMetadataLoader loader, TLDElementDeclaration tldElement) - { - _tagId = tagId; - _loader = loader; - _tldElement = tldElement; - } - - public ITagAttributeHandler createAttributeHandler(final String name) - throws UnknownAttributeException - { - final AttributeToPropertyMapping mapping = _loader.getAttributeMapping( - _tagId, name); - if (mapping != null) - { - final String customHandler = mapping.getCustomConversionFactoryId(); - final boolean isELAllowed = mapping.isElAllowed(); - final String propertyName = mapping.getPropertyName(); - if (propertyName != null) - { - return new ComponentPropertyHandler(customHandler, name, - isELAllowed, propertyName); - } - return new TagAttributeHandler(customHandler, name, isELAllowed); - } - return new TagAttributeHandler(null, name, false); - } - - public Map<String, ? extends ITagAttribute> getAttributes() - { - final Map<String, TLDTagAttribute> attributes = new HashMap<String, TLDTagAttribute>(); - - for (int i = 0; i < _tldElement.getAttributes().getLength(); i++) - { - CMNode item = _tldElement.getAttributes().item(i); - if (item instanceof TLDAttributeDeclaration) - { - TLDTagAttribute attr = new TLDTagAttribute((TLDAttributeDeclaration) item); - attributes.put(attr.getName(), attr); - } - } - return attributes; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDComponentTagElement.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDComponentTagElement.java deleted file mode 100644 index 416bc1638..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDComponentTagElement.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.model.jsp; - -import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentTypeInfo; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.IComponentTagElement; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDElementDeclaration; - - - -/** - * A TLD-defined tag (i.e. JSP) that maps one-to-one with a JSF UIComponent - * @author cbateman - * - */ -public class TLDComponentTagElement extends TLDJSFTagElement implements -IComponentTagElement -{ - /** - * - */ - private static final long serialVersionUID = -6479445622102799425L; - private final ComponentTypeInfo _componentTypeInfo; - - /** - * @param elementDecl - * @param componentTypeInfo - * @param advisor - */ - public TLDComponentTagElement(final TLDElementDeclaration elementDecl - , final ComponentTypeInfo componentTypeInfo, final IAttributeAdvisor advisor) - { - super(elementDecl, advisor); - _componentTypeInfo = componentTypeInfo; - } - - public ComponentTypeInfo getComponent() - { - return _componentTypeInfo; - } - - @Override - public TagType getType() - { - return TagType.COMPONENT; - } - - @Override - public String toString() - { - final String attributes = constructAttributesString(); - return _componentTypeInfo.toString() + - (!"".equals(attributes) ? "\n" + attributes : ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDConverterTagElement.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDConverterTagElement.java deleted file mode 100644 index 257a6f479..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDConverterTagElement.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.model.jsp; - -import org.eclipse.jst.jsf.common.runtime.internal.model.decorator.ConverterTypeInfo; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.IConverterTagElement; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDElementDeclaration; - -/** - * A TLD-defined tag (i.e. JSP) that maps one-to-one with a JSF Converter - * - * @author cbateman - * - */ -public class TLDConverterTagElement extends TLDJSFTagElement implements IConverterTagElement -{ - /** - * - */ - private static final long serialVersionUID = 2854457220470229847L; - private final ConverterTypeInfo _converterTypeInfo; - - /** - * @param elementDecl - * @param converterTypeInfo - * @param advisor - */ - public TLDConverterTagElement(final TLDElementDeclaration elementDecl, final ConverterTypeInfo converterTypeInfo, final IAttributeAdvisor advisor) - { - super(elementDecl, advisor); - _converterTypeInfo = converterTypeInfo; - } - - @Override - public TagType getType() - { - return TagType.CONVERTER; - } - - /** - * @return the type info for this converter - */ - public final ConverterTypeInfo getConverter() - { - return _converterTypeInfo; - } - - @Override - public String toString() - { - return _converterTypeInfo.toString(); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDJSFTagElement.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDJSFTagElement.java deleted file mode 100644 index 58f88a865..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDJSFTagElement.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.model.jsp; - -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.IJSFTagElement; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDElementDeclaration; - -/** - * A JSF tag element. - * - * @author cbateman - * - */ -public abstract class TLDJSFTagElement extends TLDTagElement implements - IJSFTagElement -{ - /** - * - */ - private static final long serialVersionUID = -7629153104201317346L; - - /** - * @param elementDecl - * @param advisor - */ - public TLDJSFTagElement(final TLDElementDeclaration elementDecl - , final IAttributeAdvisor advisor) - { - super(elementDecl, advisor); - } - - public abstract TagType getType(); - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDNamespace.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDNamespace.java deleted file mode 100644 index 043ffe7d5..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDNamespace.java +++ /dev/null @@ -1,314 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.model.jsp; - -import java.io.Serializable; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.core.runtime.jobs.ILock; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagElement; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.Namespace; -import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.persistence.SerializableTLDNamespace; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDDocument; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDElementDeclaration; -import org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap; -import org.eclipse.wst.xml.core.internal.contentmodel.CMNode; - -/** - * Represents a JSP tag library namespace - * - * @author cbateman - * - */ -public class TLDNamespace extends Namespace -{ - /** - * - */ - private static final long serialVersionUID = 9206460825737988441L; - private TLDNamespaceData _tldData; - - /** - * @param tldDoc - * @param tagResolver - */ - public TLDNamespace( - final TLDDocument tldDoc, - final ITagResolvingStrategy<TLDElementDeclaration, String> tagResolver) - { - _tldData = new DocumentTLDNamespaceData(tldDoc, tagResolver); - } - - @Override - public final String getDisplayName() - { - return _tldData.getDisplayName(); - } - - @Override - public final String getNSUri() - { - return _tldData.getUri(); - } - - @Override - public boolean isInitialized() - { - return _tldData.isInitialized(); - } - - public final ITagElement getViewElement(final String name) - { - // // bias the table small if this creates it - // final Map<String, ITagElement> tags = getOrCreateMap(3); - // - // return _tldData.getOrCreateTagElement(name, tags); - return _tldData.getViewElement(name); - } - - @Override - public final Collection<? extends ITagElement> getViewElements() - { - return Collections.unmodifiableCollection(_tldData.getAllViewElements().values()); - } - - /** - * Differs from getViewElements because it won't include those elements - * that haven't been lazily loaded. - * - * @return an unmodifiable map of all elements currently calculated for - * this namespaces - */ - public final Map<String, ITagElement> getCurrentElements() - { - return Collections.unmodifiableMap(_tldData.getCurrentElements()); - } - - @Override - public final boolean hasViewElements() - { - return _tldData.getNumTags() > 0; - } - - - private Object writeReplace() - { - return new SerializableTLDNamespace(this); - } - - private static class DocumentTLDNamespaceData extends TLDNamespaceData - { - /** - * - */ - private static final long serialVersionUID = -1098872687238068584L; - private final transient TLDDocument _tldDoc; - private final transient ITagResolvingStrategy<TLDElementDeclaration, String> _tagResolver; - private final transient ILock _tagMapReadWriteLock; - // should only be accessed directly in getOrCreateMap; - private Map<String, ITagElement> _tags; // lazy init in initializeTags - - public DocumentTLDNamespaceData( - final TLDDocument tldDoc, - final ITagResolvingStrategy<TLDElementDeclaration, String> tagResolver) - { - _tldDoc = tldDoc; - _tagResolver = tagResolver; - _tagMapReadWriteLock = Job.getJobManager().newLock(); - } - - @Override - public String getDisplayName() - { - String displayName = _tldDoc.getDisplayName(); - if (displayName == null || "".equals(displayName.trim())) //$NON-NLS-1$ - { - displayName = getUri(); - } - return displayName; - } - - @Override - public String getUri() - { - return _tldDoc.getUri(); - } - - @Override - public int getNumTags() - { - return _tldDoc.getElements().getLength(); - } - - private ITagElement createTagElement(final String name) - { - CMNode cmNode = _tldDoc.getElements().getNamedItem(name); - ITagElement tagElement = null; - if (cmNode instanceof TLDElementDeclaration) - { - tagElement = _tagResolver - .resolve((TLDElementDeclaration) cmNode); - - if (tagElement == _tagResolver.getNotFoundIndicator()) - { - // the not-found indicator may not be null. - tagElement = null; - } - } - return tagElement; - } - - public final Map<String, ITagElement> getAllViewElements() - { - final CMNamedNodeMap elementMap = _tldDoc.getElements(); - final Map<String, ITagElement> tags = getOrCreateMap(elementMap - .getLength()); - if (!isInitialized()) - { - // if we create the table with this call, bias the table size - // to be 1 bigger than the number of tags, since we know if it's - // smaller, it'll cause at least one buffer resize - - - for (int i = 0; i < elementMap.getLength(); i++) - { - final CMNode cmNode = elementMap.item(i); - getViewElement(cmNode.getNodeName()); - } - } - return tags; - } - - public ITagElement getViewElement(final String name) - { - ITagElement tagElement = null; - - _tagMapReadWriteLock.acquire(); - final Map<String, ITagElement> tags = getOrCreateMap(_tldDoc.getElements().getLength()); - try - { - tagElement = tags.get(name); - - if (tagElement == null) - { - tagElement = createTagElement(name); - - if (tagElement != null) - { - tags.put(tagElement.getName(), tagElement); - } - } - } - finally - { - _tagMapReadWriteLock.release(); - } - - return tagElement; - } - - /** - * mapSizeHint will be used - * - * @param mapSizeHint - * @return the map - */ - private synchronized Map<String, ITagElement> getOrCreateMap( - final int mapSizeHint) - { - if (_tags == null) - { - final float loadFactor = 0.75f; - final int initSize = ((int) (mapSizeHint / loadFactor)) + 1; - _tags = Collections - .synchronizedMap(new HashMap<String, ITagElement>( - initSize)); - } - return _tags; - } - - @Override - public boolean isInitialized() - { - int numTags = getNumTags(); - int tagMapSize = getOrCreateMap(3).size(); - - // we are only initialized if the tag map is the equal in size - // to the number of tags in the tld. - return numTags == tagMapSize; - } - - @Override - public Map<String, ITagElement> getCurrentElements() - { - return getOrCreateMap(3); - } - } - - /** - * Encapsulates all the data for a TLDNamespace. Allows the model - * to be separated from the Namespace interface for ease of serialization and - * controlled subclassing. - * - */ - public abstract static class TLDNamespaceData implements Serializable - { - /** - * - */ - private static final long serialVersionUID = -1284294636936289804L; - - /** - * @return the displayb - */ - public abstract String getDisplayName(); - -// public abstract ITagElement getOrCreateTagElement(String name, -// Map<String, ITagElement> tags); - - /** - * @return the number of tags - */ - public abstract int getNumTags(); - - /** - * @return the namespace uri - */ - public abstract String getUri(); - - /** - * @param name - * @return the view element for name or null if not found. - */ - public abstract ITagElement getViewElement(final String name); - - /** - * May be long running since it will lazily calculate all unloaded - * tags. - * @return all view elements for this namespace - */ - public abstract Map<String, ITagElement> getAllViewElements(); - - /** - * @return true if all elements have been lazily loaded - */ - public abstract boolean isInitialized(); - - /** - * @return just the currently loaded elements for this namespace. - */ - public abstract Map<String, ITagElement> getCurrentElements(); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDTagAttribute.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDTagAttribute.java deleted file mode 100644 index 94ac59948..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDTagAttribute.java +++ /dev/null @@ -1,213 +0,0 @@ -package org.eclipse.jst.jsf.designtime.internal.view.model.jsp; - -import java.io.IOException; -import java.io.Serializable; - -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.AbstractTagAttribute; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDAttributeDeclaration; - -/** - * Adapts a TLDAttributeDeclaration to the ITagAttribute interface. - * - * @author cbateman - * - */ -public class TLDTagAttribute extends AbstractTagAttribute -{ - - /** - * - */ - private static final long serialVersionUID = 4327701042556836452L; - - private final TLDAttributeData _tldData; - - /** - * @param decl - */ - public TLDTagAttribute(final TLDAttributeDeclaration decl) - { - _tldData = new DocumentAttributeData(decl); - } - - @Override - public String getName() - { - return _tldData.getName(); - } - - @Override - public String getDisplayName() - { - return _tldData.getDisplayName(); - } - - @Override - public String getDescription() { - return _tldData.getDescription(); - } - - @Override - public String getTargetNamespace() - { - return _tldData.getTargetNamespace(); - } - - public boolean isRequired() - { - return _tldData.isRequired(); - } - - /** - * Diagnostic only. For testing only. Should never be exposed on ITagAttribute. - * - * @return true if this instance wraps a SerializedTLDAttributeData (the - * instance was created by readObject). False if it is wrapping a - * TLDAttributeDeclaration. - */ - public boolean hasBeenDeserialized() - { - return _tldData instanceof SerializedTLDAttributeData; - } - @Override - public String toString() - { - return String.format("Attribute: name=%s, displayName=%s, description=%s\n" //$NON-NLS-1$ - , getName(), getDisplayName(), getDescription()); - } - - private static class DocumentAttributeData extends TLDAttributeData - { - /** - * - */ - private static final long serialVersionUID = -5974753636507938515L; - private final TLDAttributeDeclaration _decl; - - - public DocumentAttributeData(TLDAttributeDeclaration decl) - { - super(); - _decl = decl; - } - - private Object writeReplace() - { - return new SerializedTLDAttributeData(getName(), getDisplayName(), getDescription() - , getTargetNamespace(), isRequired()); - } - - @SuppressWarnings("unused") - private void readObject(java.io.ObjectInputStream in) - throws IOException, ClassNotFoundException - { - throw new UnsupportedOperationException("This object should be serialized; writeReplace"); //$NON-NLS-1$ - } - - @Override - public String getName() - { - return _decl.getAttrName(); - } - - @Override - public String getTargetNamespace() - { - return null; - } - - @Override - public String getDescription() - { - return _decl.getDescription(); - } - - @Override - public String getDisplayName() - { - return _decl.getAttrName(); - } - - @Override - public boolean isRequired() - { - return _decl.isRequired(); - } - - } - - /** - * @author cbateman - * - */ - private static class SerializedTLDAttributeData extends TLDAttributeData - { - /** - * - */ - private static final long serialVersionUID = -1094006883222087189L; - - private final String _name; - private final String _displayName; - private final String _description; - private final String _targetNamespace; - private final boolean _isRequired; - - - - public SerializedTLDAttributeData(String name, String displayName, - String description, String targetNamespace, boolean isRequired) - { - super(); - _name = name; - _displayName = displayName; - _description = description; - _targetNamespace = targetNamespace; - _isRequired = isRequired; - } - - @Override - public String getName() - { - return _name; - } - - @Override - public String getDisplayName() - { - return _displayName; - } - - @Override - public String getDescription() - { - return _description; - } - - @Override - public String getTargetNamespace() - { - return _targetNamespace; - } - - @Override - public boolean isRequired() - { - return _isRequired; - } - - } - - private static abstract class TLDAttributeData implements Serializable - { - /** - * - */ - private static final long serialVersionUID = 8376571212994363562L; - public abstract String getName(); - public abstract String getDisplayName(); - public abstract String getDescription(); - public abstract String getTargetNamespace(); - public abstract boolean isRequired(); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDTagElement.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDTagElement.java deleted file mode 100644 index 001e1aeb0..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDTagElement.java +++ /dev/null @@ -1,258 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.model.jsp; - -import java.io.IOException; -import java.io.Serializable; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.Map.Entry; - -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagAttribute; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagAttributeHandler; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.TagElement; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDDocument; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDElementDeclaration; -import org.eclipse.wst.xml.core.internal.contentmodel.CMDocument; - - -/** - * A tag element for a JSP tag (TLD-defined) - * - * @author cbateman - * - */ -public class TLDTagElement extends TagElement -{ - /** - * - */ - private static final long serialVersionUID = -874272538404837105L; - private final TLDElementData _tldData; - - /** - * @param elementDecl - * @param advisor - */ - public TLDTagElement(final TLDElementDeclaration elementDecl - , final IAttributeAdvisor advisor) - { - _tldData = new DocumentElementData(elementDecl, advisor); - } - - @Override - public String getName() - { - return _tldData.getName(); - } - - @Override - public String getUri() - { - return _tldData.getUri(); - } - - @Override - public String getTagHandlerClassName() { - return _tldData.getTagHandlerClassName(); - } - - @Override - public String toString() - { - return String.format("Tag: Tag Handler: name=%s, uri=%s, tagHandlerClassName=%s\n" //$NON-NLS-1$ - , getName(), getUri(), getTagHandlerClassName()) - + constructAttributesString(); - } - - /** - * @return a string representation of the attributes. - */ - protected String constructAttributesString() - { - String attributes = ""; //$NON-NLS-1$ - - for (final Iterator it = getAttributeHandlers().entrySet().iterator(); it.hasNext();) - { - final Map.Entry entry = (Entry) it.next(); - final String name = (String) entry.getKey(); - final ITagAttributeHandler handler = (ITagAttributeHandler) entry.getValue(); - - attributes += String.format("\t\t\tAttribute: name=%s, customHandler=%s, propertyName=%s, isELAllowed=%b\n", //$NON-NLS-1$ - name, handler.getCustomHandler(), handler.getName(), - Boolean.valueOf(handler.isELAllowed())); - } - return attributes; - } - - @Override - public Map getAttributeHandlers() - { - return _tldData.getAttributeHandlers(); - } - - public Map<String, ? extends ITagAttribute> getAttributes() - { - return _tldData.getAttributes(); - } - - private static class DocumentElementData extends TLDElementData - { - /** - * serialization id - */ - private static final long serialVersionUID = -6160324802818766058L; - private final TLDElementDeclaration _tldDoc; - private final CMNodeNamedMapAdapter _adapter; - private Map<String, ? extends ITagAttribute> _tldAttributes; - - public DocumentElementData(final TLDElementDeclaration tldDoc, - final IAttributeAdvisor advisor) - { - _tldDoc = tldDoc; - _adapter = new CMNodeNamedMapAdapter(tldDoc, advisor); - _tldAttributes = advisor.getAttributes(); - } - - @Override - public String getName() - { - return _tldDoc.getElementName(); - } - - @Override - public String getTagHandlerClassName() - { - return _tldDoc.getTagclass(); - } - - @Override - public String getUri() - { - final CMDocument owner = _tldDoc.getOwnerDocument(); - - if (owner instanceof TLDDocument) - { - return ((TLDDocument)owner).getUri(); - } - return null; - } - - private Object writeReplace() - { - return new SerializedTLDElementData(getName(), getTagHandlerClassName(), getUri() - , _adapter, _tldAttributes); - } - - @SuppressWarnings("unused") - private void readObject(java.io.ObjectInputStream in) - throws IOException, ClassNotFoundException - { - throw new UnsupportedOperationException("This object should be serialized; writeReplace"); //$NON-NLS-1$ - } - - @Override - public Map<String, ? extends ITagAttributeHandler> getAttributeHandlers() - { - return _adapter; - } - - @Override - public Map<String, ? extends ITagAttribute> getAttributes() - { - return _tldAttributes; - } - } - - /** - * @author cbateman - * - */ - private static class SerializedTLDElementData extends TLDElementData - { - /** - * - */ - private static final long serialVersionUID = 4008084060638384114L; - private final String _name; - private final String _uri; - private final String _tagHandlerClassName; - private final Map<String, ? extends ITagAttributeHandler> _tagAttributes; - private final Map<String, ? extends ITagAttribute> _actualTagAttributes; - - /** - * @param name - * @param tagHandlerClassName - * @param uri - * @param tagAttributes - */ - private SerializedTLDElementData(final String name, - final String tagHandlerClassName, final String uri, - final Map<String, ? extends ITagAttributeHandler> tagAttributes, - final Map<String, ? extends ITagAttribute> actualTagAttributes) - { - super(); - _name = name; - _tagHandlerClassName = tagHandlerClassName; - _uri = uri; - // copy the map, because we don't if it is simply delta - _tagAttributes = new HashMap(tagAttributes); - _actualTagAttributes = new HashMap(actualTagAttributes); - } - - @Override - public String getName() - { - return _name; - } - - @Override - public String getTagHandlerClassName() - { - return _tagHandlerClassName; - } - - @Override - public String getUri() - { - return _uri; - } - - @Override - public Map<String, ? extends ITagAttributeHandler> getAttributeHandlers() - { - return _tagAttributes; - } - - @Override - public Map<String, ? extends ITagAttribute> getAttributes() - { - return _actualTagAttributes; - } - } - - private static abstract class TLDElementData implements Serializable - { - /** - * - */ - private static final long serialVersionUID = -2494388738109839064L; - public abstract String getTagHandlerClassName(); - public abstract String getName(); - public abstract String getUri(); - public abstract Map<String, ? extends ITagAttributeHandler> getAttributeHandlers(); - public abstract Map<String, ? extends ITagAttribute> getAttributes(); - - } - - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDTagHandlerElement.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDTagHandlerElement.java deleted file mode 100644 index d637f49e2..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDTagHandlerElement.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.model.jsp; - -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.IHandlerTagElement; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDElementDeclaration; - -/** - * A TLD-defined tag (i.e. JSP) that maps to a known tag handler. - * - * @author cbateman - * - */ -public class TLDTagHandlerElement extends TLDJSFTagElement implements -IHandlerTagElement -{ - /** - * - */ - private static final long serialVersionUID = 8984277085824995102L; - private final TagHandlerType _tagHandlerType; - - /** - * @param elementDecl - * @param tagHandlerType - * @param advisor - */ - public TLDTagHandlerElement(final TLDElementDeclaration elementDecl, final TagHandlerType tagHandlerType, final IAttributeAdvisor advisor) - { - super(elementDecl, advisor); - _tagHandlerType = tagHandlerType; - } - - public TagHandlerType getTagHandlerType() - { - return _tagHandlerType; - } - - @Override - public TagType getType() - { - return TagType.HANDLER; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDValidatorTagElement.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDValidatorTagElement.java deleted file mode 100644 index e99d97b07..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDValidatorTagElement.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.model.jsp; - -import org.eclipse.jst.jsf.common.runtime.internal.model.decorator.ValidatorTypeInfo; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.IValidatorTagElement; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDElementDeclaration; - -/** - * A TLD-defined tag (i.e. JSP) that maps one-to-one with a JSF Converter - * - * @author cbateman - * - */ -public class TLDValidatorTagElement extends TLDJSFTagElement implements IValidatorTagElement -{ - /** - * - */ - private static final long serialVersionUID = 4251223772554969477L; - private final ValidatorTypeInfo _validator; - - /** - * @param elementDecl - * @param validatorTypeInfo - * @param advisor - */ - public TLDValidatorTagElement(final TLDElementDeclaration elementDecl, final ValidatorTypeInfo validatorTypeInfo, final IAttributeAdvisor advisor) - { - super(elementDecl, advisor); - _validator = validatorTypeInfo; - } - - public final ValidatorTypeInfo getValidator() - { - return _validator; - } - - @Override - public final TagType getType() - { - return TagType.VALIDATOR; - } - - @Override - public String toString() - { - return _validator.toString(); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TagIntrospectingStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TagIntrospectingStrategy.java deleted file mode 100644 index 6a5d97d35..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TagIntrospectingStrategy.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.model.jsp; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagElement; -import org.eclipse.jst.jsf.designtime.internal.Messages; -import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.analyzer.TagAnalyzer; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDElementDeclaration; - -/** - * A resolving strategy that uses tag introspection. - * - * @author cbateman - * - */ -public final class TagIntrospectingStrategy extends JSPTagResolvingStrategy -{ - /** - * the identifier of this strategy - */ - public final static String ID = "org.eclipse.jst.jsf.designtime.TagIntrospectingStrategy"; //$NON-NLS-1$ - /** - * the display name - */ - public final static String DISPLAY_NAME = Messages.TagIntrospectingStrategy_DisplayName; - - private final IProject _project; - - /** - * @return the descriptor for this resolver strategy - */ - public static StrategyDescriptor createDescriptor() - { - return new StrategyDescriptor(ID, DISPLAY_NAME); - } - - /** - * @param project - */ - public TagIntrospectingStrategy(final IProject project) - { - // TODO: would it be better to have a model context on the resolve? - _project = project; - } - - @Override - public String getId() - { - return ID; - } - - public String getDisplayName() - { - return DISPLAY_NAME; - } - - @Override - public ITagElement resolve(TLDElementDeclaration element) - { - return TagAnalyzer.createTLDTagElement(element, _project); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/UnresolvedJSPTagResolvingStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/UnresolvedJSPTagResolvingStrategy.java deleted file mode 100644 index 0a94f66b5..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/UnresolvedJSPTagResolvingStrategy.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.model.jsp; - -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagElement; -import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.IAttributeAdvisor.NullAttributeAdvisor; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDElementDeclaration; - -/** - * This a fallback strategy that always creates an element for a tld decl. This - * can be tacked to the end of a composite strategy (or used alone) to ensure - * that a basic ITagElement is always created for a TLDElementDeclaration. - * - * @author cbateman - * - */ -public class UnresolvedJSPTagResolvingStrategy extends JSPTagResolvingStrategy -{ - /** - * the identifier of this strategy - */ - public final static String ID = "org.eclipse.jst.jsf.designtime.UnresolvedJSPTagResolvingStrategy"; //$NON-NLS-1$ - /** - * the displayable name - */ - public final static String DISPLAY_NAME = Messages.UnresolvedJSPTagResolvingStrategy_1; - - /** - * @return the descriptor for this resolver strategy - */ - public static StrategyDescriptor createDescriptor() - { - return new StrategyDescriptor(ID, DISPLAY_NAME); - } - - @Override - public String getId() - { - return ID; - } - - public String getDisplayName() - { - return DISPLAY_NAME; - } - - @Override - public ITagElement resolve(TLDElementDeclaration element) - { - // just create a tag element - return new TLDTagElement(element, new NullAttributeAdvisor()); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/analyzer/ServletBeanProxyContributor.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/analyzer/ServletBeanProxyContributor.java deleted file mode 100644 index 45d8d9212..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/analyzer/ServletBeanProxyContributor.java +++ /dev/null @@ -1,75 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -/** - * - */ -package org.eclipse.jst.jsf.designtime.internal.view.model.jsp.analyzer; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jem.internal.proxy.core.ConfigurationContributorAdapter; -import org.eclipse.jem.internal.proxy.core.IConfigurationContributionController; -import org.eclipse.jst.jsf.core.JSFVersion; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.osgi.framework.Bundle; - -class ServletBeanProxyContributor extends ConfigurationContributorAdapter -{ - private final JSFVersion _jsfVersion; - - public ServletBeanProxyContributor(final IProject project) - { - _jsfVersion = getProjectVersion(project); - if (_jsfVersion == null) - { - throw new IllegalArgumentException("jsfVersion must not be null"); //$NON-NLS-1$ - } - } - - @Override - public void contributeClasspaths( - final IConfigurationContributionController controller) - throws CoreException - { - if (_jsfVersion != null && _jsfVersion.compareTo(JSFVersion.V1_2) < 0) - { - final Bundle servletBundle = Platform.getBundle("javax.servlet"); //$NON-NLS-1$ - controller.contributeClasspath(servletBundle, (IPath) null, - IConfigurationContributionController.APPEND_USER_CLASSPATH, - true); - - final Bundle jspBundle = Platform.getBundle("javax.servlet.jsp"); //$NON-NLS-1$ - controller.contributeClasspath(jspBundle, (IPath) null, - IConfigurationContributionController.APPEND_USER_CLASSPATH, - true); - } - else - { - final Bundle coreBundle = JSFCorePlugin.getDefault().getBundle(); - controller.contributeClasspath(coreBundle, - "/jars/fake_jsp_21.jar", //$NON-NLS-1$ - IConfigurationContributionController.APPEND_USER_CLASSPATH, - false); - controller.contributeClasspath(coreBundle, - "/jars/fake_el.jar", //$NON-NLS-1$ - IConfigurationContributionController.APPEND_USER_CLASSPATH, - false); - } - } - - static JSFVersion getProjectVersion(final IProject project) - { - return JSFVersion.valueOfProject(project); - } - -}
\ No newline at end of file diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/analyzer/TagAnalyzer.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/analyzer/TagAnalyzer.java deleted file mode 100644 index 150d160e7..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/analyzer/TagAnalyzer.java +++ /dev/null @@ -1,870 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.model.jsp.analyzer; - -import java.util.Collections; -import java.util.HashSet; -import java.util.Set; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.JavaConventions; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jem.internal.proxy.core.IBeanProxy; -import org.eclipse.jem.internal.proxy.core.IBeanTypeProxy; -import org.eclipse.jem.internal.proxy.core.IConfigurationContributor; -import org.eclipse.jem.internal.proxy.core.IStandardBeanTypeProxyFactory; -import org.eclipse.jem.internal.proxy.core.ProxyFactoryRegistry; -import org.eclipse.jem.internal.proxy.ide.IDERegistration; -import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentTypeInfo; -import org.eclipse.jst.jsf.common.runtime.internal.model.decorator.ConverterTypeInfo; -import org.eclipse.jst.jsf.common.runtime.internal.model.decorator.ValidatorTypeInfo; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.IJSFTagElement; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.IHandlerTagElement.TagHandlerType; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.IJSFTagElement.TagType; -import org.eclipse.jst.jsf.core.JSFVersion; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.core.internal.JSFCoreTraceOptions; -import org.eclipse.jst.jsf.core.internal.jem.BeanProxyUtil.BeanProxyWrapper; -import org.eclipse.jst.jsf.core.internal.jem.BeanProxyUtil.ProxyException; -import org.eclipse.jst.jsf.designtime.internal.view.DTComponentIntrospector; -import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.TLDComponentTagElement; -import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.TLDConverterTagElement; -import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.TLDTagElement; -import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.TLDTagHandlerElement; -import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.TLDValidatorTagElement; -import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.IAttributeAdvisor.NullAttributeAdvisor; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDElementDeclaration; - -/** - * Utility class supporting methods to derive information from JSP tag - * definitions (TLD) - * - * @author cbateman - * - */ -public final class TagAnalyzer -{ - private static final String JAVAX_FACES_WEBAPP_CONVERTER_TAG = "javax.faces.webapp.ConverterTag"; //$NON-NLS-1$ - private static final String JAVAX_FACES_WEBAPP_CONVERTER_ELTAG = "javax.faces.webapp.ConverterELTag"; //$NON-NLS-1$ - private static final String JAVAX_FACES_WEBAPP_VALIDATOR_TAG = "javax.faces.webapp.ValidatorTag"; //$NON-NLS-1$ - private static final String JAVAX_FACES_WEBAPP_VALIDATOR_ELTAG = "javax.faces.webapp.ValidatorELTag"; //$NON-NLS-1$ - private static final String JAVAX_FACES_WEBAPP_FACET_TAG = "javax.faces.webapp.FacetTag"; //$NON-NLS-1$ - - // private static final String JAVAX_FACES_WEBAPP_ACTIONLISTENER_TAG = - // "javax.faces.webapp.ActionListenerTag"; - // private static final String JAVAX_FACES_WEBAPP_VALUECHANGELISTENER_TAG = - // "javax.faces.webapp.ValueChangeListenerTag"; - private static final String JAVAX_FACES_WEBAPP_ATTRIBUTE_TAG = "javax.faces.webapp.AttributeTag"; //$NON-NLS-1$ - - private final static Set<String> COMPONENT_TAG_HANDLER_TYPES_JSF11; - private final static Set<String> COMPONENT_TAG_HANDLER_TYPES_JSF12; - - private final static Set<String> CONVERTER_TAG_HANDLER_TYPES_JSF11 = Collections - .singleton(JAVAX_FACES_WEBAPP_CONVERTER_TAG); - private final static Set<String> CONVERTER_TAG_HANDLER_TYPES_JSF12; - - private final static Set<String> VALIDATOR_TAG_HANDLER_TYPES_JSF11 = Collections - .singleton(JAVAX_FACES_WEBAPP_VALIDATOR_TAG); - private final static Set<String> VALIDATOR_TAG_HANDLER_TYPES_JSF12; - - private final static Set<String> FACET_TAG_HANDLER = Collections - .singleton(JAVAX_FACES_WEBAPP_FACET_TAG); - private final static Set<String> ATTRIBUTE_TAG_HANDLER = Collections - .singleton(JAVAX_FACES_WEBAPP_ATTRIBUTE_TAG); - // private final static Set<String> ACTIONLISTENER_TAG_HANDLER = Collections - // .singleton(JAVAX_FACES_WEBAPP_ACTIONLISTENER_TAG); - // private final static Set<String> VALUECHANGELISTENER_TAG_HANDLER = - // Collections - // .singleton(JAVAX_FACES_WEBAPP_VALUECHANGELISTENER_TAG); - - private final static Set<String> ALL_HANDLER_TAGS; - - static - { - // components - // JSF 1.1 - Set<String> set = new HashSet<String>(8); - set.add("javax.faces.webapp.UIComponentTag"); //$NON-NLS-1$ - set.add("javax.faces.webapp.UIComponentBodyTag"); //$NON-NLS-1$ - COMPONENT_TAG_HANDLER_TYPES_JSF11 = Collections.unmodifiableSet(set); - - // JSF 1.2+ - set = new HashSet<String>(8); - set.addAll(COMPONENT_TAG_HANDLER_TYPES_JSF11); - set.add("javax.faces.webapp.UIComponentELTag"); //$NON-NLS-1$ - COMPONENT_TAG_HANDLER_TYPES_JSF12 = Collections.unmodifiableSet(set); - - // converters - set = new HashSet<String>(8); - set.add(JAVAX_FACES_WEBAPP_CONVERTER_TAG); - set.add(JAVAX_FACES_WEBAPP_CONVERTER_ELTAG); - CONVERTER_TAG_HANDLER_TYPES_JSF12 = Collections.unmodifiableSet(set); - - // validators - set = new HashSet<String>(8); - set.add(JAVAX_FACES_WEBAPP_VALIDATOR_TAG); - set.add(JAVAX_FACES_WEBAPP_VALIDATOR_ELTAG); - VALIDATOR_TAG_HANDLER_TYPES_JSF12 = Collections.unmodifiableSet(set); - - // tag handlers - ALL_HANDLER_TAGS = new HashSet<String>(); - ALL_HANDLER_TAGS.addAll(FACET_TAG_HANDLER); - ALL_HANDLER_TAGS.addAll(ATTRIBUTE_TAG_HANDLER); - // ALL_HANDLER_TAGS.addAll(VALUECHANGELISTENER_TAG_HANDLER); - // ALL_HANDLER_TAGS.addAll(ACTIONLISTENER_TAG_HANDLER); - } - - /** - * Tries to determine the component type of the component that corresponds - * to the JSP tag defined by tldDecl. - * - * @param tldDecl - * @param project - * @return get the component type from the tag definition or null if none. - */ - public static String findComponentType(final TLDElementDeclaration tldDecl, - final IProject project) - { - final String className = tldDecl.getTagclass(); - - final IConfigurationContributor[] contributor = new IConfigurationContributor[] - { new ServletBeanProxyContributor(project) }; - - ProxyFactoryRegistry registry = null; - try - { - registry = getProxyFactoryRegistry(contributor, project); - - if (registry != null) - { - - final IStandardBeanTypeProxyFactory factory = registry - .getBeanTypeProxyFactory(); - final IBeanTypeProxy classTypeProxy = factory - .getBeanTypeProxy(className); - final BeanProxyWrapper classTypeWrapper = new BeanProxyWrapper(project, - classTypeProxy); - - try - { - classTypeWrapper.init(); - return classTypeWrapper.callStringMethod("getComponentType"); //$NON-NLS-1$ - } - catch (final ProxyException tp) - { - if (JSFCoreTraceOptions.TRACE_JSPTAGINTROSPECTOR) - { - JSFCoreTraceOptions.log("TagAnalyzer.findComponentType", tp); //$NON-NLS-1$ - } - } - } - } - finally - { - if (registry != null) - { - registry.terminateRegistry(true); - } - } - return null; - } - - /** - * Tries to introspect tldDecl's tag class to determine what the identifier - * of the underlying Converter that is used to register it in the app config - * - * @param tldDecl - * @param project - * @return the converter type identifier for the tldDecl or null if not - * found - */ - public static String findConverterType(final TLDElementDeclaration tldDecl, - final IProject project) - { - // TODO: allow for pluggable resolver? - - // This one is more hacky and less prone to success than the component - // type finder because the ConverterTag doesn't initialize its type - // field on construction. Instead, both MyFaces and RI seem to do it - // based on the doStartTag method. They also don't provide a standard - // interface for acquiring the id so instead we make some guess on - // the internal field name. - ProxyFactoryRegistry registry = null; - try - { - final String className = tldDecl.getTagclass(); - - final IConfigurationContributor[] contributor = new IConfigurationContributor[] - { new ServletBeanProxyContributor(project) }; - registry = getProxyFactoryRegistry( - contributor, project); - - if (registry != null) - { - final IStandardBeanTypeProxyFactory factory = registry - .getBeanTypeProxyFactory(); - final IBeanTypeProxy classTypeProxy = factory - .getBeanTypeProxy(className); - - try - { - final IType type = JavaCore.create(project).findType(className); - - if (type != null - && DTComponentIntrospector - .isTypeNameInstanceOfClass( - type, - Collections - .singleton(JAVAX_FACES_WEBAPP_CONVERTER_ELTAG))) - { - return findConverterType_InELTag(factory, classTypeProxy,project); - } - // the assumption is that this is a component tag, so we assume - // it is one. - else if (type != null - && DTComponentIntrospector - .isTypeNameInstanceOfClass( - type, - Collections - .singleton(JAVAX_FACES_WEBAPP_CONVERTER_TAG))) - { - return findConverterType_InTag(factory, classTypeProxy, project); - } - } - catch (final JavaModelException jme) - { - // suppress for now - } - } - } - finally - { - if (registry != null) - { - registry.terminateRegistry(true); - } - } - return null; - } - - private static String findConverterType_InTag( - final IStandardBeanTypeProxyFactory factory, - final IBeanTypeProxy classTypeProxy, final IProject project) - { - final IBeanTypeProxy nullPageContextType = factory - .getBeanTypeProxy("javax.servlet.jsp.PageContext"); //$NON-NLS-1$ - final BeanProxyWrapper classTypeWrapper = new BeanProxyWrapper(project, - classTypeProxy); - - try - { - classTypeWrapper.init(); - - callSuppressExceptions(classTypeWrapper, "setPageContext", //$NON-NLS-1$ - new IBeanProxy[] - { null }, new IBeanTypeProxy[] - { nullPageContextType }); - callSuppressExceptions(classTypeWrapper, "doStartTag"); //$NON-NLS-1$ - - final IBeanTypeProxy converterProxy = factory - .getBeanTypeProxy(JAVAX_FACES_WEBAPP_CONVERTER_TAG); - - // hopefully doStartTag set the converter field before it - // failed. - // now try to guess what it's called - String converterId = getStringField(classTypeWrapper, - converterProxy, "converterId"); //$NON-NLS-1$ - - if (converterId != null) - { - return converterId; - } - - converterId = getStringField(classTypeWrapper, converterProxy, - "_converterId"); //$NON-NLS-1$ - - if (converterId != null) - { - return converterId; - } - - // no? look for a CONVERTER_ID - converterId = getStringField(classTypeWrapper, classTypeProxy, - "CONVERTER_ID"); //$NON-NLS-1$ - } - catch (final ProxyException tp) - { - // fall through - } - return null; - } - - private static String findConverterType_InELTag( - final IStandardBeanTypeProxyFactory factory, - final IBeanTypeProxy classTypeProxy, final IProject project) - { - final BeanProxyWrapper classTypeWrapper = new BeanProxyWrapper(project, - classTypeProxy); - final IBeanTypeProxy elExpressionType = factory - .getBeanTypeProxy("javax.el.ValueExpression"); //$NON-NLS-1$ - - if (elExpressionType == null) - { - return null; - } - - try - { - classTypeWrapper.init(); - - callSuppressExceptions(classTypeWrapper, "doStartTag"); //$NON-NLS-1$ - - // no? look for a CONVERTER_ID - final IBeanProxy converterId = getFieldInParents(classTypeWrapper, - classTypeProxy, "CONVERTER_ID_EXPR"); //$NON-NLS-1$ - - if (converterId != null) - { - converterId.getTypeProxy().isKindOf(elExpressionType); - final BeanProxyWrapper elExprValue = new BeanProxyWrapper(project, - converterId.getTypeProxy()); - final String value = elExprValue - .callStringMethod("getExpressionString"); //$NON-NLS-1$ - System.out.println("Expression string:" + value); //$NON-NLS-1$ - } - - // - // - // final IBeanTypeProxy converterProxy = factory - // .getBeanTypeProxy(JAVAX_FACES_WEBAPP_CONVERTER_TAG); - - } - catch (final ProxyException tp) - { - // fall through - } - return null; - } - - /** - * @param tldDecl - * @param project - * @return the validator type identifier for the tldDecl or null if not - * found - */ - public static String findValidatorType(final TLDElementDeclaration tldDecl, - final IProject project) - { - // TODO: allow for pluggable resolver? - - // This one is more hacky and less prone to success than the component - // type finder because the Validator doesn't initialize its type - // field on construction. Instead, both MyFaces and RI seem to do it - // based on the doStartTag method. They also don't provide a standard - // interface for acquiring the id so instead we make some guess on - // the internal field name. - final String className = tldDecl.getTagclass(); - - final IConfigurationContributor[] contributor = new IConfigurationContributor[] - { new ServletBeanProxyContributor(project) }; - - ProxyFactoryRegistry registry = null; - - try - { - registry = getProxyFactoryRegistry(contributor, project); - - if (registry != null) - { - final IStandardBeanTypeProxyFactory factory = registry - .getBeanTypeProxyFactory(); - final IBeanTypeProxy classTypeProxy = factory - .getBeanTypeProxy(className); - final BeanProxyWrapper classTypeWrapper = new BeanProxyWrapper(project, - classTypeProxy); - final IBeanTypeProxy converterProxy = factory - .getBeanTypeProxy(JAVAX_FACES_WEBAPP_VALIDATOR_TAG); - try - { - classTypeWrapper.init(); - - callSuppressExceptions(classTypeWrapper, "doStartTag"); //$NON-NLS-1$ - callSuppressExceptions(classTypeWrapper, "createValidator"); //$NON-NLS-1$ - - // hopefully doStartTag set the converter field before it - // failed. - // now try to guess what it's called - String validatorId = getStringField(classTypeWrapper, - converterProxy, "validatorId"); //$NON-NLS-1$ - - if (validatorId != null) - { - return validatorId; - } - - validatorId = getStringField(classTypeWrapper, converterProxy, - "_validatorId"); //$NON-NLS-1$ - - if (validatorId != null) - { - return validatorId; - } - - // no? then see if there's a VALIDATOR_ID field *on the tag* - validatorId = getStringField(classTypeWrapper, classTypeProxy, - "VALIDATOR_ID"); //$NON-NLS-1$ - - if (validatorId != null) - { - return validatorId; - } - } - catch (final ProxyException tp) - { - // fall through - } - } - } - finally - { - if (registry != null) - { - registry.terminateRegistry(true); - } - } - return null; - - } - - private static IBeanProxy getFieldInParents( - final BeanProxyWrapper classTypeWrapper, - final IBeanTypeProxy typeProxy, final String fieldName) - { - try - { - return classTypeWrapper.getFieldValueIncludeParents(fieldName, - typeProxy); - } - catch (final ProxyException e) - { - // suppress - } - - return null; - } - - private static String getStringField( - final BeanProxyWrapper classTypeWrapper, - final IBeanTypeProxy typeProxy, final String fieldName) - { - try - { - return classTypeWrapper.getStringFieldValue(fieldName, typeProxy); - } - catch (final ProxyException e) - { - // suppress - } - - return null; - } - - private static void callSuppressExceptions( - final BeanProxyWrapper classTypeWrapper, final String methodName) - { - try - { - classTypeWrapper.call(methodName); - } - catch (final ProxyException tp) - { - // suppress this since it may well throw an exception - // depending on what assumptions the tag class is making - // that won't be true because we're not in a servlet - } - } - - private static void callSuppressExceptions( - final BeanProxyWrapper classTypeWrapper, final String methodName, - final IBeanProxy[] args, final IBeanTypeProxy[] argTypes) - { - try - { - classTypeWrapper.call(methodName, args, argTypes); - } - catch (final ProxyException tp) - { - // suppress this since it may well throw an exception - // depending on what assumptions the tag class is making - // that won't be true because we're not in a servlet - } - - } - - /** - * @param project - * @return a new proxy factory registry or null; - * - * TODO: caching? - */ - private static ProxyFactoryRegistry getProxyFactoryRegistry( - final IConfigurationContributor[] configuration, - final IProject project) - { - try - { - return IDERegistration.startAnImplementation(configuration, false, - project, project.getName(), JSFCorePlugin.PLUGIN_ID, - new NullProgressMonitor()); - } - catch (final CoreException e) - { - JSFCorePlugin.log("Error starting vm for project: " //$NON-NLS-1$ - + project.getName(), e); - } - - return null; - } - - /** - * @param tldDecl - * @param project - * @return the tag element for the tldDecl - */ - public static TLDTagElement createTLDTagElement( - final TLDElementDeclaration tldDecl, final IProject project) - { - if (JSFCoreTraceOptions.TRACE_JSPTAGINTROSPECTOR) - { - JSFCoreTraceOptions - .log(String - .format( - "TagAnalyzer.createTLDTagElement: Start tld=%s, project=%s", //$NON-NLS-1$ - tldDecl.getNodeName(), project.getName())); - } - long startTime = 0; - if (JSFCoreTraceOptions.TRACE_JSPTAGINTROSPECTOR_PERF) - { - startTime = System.nanoTime(); - } - - try - { - final IJavaProject javaProject = JavaCore.create(project); - final String typeName = tldDecl.getTagclass(); - - if (typeName == null - || JavaConventions.validateJavaTypeName(typeName, - JavaCore.VERSION_1_3, - JavaCore.VERSION_1_3).getSeverity() == IStatus.ERROR) - { - if (JSFCoreTraceOptions.TRACE_JSPTAGINTROSPECTOR) - { - JSFCoreTraceOptions.log( - "Bad tag class name in " + tldDecl.toString()); //$NON-NLS-1$ - } - return null; - } - - final IType type = javaProject.findType(typeName); - - if (type == null) - { - if (JSFCoreTraceOptions.TRACE_JSPTAGINTROSPECTOR) - { - JSFCoreTraceOptions.log("Type not found for: "+typeName); //$NON-NLS-1$ - } - return null; - } - final TagType tagType = getJSFComponentTagType(type, project); - - if (JSFCoreTraceOptions.TRACE_JSPTAGINTROSPECTOR) - { - JSFCoreTraceOptions.log(String.format( - "Tag class type=%s\nTag type=%s", type, tagType)); //$NON-NLS-1$ - } - - if (tagType == TagType.COMPONENT) - { - final TLDTagElement element = createComponentTagElement(tldDecl, project); - - if (JSFCoreTraceOptions.TRACE_JSPTAGINTROSPECTOR_PERF) - { - String name = element != null ? element.toString() - : "<none>"; //$NON-NLS-1$ - System.out.printf( - "Time to create component tag element %s was %d\n", //$NON-NLS-1$ - name, Long.valueOf(System.nanoTime() - startTime)); - } - return element; - } - else if (tagType == TagType.CONVERTER) - { - final TLDTagElement element = createConverterTagElement(tldDecl, project); - if (JSFCoreTraceOptions.TRACE_JSPTAGINTROSPECTOR_PERF) - { - String name = element != null ? element.toString() - : "<none>"; //$NON-NLS-1$ - System.out.printf( - "Time to create converter tag element %s was %d\n", //$NON-NLS-1$ - name, Long.valueOf(System.nanoTime() - startTime)); - } - return element; - } - else if (tagType == TagType.VALIDATOR) - { - final TLDTagElement element = createValidatorTagElement(tldDecl, project); - if (JSFCoreTraceOptions.TRACE_JSPTAGINTROSPECTOR_PERF) - { - String name = element != null ? element.toString() - : "<none>"; //$NON-NLS-1$ - System.out.printf( - "Time to create validator tag element %s was %d\n", //$NON-NLS-1$ - name, Long.valueOf(System.nanoTime() - startTime)); - } - return element; - } - else if (tagType == TagType.HANDLER) - { - final TLDTagElement element = createHandlerTagElement(tldDecl, type); - if (JSFCoreTraceOptions.TRACE_JSPTAGINTROSPECTOR_PERF) - { - String name = element != null ? element.toString() - : "<none>"; //$NON-NLS-1$ - System.out.printf( - "Time to create handler tag element %s was %d\n", //$NON-NLS-1$ - name, Long.valueOf(System.nanoTime() - startTime)); - } - return element; - } - } - catch (final JavaModelException jme) - { - JSFCorePlugin.log(jme, "Trying to get type for TLD"); //$NON-NLS-1$ - } - - return null; - } - - /** - * @param tldDecl - * @param project - * @return a component tag element for tldDecl - */ - public static TLDTagElement createComponentTagElement( - final TLDElementDeclaration tldDecl, final IProject project) - { - final String componentType = findComponentType(tldDecl, project); - - if (componentType != null) - { - final String componentClass = DTComponentIntrospector - .findComponentClass(componentType, project); - - if (componentClass != null && !"".equals(componentClass.trim())) //$NON-NLS-1$ - { - final ComponentTypeInfo typeInfo = DTComponentIntrospector - .getComponent(componentType, componentClass, project, - new IConfigurationContributor[] - {new ServletBeanProxyContributor(project)}); - - if (typeInfo != null) - { - final TLDComponentTagElement tagElement = new TLDComponentTagElement( - tldDecl, typeInfo, new NullAttributeAdvisor()); - return tagElement; - } - } - } - - // TODO: really return null? - return null; - } - - /** - * @param tldDecl - * @param project - * @return a converter tag element for tldDecl - */ - public static TLDTagElement createConverterTagElement( - final TLDElementDeclaration tldDecl, final IProject project) - { - final String converterId = findConverterType(tldDecl, project); - - if (converterId != null) - { - final String converterClass = DTComponentIntrospector - .findConverterClass(converterId, project); - - if (converterClass != null && !"".equals(converterClass.trim())) //$NON-NLS-1$ - { - final ConverterTypeInfo typeInfo = DTComponentIntrospector - .getConverter(converterId, converterClass); - final TLDConverterTagElement tagElement = new TLDConverterTagElement( - tldDecl, typeInfo, new NullAttributeAdvisor()); - return tagElement; - } - } - - // we know (actually we assume by contract) that this a converter - // so create an unknown converter tag for it - return new TLDConverterTagElement(tldDecl, ConverterTypeInfo.UNKNOWN, new NullAttributeAdvisor()); - } - - /** - * @param tldDecl - * @param project - * @return a validator tag element for the tldDec - */ - public static TLDTagElement createValidatorTagElement( - final TLDElementDeclaration tldDecl, final IProject project) - { - final String validatorId = findValidatorType(tldDecl, project); - - if (validatorId != null) - { - final String validatorClass = DTComponentIntrospector - .findValidatorClass(validatorId, project); - - if (validatorClass != null && !"".equals(validatorClass.trim())) //$NON-NLS-1$ - { - final ValidatorTypeInfo typeInfo = DTComponentIntrospector - .getValidator(validatorId, validatorClass); - final TLDValidatorTagElement tagElement = new TLDValidatorTagElement( - tldDecl, typeInfo, new NullAttributeAdvisor()); - return tagElement; - } - } - // we know (actually we assume by contract) that this a validator - // so create an unknown converter tag for it - return new TLDValidatorTagElement(tldDecl, ValidatorTypeInfo.UNKNOWN, new NullAttributeAdvisor()); - } - - /** - * @param tldDecl - * @param type - * @return the tag element for a JSF handler - */ - public static TLDTagElement createHandlerTagElement( - final TLDElementDeclaration tldDecl, final IType type) - { - if (DTComponentIntrospector.isTypeNameInstanceOfClass(type, - FACET_TAG_HANDLER)) - { - return new TLDTagHandlerElement(tldDecl, TagHandlerType.FACET, new NullAttributeAdvisor()); - } - else if (DTComponentIntrospector.isTypeNameInstanceOfClass(type, - ATTRIBUTE_TAG_HANDLER)) - { - return new TLDTagHandlerElement(tldDecl, TagHandlerType.ATTRIBUTE, new NullAttributeAdvisor()); - } - // else if (isTypeNameInstanceOfClass(type, ACTIONLISTENER_TAG_HANDLER)) - // { - // return new TLDTagHandlerElement(tldDecl, - // TagHandlerType.ACTIONLISTENER); - // } - // else if (isTypeNameInstanceOfClass(type, - // VALUECHANGELISTENER_TAG_HANDLER)) - // { - // return new TLDTagHandlerElement(tldDecl, - // TagHandlerType.VALUECHANGELISTENER); - // } - return null; - } - - /** - * @param type - * @param project - * @return true if type represents a JSF component action class (spec 9.2.2) - */ - public static IJSFTagElement.TagType getJSFComponentTagType( - final IType type, final IProject project) - { - if (JSFCoreTraceOptions.TRACE_JSPTAGINTROSPECTOR) - { - JSFCoreTraceOptions - .log(String - .format( - "TagAnalyzer.getJSFComponentTagType: Determining Tag Type for type %s on project %s", //$NON-NLS-1$ - type.getFullyQualifiedName(), project - .toString())); - } - - Set<String> componentTags = null; - Set<String> converterTags = null; - Set<String> validatorTags = null; - - final JSFVersion jsfVersion = ServletBeanProxyContributor.getProjectVersion(project); - - if (jsfVersion == null){ - return null; - } - // v1.1(9.2.2): JSF component tags must sub-class one of these - else if (jsfVersion == JSFVersion.V1_0 || jsfVersion == JSFVersion.V1_1) - { - componentTags = COMPONENT_TAG_HANDLER_TYPES_JSF11; - converterTags = CONVERTER_TAG_HANDLER_TYPES_JSF11; - validatorTags = VALIDATOR_TAG_HANDLER_TYPES_JSF11; - } - // v1.2(9.2.2): JSF component tags must sub-class UIComponentELTag - // the original two are included because we must be backward - // compatible - else if (jsfVersion == JSFVersion.V1_2 || jsfVersion == JSFVersion.V2_0) - { - componentTags = COMPONENT_TAG_HANDLER_TYPES_JSF12; - converterTags = CONVERTER_TAG_HANDLER_TYPES_JSF12; - validatorTags = VALIDATOR_TAG_HANDLER_TYPES_JSF12; - } - else - { - throw new IllegalArgumentException(); - } - - TagType tagType = null; - - if (DTComponentIntrospector.isTypeNameInstanceOfClass(type, - componentTags)) - { - tagType = TagType.COMPONENT; - } - else if (DTComponentIntrospector.isTypeNameInstanceOfClass(type, - converterTags)) - { - tagType = TagType.CONVERTER; - } - else if (DTComponentIntrospector.isTypeNameInstanceOfClass(type, - validatorTags)) - { - tagType = TagType.VALIDATOR; - } - else if (DTComponentIntrospector.isTypeNameInstanceOfClass(type, - ALL_HANDLER_TAGS)) - { - tagType = TagType.HANDLER; - } - - if (JSFCoreTraceOptions.TRACE_JSPTAGINTROSPECTOR) - { - JSFCoreTraceOptions.log(String.format( - "TagAnalyzer.getJSFComponentTagType: tag type is %s", //$NON-NLS-1$ - tagType != null ? tagType.toString() : "null")); //$NON-NLS-1$ - } - return tagType; - } - - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/messages.properties b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/messages.properties deleted file mode 100644 index 15bf8c5b3..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/messages.properties +++ /dev/null @@ -1 +0,0 @@ -UnresolvedJSPTagResolvingStrategy_1=Unresolved Tag Resolver diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/persistence/MasterIndex.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/persistence/MasterIndex.java deleted file mode 100644 index 3f2799de9..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/persistence/MasterIndex.java +++ /dev/null @@ -1,442 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.model.jsp.persistence; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.Path; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.core.internal.JSFCoreTraceOptions; -import org.osgi.framework.Version; - -/** - * The definitive index of what projects are indexed for JSP tag registry - * persistence. - * - * @author cbateman - * - */ -class MasterIndex implements Serializable -{ - public final static SerializableVersion CURRENT_VERSION = new SerializableVersion( - 1, 0, 0); - - /** - * - */ - private static final long serialVersionUID = -2725662604972649316L; - - private final transient String _repositoryPath; - private final transient File _storageFile; - - private IndexHeader _header; - private List<ProjectIndex> _projectIndices; - - public MasterIndex(final File storageFile, final String repositoryPath) - { - _storageFile = storageFile; - _repositoryPath = repositoryPath; - } - - public synchronized void create(final SerializableVersion version) - throws IOException - { - if (JSFCoreTraceOptions.TRACE_JSPTAGPERSISTENCE) - { - JSFCoreTraceOptions.log("MasterIndex.create, version=:" //$NON-NLS-1$ - + version.toString()); - } - - _header = new IndexHeader(version); - _projectIndices = new ArrayList<ProjectIndex>(); - - save(_storageFile); - } - - public synchronized void save(final File file) throws IOException - { - FileOutputStream out = null; - - try - { - if (JSFCoreTraceOptions.TRACE_JSPTAGPERSISTENCE) - { - JSFCoreTraceOptions.log("Trying to save master index file: " //$NON-NLS-1$ - + file.getAbsolutePath()); - } - - out = new FileOutputStream(file); - final ObjectOutputStream objStream = new ObjectOutputStream(out); - objStream.writeObject(this); - - if (JSFCoreTraceOptions.TRACE_JSPTAGPERSISTENCE) - { - JSFCoreTraceOptions - .log("Master index file written successfully: " //$NON-NLS-1$ - + file.getAbsolutePath()); - } - } - finally - { - if (out != null) - { - out.close(); - } - } - } - - public synchronized void load(final SerializableVersion expectedVersion) - throws IOException, ClassNotFoundException - { - FileInputStream in = null; - - try - { - if (JSFCoreTraceOptions.TRACE_JSPTAGPERSISTENCE) - { - JSFCoreTraceOptions.log("Trying to load master index file: " //$NON-NLS-1$ - + _storageFile.getAbsolutePath()); - } - - in = new FileInputStream(_storageFile); - final ObjectInputStream objStream = new ObjectInputStream(in); - MasterIndex index = (MasterIndex) objStream.readObject(); - _header = index._header; - _projectIndices = index._projectIndices; - - if (JSFCoreTraceOptions.TRACE_JSPTAGPERSISTENCE) - { - JSFCoreTraceOptions - .log("Loaded master index file successfully:" //$NON-NLS-1$ - + _storageFile.getAbsolutePath()); - JSFCoreTraceOptions.log("Initial contents: "); //$NON-NLS-1$ - System.out.println(index.toString()); - } - } - finally - { - if (in != null) - { - in.close(); - } - } - } - - public synchronized String toString() - { - StringBuffer buffer = new StringBuffer(); - - buffer.append(String.format("Header: %s\n\n", _header.toString())); //$NON-NLS-1$ - - for (final ProjectIndex projIndex : _projectIndices) - { - buffer.append(String.format("\t%s\n", projIndex.toString())); //$NON-NLS-1$ - } - - return buffer.toString(); - } - - public synchronized ProjectIndex getProjectIndex(final IProject project) - { - ProjectIndex index = findIndex(project); - - if (index != null) - { - return index; - } - - // otherwise, create. - index = new ProjectIndex(0, project.getName(), _repositoryPath); - index.create(); - _projectIndices.add(index); - try - { - save(_storageFile); - } - catch (IOException ioe) - { - JSFCorePlugin.log(ioe, - "Failed to save master index. Project Index for " //$NON-NLS-1$ - + project.toString() + " may not be saved"); //$NON-NLS-1$ - } - return index; - } - - public synchronized void removeProjectIndex(final IProject project) throws IOException - { - final ProjectIndex index = findIndex(project); - if (index != null) - { - _projectIndices.remove(index); - if (!index.remove()) - { - throw new IOException("Failed to remove index file"); //$NON-NLS-1$ - } - } - } - - private ProjectIndex findIndex(final IProject project) - { - // check if the project already exists - for (final ProjectIndex index : _projectIndices) - { - if (index.getProjectName().equals(project.getName())) - { - return index; - } - } - return null; - } - - private void writeObject(final java.io.ObjectOutputStream out) - throws IOException - { - out.writeObject(_header); - out.writeObject(_projectIndices); - } - - private void readObject(final java.io.ObjectInputStream in) - throws IOException, ClassNotFoundException - { - _header = (IndexHeader) in.readObject(); - _projectIndices = (List<ProjectIndex>) in.readObject(); - } - - private class IndexHeader implements Serializable - { - /** - * serializable - */ - private static final long serialVersionUID = 40851054201507727L; - - private final SerializableVersion _version; -// private long _lastModifiedStamp; - - public IndexHeader(final SerializableVersion version) - { - _version = version; -// _lastModifiedStamp = 0; - } - -// protected final Version getVersion() -// { -// return _version.getVersion(); -// } -// -// protected final synchronized long modified() -// { -// return _lastModifiedStamp++; -// } -// -// protected final synchronized long getLastModifiedStamp() -// { -// return _lastModifiedStamp; -// } - - public String toString() - { - return "Version: " + _version.toString(); //$NON-NLS-1$ - } - } - - static class SerializableVersion implements Serializable - { - private Version _version; - /** - * - */ - private static final long serialVersionUID = 5973410328814890568L; - - public SerializableVersion(final int major, final int minor, - final int micro) - { - _version = new Version(major, minor, micro); - } - - public SerializableVersion(final String versionString) - { - _version = new Version(versionString); - } - - public Version getVersion() - { - return _version; - } - - public String toString() - { - return _version.toString(); - } - - private void writeObject(ObjectOutputStream out) throws IOException - { - out.writeObject(_version.toString()); - } - - private void readObject(ObjectInputStream in) throws IOException, - ClassNotFoundException - { - final String versionString = (String) in.readObject(); - _version = new Version(versionString); - } - } - - static class ProjectIndex implements Serializable - { - /** - * - */ - private static final long serialVersionUID = 2864798175910805380L; - - private final String _projectName; - private final String _relativePath; - private final long _lastModStampOnProject; - private File _file; - - /** - * @param lastModStampOnProject - * @param projectName - * @param relativePath - */ - public ProjectIndex(final long lastModStampOnProject, - final String projectName, final String relativePath) - { - super(); - _lastModStampOnProject = lastModStampOnProject; - _projectName = projectName; - _relativePath = relativePath; - } - - public boolean remove() - { - return _file.delete(); - } - - public synchronized void create() - { - final long uniqueCode = Math - .round((Math.random() * Integer.MAX_VALUE)); - final String fileName = String.format("Project_%s_%x.idx", //$NON-NLS-1$ - _projectName, Long.valueOf(uniqueCode)); - _file = new File(new Path(_relativePath).append(fileName) - .toOSString()); - } - - public synchronized Map<String, SerializableTLDNamespace> getNamespaces() - throws IOException, ClassNotFoundException - { - FileInputStream in = null; - - try - { - in = new FileInputStream(_file); - final ObjectInputStream objStream = new ObjectInputStream(in); - final Map<String, SerializableTLDNamespace> namespaces = (Map<String, SerializableTLDNamespace>) objStream - .readObject(); - return namespaces; - } - catch (FileNotFoundException nfe) - { - return new HashMap<String, SerializableTLDNamespace>(); - } - finally - { - if (in != null) - { - in.close(); - } - } - } - - public synchronized void save( - final Map<String, SerializableTLDNamespace> namespaces) - throws IOException - { - FileOutputStream out = null; - - try - { - out = new FileOutputStream(_file); - final ObjectOutputStream objStream = new ObjectOutputStream(out); - objStream.writeObject(namespaces); - } - finally - { - if (out != null) - { - out.close(); - } - } - } - - public String toString() - { - return "project= " + _projectName + ", relativePath=" //$NON-NLS-1$ //$NON-NLS-2$ - + _relativePath + ", lastModified=" //$NON-NLS-1$ - + _lastModStampOnProject + ", saveFile=" + _file; //$NON-NLS-1$ - } - - // public synchronized void save() - // { - // if (_file != null) - // { - // doSave(); - // } - // throw new NullPointerException("_file is null"); - // } - // - // private void doSave() throws IOException - // { - // FileOutputStream out = null; - // - // try - // { - // out = new FileOutputStream(_file); - // final ObjectOutputStream objStream = new ObjectOutputStream(out); - // objStream.writeObject(this); - // } - // finally - // { - // if (out != null) - // { - // out.close(); - // } - // } - // } - - protected final String getProjectName() - { - return _projectName; - } - - protected final String getRelativePath() - { - return _relativePath; - } - - protected final long getLastModStampOnProject() - { - return _lastModStampOnProject; - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/persistence/PersistedDataTagStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/persistence/PersistedDataTagStrategy.java deleted file mode 100644 index 6c95f0274..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/persistence/PersistedDataTagStrategy.java +++ /dev/null @@ -1,257 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.model.jsp.persistence; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.atomic.AtomicBoolean; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagElement; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.core.internal.JSFCoreTraceOptions; -import org.eclipse.jst.jsf.designtime.internal.Messages; -import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.JSPTagResolvingStrategy; -import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.TLDNamespace; -import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.TLDTagElement; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDDocument; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDElementDeclaration; -import org.eclipse.wst.xml.core.internal.contentmodel.CMDocument; - -/** - * @author cbateman - * - */ -public class PersistedDataTagStrategy extends JSPTagResolvingStrategy -{ - /** - * the identifier of this strategy - */ - public final static String ID = "org.eclipse.jst.jsf.designtime.PersistedDataTagStrategy"; //$NON-NLS-1$ - /** - * the display name - */ - public final static String DISPLAY_NAME = Messages.PersistedDataTagStrategy_DisplayName; - - private final IProject _project; - private final TagRepository _repository; - private Map<String, SerializableTLDNamespace> _namespaces; - private final transient AtomicBoolean _reentrancyFlag = new AtomicBoolean( - false); - - /** - * @return the descriptor for this resolver strategy - */ - public static StrategyDescriptor createDescriptor() - { - return new StrategyDescriptor(ID, DISPLAY_NAME); - } - - /** - * @param project - */ - public PersistedDataTagStrategy(final IProject project) - { - _project = project; - _repository = new TagRepository(_project); - } - - /** - * - */ - public void init() - { - if (JSFCoreTraceOptions.TRACE_JSPTAGPERSISTENCE) - { - JSFCoreTraceOptions - .log("Initializing PersistedDataTagStrategy for project: " //$NON-NLS-1$ - + _project.toString()); - } - try - { - _namespaces = _repository.load(); - return; - } - catch (final IOException e) - { - JSFCorePlugin - .log(e, - "JSP tag registry cached failed to load. Strategy will not be used"); //$NON-NLS-1$ - } - catch (final ClassNotFoundException e) - { - JSFCorePlugin - .log(e, - "JSP tag registry cached failed to load. Strategy will not be used"); //$NON-NLS-1$ - } - _namespaces = new HashMap<String, SerializableTLDNamespace>(); - } - - /** - * @param namespace - * @throws ClassNotFoundException - * @throws IOException - */ - public void save(final Map<String, TLDNamespace> namespace) - throws IOException, ClassNotFoundException - { - if (JSFCoreTraceOptions.TRACE_JSPTAGPERSISTENCE) - { - JSFCoreTraceOptions - .log("Saving PersistedDataTagStrategy for project: " //$NON-NLS-1$ - + _project.toString()); - } - - // namespace is considered authoritative for every key it contains - // so copy them all in. However, preserve anything in our own namespace - // map not found in namespace - for (final Map.Entry<String, TLDNamespace> namespaceEntry : namespace - .entrySet()) - { - final TLDNamespace ns = namespaceEntry.getValue(); - final String nsName = namespaceEntry.getKey(); - final SerializableTLDNamespace myNs = _namespaces.get(nsName); - - if (myNs == null) - { - if (JSFCoreTraceOptions.TRACE_JSPTAGPERSISTENCE) - { - JSFCoreTraceOptions.log(String.format( - "Adding namespace %s for project", ns.getNSUri(), //$NON-NLS-1$ - _project.toString())); - } - - _namespaces.put(nsName, new SerializableTLDNamespace(ns)); - } - else - { - if (JSFCoreTraceOptions.TRACE_JSPTAGPERSISTENCE) - { - JSFCoreTraceOptions.log(String.format( - "Updating namespace %s for project", ns.getNSUri(), //$NON-NLS-1$ - _project.toString())); - } - - for (final Map.Entry<String, ITagElement> elementEntry : ns - .getCurrentElements().entrySet()) - { - if (JSFCoreTraceOptions.TRACE_JSPTAGPERSISTENCE) - { - JSFCoreTraceOptions.log(String.format( - "Putting element %s", elementEntry.getKey())); //$NON-NLS-1$ - } - myNs.put(elementEntry.getKey(), elementEntry.getValue()); - } - } - } - - _repository.save(_namespaces); - } - - @Override - public ITagElement resolve(final TLDElementDeclaration element) - { - if (JSFCoreTraceOptions.TRACE_JSPTAGPERSISTENCE) - { - JSFCoreTraceOptions.log(String.format( - "Attempting to resolve element %s for project %s", element //$NON-NLS-1$ - .getElementName(), _project)); - } - - try - { - if (!_reentrancyFlag.compareAndSet(false, true)) - { - throw new IllegalStateException("Reentrant call to resolve"); //$NON-NLS-1$ - } - - final String uri = getUri(element); - final String tagName = element.getElementName(); - - if (uri != null && tagName != null) - { - final SerializableTLDNamespace ns = _namespaces.get(uri); - - if (ns != null) - { - final ITagElement tagElement = ns.getViewElement(tagName); - - if (tagElement instanceof TLDTagElement) - { - if (JSFCoreTraceOptions.TRACE_JSPTAGPERSISTENCE) - { - JSFCoreTraceOptions.log(String.format( - "Resolved element %s for project %s", //$NON-NLS-1$ - element.getElementName(), _project)); - } - return tagElement; - } - } - } - return getNotFoundIndicator(); - } - finally - { - _reentrancyFlag.set(false); - } - } - - /** - * Clears all cached data and removes it permanently from disk. - */ - public void clear() - { - if (JSFCoreTraceOptions.TRACE_JSPTAGPERSISTENCE) - { - JSFCoreTraceOptions.log(String.format( - "Flushing all data for project %s", _project)); //$NON-NLS-1$ - } - - try - { - _repository.clearAll(); - } - catch (IOException e) - { - JSFCorePlugin.log(e, "Failure during cache flushing on project: " //$NON-NLS-1$ - + _project); - } - catch (ClassNotFoundException e) - { - JSFCorePlugin.log(e, "Failure during cache flushing on project: " //$NON-NLS-1$ - + _project); - } - _namespaces.clear(); - } - - public String getDisplayName() - { - return DISPLAY_NAME; - } - - private static String getUri(final TLDElementDeclaration element) - { - final CMDocument owner = element.getOwnerDocument(); - - if (owner instanceof TLDDocument) - { - return ((TLDDocument) owner).getUri(); - } - return null; - } - - @Override - public String getId() - { - return ID; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/persistence/SerializableTLDNamespace.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/persistence/SerializableTLDNamespace.java deleted file mode 100644 index b40878a8f..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/persistence/SerializableTLDNamespace.java +++ /dev/null @@ -1,159 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.model.jsp.persistence; - -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagElement; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.Namespace; -import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.TLDNamespace; -import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.TLDNamespace.TLDNamespaceData; - -/** - * A serializable tld namespace. This is distinct from TLDNamespace in that it - * takes a snapshot of a TLDNamespace at a point in time. Any elements not - * lazily resolved by the TLDNamespace will not be resolved by this namespace. - * - */ -public class SerializableTLDNamespace extends Namespace -{ - private final SerializedNamespaceData _data; - - /** - * @param namespace - */ - public SerializableTLDNamespace(final TLDNamespace namespace) - { - _data = new SerializedNamespaceData(namespace.getDisplayName(), - namespace.getCurrentElements(), namespace.getNSUri()); - } - - /** - * - */ - private static final long serialVersionUID = 5364814479459691353L; - - @Override - public String getDisplayName() - { - return _data.getDisplayName(); - } - - @Override - public String getNSUri() - { - return _data.getUri(); - } - - @Override - public ITagElement getViewElement(String name) - { - return _data.getViewElement(name); - } - - @Override - public Collection<? extends ITagElement> getViewElements() - { - return Collections.unmodifiableCollection(_data.getAllViewElements() - .values()); - } - - @Override - public boolean hasViewElements() - { - return _data.getNumTags() > 0; - } - - @Override - public boolean isInitialized() - { - return _data.isInitialized(); - } - - /* package */void put(final String name, final ITagElement tagElement) - { - _data._tags.put(name, tagElement); - } - - private static class SerializedNamespaceData extends TLDNamespaceData - { - /** - * serializable id - */ - private static final long serialVersionUID = -6723194339788215607L; - private final String _displayName; - private final String _uri; - private final Map<String, ITagElement> _tags; - - /** - * @param displayName - * @param tags - * @param uri - */ - private SerializedNamespaceData(String displayName, - Map<String, ITagElement> tags, String uri) - { - super(); - _displayName = displayName; - _tags = new HashMap<String, ITagElement>(); - for (final Map.Entry<String, ITagElement> tagEntry : tags.entrySet()) - { - _tags.put(tagEntry.getKey(), tagEntry.getValue()); - } - _uri = uri; - } - - @Override - public String getDisplayName() - { - return _displayName; - } - - @Override - public int getNumTags() - { - return _tags.size(); - } - - @Override - public ITagElement getViewElement(String name) - { - return _tags.get(name); - } - - @Override - public String getUri() - { - return _uri; - } - - @Override - public Map<String, ITagElement> getAllViewElements() - { - return _tags; - } - - @Override - public boolean isInitialized() - { - return true; - } - - @Override - public Map<String, ITagElement> getCurrentElements() - { - return _tags; - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/persistence/TagRepository.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/persistence/TagRepository.java deleted file mode 100644 index 0d15744f8..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/persistence/TagRepository.java +++ /dev/null @@ -1,166 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -/** - * - */ -package org.eclipse.jst.jsf.designtime.internal.view.model.jsp.persistence; - -import java.io.File; -import java.io.IOException; -import java.util.Map; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagElement; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.core.internal.JSFCoreTraceOptions; -import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.persistence.MasterIndex.ProjectIndex; -import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.persistence.MasterIndex.SerializableVersion; - -class TagRepository -{ - private final static Object GLOBAL_MASTER_INDEX_LOCK = new Object(); - private static MasterIndex GLOBAL_MASTER_INDEX; - private final static String PATH_TO_REPOSITORY = "/.jsptagregistry"; //$NON-NLS-1$ - private final static String MASTER_INDEX_FILE_NAME = "tagRegistryMasterIndex.idx"; //$NON-NLS-1$ - - private final IProject _project; - //private Map<String, SerializableTLDNamespace> _namespaces; - - public TagRepository(final IProject project) - { - _project = project; - } - - public Map<String, SerializableTLDNamespace> load() throws IOException, - ClassNotFoundException - { - if (JSFCoreTraceOptions.TRACE_JSPTAGPERSISTENCE) - { - JSFCoreTraceOptions.log("Loading tag repository for: " //$NON-NLS-1$ - + _project.toString()); - } - - final MasterIndex index = getOrCreateMasterIndex(); - - final ProjectIndex projIndex = index.getProjectIndex(_project); - final Map<String, SerializableTLDNamespace> namespaces = projIndex.getNamespaces(); - - if (JSFCoreTraceOptions.TRACE_JSPTAGPERSISTENCE) - { - JSFCoreTraceOptions.log("Contents of repo for: " //$NON-NLS-1$ - + _project.toString()); - - for (final Map.Entry<String, SerializableTLDNamespace> nsEntry : namespaces.entrySet()) - { - JSFCoreTraceOptions.log("\tNamespace: "+nsEntry.getKey()); //$NON-NLS-1$ - - SerializableTLDNamespace ns = nsEntry.getValue(); - for (final ITagElement element : ns.getViewElements()) - { - JSFCoreTraceOptions.log("\t\tTag: "+element.toString()); //$NON-NLS-1$ - } - } - } - - return namespaces; - } - - public void save(Map<String, SerializableTLDNamespace> namespaces) throws IOException, - ClassNotFoundException - { - final MasterIndex index = getOrCreateMasterIndex(); - final ProjectIndex projectIndex = index.getProjectIndex(_project); - projectIndex.save(namespaces); - } - - public void clearAll() throws IOException, ClassNotFoundException - { - final MasterIndex index = getOrCreateMasterIndex(); - index.removeProjectIndex(_project); - } - - private MasterIndex getOrCreateMasterIndex() throws IOException, - ClassNotFoundException - { - final IPath wkspacePath = JSFCorePlugin.getDefault().getStateLocation(); - final IPath repoPath = wkspacePath.append(PATH_TO_REPOSITORY); - final File repoDir = new File(repoPath.toOSString()); - - synchronized (GLOBAL_MASTER_INDEX_LOCK) - { - if (GLOBAL_MASTER_INDEX != null) - { - if (JSFCoreTraceOptions.TRACE_JSPTAGPERSISTENCE) - { - JSFCoreTraceOptions - .log("GLOBAL_MASTER_INDEX already exists for: " //$NON-NLS-1$ - + _project.toString()); - } - return GLOBAL_MASTER_INDEX; - } - - if (!repoDir.exists()) - { - createNewRepo(repoDir); - } - - final File masterIndexFile = new File(new Path(repoDir - .getAbsolutePath()).append(MASTER_INDEX_FILE_NAME) - .toOSString()); - final MasterIndex index = new MasterIndex(masterIndexFile, repoDir.getAbsolutePath()); - - if (!masterIndexFile.exists()) - { - if (!masterIndexFile.createNewFile()) - { - throw new IOException( - "Could not create new master index file: " //$NON-NLS-1$ - + masterIndexFile.toString()); - } - if (JSFCoreTraceOptions.TRACE_JSPTAGPERSISTENCE) - { - JSFCoreTraceOptions.log("Creating master index file for " //$NON-NLS-1$ - + _project.toString()); - } - index.create(new SerializableVersion(1, 0, 0)); - } - else - { - if (JSFCoreTraceOptions.TRACE_JSPTAGPERSISTENCE) - { - JSFCoreTraceOptions.log("Loading master index file for " //$NON-NLS-1$ - + _project.toString()); - } - index.load(new SerializableVersion(1, 0, 0)); - } - - GLOBAL_MASTER_INDEX = index; - return index; - } - } - - private static void createNewRepo(final File repoDir) throws IOException - { - if (JSFCoreTraceOptions.TRACE_JSPTAGPERSISTENCE) - { - JSFCoreTraceOptions.log("Creating repo directory: " //$NON-NLS-1$ - + repoDir.getAbsolutePath()); - } - - if (!repoDir.mkdir()) - { - throw new IOException("Failed to create repo directory: " //$NON-NLS-1$ - + repoDir.getAbsolutePath()); - } - } -}
\ No newline at end of file diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/registry/LibraryOperation.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/registry/LibraryOperation.java deleted file mode 100644 index 403fea914..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/registry/LibraryOperation.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -/** - * - */ -package org.eclipse.jst.jsf.designtime.internal.view.model.jsp.registry; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsp.core.taglib.ITaglibRecord; - -abstract class LibraryOperation implements Runnable -{ - protected final ITaglibRecord _changeRecord; - private IStatus _result; - - protected LibraryOperation(final ITaglibRecord changeRecord) - { - _changeRecord = changeRecord; - } - - public final void run() - { - try - { - _result = doRun(); - } - catch (final Exception e) - { - _result = new Status(IStatus.ERROR, JSFCorePlugin.PLUGIN_ID, - "Problem during run", e); //$NON-NLS-1$ - } - } - - public IStatus getResult() - { - return _result; - } - - protected abstract IStatus doRun(); -}
\ No newline at end of file diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/registry/LibraryOperationFactory.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/registry/LibraryOperationFactory.java deleted file mode 100644 index 70f5d3f51..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/registry/LibraryOperationFactory.java +++ /dev/null @@ -1,122 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.model.jsp.registry; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jst.jsp.core.taglib.ITaglibRecord; - -class LibraryOperationFactory -{ - private final TLDTagRegistry _tagRegistry; - - public LibraryOperationFactory(final TLDTagRegistry tagRegistry) - { - _tagRegistry = tagRegistry; - } - - LibraryOperation createAddOperation(final ITaglibRecord changeRecord) - { - return new AddTagLibrary(_tagRegistry, changeRecord); - } - - LibraryOperation createRemoveOperation(final ITaglibRecord changeRecord) - { - return new RemoveTagLibrary(_tagRegistry, changeRecord); - } - - LibraryOperation createChangeOperation(final ITaglibRecord changeRecord) - { - if (changeRecord == null) - { - throw new IllegalArgumentException(); - } - return new ChangeTagLibrary(_tagRegistry, changeRecord); - } - - private static class AddTagLibrary extends LibraryOperation - { - private final TLDTagRegistry _tagRegistry; - - public AddTagLibrary(final TLDTagRegistry tagRegistry, - final ITaglibRecord newRecord) - { - super(newRecord); - _tagRegistry = tagRegistry; - } - - @Override - protected IStatus doRun() - { - synchronized (_tagRegistry) - { - // fire change event if applicable - _tagRegistry.initialize(_changeRecord, true); - return Status.OK_STATUS; - } - } - } - - private static class RemoveTagLibrary extends LibraryOperation - { - private final TLDTagRegistry _tagRegistry; - - protected RemoveTagLibrary(final TLDTagRegistry tagRegistry, - final ITaglibRecord changeRecord) - { - super(changeRecord); - _tagRegistry = tagRegistry; - } - - @Override - protected IStatus doRun() - { - _tagRegistry.remove(_changeRecord); - return Status.OK_STATUS; - - } - - } - - private static class ChangeTagLibrary extends LibraryOperation - { - private final TLDTagRegistry _tagRegistry; - - protected ChangeTagLibrary(final TLDTagRegistry tagRegistry, - final ITaglibRecord changeRecord) - { - super(changeRecord); - _tagRegistry = tagRegistry; - } - - @Override - protected IStatus doRun() - { - IStatus result = null; - - synchronized (_tagRegistry) - { - result = new RemoveTagLibrary(_tagRegistry, _changeRecord).doRun(); - - if (result.getSeverity() != IStatus.ERROR - && result.getSeverity() != IStatus.CANCEL) - { - result = new AddTagLibrary(_tagRegistry, _changeRecord) - .doRun(); - } - } - - return result; - } - - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/registry/TLDRegistryManager.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/registry/TLDRegistryManager.java deleted file mode 100644 index 8bec0653c..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/registry/TLDRegistryManager.java +++ /dev/null @@ -1,251 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.model.jsp.registry; - -import java.util.Collection; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.ISaveContext; -import org.eclipse.core.resources.ISaveParticipant; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jst.jsf.common.internal.resource.ResourceSingletonObjectManager; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.core.internal.JSFCoreTraceOptions; -import org.eclipse.jst.jsf.designtime.internal.Messages; -import org.eclipse.jst.jsf.designtime.internal.view.model.ITagRegistry; -import org.eclipse.jst.jsf.designtime.internal.view.model.TagRegistryFactory; -import org.eclipse.wst.common.project.facet.core.IFacetedProject; -import org.eclipse.wst.common.project.facet.core.IProjectFacet; -import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager; - -/** - * A per-resource singleton manager for TLDTagRegistry's. - * - * @author cbateman - * - */ -public final class TLDRegistryManager extends - ResourceSingletonObjectManager<TLDTagRegistry, IProject> -{ - // STATIC - private final static String JST_WEB_MODULE = "jst.web"; //$NON-NLS-1$ - private static TLDRegistryManager INSTANCE; - - /** - * @return the singleton instance - */ - private static TLDRegistryManager getGlobalManager() - { - synchronized (TLDRegistryManager.class) - { - if (INSTANCE == null) - { - if (JSFCoreTraceOptions.TRACE_TLDREGISTRYMANAGER) - { - JSFCoreTraceOptions - .log("TLDRegistryManager: Initializing TLDRegistryManager singleton"); //$NON-NLS-1$ - } - INSTANCE = new TLDRegistryManager(); - } - - return INSTANCE; - } - } - - private TLDRegistryManager() - { - super(ResourcesPlugin.getWorkspace()); - final ISaveParticipant participant = new MyWorkspaceSaveParticipant(); - - try - { - ResourcesPlugin.getWorkspace().addSaveParticipant(JSFCorePlugin.getDefault().getPluginID() - , participant); - } - catch (CoreException e) - { - JSFCorePlugin.log(e, "TLDRegistryManager failed to install save participant"); //$NON-NLS-1$ - } - } - - @Override - protected TLDTagRegistry createNewInstance(final IProject project) - { - if (JSFCoreTraceOptions.TRACE_TLDREGISTRYMANAGER) - { - JSFCoreTraceOptions - .log("TLDRegistryManager: creating new instance for " //$NON-NLS-1$ - + project.toString()); - } - - return new TLDTagRegistry(project); - } - - @Override - protected void runAfterGetInstance(final IProject resource) - { - if (JSFCoreTraceOptions.TRACE_TLDREGISTRYMANAGER) - { - JSFCoreTraceOptions - .log("TLDRegistryManager: Acquired instance for " //$NON-NLS-1$ - + resource.toString()); - } - } - - @Override - protected void runBeforeGetInstance(final IProject resource) - { - if (JSFCoreTraceOptions.TRACE_TLDREGISTRYMANAGER) - { - JSFCoreTraceOptions.log("TLDRegistryManager: Getting registry for " //$NON-NLS-1$ - + resource.toString()); - } - } - - /** - * Adapter used to allow creation by extension point. - * - * @author cbateman - * - */ - public static class MyRegistryFactory extends TagRegistryFactory - { - @Override - public ITagRegistry createTagRegistry(IProject project) - throws TagRegistryFactoryException - { - try - { - return getGlobalManager().getInstance(project); - } - catch (ManagedObjectException e) - { - throw new TagRegistryFactoryException(e); - } - } - - @Override - public boolean isInstance(IProject project) - { - return getGlobalManager().isInstance(project); - } - - public String getDisplayName() - { - return Messages.TLDRegistryManager_DisplayName; - } - - @Override - public boolean projectIsValid(IProject project) { - if (project == null) - { - return false; - } - - // Check that this is a dynamic web project - // (I.E. the JST Web facet is installed) - try - { - if (ProjectFacetsManager.isProjectFacetDefined(JST_WEB_MODULE)) - { - IFacetedProject faceted = ProjectFacetsManager.create(project); - IProjectFacet webModuleFacet = ProjectFacetsManager.getProjectFacet(JST_WEB_MODULE); - if (faceted != null && faceted.hasProjectFacet(webModuleFacet)) - { - return true; - } - } - } - catch (CoreException ce) - { - JSFCorePlugin.log(ce, "TLDRegistryManager failed checking web project"); //$NON-NLS-1$ - } - - return false; - } - } - - private class MyWorkspaceSaveParticipant implements ISaveParticipant - { - public void saving(ISaveContext context) throws CoreException - { - if (JSFCoreTraceOptions.TRACE_TLDREGISTRYMANAGER) - { - JSFCoreTraceOptions.log("MyWorkspaceSaveParticipant.saving: Kind="+context.getKind()); //$NON-NLS-1$ - } - try - { - if (context.getKind() == ISaveContext.FULL_SAVE) - { - final Collection<IProject> projects = TLDRegistryManager.this - .getManagedResources(); - - for (final IProject project : projects) - { - saveProject(project); - } - } - else if (context.getKind() == ISaveContext.PROJECT_SAVE) - { - saveProject(context.getProject()); - } - - } - catch (ManagedObjectException moe) - { - throw new CoreException(new Status(IStatus.ERROR, - JSFCorePlugin.PLUGIN_ID, "Couldn't commit workspace", //$NON-NLS-1$ - moe)); - } - } - - private void saveProject(final IProject project) - throws ManagedObjectException - { - if (JSFCoreTraceOptions.TRACE_TLDREGISTRYMANAGER) - { - JSFCoreTraceOptions.log("MyWorkspaceSaveParticipant.saveProject: Project="+project.toString()); //$NON-NLS-1$ - } - - // check that there is already instance -- don't do anything if there - // isn't already an instance for project. - if (TLDRegistryManager.this.isInstance(project)) - { - final TLDTagRegistry registry = TLDRegistryManager.this - .getInstance(project); - if (JSFCoreTraceOptions.TRACE_TLDREGISTRYMANAGER) - { - JSFCoreTraceOptions.log("MyWorkspaceSaveParticipant.saveProject: calling checkpoint on registry: "+registry.toString()); //$NON-NLS-1$ - } - - registry.checkpoint(); - } - } - - public void doneSaving(ISaveContext context) - { - // nothing to do - } - - public void prepareToSave(ISaveContext context) throws CoreException - { - // nothing to do - } - - public void rollback(ISaveContext context) - { - // nothing to do - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/registry/TLDRegistryPreferences.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/registry/TLDRegistryPreferences.java deleted file mode 100644 index 594db8b70..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/registry/TLDRegistryPreferences.java +++ /dev/null @@ -1,394 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.model.jsp.registry; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.CopyOnWriteArrayList; -import java.util.concurrent.atomic.AtomicBoolean; - -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jface.util.IPropertyChangeListener; -import org.eclipse.jface.util.PropertyChangeEvent; -import org.eclipse.jst.jsf.common.internal.policy.OrderedListProvider; -import org.eclipse.jst.jsf.common.internal.policy.OrderedListProvider.OrderableObject; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.DefaultJSPTagResolver; -import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.TagIntrospectingStrategy; -import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.JSPTagResolvingStrategy.StrategyDescriptor; -import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.persistence.PersistedDataTagStrategy; - -/** - * Preferences model for the TLD registry. This class is not thread-safe and - * a single instance should only be used by one owner. - * - * @author cbateman - * - */ -public class TLDRegistryPreferences -{ - private final static Map<String, StrategyDescriptor> ALL_KNOWN_STRATEGIES; - - private final IPreferenceStore _prefStore; - private final CopyOnWriteArrayList<PropertyListener> _listeners; - private final AtomicBoolean _isDisposed = new AtomicBoolean(false); - - private final static String KEY_STRATEGY_ID_ORDER = "org.eclipse.jst.jsf.designtime.jsp.registry.StrategyIDOrder"; //$NON-NLS-1$ - - private final static List<OrderableObject> DEFAULT_STRATEGY_ORDER; - - static - { - final List<OrderableObject> list = new ArrayList<OrderableObject>(); - - // NOTE !!! this ordering is important and effects the default order - // in which strategies will be consulted !!! - list.add(new OrderableObject(new StrategyIdentifier(PersistedDataTagStrategy.createDescriptor()), true)); - list.add(new OrderableObject(new StrategyIdentifier(DefaultJSPTagResolver.createDescriptor()), true)); - // Bug 312954 - temporarily disable the default preference for the - // TagIntrospectingStrategy. When bug 312936 and 240394 get resolved, - // roll back this change and re-enable. - list.add(new OrderableObject(new StrategyIdentifier(TagIntrospectingStrategy.createDescriptor()), false)); - DEFAULT_STRATEGY_ORDER = Collections.unmodifiableList(list); - - - final Map<String, StrategyDescriptor> knownDescriptors = new HashMap<String, StrategyDescriptor>(); - for (final OrderableObject object : DEFAULT_STRATEGY_ORDER) - { - StrategyIdentifier strategyId = (StrategyIdentifier) object.getObject(); - knownDescriptors.put(strategyId.getId(), strategyId._descriptor); - } - ALL_KNOWN_STRATEGIES = Collections.unmodifiableMap(knownDescriptors); - } - - private List<OrderableObject> _ids; - private List<OrderableObject> _originalIds; - private IPropertyChangeListener _propertyListener; - - /** - * Constructor - * - * @param prefStore - */ - public TLDRegistryPreferences(final IPreferenceStore prefStore) - { - _prefStore = prefStore; - _ids = new ArrayList<OrderableObject>(); - _listeners = new CopyOnWriteArrayList<PropertyListener>(); - } - - /** - * Dispose of this preferences object - */ - public void dispose() - { - if (_isDisposed.compareAndSet(false, true)) - { - if (_propertyListener != null) - { - _prefStore.removePropertyChangeListener(_propertyListener); - } - } - } - - void addListener(final PropertyListener propListener) - { - if (!assertNotDisposed()) - { - return; - } - - if (_propertyListener == null) - { - _propertyListener = new IPropertyChangeListener() - { - public void propertyChange(PropertyChangeEvent event) - { - if (KEY_STRATEGY_ID_ORDER.equals(event.getProperty())) - { - fireStrategyOrderChanged(); - } - } - }; - - _prefStore.addPropertyChangeListener(_propertyListener); - } - _listeners.addIfAbsent(propListener); - } - - void removeListener(final PropertyListener propListener) - { - if (!assertNotDisposed()) - { - return; - } - _listeners.remove(propListener); - - if (_listeners.isEmpty()) - { - _prefStore.removePropertyChangeListener(_propertyListener); - _propertyListener = null; - } - } - - private void fireStrategyOrderChanged() - { - if (!assertNotDisposed()) - { - return; - } - for (final PropertyListener listener : _listeners) - { - listener.strategyOrderChanged(); - } - } - - /** - * @return false if the assertion fails - */ - private boolean assertNotDisposed() - { - if (_isDisposed.get()) - { - JSFCorePlugin.log(new Exception("Stack trace only"), "TLDRegistryPreferences is disposed"); //$NON-NLS-1$ //$NON-NLS-2$ - return false; - } - return true; - } - - /** - * IPreferenceStore The default preference loader - */ - public void load() - { - load(_prefStore); - } - - /** - * @return the ordered list provider for the strategy id ordering - */ - public OrderedListProvider getOrderedListProvider() - { - return new MyOrderedListProvider(); - } - - /** - * @return the strategy id ordering - */ - public List<OrderableObject> getStrategyIdOrdering() - { - return _ids; - } - - /** - * @param ids - */ - public void setStrategyIdOrdering(final List<OrderableObject> ids) - { - _ids = ids; - } - - /** - * @return the list of strategy ids in the order they should be consulted - */ - public List<String> getEnabledIds() - { - final List<String> strategies = new ArrayList<String>(); - - for (final OrderableObject id : _ids) - { - if (id.isEnabled()) - { - StrategyIdentifier strategyId = (StrategyIdentifier) id.getObject(); - strategies.add(strategyId.getId()); - } - } - return strategies; - } - - /** - * Loads preferences from prefStore - * - * @param prefStore - */ - private void load(final IPreferenceStore prefStore) - { - if (!prefStore.contains(KEY_STRATEGY_ID_ORDER)) - { - prefStore.setDefault(KEY_STRATEGY_ID_ORDER, - serialize(DEFAULT_STRATEGY_ORDER)); - } - List<OrderableObject> ids = deserialize(prefStore - .getString(KEY_STRATEGY_ID_ORDER)); - if (ids == null) - { - ids = deserialize(serialize(DEFAULT_STRATEGY_ORDER)); - } - _ids = ids; - final List<OrderableObject> originalList = new ArrayList<OrderableObject>(); - for (final OrderableObject id : _ids) - { - final OrderableObject copy = id.clone(); - originalList.add(copy); - } - _originalIds = Collections.unmodifiableList(originalList); - } - - private String serialize(final List<OrderableObject> ids) - { - final StringBuffer buffer = new StringBuffer(); - - for (final OrderableObject id : ids) - { - StrategyIdentifier strategyId = (StrategyIdentifier) id.getObject(); - buffer.append("dummyValue"); //$NON-NLS-1$ - buffer.append(","); //$NON-NLS-1$ - buffer.append(strategyId.getId()); - buffer.append(","); //$NON-NLS-1$ - buffer.append(id.isEnabled()); - buffer.append(","); //$NON-NLS-1$ - } - return buffer.toString(); - } - - private List<OrderableObject> deserialize(final String serializedList) - { - final List<OrderableObject> list = new ArrayList<OrderableObject>(); - final String[] ids = serializedList.split(","); //$NON-NLS-1$ - if ((ids.length % 3) != 0) - { - return null; - } - - for (int i = 0; i < ids.length; i += 3) - { - /// ingore the dummy value: final String displayName = ids[i]; - String id = ids[i + 1]; - final String enabled = ids[i + 2]; - - // fix old id for meta-data resolver - if ("org.eclipse.jst.jsf.THISISTEMPORARY".equals(id)) //$NON-NLS-1$ - { - id = DefaultJSPTagResolver.ID; - } - - final StrategyDescriptor desc = ALL_KNOWN_STRATEGIES.get(id); - - if (desc == null) - { - JSFCorePlugin.log(new Exception("Stack trace only"), "Error: unknown strategy id: "+id); //$NON-NLS-1$ //$NON-NLS-2$ - } - else - { - final StrategyIdentifier strategyIdentifier = new StrategyIdentifier(desc); - list.add(new OrderableObject(strategyIdentifier - , Boolean.valueOf(enabled).booleanValue())); - } - } - return list; - } - - /** - * Commits but does not store the preferences - * - * @param prefStore - */ - public void commit(final IPreferenceStore prefStore) - { - prefStore.setValue(KEY_STRATEGY_ID_ORDER, - serialize(getStrategyIdOrdering())); - // refresh local copy of preferences - load(); - } - - /** - * Reverts the model to it's defaults. Does not commit to pref store. - */ - public void setDefaults() - { - setStrategyIdOrdering(new ArrayList<OrderableObject>( - DEFAULT_STRATEGY_ORDER)); - } - - /** - * @return true if this preference object's properties have - * changed since load() was last called. - */ - public boolean isDirty() - { - // dirty if the current list is not equal to the original list - // generated at load time. - return !(_ids.equals(_originalIds)); - } - - /** - * Used as the model for sorting and enabling strategy identifiers. - * - */ - public static class StrategyIdentifier - { - private final StrategyDescriptor _descriptor; - - StrategyIdentifier(final StrategyDescriptor descriptor) - { - _descriptor = descriptor; - } - - /** - * @return the id - */ - public String getId() - { - return _descriptor.getId(); - } - - @Override - public boolean equals(Object obj) - { - if (obj instanceof StrategyIdentifier) - { - return getId().equals(((StrategyIdentifier)obj).getId()); - } - return false; - } - - @Override - public int hashCode() - { - return getId().hashCode(); - } - - /** - * @return the display name of the strategy - */ - public String getDisplayName() - { - return _descriptor.getDisplayName(); - } - } - - private class MyOrderedListProvider extends OrderedListProvider - { - @Override - protected List<OrderableObject> createAndPopulateOrderedObjects() - { - return _ids; - } - } - - static abstract class PropertyListener - { - public abstract void strategyOrderChanged(); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/registry/TLDTagRegistry.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/registry/TLDTagRegistry.java deleted file mode 100644 index b2248085d..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/registry/TLDTagRegistry.java +++ /dev/null @@ -1,475 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.designtime.internal.view.model.jsp.registry; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.ConcurrentLinkedQueue; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.MultiStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.jst.jsf.common.internal.managedobject.IManagedObject; -import org.eclipse.jst.jsf.common.internal.policy.IdentifierOrderedIteratorPolicy; -import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.Namespace; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.core.internal.JSFCoreTraceOptions; -import org.eclipse.jst.jsf.designtime.internal.Messages; -import org.eclipse.jst.jsf.designtime.internal.view.model.AbstractTagRegistry; -import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.CompositeTagResolvingStrategy; -import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.DefaultJSPTagResolver; -import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.TLDNamespace; -import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.TagIntrospectingStrategy; -import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.UnresolvedJSPTagResolvingStrategy; -import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.persistence.PersistedDataTagStrategy; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.CMDocumentFactoryTLD; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDDocument; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDElementDeclaration; -import org.eclipse.jst.jsp.core.taglib.ITLDRecord; -import org.eclipse.jst.jsp.core.taglib.ITaglibRecord; -import org.eclipse.jst.jsp.core.taglib.TaglibIndex; - -/** - * Registry of all tld-defined tags for a particular project classpath - * - * @author cbateman - * - */ -public final class TLDTagRegistry extends AbstractTagRegistry implements - IManagedObject -{ - // INSTANCE - private final IProject _project; - private final Map<String, TLDNamespace> _nsResolved; - private final CompositeTagResolvingStrategy<TLDElementDeclaration> _resolver; - private boolean _hasBeenInitialized = false; - private final ConcurrentLinkedQueue<LibraryOperation> _changeOperations = new ConcurrentLinkedQueue<LibraryOperation>(); - private final Job _changeJob; - private final PersistedDataTagStrategy _persistedTagStrategy; - private TagIndexListener _tagIndexListener; - private final TLDRegistryPreferences _prefs; - private final MyPropertyListener _myPropertyListener; - - TLDTagRegistry(final IProject project) - { - _project = project; - _nsResolved = new HashMap<String, TLDNamespace>(); - - _prefs = new TLDRegistryPreferences(JSFCorePlugin.getDefault().getPreferenceStore()); - _myPropertyListener = new MyPropertyListener(); - _prefs.addListener(_myPropertyListener); - _prefs.load(); - final IdentifierOrderedIteratorPolicy<String> policy = - getTagResolvingPolicy(); - - _resolver = new CompositeTagResolvingStrategy<TLDElementDeclaration>( - policy); - - // add the strategies - _resolver.addStrategy(new TagIntrospectingStrategy(_project)); - _resolver.addStrategy(new DefaultJSPTagResolver(_project)); - // makes sure that a tag element will always be created for any - // given tag definition even if other methods fail - _resolver.addStrategy(new UnresolvedJSPTagResolvingStrategy()); - _persistedTagStrategy = new PersistedDataTagStrategy(_project); - _persistedTagStrategy.init(); - _resolver.addStrategy(_persistedTagStrategy); - - _changeJob = new ChangeJob(project.getName()); - } - - private IdentifierOrderedIteratorPolicy<String> getTagResolvingPolicy() - { - // strategy ordering - final List<String> prefOrdering = _prefs.getEnabledIds(); - final List<String> strategyOrdering = new ArrayList<String>(prefOrdering); - - // this strategy must always be here, always last - strategyOrdering.add(UnresolvedJSPTagResolvingStrategy.ID); - - final IdentifierOrderedIteratorPolicy<String> policy = new IdentifierOrderedIteratorPolicy<String>( - strategyOrdering); - // exclude things that are not explicitly listed in the policy. That - // way preference-based disablement will cause those strategies to - // be excluded. - policy.setExcludeNonExplicitValues(true); - return policy; - } - - protected final void doDispose() - { - if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY) - { - JSFCoreTraceOptions.log("TLDTagRegistry: Disposing for project " //$NON-NLS-1$ - + _project.toString()); - } - - // call checkpoint to flush serializable data - checkpoint(); - //_persistedTagStrategy.dispose(); - - _nsResolved.clear(); - _changeOperations.clear(); - - if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY) - { - JSFCoreTraceOptions - .log("TLDTagRegistry: Done disposing registry for " //$NON-NLS-1$ - + _project.toString()); - } - } - - @Override - protected void cleanupPersistentState() - { - // TODO - } - - public synchronized void checkpoint() - { - try - { - _persistedTagStrategy.save(_nsResolved); - } - catch (IOException e) - { - JSFCorePlugin.log(e, "Checkpointing JSP tags failed"); //$NON-NLS-1$ - } - catch (ClassNotFoundException e) - { - JSFCorePlugin.log(e, "Checkpointing JSP tags failed"); //$NON-NLS-1$ - } - } - - @Override - protected Job getRefreshJob(final boolean flushCaches) - { - return new Job(Messages.TLDTagRegistry_RefreshJob + _project.getName()) - { - @Override - protected IStatus run(final IProgressMonitor monitor) - { - if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY) - { - JSFCoreTraceOptions.log("TLDTagRegistry.refresh: start"); //$NON-NLS-1$ - } - - synchronized (TLDTagRegistry.this) - { - if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY) - { - JSFCoreTraceOptions - .log("TLDTagRegistry.refresh: start"); //$NON-NLS-1$ - } - - final List<Namespace> namespaces = new ArrayList( - _nsResolved.values()); - - if (flushCaches) - { - _persistedTagStrategy.clear(); - } - // if we aren't flushing caches, then check point the - // current namespace data, so it isn't lost when we clear - // the namespaces - else - { - checkpoint(); - } - - _nsResolved.clear(); - - fireEvent(new TagRegistryChangeEvent(TLDTagRegistry.this, - TagRegistryChangeEvent.EventType.REMOVED_NAMESPACE, - namespaces)); - initialize(true); - - if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY) - { - JSFCoreTraceOptions - .log("TLDTagRegistry.refresh: finished"); //$NON-NLS-1$ - } - return Status.OK_STATUS; - } - } - }; - } - - /** - */ - private void initialize(boolean fireEvent) - { - if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY) - { - JSFCoreTraceOptions.log("TLDTagRegistry.initialize: start"); //$NON-NLS-1$ - } - - final ITaglibRecord[] tldrecs = TaglibIndex - .getAvailableTaglibRecords(_project.getFullPath()); - final List<Namespace> affectedObjects = new ArrayList<Namespace>(); - for (final ITaglibRecord tldrec : tldrecs) - { - // defer the event - final Namespace ns = initialize(tldrec, fireEvent); - - if (ns != null) - { - affectedObjects.add(ns); - } - } - - _hasBeenInitialized = true; - - // if tag index listener does exist, add it - if (_tagIndexListener == null) - { - if (JSFCoreTraceOptions.TRACE_TLDREGISTRYMANAGER) - { - JSFCoreTraceOptions - .log("TLDRegistryManager: installing tag index listener due to create instance for " //$NON-NLS-1$ - + _project.toString()); - } - - _tagIndexListener = new TagIndexListener(this); - TaglibIndex.addTaglibIndexListener(_tagIndexListener); - } - - // if (affectedObjects.size() > 0) - // { - // fireEvent(new TagRegistryChangeEvent(this, - // TagRegistryChangeEvent.EventType.ADDED_NAMESPACE, - // affectedObjects)); - // } - - if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY) - { - JSFCoreTraceOptions.log("TLDTagRegistry.initialize: finished"); //$NON-NLS-1$ - } - } - - TLDNamespace initialize(final ITaglibRecord tagRecord, - final boolean fireEvent) - { - if (tagRecord.getRecordType() == ITLDRecord.URL) - { - if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY_CHANGES) - { - JSFCoreTraceOptions.log("TLDTagRegistry.initialize_TagRecord: Initializing new tld record: "+tagRecord.toString()); //$NON-NLS-1$ - } - long startTime = 0; - - if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY_PERF) - { - startTime = System.nanoTime(); - } - - final CMDocumentFactoryTLD factory = new CMDocumentFactoryTLD(); - final TLDDocument doc = (TLDDocument) factory - .createCMDocument(tagRecord); - if (doc != null) - { - final TLDNamespace ns = new TLDNamespace(doc, _resolver); - _nsResolved.put(doc.getUri(), ns); - - if (fireEvent) - { - fireEvent(new TagRegistryChangeEvent(this, - TagRegistryChangeEvent.EventType.ADDED_NAMESPACE, - Collections.singletonList(ns))); - } - - if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY_PERF) - { - System.out.printf("Time to update namespace %s was %d\n", //$NON-NLS-1$ - ns.getNSUri(), Long.valueOf(System.nanoTime() - - startTime)); - } - return ns; - } - } - else - { - if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY_CHANGES) - { - JSFCoreTraceOptions.log("TLDTagRegistry.initialize_TagRecord: Skipping tag record for "+tagRecord.toString()); //$NON-NLS-1$ - } - - } - // no new namespace - return null; - } - - void remove(final ITaglibRecord tagRecord) - { - // this is safer, since we likely fail to create a TLDDocument for - // a tagRecord that has been removed. - final String uri = tagRecord.getDescriptor().getURI(); - final TLDNamespace ns = _nsResolved.remove(uri); - - if (ns != null) - { - fireEvent(new TagRegistryChangeEvent(this, - TagRegistryChangeEvent.EventType.REMOVED_NAMESPACE, - Collections.singletonList(ns))); - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.jsf.designtime.internal.view.model.jsp.registry.ITagRegistry#getAllTagLibraries() - */ - public final synchronized Collection<? extends Namespace> getAllTagLibraries() - { - if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY) - { - JSFCoreTraceOptions.log("TLDTagRegistry.getAllTagLibraries: start"); //$NON-NLS-1$ - } - long startTime = 0; - - if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY_PERF) - { - startTime = System.nanoTime(); - } - - if (!_hasBeenInitialized) - { - initialize(false); - } - - final Set<TLDNamespace> allTagLibraries = new HashSet<TLDNamespace>(); - allTagLibraries.addAll(_nsResolved.values()); - - if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY_PERF) - { - System.out.println("Time to getAllTagLibraries for JSP: "+(System.nanoTime()-startTime)); //$NON-NLS-1$ - } - if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY) - { - JSFCoreTraceOptions - .log("TLDTagRegistry.getAllTagLibraries: finished"); //$NON-NLS-1$ - } - return allTagLibraries; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.jsf.designtime.internal.view.model.jsp.registry.ITagRegistry#getTagLibrary(java.lang.String) - */ - public final synchronized Namespace getTagLibrary(final String uri) - { - if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY) - { - JSFCoreTraceOptions.log("TLDTagRegistry.getTagLibrary: start uri=" //$NON-NLS-1$ - + uri); - } - - if (!_hasBeenInitialized) - { - initialize(false); - } - - final Namespace ns = _nsResolved.get(uri); - - if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY) - { - JSFCoreTraceOptions - .log("TLDTagRegistry.getTagLibrary: finished, result=" //$NON-NLS-1$ - + ns.toString()); - } - return ns; - } - - @Override - public String toString() - { - return String - .format( - "TLDRegistry for project %s, isDisposed=%s, hasBeenInitialized=%s, numberOfNamespace=%d", //$NON-NLS-1$ - _project.toString(), Boolean.valueOf(isDisposed()), - Boolean.valueOf(_hasBeenInitialized), Integer - .valueOf(_nsResolved.size())); - } - - void addLibraryOperation(final LibraryOperation operation) - { - _changeOperations.add(operation); - _changeJob.schedule(); - } - - - private class ChangeJob extends Job - { - private int _rescheduleTime = -1; - - public ChangeJob(final String projectName) - { - super(Messages.TLDTagRegistry_UpdateJob + projectName); - } - - @Override - protected IStatus run(final IProgressMonitor monitor) - { - synchronized (TLDTagRegistry.this) - { - _rescheduleTime = -1; - - LibraryOperation operation = null; - final MultiStatus multiStatus = new MultiStatus( - JSFCorePlugin.PLUGIN_ID, 0, "Result of change job", //$NON-NLS-1$ - new Throwable()); - while ((operation = _changeOperations.poll()) != null) - { - _rescheduleTime = 10000; // ms - - operation.run(); - multiStatus.add(operation.getResult()); - } - - if (_rescheduleTime >= 0 && !monitor.isCanceled()) - { - // if any operations were found on this run, reschedule - // to run again in 10seconds based on the assumption that - // events may be coming in bursts - schedule(_rescheduleTime); - } - - return multiStatus; - } - } - } - - private class MyPropertyListener extends TLDRegistryPreferences.PropertyListener - { - @Override - public void strategyOrderChanged() - { - synchronized(TLDTagRegistry.this) - { - _prefs.load(); - final IdentifierOrderedIteratorPolicy<String> policy = - getTagResolvingPolicy(); - _resolver.setPolicy(policy); - } - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/registry/TagIndexListener.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/registry/TagIndexListener.java deleted file mode 100644 index b360a276f..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/registry/TagIndexListener.java +++ /dev/null @@ -1,104 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -/** - * - */ -package org.eclipse.jst.jsf.designtime.internal.view.model.jsp.registry; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.jsf.core.internal.JSFCoreTraceOptions; -import org.eclipse.jst.jsp.core.taglib.ITaglibIndexDelta; -import org.eclipse.jst.jsp.core.taglib.ITaglibIndexListener; - -class TagIndexListener implements ITaglibIndexListener -{ - private final TLDTagRegistry _registry; - private final LibraryOperationFactory _factory; - - TagIndexListener(final TLDTagRegistry registry) - { - _registry = registry; - _factory = new LibraryOperationFactory(_registry); - } - - public void indexChanged(final ITaglibIndexDelta delta) - { - if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY_CHANGES) - { - JSFCoreTraceOptions.log("TagIndexListener.indexChanged: start"); //$NON-NLS-1$ - } - - visitDelta(delta); - - if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY_CHANGES) - { - JSFCoreTraceOptions.log("TagIndexListener.indexChanged: finish"); //$NON-NLS-1$ - } - } - - private void visitDelta(final ITaglibIndexDelta delta) - { - final IProject project = delta.getProject(); - - if (_registry != null && !_registry.isDisposed() - && delta.getTaglibRecord() != null) - { - switch (delta.getKind()) - { - case ITaglibIndexDelta.ADDED: - { - if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY_CHANGES) - { - JSFCoreTraceOptions.log(String.format( - "Processing add change: project=%s", project //$NON-NLS-1$ - .getName())); - } - - _registry.addLibraryOperation(_factory - .createAddOperation(delta.getTaglibRecord())); - } - break; - case ITaglibIndexDelta.REMOVED: - { - if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY_CHANGES) - { - JSFCoreTraceOptions - .log(String - .format( - "Processing remove change: project=%s, tagrecord=%s", //$NON-NLS-1$ - project.getName())); - } - _registry.addLibraryOperation(_factory - .createRemoveOperation(delta.getTaglibRecord())); - } - break; - case ITaglibIndexDelta.CHANGED: - { - if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY_CHANGES) - { - JSFCoreTraceOptions.log(String.format( - "Processing change: project=%s, tagrecord=%s", //$NON-NLS-1$ - project.getName())); - } - _registry.addLibraryOperation(_factory - .createChangeOperation(delta.getTaglibRecord())); - } - break; - } - } - - // visit children - for (final ITaglibIndexDelta child : delta.getAffectedChildren()) - { - visitDelta(child); - } - } -}
\ No newline at end of file |