Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcbateman2013-03-13 06:42:51 +0000
committercbateman2013-03-13 06:42:51 +0000
commite43a6c5b934150f661eb3c2f5dfadf0b6d852727 (patch)
tree8e1723e7421d2aef340e4a6ff9e38ad9d8c4fcd9
parent875dfcd74acdf9e07b1d02c7846ffefd7cab65b2 (diff)
downloadwebtools.jsf-e43a6c5b934150f661eb3c2f5dfadf0b6d852727.tar.gz
webtools.jsf-e43a6c5b934150f661eb3c2f5dfadf0b6d852727.tar.xz
webtools.jsf-e43a6c5b934150f661eb3c2f5dfadf0b6d852727.zip
Changes to relax dependence on facets in JSF projects.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=398243
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/componentcore/AbstractCompCoreQueryFactory.java47
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/componentcore/AbstractJEEModelProviderQuery.java48
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/provider/IBeanInstanceSymbolItemProvider.java8
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/provider/IInstanceSymbolItemProvider.java8
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/plugin.properties3
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/plugin.xml1
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/schema/viewHandlerOverride.exsd102
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/JSFVersion.java52
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/JSFCorePlugin.java39
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/ContextParamSpecifiedJSFAppConfigLocater.java13
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/DesignTimeApplicationManager.java23
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/AbstractDTViewHandler.java17
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/symbols/DefaultBuiltInSymbolProvider.java72
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.facelet.core/plugin.properties4
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.facelet.core/plugin.xml1
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.facelet.core/schema/componentCoreQueryFactory.exsd102
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/FaceletCorePlugin.java66
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/FaceletDocumentFactory.java2
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/registry/FaceletRegistryManager.java9
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/registry/FaceletTagResolvingStrategy.java11
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/registry/taglib/ContextParamSpecifiedFaceletTaglibLocator.java4
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/registry/taglib/FaceletTagIndex.java44
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/registry/taglib/TagModelLoader.java5
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/registry/taglib/WebappConfiguration.java87
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/registry/taglib/faceletTaglib/impl/FaceletTaglibPackageImpl.java2
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/tagmodel/NoArchetypeFaceletTag.java14
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/util/ViewUtil.java57
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/validation/TaglibValidator.java16
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/view/DTFaceletViewHandler.java5
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/view/FaceletViewDefnAdapter.java7
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.facelet.ui/src/org/eclipse/jst/jsf/facelet/ui/internal/FaceletUiPlugin.java3
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.facelet.ui/src/org/eclipse/jst/jsf/facelet/ui/internal/contentassist/CompositeAttributeAssistProcessor.java31
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.facelet.ui/src/org/eclipse/jst/jsf/facelet/ui/internal/contentassist/XHTMLContentAssistProcessor.java1
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/tagregistry/TagRegistryMasterForm.java9
34 files changed, 735 insertions, 178 deletions
diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/componentcore/AbstractCompCoreQueryFactory.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/componentcore/AbstractCompCoreQueryFactory.java
new file mode 100644
index 000000000..d36310ef9
--- /dev/null
+++ b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/componentcore/AbstractCompCoreQueryFactory.java
@@ -0,0 +1,47 @@
+package org.eclipse.jst.jsf.common.internal.componentcore;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jst.j2ee.model.IModelProvider;
+import org.eclipse.jst.j2ee.model.ModelProviderManager;
+import org.eclipse.jst.jsf.common.internal.componentcore.AbstractJEEModelProviderQuery.DefaultJEEModelProviderQuery;
+import org.eclipse.jst.jsf.common.internal.componentcore.AbstractVirtualComponentQuery.DefaultVirtualComponentQuery;
+
+/**
+ * Factory for creating queries that decouple the caller from comp core/facets
+ *
+ */
+public abstract class AbstractCompCoreQueryFactory {
+ /**
+ * @param project
+ * @return the query for the project or null if one can't be found
+ */
+ public abstract AbstractVirtualComponentQuery createVirtualComponentQuery(final IProject project);
+ /**
+ * @param project
+ * @return the query for the project or null if one can't be found
+ */
+ public abstract AbstractJEEModelProviderQuery createJEEModelProviderQuery(final IProject project);
+
+ /**
+ * The default factory
+ *
+ */
+ public static class DefaultCompCoreQueryFactory extends AbstractCompCoreQueryFactory
+ {
+ @Override
+ public AbstractVirtualComponentQuery createVirtualComponentQuery(IProject project) {
+ return new DefaultVirtualComponentQuery();
+ }
+
+ @Override
+ public AbstractJEEModelProviderQuery createJEEModelProviderQuery(IProject project) {
+ if (ModelProviderManager.hasModelProvider(project))
+ {
+ IModelProvider modelProvider = ModelProviderManager.getModelProvider(project);
+ return new DefaultJEEModelProviderQuery(modelProvider);
+ }
+ return null;
+ }
+
+ }
+}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/componentcore/AbstractJEEModelProviderQuery.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/componentcore/AbstractJEEModelProviderQuery.java
new file mode 100644
index 000000000..4c62dd43a
--- /dev/null
+++ b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/componentcore/AbstractJEEModelProviderQuery.java
@@ -0,0 +1,48 @@
+package org.eclipse.jst.jsf.common.internal.componentcore;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.jst.j2ee.model.IModelProvider;
+import org.eclipse.jst.javaee.core.ParamValue;
+import org.eclipse.jst.javaee.web.WebApp;
+
+/**
+ * Provides a decoupling indirection to decouple JEE model calls from the IModelProvider for testing etc.
+ *
+ */
+public abstract class AbstractJEEModelProviderQuery {
+
+ public abstract List<ParamValue> getWebAppParamValues();
+
+ public static class DefaultJEEModelProviderQuery extends AbstractJEEModelProviderQuery
+ {
+ private IModelProvider modelProvider;
+ public DefaultJEEModelProviderQuery(final IModelProvider modelProvider)
+ {
+ this.modelProvider = modelProvider;
+ }
+ @Override
+ public List<ParamValue> getWebAppParamValues() {
+ WebApp webApp = getWebApp();
+ if (webApp != null)
+ {
+ return webApp.getContextParams();
+ }
+ return Collections.emptyList();
+ }
+
+ protected WebApp getWebApp()
+ {
+ final Object webAppObj = modelProvider.getModelObject();
+ if (webAppObj instanceof org.eclipse.jst.javaee.web.WebApp)
+ {
+ return (WebApp) webAppObj;
+ }
+ return null;
+ }
+ }
+
+
+
+}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/provider/IBeanInstanceSymbolItemProvider.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/provider/IBeanInstanceSymbolItemProvider.java
index ee8e4b9ad..35cea4ce5 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/provider/IBeanInstanceSymbolItemProvider.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/provider/IBeanInstanceSymbolItemProvider.java
@@ -31,6 +31,7 @@ import org.eclipse.jst.jsf.context.symbol.IBeanInstanceSymbol;
import org.eclipse.jst.jsf.context.symbol.SymbolPackage;
import org.eclipse.jst.jsf.context.symbol.provider.IContentProposalProvider;
import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
/**
* This is the item provider adapter for a {@link org.eclipse.jst.jsf.context.symbol.IBeanInstanceSymbol} object.
@@ -204,8 +205,11 @@ public class IBeanInstanceSymbolItemProvider
final String replacementText = symbol.getName();
final String displayText = getText(symbol);
final String additionalText = symbol.getDetailedDescription();
- final Image displayImage =
- ExtendedImageRegistry.getInstance().getImage(getImage(symbol));
+ // for running headless, we need to avoid hitting the image registry
+ // because it accesses the Display object that won't exist
+ final Image displayImage = Display.getCurrent() != null ?
+ ExtendedImageRegistry.getInstance().getImage(getImage(symbol))
+ : null;
return new ICompletionProposal[]
{
diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/provider/IInstanceSymbolItemProvider.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/provider/IInstanceSymbolItemProvider.java
index 155bfb186..92d39fcbf 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/provider/IInstanceSymbolItemProvider.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/symbol/internal/provider/IInstanceSymbolItemProvider.java
@@ -34,6 +34,7 @@ import org.eclipse.jst.jsf.context.symbol.IInstanceSymbol;
import org.eclipse.jst.jsf.context.symbol.SymbolPackage;
import org.eclipse.jst.jsf.context.symbol.provider.IContentProposalProvider;
import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
@@ -314,8 +315,11 @@ public class IInstanceSymbolItemProvider
final String replacementText = symbol.getName();
final String displayText = getText(symbol);
//final String additionalText = symbol.getDetailedDescription();
- final Image displayImage =
- ExtendedImageRegistry.getInstance().getImage(getImage(symbol));
+ // for running headless, we need to avoid hitting the image registry
+ // because it accesses the Display object that won't exist
+ final Image displayImage = Display.getCurrent() != null ?
+ ExtendedImageRegistry.getInstance().getImage(getImage(symbol))
+ : null;
return new ICompletionProposal[]
{
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/plugin.properties b/jsf/plugins/org.eclipse.jst.jsf.core/plugin.properties
index b06256236..52e859892 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.core/plugin.properties
+++ b/jsf/plugins/org.eclipse.jst.jsf.core/plugin.properties
@@ -61,4 +61,5 @@ extension-point.name.13 = Tag Registry Factory
extension-point.name.14 = JSF AppConfig Locator Provider Factory (internal)
extension-point.name.15 = JSF AppConfig Manager Factory (internal)
Facelet.name=Facelet
-FaceletComposite.name=Facelet Composite Component \ No newline at end of file
+FaceletComposite.name=Facelet Composite Component
+extension-point.name.viewHandlerOverride = viewHandlerOverride \ No newline at end of file
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/plugin.xml b/jsf/plugins/org.eclipse.jst.jsf.core/plugin.xml
index e645c0342..954bdfd8a 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.core/plugin.xml
+++ b/jsf/plugins/org.eclipse.jst.jsf.core/plugin.xml
@@ -17,6 +17,7 @@
<extension-point id="tagRegistryFactory" name="%extension-point.name.13" schema="schema/tagRegistryFactory.exsd"/>
<extension-point id="jsfAppConfigLocatorProviderFactory" name="%extension-point.name.14" schema="schema/jsfAppConfigLocatorProviderFactory.exsd"/>
<extension-point id="jsfAppConfigManagerFactory" name="%extension-point.name.15" schema="schema/jsfAppConfigManagerFactory.exsd"/>
+ <extension-point id="viewHandlerOverride" name="%extension-point.name.viewHandlerOverride" schema="schema/viewHandlerOverride.exsd"/>
<extension point="org.eclipse.emf.ecore.generated_package">
<package
uri = "http://org.eclipse.jst.jsf.core/constraints.ecore"
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/schema/viewHandlerOverride.exsd b/jsf/plugins/org.eclipse.jst.jsf.core/schema/viewHandlerOverride.exsd
new file mode 100644
index 000000000..06a3ef62f
--- /dev/null
+++ b/jsf/plugins/org.eclipse.jst.jsf.core/schema/viewHandlerOverride.exsd
@@ -0,0 +1,102 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.jst.jsf.core" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.jst.jsf.core" id="viewHandlerOverride" name="viewHandlerOverride"/>
+ </appInfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appInfo>
+ <meta.element />
+ </appInfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="viewHandlerOverride"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="viewHandlerOverride">
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn="org.eclipse.jst.jsf.designtime.internal.view.AbstractDTViewHandler:"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiinfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/JSFVersion.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/JSFVersion.java
index 29f3a8a0e..54118a9bd 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/JSFVersion.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/JSFVersion.java
@@ -12,6 +12,10 @@ package org.eclipse.jst.jsf.core;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.jsf.core.internal.JSFCorePlugin;
import org.eclipse.wst.common.project.facet.core.FacetedProjectFramework;
import org.eclipse.wst.common.project.facet.core.IFacetedProject;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
@@ -166,4 +170,52 @@ public enum JSFVersion {
}
return null;
}
+
+
+ /**
+ * @param project
+ * @return the best guess at what JSF version the project is or null if can't determine.
+ */
+ public static JSFVersion guessJSFVersion(final IProject project) {
+ JSFVersion jsfVersion = JSFVersion.valueOfProject(project);
+ if (jsfVersion == null) {
+ try
+ {
+ IJavaProject javaProj = JavaCore.create(project);
+ if (javaProj != null && javaProj.exists())
+ {
+ if (javaProj.findType("javax.faces.component.html.HtmlBody") != null) //$NON-NLS-1$
+ {
+ // at least 2.0 inside here
+ jsfVersion = JSFVersion.V2_0;
+ if (javaProj.findType("javax.faces.view.facelets.FaceletCacheFactory") != null) //$NON-NLS-1$
+ {
+ // add in 2.1
+ jsfVersion = JSFVersion.V2_1;
+ }
+ }
+ }
+ }
+ catch (JavaModelException jme)
+ {
+ JSFCorePlugin.log(jme, "Trying to guess jsf version"); //$NON-NLS-1$
+ }
+ }
+ return jsfVersion;
+ }
+
+ /**
+ * @param atLeastThisVersion
+ * @param project
+ * @return true if the project has at least JSFVersion passed based guessJSFVersion
+ */
+ public static boolean guessAtLeast(final JSFVersion atLeastThisVersion, final IProject project)
+ {
+ if (project != null && project.isAccessible())
+ {
+ JSFVersion guessJSFVersion = guessJSFVersion(project);
+ return guessJSFVersion != null && guessJSFVersion.compareTo(atLeastThisVersion) >= 0;
+ }
+ return false;
+ }
}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/JSFCorePlugin.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/JSFCorePlugin.java
index 0670ce94c..11634dfc0 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/JSFCorePlugin.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/JSFCorePlugin.java
@@ -14,6 +14,8 @@ package org.eclipse.jst.jsf.core.internal;
import java.util.Collections;
import java.util.List;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.ILog;
import org.eclipse.core.runtime.IStatus;
@@ -28,8 +30,8 @@ import org.eclipse.jst.jsf.designtime.el.AbstractDTMethodResolver;
import org.eclipse.jst.jsf.designtime.el.AbstractDTPropertyResolver;
import org.eclipse.jst.jsf.designtime.el.AbstractDTVariableResolver;
import org.eclipse.jst.jsf.designtime.internal.BasicExtensionFactory;
-import org.eclipse.jst.jsf.designtime.internal.DecoratableExtensionFactory;
import org.eclipse.jst.jsf.designtime.internal.BasicExtensionFactory.ExtensionData;
+import org.eclipse.jst.jsf.designtime.internal.DecoratableExtensionFactory;
import org.eclipse.jst.jsf.designtime.internal.resolver.ViewBasedTaglibResolverFactory;
import org.eclipse.jst.jsf.designtime.internal.view.AbstractDTViewHandler;
import org.eclipse.ui.preferences.ScopedPreferenceStore;
@@ -365,10 +367,41 @@ public class JSFCorePlugin extends WTPPlugin
private final static String VIEWHANDLER_EXT_POINT_NAME = "viewhandler"; //$NON-NLS-1$
private final static String VIEWHANDLER_ELEMENT_NAME = "viewhandler"; //$NON-NLS-1$
+
+ /**
+ * @param viewHandler
+ * @return checks for an override handler and returns it, using viewHandler as a decorated object. This allows
+ * an adopter to selectively decorate the view handler provided by the framework.
+ */
+ public synchronized static AbstractDTViewHandler getViewOverrideHandler(final AbstractDTViewHandler viewHandler)
+ {
+ final IExtensionPoint extension = getDefault().getExtension(VIEWHANDLEROVERRIDE_EXT_POINT_NAME);
+ if (extension != null)
+ {
+ final IConfigurationElement[] configurationElements = extension.getConfigurationElements();
+ if (configurationElements.length > 1)
+ {
+ log(IStatus.ERROR, "More than one view handler override registered"); //$NON-NLS-1$
+ return null;
+ }
+ if (configurationElements.length == 1)
+ {
+ try {
+ return (AbstractDTViewHandler) configurationElements[0].createExecutableExtension("class"); //$NON-NLS-1$
+ } catch (CoreException e) {
+ log("Failed to load class for view override", e); //$NON-NLS-1$
+ }
+ }
+ }
+ return null;
+ }
+ private final static String VIEWHANDLEROVERRIDE_EXT_POINT_NAME = "viewHandlerOverride"; //$NON-NLS-1$
+// private final static String VIEWHANDLEROVERRIDE_VIEWHANDLER_ELEMENT_NAME = "viewHandlerOverride"; //$NON-NLS-1$
+
/**
- * @return the preference store for this bundle TODO: this is copied from
- * AbstractUIPlugin; need to upgrade to new IPreferencesService
+ * @return the preference store for this bundle
*/
+ @SuppressWarnings("deprecation")
public synchronized IPreferenceStore getPreferenceStore()
{
// Create the preference store lazily.
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/ContextParamSpecifiedJSFAppConfigLocater.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/ContextParamSpecifiedJSFAppConfigLocater.java
index 0446045de..70847d085 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/ContextParamSpecifiedJSFAppConfigLocater.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/ContextParamSpecifiedJSFAppConfigLocater.java
@@ -14,6 +14,7 @@ import java.util.Iterator;
import java.util.List;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.impl.AdapterImpl;
import org.eclipse.emf.common.util.EList;
@@ -23,6 +24,7 @@ import org.eclipse.jst.j2ee.model.IModelProvider;
import org.eclipse.jst.j2ee.model.ModelProviderManager;
import org.eclipse.jst.j2ee.webapplication.ContextParam;
import org.eclipse.jst.j2ee.webapplication.WebApp;
+import org.eclipse.wst.common.project.facet.core.FacetedProjectFramework;
/**
* ContextParamSpecifiedJSFAppConfigLocater attempts to locate application
@@ -61,7 +63,16 @@ public class ContextParamSpecifiedJSFAppConfigLocater extends WebContentRelative
private Object getModelObject() {
Object modelObject = null;
IProject project = getJSFAppConfigManager().getProject();
- if (project.isAccessible()) {
+ boolean facetedProject = false;
+ try
+ {
+ facetedProject = FacetedProjectFramework.isFacetedProject(project);
+ }
+ catch (CoreException ce)
+ {
+ // ignore
+ }
+ if (facetedProject) {
IModelProvider provider = ModelProviderManager.getModelProvider(project);
if (provider != null) {
// we can't get the model if the workspace tree is currently locked.
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/DesignTimeApplicationManager.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/DesignTimeApplicationManager.java
index 097fbd646..913f53c83 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/DesignTimeApplicationManager.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/DesignTimeApplicationManager.java
@@ -50,7 +50,6 @@ import org.eclipse.jst.jsf.designtime.el.AbstractDTVariableResolver;
import org.eclipse.jst.jsf.designtime.internal.BasicExtensionFactory.ExtensionData;
import org.eclipse.jst.jsf.designtime.internal.view.AbstractDTViewHandler;
import org.eclipse.jst.jsf.designtime.internal.view.IDTViewHandler;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
/**
* Per-web-application manager that manages design time information for a
@@ -214,8 +213,9 @@ public final class DesignTimeApplicationManager
*/
public static boolean hasJSFDesignTime(final IProject project)
{
+ JSFVersion guessJSFVersion = JSFVersion.guessJSFVersion(project);
return project != null && project.isAccessible()
- && JSFAppConfigUtils.isValidJSFProject(project);
+ && (JSFAppConfigUtils.isValidJSFProject(project) || (guessJSFVersion != null && guessJSFVersion.compareTo(JSFVersion.V2_0) >= 0));
}
// instance definition
@@ -673,17 +673,14 @@ public final class DesignTimeApplicationManager
protected String getHandlerId(final IProject project)
{
- IProjectFacetVersion projectFacet = JSFAppConfigUtils.getProjectFacet(project);
- if (projectFacet != null)
+ JSFVersion projectVersion = JSFVersion.guessJSFVersion(project);
+ if (projectVersion != null)
{
- JSFVersion projectVersion = JSFVersion.valueOfFacetVersion(projectFacet);
-
String defaultHandler = PRE_20_DEFAULT_VIEW_HANDLER_ID;
// starting with JSF 2.0 a new view handler that first
// processes as Facelet and then delegates to JSP is
// used by default
- // TODO: check the web.xml flag that reverts things to 1.2 defaults
if (projectVersion.compareTo(JSFVersion.V2_0) >= 0)
{
defaultHandler = JSF_20_DEFAULT_VIEW_HANDLER_ID;
@@ -695,7 +692,6 @@ public final class DesignTimeApplicationManager
}
return null;
}
-
public synchronized IDTViewHandler getViewHandler(
final IProject project, final LifecycleListener listener)
@@ -713,8 +709,17 @@ public final class DesignTimeApplicationManager
.getViewHandlers(PRE_20_DEFAULT_VIEW_HANDLER_ID);
}
- final AbstractDTViewHandler viewHandler = viewHandlers
+ AbstractDTViewHandler viewHandler = viewHandlers
.getInstance(project);
+ if (JSFVersion.guessAtLeast(JSFVersion.V2_0, project))
+ {
+ final AbstractDTViewHandler overrideHandler = JSFCorePlugin.getViewOverrideHandler(viewHandler);
+ if (overrideHandler != null)
+ {
+ overrideHandler.setParent(viewHandler);
+ viewHandler = overrideHandler;
+ }
+ }
viewHandler.setLifecycleListener(listener);
return viewHandler;
}
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
index bf38fe899..72bb2821d 100644
--- 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
@@ -39,6 +39,8 @@ public abstract class AbstractDTViewHandler implements IDTViewHandler
{
private final AtomicBoolean _isDisposed = new AtomicBoolean(false);
+ private AbstractDTViewHandler parent;
+
/**
* the path separator
*/
@@ -131,6 +133,21 @@ public abstract class AbstractDTViewHandler implements IDTViewHandler
}
/**
+ * @return the parent or null if there is no parent. A handler may
+ * delegate to its parent if it has one or override behaviour itself.
+ */
+ public AbstractDTViewHandler getParent() {
+ return parent;
+ }
+
+ /**
+ * @param parent
+ */
+ public void setParent(AbstractDTViewHandler parent) {
+ this.parent = parent;
+ }
+
+ /**
* IMPORTANT: this method must not return null. All view creation will fail
* for this handler when createVersionStamp() returns null. create() will
* throw ViewHandlerException.
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/symbols/DefaultBuiltInSymbolProvider.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/symbols/DefaultBuiltInSymbolProvider.java
index b3740fc44..b6422e43c 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/symbols/DefaultBuiltInSymbolProvider.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/symbols/DefaultBuiltInSymbolProvider.java
@@ -82,13 +82,13 @@ public class DefaultBuiltInSymbolProvider
private static final ISymbol SYMBOL_INIT_PARAM_IMPLICIT_OBJ;
//JSF2.0
- private static final String VIEW_SCOPE = "viewScope"; //$NON-NLS-1$
- private static final String FLASH_SCOPE = "flash"; //$NON-NLS-1$
- private static final String CC_IMPLICIT_OBJ = "cc"; //$NON-NLS-1$
- private static final String COMPONENT_IMPLICIT_OBJ = "component"; //$NON-NLS-1$
- private static final String RESOURCE_IMPLICIT_OBJ = "resource"; //$NON-NLS-1$
+ private static final String VIEW_SCOPE = "viewScope"; //$NON-NLS-1$
+ private static final String FLASH_SCOPE = "flash"; //$NON-NLS-1$
+ private static final String CC_IMPLICIT_OBJ = "cc"; //$NON-NLS-1$
+ private static final String COMPONENT_IMPLICIT_OBJ = "component"; //$NON-NLS-1$
+ private static final String RESOURCE_IMPLICIT_OBJ = "resource"; //$NON-NLS-1$
- private static final String UICOMPONENT_FULLY_QUALIFIED_CLASS = "javax.faces.component.UIComponent";//$NON-NLS-1$
+ private static final String UICOMPONENT_FULLY_QUALIFIED_CLASS = "javax.faces.component.UIComponent";//$NON-NLS-1$
static
{
@@ -197,11 +197,11 @@ public class DefaultBuiltInSymbolProvider
}
if ((symbolScopeMask & ISymbolConstants.SYMBOL_SCOPE_VIEW) != 0)
{
- symbols.addAll(getViewScopeSymbols(file).values());
+ symbols.addAll(getViewScopeSymbols(file).values());
}
if ((symbolScopeMask & ISymbolConstants.SYMBOL_SCOPE_FLASH) != 0)
{
- symbols.addAll(getFlashScopeSymbols(file).values());
+ symbols.addAll(getFlashScopeSymbols(file).values());
}
return symbols.toArray(ISymbol.EMPTY_SYMBOL_ARRAY);
}
@@ -260,8 +260,8 @@ public class DefaultBuiltInSymbolProvider
requestSymbols.put(symbol.getName(), symbol);
//add jsf2.0 implicits
- if (JSFVersion.valueOfProject(file.getProject()).compareTo(JSFVersion.V2_0) >=0) {
- symbol = _symbolFactory.createBeanOrUnknownInstanceSymbol(file
+ if (JSFVersion.guessAtLeast(JSFVersion.V2_0, file.getProject()) ) {
+ symbol = _symbolFactory.createBeanOrUnknownInstanceSymbol(file
.getProject(), UICOMPONENT_FULLY_QUALIFIED_CLASS,
CC_IMPLICIT_OBJ,
ERuntimeSource.BUILT_IN_SYMBOL_LITERAL);
@@ -269,7 +269,7 @@ public class DefaultBuiltInSymbolProvider
// _symbolFactory.createJavaComponentSymbol(CC_IMPLICIT_OBJ, typeDesc, ""); //$NON-NLS-1$
- symbol = _symbolFactory.createBeanOrUnknownInstanceSymbol(file
+ symbol = _symbolFactory.createBeanOrUnknownInstanceSymbol(file
.getProject(), UICOMPONENT_FULLY_QUALIFIED_CLASS,
COMPONENT_IMPLICIT_OBJ,
ERuntimeSource.BUILT_IN_SYMBOL_LITERAL);
@@ -301,11 +301,11 @@ public class DefaultBuiltInSymbolProvider
symbols.put(symbol.getName(), symbol);
//add jsf2.0 implicits
- if (JSFVersion.valueOfProject(file.getProject()).compareTo(JSFVersion.V2_0) >=0) {
- symbol = _symbolFactory.createUnknownInstanceSymbol(
+ if (JSFVersion.guessAtLeast(JSFVersion.V2_0, file.getProject()) ) {
+ symbol = _symbolFactory.createUnknownInstanceSymbol(
RESOURCE_IMPLICIT_OBJ,
ERuntimeSource.BUILT_IN_SYMBOL_LITERAL);
- symbols.put(symbol.getName(), symbol);
+ symbols.put(symbol.getName(), symbol);
}
return Collections.unmodifiableMap(symbols);
@@ -313,28 +313,26 @@ public class DefaultBuiltInSymbolProvider
private Map<String,ISymbol> getViewScopeSymbols(final IFile file)
{
- if(JSFVersion.valueOfProject(file.getProject()).compareTo(JSFVersion.V2_0) >= 0) {
-
- ISymbol symbol = createScopeSymbol(file,
- ISymbolConstants.SYMBOL_SCOPE_VIEW, VIEW_SCOPE);
-
- return Collections.unmodifiableMap
- (Collections.singletonMap(symbol.getName(), symbol));
- }
- return Collections.emptyMap();
+ if (JSFVersion.guessAtLeast(JSFVersion.V2_0, file.getProject()) ) {
+ ISymbol symbol = createScopeSymbol(file,
+ ISymbolConstants.SYMBOL_SCOPE_VIEW, VIEW_SCOPE);
+
+ return Collections.unmodifiableMap
+ (Collections.singletonMap(symbol.getName(), symbol));
+ }
+ return Collections.emptyMap();
}
private Map<String,ISymbol> getFlashScopeSymbols(final IFile file)
{
- if(JSFVersion.valueOfProject(file.getProject()).compareTo(JSFVersion.V2_0) >= 0) {
-
- ISymbol symbol = createScopeSymbol(file,
- ISymbolConstants.SYMBOL_SCOPE_FLASH, FLASH_SCOPE);
-
- return Collections.unmodifiableMap
- (Collections.singletonMap(symbol.getName(), symbol));
- }
- return Collections.emptyMap();
+ if (JSFVersion.guessAtLeast(JSFVersion.V2_0, file.getProject()) ) {
+ ISymbol symbol = createScopeSymbol(file,
+ ISymbolConstants.SYMBOL_SCOPE_FLASH, FLASH_SCOPE);
+
+ return Collections.unmodifiableMap
+ (Collections.singletonMap(symbol.getName(), symbol));
+ }
+ return Collections.emptyMap();
}
private ISymbol createScopeSymbol(final IFile file, final int scopeMask,
@@ -396,13 +394,13 @@ public class DefaultBuiltInSymbolProvider
scopeMap.putAll(externalContext.getMapForScope(_scopeMask));
DTUIViewRoot viewRoot = manager
- .getFacesContext(_externalContextKey)
- .getViewRootHandle().getCachedViewRoot();
+ .getFacesContext(_externalContextKey)
+ .getViewRootHandle().getCachedViewRoot();
if (viewRoot == null) {
- viewRoot = manager
- .getFacesContext(_externalContextKey)
- .getViewRootHandle().updateViewRoot();
+ viewRoot = manager
+ .getFacesContext(_externalContextKey)
+ .getViewRootHandle().updateViewRoot();
}
scopeMap.putAll(viewRoot.getViewMap());
}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/plugin.properties b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/plugin.properties
index f0b7de2bc..5e170e4bb 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/plugin.properties
+++ b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/plugin.properties
@@ -29,4 +29,6 @@ _UI_AttributeUsage_FIXED_literal = FIXED
_UI_AttributeUsage_PROHIBITED_literal = PROHIBITED
_UI_AttributeData_description_feature = Description
-extension-point.name = testProjectTaglibDescriptorFactory \ No newline at end of file
+extension-point.name = testProjectTaglibDescriptorFactory
+
+componentCoreQueryFactory-ext-pt = componentCoreQueryFactory \ No newline at end of file
diff --git a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/plugin.xml b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/plugin.xml
index d17c4c5f3..d7aae6819 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/plugin.xml
+++ b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/plugin.xml
@@ -2,6 +2,7 @@
<?eclipse version="3.2"?>
<plugin>
<extension-point id="projectTaglibDescriptorFactory" name="%extension-point.name" schema="schema/testProjectTaglibDescriptorFactory.exsd"/>
+ <extension-point id="componentCoreQueryFactory" name="%componentCoreQueryFactory-ext-pt" schema="schema/componentCoreQueryFactory.exsd"/>
<extension
point="org.eclipse.jst.jsf.core.tagregistry">
<tagRegistry
diff --git a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/schema/componentCoreQueryFactory.exsd b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/schema/componentCoreQueryFactory.exsd
new file mode 100644
index 000000000..7e4dcec56
--- /dev/null
+++ b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/schema/componentCoreQueryFactory.exsd
@@ -0,0 +1,102 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.jst.jsf.facelet.core" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.jst.jsf.facelet.core" id="componentCoreQueryFactory" name="componentCoreQueryFactory"/>
+ </appInfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appInfo>
+ <meta.element />
+ </appInfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="componentCoreQueryFactory"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="componentCoreQueryFactory">
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn="org.eclipse.jst.jsf.common.internal.componentcore.AbstractCompCoreQueryFactory:"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiinfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
diff --git a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/FaceletCorePlugin.java b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/FaceletCorePlugin.java
index 278fdd1d8..15741a9fb 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/FaceletCorePlugin.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/FaceletCorePlugin.java
@@ -1,9 +1,15 @@
package org.eclipse.jst.jsf.facelet.core.internal;
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.emf.common.EMFPlugin;
import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.jst.jsf.common.internal.componentcore.AbstractCompCoreQueryFactory;
+import org.eclipse.jst.jsf.common.internal.componentcore.AbstractCompCoreQueryFactory.DefaultCompCoreQueryFactory;
+import org.eclipse.jst.jsf.common.internal.pde.AbstractSimpleClassExtensionRegistryReader;
import org.osgi.framework.BundleContext;
/**
@@ -28,6 +34,7 @@ public class FaceletCorePlugin extends EMFPlugin
// The shared instance
private static Implementation plugin;
+
/**
* Create the instance.
* <!-- begin-user-doc -->
@@ -91,6 +98,33 @@ public class FaceletCorePlugin extends EMFPlugin
plugin = this;
}
+ private AbstractCompCoreQueryFactory compCoreQueryFactory;
+
+ /**
+ * @return the query factory
+ */
+ public AbstractCompCoreQueryFactory getCompCoreQueryFactory()
+ {
+ synchronized(this)
+ {
+ if (compCoreQueryFactory == null)
+ {
+ List<AbstractCompCoreQueryFactory> extensions = new MyCompCoreFactoryLoader().getExtensions();
+ if (!extensions.isEmpty())
+ {
+ compCoreQueryFactory = extensions.get(0);
+
+ }
+ else
+ {
+ this.compCoreQueryFactory = new DefaultCompCoreQueryFactory();
+ }
+ }
+ return this.compCoreQueryFactory;
+ }
+ }
+
+
@Override
public void start(BundleContext bundleContext) throws Exception
{
@@ -107,7 +141,19 @@ public class FaceletCorePlugin extends EMFPlugin
}
}
-
+ private static class MyCompCoreFactoryLoader extends AbstractSimpleClassExtensionRegistryReader<AbstractCompCoreQueryFactory>
+ {
+
+ protected MyCompCoreFactoryLoader() {
+ super(PLUGIN_ID, "componentCoreQueryFactory", "componentCoreQueryFactory", "class", null); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+
+ @Override
+ protected void handleLoadFailure(CoreException ce) {
+ FaceletCorePlugin.log(ce);
+ }
+
+ }
/**
* Returns the shared instance
*
@@ -133,4 +179,22 @@ public class FaceletCorePlugin extends EMFPlugin
getDefault().getLog().log(status);
}
+ /**
+ * @param exception
+ */
+ public static void log(final Throwable exception)
+ {
+ log("Caught exception", exception); //$NON-NLS-1$
+ }
+
+ /**
+ * @param logMessage
+ * @param exception
+ */
+ public static void logInfo(final String logMessage, final Throwable exception)
+ {
+ final IStatus status = new Status(IStatus.INFO, PLUGIN_ID,
+ logMessage, exception);
+ getDefault().getLog().log(status);
+ }
}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/FaceletDocumentFactory.java b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/FaceletDocumentFactory.java
index a43c99170..c1c7b29ec 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/FaceletDocumentFactory.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/cm/FaceletDocumentFactory.java
@@ -110,7 +110,7 @@ public class FaceletDocumentFactory
*/
private TagInfo createExternalTagInfo(final String uri)
{
- final JSFVersion jsfVersion = JSFVersion.valueOfProject(_project);
+ final JSFVersion jsfVersion = JSFVersion.guessJSFVersion(_project);
TagInfo tldTagInfo = null;
if (jsfVersion != null)
{
diff --git a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/registry/FaceletRegistryManager.java b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/registry/FaceletRegistryManager.java
index 357458b0d..b4c56b85e 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/registry/FaceletRegistryManager.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/registry/FaceletRegistryManager.java
@@ -117,14 +117,7 @@ public final class FaceletRegistryManager extends
{
return false;
}
-
- final JSFVersion jsfVersion = JSFVersion.valueOfProject(project);
- if (jsfVersion != null && jsfVersion.compareTo(JSFVersion.V2_0) >= 0)
- {
- return true;
- }
-
- return false;
+ return JSFVersion.guessAtLeast(JSFVersion.V2_0, project);
}
}
}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/registry/FaceletTagResolvingStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/registry/FaceletTagResolvingStrategy.java
index 7ba62383a..a8a5f12e6 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/registry/FaceletTagResolvingStrategy.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/registry/FaceletTagResolvingStrategy.java
@@ -14,6 +14,7 @@ import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.AbstractTagResolvi
import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.IAttributeAdvisor;
import org.eclipse.jst.jsf.facelet.core.internal.cm.FaceletDocumentFactory;
import org.eclipse.jst.jsf.facelet.core.internal.registry.taglib.faceletTaglib.FaceletTaglibTag;
+import org.eclipse.jst.jsf.facelet.core.internal.registry.taglib.faceletTaglib.FullyQualifiedClass;
import org.eclipse.jst.jsf.facelet.core.internal.registry.taglib.faceletTaglib_1_0.ComponentTagDefn;
import org.eclipse.jst.jsf.facelet.core.internal.registry.taglib.faceletTaglib_1_0.ConverterTagDefn;
import org.eclipse.jst.jsf.facelet.core.internal.registry.taglib.faceletTaglib_1_0.HandlerTagDefn;
@@ -145,7 +146,15 @@ import org.eclipse.jst.jsf.facelet.core.internal.tagmodel.ValidatorTag;
return new SourceTag(uri, tagName, source, _factory, advisor);
}
- return new NoArchetypeFaceletTag(uri, tagName, _factory, advisor);
+ return handleNewFaceletTagDefn(uri, tagName, tagDefn, advisor);
+ }
+
+ private FaceletTag handleNewFaceletTagDefn(final String uri, final String tagName, FaceletTaglibTag tagDefn,
+ final IAttributeAdvisor advisor) {
+ FullyQualifiedClass handlerClassElement = tagDefn.getHandlerClassElement();
+ return new NoArchetypeFaceletTag(uri, tagName,
+ safeGetString(handlerClassElement != null ? safeGetString(handlerClassElement.getValue()) : null),
+ _factory, advisor);
}
private static String safeGetString(final String value)
diff --git a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/registry/taglib/ContextParamSpecifiedFaceletTaglibLocator.java b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/registry/taglib/ContextParamSpecifiedFaceletTaglibLocator.java
index 863b16cd7..e247f3541 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/registry/taglib/ContextParamSpecifiedFaceletTaglibLocator.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/registry/taglib/ContextParamSpecifiedFaceletTaglibLocator.java
@@ -18,7 +18,7 @@ import java.util.Map;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
-import org.eclipse.jst.j2ee.model.IModelProvider;
+import org.eclipse.jst.jsf.common.internal.componentcore.AbstractJEEModelProviderQuery;
import org.eclipse.jst.jsf.common.internal.componentcore.AbstractVirtualComponentQuery;
import org.eclipse.jst.jsf.common.internal.managedobject.ObjectManager.ManagedObjectException;
import org.eclipse.jst.jsf.common.internal.resource.WorkspaceMediator;
@@ -56,7 +56,7 @@ public class ContextParamSpecifiedFaceletTaglibLocator extends
*/
public ContextParamSpecifiedFaceletTaglibLocator(final IProject project,
final TagRecordFactory factory,
- final IModelProvider webAppProvider,
+ final AbstractJEEModelProviderQuery webAppProvider,
final AbstractVirtualComponentQuery vcQuery,
final WorkspaceMediator wsMediator)
{
diff --git a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/registry/taglib/FaceletTagIndex.java b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/registry/taglib/FaceletTagIndex.java
index cdef395f4..f4bc54abe 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/registry/taglib/FaceletTagIndex.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/registry/taglib/FaceletTagIndex.java
@@ -17,8 +17,9 @@ import java.util.concurrent.CopyOnWriteArrayList;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.jst.j2ee.model.ModelProviderManager;
-import org.eclipse.jst.jsf.common.internal.componentcore.AbstractVirtualComponentQuery.DefaultVirtualComponentQuery;
+import org.eclipse.jst.jsf.common.internal.componentcore.AbstractCompCoreQueryFactory;
+import org.eclipse.jst.jsf.common.internal.componentcore.AbstractJEEModelProviderQuery;
+import org.eclipse.jst.jsf.common.internal.componentcore.AbstractVirtualComponentQuery;
import org.eclipse.jst.jsf.common.internal.finder.AbstractMatcher.AlwaysMatcher;
import org.eclipse.jst.jsf.common.internal.locator.AbstractLocatorProvider;
import org.eclipse.jst.jsf.common.internal.locator.AbstractLocatorProvider.DefaultLocatorProvider;
@@ -33,6 +34,7 @@ import org.eclipse.jst.jsf.common.internal.strategy.ISimpleStrategy;
import org.eclipse.jst.jsf.designtime.internal.resources.IJSFResourceLocator;
import org.eclipse.jst.jsf.designtime.internal.resources.JarBasedJSFResourceLocator;
import org.eclipse.jst.jsf.designtime.internal.resources.WorkspaceJSFResourceLocator;
+import org.eclipse.jst.jsf.facelet.core.internal.FaceletCorePlugin;
/**
* @author cbateman
@@ -172,9 +174,11 @@ public class FaceletTagIndex extends
{
final List<AbstractFaceletTaglibLocator> locators = new ArrayList<AbstractFaceletTaglibLocator>();
locators.add(new JarFileFaceletTaglibLocator(factory));
- locators.add(new ContextParamSpecifiedFaceletTaglibLocator(project,
- factory, ModelProviderManager.getModelProvider(project),
- new DefaultVirtualComponentQuery(), new WorkspaceMediator()));
+ ContextParamSpecifiedFaceletTaglibLocator createContextParamSpecific = createContextParamSpecific(project, factory);
+ if (createContextParamSpecific != null)
+ {
+ locators.add(createContextParamSpecific);
+ }
final List<IJSFResourceLocator> resourceLocators = new ArrayList<IJSFResourceLocator>();
resourceLocators
.add(new JarBasedJSFResourceLocator(Collections.EMPTY_LIST,
@@ -183,12 +187,7 @@ public class FaceletTagIndex extends
.singletonList(new AlwaysMatcher()),
new JavaCoreMediator()),
new ContentTypeResolver()));
- final IWorkspace workspace = project.getWorkspace();
- resourceLocators.add(new WorkspaceJSFResourceLocator(
- Collections.EMPTY_LIST,
- new CopyOnWriteArrayList<ILocatorChangeListener>(),
- new DefaultVirtualComponentQuery(),
- new ContentTypeResolver(), workspace));
+ resourceLocators.add(createJsfResourceLocator(project));
final DefaultLocatorProvider<IJSFResourceLocator> resourceLocatorProvider = new DefaultLocatorProvider<IJSFResourceLocator>(
resourceLocators);
locators.add(new CompositeComponentTaglibLocator(
@@ -196,6 +195,29 @@ public class FaceletTagIndex extends
final LocatorProvider provider = new LocatorProvider(locators);
return new ProjectTaglibDescriptor(project, factory, provider);
}
+
+ private WorkspaceJSFResourceLocator createJsfResourceLocator(final IProject project) {
+ return new WorkspaceJSFResourceLocator(
+ Collections.EMPTY_LIST,
+ new CopyOnWriteArrayList<ILocatorChangeListener>(),
+ FaceletCorePlugin.getDefault().getCompCoreQueryFactory().createVirtualComponentQuery(project),
+ new ContentTypeResolver(), project.getWorkspace());
+ }
+
+ private ContextParamSpecifiedFaceletTaglibLocator createContextParamSpecific(final IProject project,
+ final TagRecordFactory factory) {
+ AbstractCompCoreQueryFactory compCoreQueryFactory = FaceletCorePlugin.getDefault()
+ .getCompCoreQueryFactory();
+ AbstractJEEModelProviderQuery modelProviderQuery = compCoreQueryFactory
+ .createJEEModelProviderQuery(project);
+ AbstractVirtualComponentQuery virtualComponentQuery = compCoreQueryFactory
+ .createVirtualComponentQuery(project);
+ if (modelProviderQuery != null && virtualComponentQuery != null) {
+ return new ContextParamSpecifiedFaceletTaglibLocator(project, factory, modelProviderQuery,
+ virtualComponentQuery, new WorkspaceMediator());
+ }
+ return null;
+ }
}
/**
diff --git a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/registry/taglib/TagModelLoader.java b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/registry/taglib/TagModelLoader.java
index fa3421dad..f08daf158 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/registry/taglib/TagModelLoader.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/registry/taglib/TagModelLoader.java
@@ -7,6 +7,7 @@ import java.net.URISyntaxException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -97,7 +98,9 @@ public class TagModelLoader
.createFileURI(_resourceUri));
if (res != null)
{
- res.load(is, Collections.EMPTY_MAP);
+ Map<String, Object> options = new HashMap<String, Object>();
+ options.put(XMLResource.OPTION_RECORD_UNKNOWN_FEATURE, Boolean.TRUE);
+ res.load(is, options);
final EObject eObject = res.getContents().get(0);
_docRoot = (DocumentRoot) eObject;
_faceletTaglib = _docRoot.getFaceletTaglib();
diff --git a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/registry/taglib/WebappConfiguration.java b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/registry/taglib/WebappConfiguration.java
index e0117c8e7..9f4b5dc21 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/registry/taglib/WebappConfiguration.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/registry/taglib/WebappConfiguration.java
@@ -12,7 +12,6 @@ package org.eclipse.jst.jsf.facelet.core.internal.registry.taglib;
import java.util.ArrayList;
import java.util.Collections;
-import java.util.Iterator;
import java.util.List;
import java.util.StringTokenizer;
import java.util.concurrent.CopyOnWriteArrayList;
@@ -24,8 +23,8 @@ import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
-import org.eclipse.jst.j2ee.model.IModelProvider;
-import org.eclipse.jst.javaee.web.IWebCommon;
+import org.eclipse.jst.javaee.core.ParamValue;
+import org.eclipse.jst.jsf.common.internal.componentcore.AbstractJEEModelProviderQuery;
import org.eclipse.jst.jsf.common.internal.componentcore.AbstractVirtualComponentQuery;
import org.eclipse.jst.jsf.common.internal.resource.EventResult;
import org.eclipse.jst.jsf.common.internal.resource.IResourceLifecycleListener;
@@ -34,7 +33,6 @@ import org.eclipse.jst.jsf.common.internal.resource.ResourceLifecycleEvent;
import org.eclipse.jst.jsf.common.internal.resource.ResourceLifecycleEvent.EventType;
import org.eclipse.jst.jsf.common.internal.resource.WorkspaceMediator;
import org.eclipse.jst.jsf.facelet.core.internal.registry.taglib.WebappConfiguration.WebappListener.WebappChangeEvent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualFile;
import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
/**
@@ -59,19 +57,19 @@ public class WebappConfiguration
*/
private final ContextParamAdapter _contextParamAdapter;
private List<IFile> _cachedFiles;
- private final IModelProvider _modelProvider;
+ private final AbstractJEEModelProviderQuery _modelProvider;
private final AbstractVirtualComponentQuery _vcQuery;
private final LifecycleListener _lifecycleListener;
private final WorkspaceMediator _wsMediator;
/**
* @param project
- * @param modelProvider
+ * @param webAppProvider
* @param vcQuery
* @param wsMediator
*/
public WebappConfiguration(final IProject project,
- final IModelProvider modelProvider,
+ final AbstractJEEModelProviderQuery webAppProvider,
final AbstractVirtualComponentQuery vcQuery,
final WorkspaceMediator wsMediator)
{
@@ -80,7 +78,7 @@ public class WebappConfiguration
_lifecycleListener = new LifecycleListener(getWebXmlFile(project),
project.getWorkspace());
_contextParamAdapter = new ContextParamAdapter();
- _modelProvider = modelProvider;
+ _modelProvider = webAppProvider;
_wsMediator = wsMediator;
}
@@ -106,11 +104,15 @@ public class WebappConfiguration
public List<IFile> getFiles()
{
final IVirtualFolder folder = _vcQuery.getWebContentFolder(_project);
-
if (folder == null)
{
return Collections.emptyList();
}
+ final IContainer underlyingContainer = folder.getUnderlyingFolder();
+ if (underlyingContainer == null)
+ {
+ return Collections.emptyList();
+ }
final List<String> filenames = getConfigFilesFromContextParam(_project,
_modelProvider);
@@ -118,10 +120,10 @@ public class WebappConfiguration
for (final String filename : filenames)
{
- final IVirtualFile vfile = folder.getFile(new Path(filename));
- if (vfile != null)
+ final IFile vfile = underlyingContainer.getFile(new Path(filename));
+ if (vfile != null && vfile.isAccessible())
{
- files.add(vfile.getUnderlyingFile());
+ files.add(vfile);
}
}
_cachedFiles = files;
@@ -170,51 +172,29 @@ public class WebappConfiguration
* @param project
* IProject instance for which to get the context parameter's
* value.
- * @param provider
+ * @param modelProvider
* @return List of application configuration file names as listed in the JSF
* CONFIG_FILES context parameter ("javax.faces.CONFIG_FILES"); list
* may be empty.
*/
public static List<String> getConfigFilesFromContextParam(
- final IProject project, final IModelProvider provider)
+ final IProject project, final AbstractJEEModelProviderQuery modelProvider)
{
- List<String> filesList = Collections.EMPTY_LIST;
- // if (JSFAppConfigUtils.isValidJSFProject(project))
+ List<String> filesList = new ArrayList<String>(5);
{
- final Object webAppObj = provider.getModelObject();
- if (webAppObj != null)
- {
- if (webAppObj instanceof org.eclipse.jst.javaee.web.WebApp)
+ List<ParamValue> paramValues = modelProvider.getWebAppParamValues();
+ for (final ParamValue paramValue : paramValues){
+ if (paramValue.getParamName().equals(
+ FACELET_10_LIBRARIES_CONTEXT_PARAM_NAME)
+ || paramValue.getParamName().equals(
+ JSF20_FACELET_LIBRARIES_CONTEXT_PARAM_NAME))
{
- filesList = getConfigFilesForJEEApp((org.eclipse.jst.javaee.web.WebApp) webAppObj);
+ String filesString = paramValue.getParamValue();
+ filesList.addAll(parseFilesString(filesString));
}
}
-
- }
- return filesList;
- }
-
- private static List<String> getConfigFilesForJEEApp(
- final org.eclipse.jst.javaee.web.WebApp webApp)
- {
- String filesString = null;
- final List contextParams = webApp.getContextParams();
- final Iterator itContextParams = contextParams.iterator();
- final List<String> fileStrings = new ArrayList<String>();
- while (itContextParams.hasNext())
- {
- final org.eclipse.jst.javaee.core.ParamValue paramValue = (org.eclipse.jst.javaee.core.ParamValue) itContextParams
- .next();
- if (paramValue.getParamName().equals(
- FACELET_10_LIBRARIES_CONTEXT_PARAM_NAME)
- || paramValue.getParamName().equals(
- JSF20_FACELET_LIBRARIES_CONTEXT_PARAM_NAME))
- {
- filesString = paramValue.getParamValue();
- fileStrings.addAll(parseFilesString(filesString));
- }
}
- return fileStrings;
+ return filesList.isEmpty() ? Collections.EMPTY_LIST : filesList;
}
private static List<String> parseFilesString(final String filesString)
@@ -351,20 +331,11 @@ public class WebappConfiguration
{
public void run(final IProgressMonitor monitor) throws CoreException
{
- final Object modelObject = _modelProvider.getModelObject();
- if (modelObject instanceof org.eclipse.jst.javaee.web.WebApp)
+ List<ParamValue> webAppParamValues = _modelProvider.getWebAppParamValues();
+ for (final org.eclipse.jst.javaee.core.ParamValue paramValue : webAppParamValues)
{
- for (final org.eclipse.jst.javaee.core.ParamValue paramValue : ((IWebCommon) modelObject)
- .getContextParams())
- {
- processParamValue(paramValue);
- }
+ processParamValue(paramValue);
}
- // TODO: possibly handle facelets 1.0 in pre-2.5 webapps in
- // the
- // future
- // if it's worth the complexity.
- // SEE previous revs in CVS.
}
};
_wsMediator.runInWorkspaceJob(runnable, "Update web xml"); //$NON-NLS-1$
diff --git a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/registry/taglib/faceletTaglib/impl/FaceletTaglibPackageImpl.java b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/registry/taglib/faceletTaglib/impl/FaceletTaglibPackageImpl.java
index d49d40f05..b398ed610 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/registry/taglib/faceletTaglib/impl/FaceletTaglibPackageImpl.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/registry/taglib/faceletTaglib/impl/FaceletTaglibPackageImpl.java
@@ -1862,7 +1862,7 @@ public class FaceletTaglibPackageImpl extends EPackageImpl implements FaceletTag
new String[] {
"name", ":0", //$NON-NLS-1$ //$NON-NLS-2$
"kind", "elementWildcard", //$NON-NLS-1$ //$NON-NLS-2$
- "processing", "lax" //$NON-NLS-1$ //$NON-NLS-2$
+ "processing", "lax" //$NON-NLS-1$//$NON-NLS-2$
});
addAnnotation
(getDescription_Id(),
diff --git a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/tagmodel/NoArchetypeFaceletTag.java b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/tagmodel/NoArchetypeFaceletTag.java
index 142ff3b3b..ba501a819 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/tagmodel/NoArchetypeFaceletTag.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/tagmodel/NoArchetypeFaceletTag.java
@@ -25,7 +25,19 @@ public final class NoArchetypeFaceletTag extends FaceletTag {
*/
public NoArchetypeFaceletTag(final String uri, final String name, final FaceletDocumentFactory factory,
final IAttributeAdvisor advisor) {
- super(uri, name, TagType.HANDLER, null, factory, advisor);
+ this(uri, name, null, factory, advisor);
}
+ /**
+ * @param uri
+ * @param name
+ * @param handlerClassName
+ * @param factory
+ * @param advisor
+ */
+ public NoArchetypeFaceletTag(final String uri, final String name, final String handlerClassName, final FaceletDocumentFactory factory,
+ final IAttributeAdvisor advisor)
+ {
+ super(uri, name, TagType.HANDLER, handlerClassName, factory, advisor);
+ }
}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/util/ViewUtil.java b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/util/ViewUtil.java
index 1429e9366..8ac6ac074 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/util/ViewUtil.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/util/ViewUtil.java
@@ -9,10 +9,16 @@ import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.content.IContentType;
+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.CompositeTagRegistryFactory;
import org.eclipse.jst.jsf.core.internal.CompositeTagRegistryFactory.TagRegistryIdentifier;
import org.eclipse.jst.jsf.designtime.DesignTimeApplicationManager;
import org.eclipse.jst.jsf.designtime.internal.view.IDTViewHandler;
+import org.eclipse.jst.jsf.designtime.internal.view.XMLViewDefnAdapter.DTELExpression;
import org.eclipse.jst.jsf.designtime.internal.view.model.ITagRegistry;
import org.eclipse.jst.jsf.designtime.internal.view.model.TagRegistryFactory.TagRegistryFactoryException;
import org.eclipse.jst.jsf.facelet.core.internal.registry.FaceletRegistryManager.MyRegistryFactory;
@@ -20,6 +26,7 @@ import org.eclipse.jst.jsp.core.internal.contentmodel.tld.CMDocumentFactoryTLD;
import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDDocument;
import org.eclipse.jst.jsp.core.taglib.ITaglibRecord;
import org.eclipse.jst.jsp.core.taglib.TaglibIndex;
+import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -258,5 +265,55 @@ public final class ViewUtil
return _uri.equals(obj);
}
}
+ /**
+ * @param genericContext
+ * @return the el expression from the context or null if none found.
+ */
+ public static DTELExpression getDTELExpression(IModelContext genericContext) {
+ final IStructuredDocumentContext context = (IStructuredDocumentContext) genericContext
+ .getAdapter(IStructuredDocumentContext.class);
+
+// if (context == null)
+// {
+// throw new ViewHandlerException(Cause.EL_NOT_FOUND);
+// }
+
+ final ITextRegionContextResolver resolver =
+ IStructuredDocumentContextResolverFactory.INSTANCE
+ .getTextRegionResolver(context);
+
+ if (resolver != null)
+ {
+ final String regionType = resolver.getRegionType();
+ int startOffset = resolver.getStartOffset();
+ int relativeOffset = context.getDocumentPosition() - startOffset;
+
+ if (DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE.equals(regionType))
+ {
+ final String attributeText = resolver.getRegionText();
+ int elOpenIdx = attributeText.indexOf("#"); //$NON-NLS-1$
+
+ if (elOpenIdx >= 0 && elOpenIdx < relativeOffset
+ && elOpenIdx+1 < attributeText.length()
+ && attributeText.charAt(elOpenIdx+1) == '{')
+ {
+ // we may have a hit
+ int elCloseIdx = attributeText.indexOf('}', elOpenIdx+1);
+ if (elCloseIdx != -1)
+ {
+ final IStructuredDocumentContext elContext =
+ IStructuredDocumentContextFactory.INSTANCE.getContext(
+ context.getStructuredDocument(), resolver
+ .getStartOffset()+elOpenIdx+2);
+ final String elText = attributeText.substring(
+ elOpenIdx + 2, elCloseIdx);
+ return new DTELExpression(elContext, elText);
+ }
+ }
+ }
+ }
+
+ return null;
+ }
}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/validation/TaglibValidator.java b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/validation/TaglibValidator.java
index 7e35aa641..32001db3d 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/validation/TaglibValidator.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/validation/TaglibValidator.java
@@ -25,7 +25,8 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.jst.j2ee.model.ModelProviderManager;
+import org.eclipse.jst.jsf.common.internal.componentcore.AbstractCompCoreQueryFactory;
+import org.eclipse.jst.jsf.common.internal.componentcore.AbstractJEEModelProviderQuery;
import org.eclipse.jst.jsf.common.internal.componentcore.AbstractVirtualComponentQuery.DefaultVirtualComponentQuery;
import org.eclipse.jst.jsf.facelet.core.internal.FaceletCorePlugin;
import org.eclipse.jst.jsf.facelet.core.internal.registry.taglib.TagModelParser;
@@ -113,12 +114,17 @@ public class TaglibValidator implements IValidatorJob
if (isInValidPath)
{
- for (final String configuredPath : WebappConfiguration.getConfigFilesFromContextParam(project, ModelProviderManager.getModelProvider(project)))
+ AbstractCompCoreQueryFactory compCoreQueryFactory = FaceletCorePlugin.getDefault().getCompCoreQueryFactory();
+ AbstractJEEModelProviderQuery modelProvider = compCoreQueryFactory.createJEEModelProviderQuery(project);
+ if (modelProvider != null)
{
- final IPath path = webFolderPath.append(configuredPath);
- if (path.equals(filePath))
+ for (final String configuredPath : WebappConfiguration.getConfigFilesFromContextParam(project, modelProvider))
{
- return true;
+ final IPath path = webFolderPath.append(configuredPath);
+ if (path.equals(filePath))
+ {
+ return true;
+ }
}
}
}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/view/DTFaceletViewHandler.java b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/view/DTFaceletViewHandler.java
index 794c38569..aa2ea6139 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/view/DTFaceletViewHandler.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/view/DTFaceletViewHandler.java
@@ -12,7 +12,7 @@ import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.core.runtime.content.IContentTypeManager;
import org.eclipse.jst.jsf.common.internal.JSPUtil;
import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentInfo;
-import org.eclipse.jst.jsf.core.jsfappconfig.JSFAppConfigUtils;
+import org.eclipse.jst.jsf.core.JSFVersion;
import org.eclipse.jst.jsf.designtime.context.DTFacesContext;
import org.eclipse.jst.jsf.designtime.internal.view.DTUIViewRoot;
import org.eclipse.jst.jsf.designtime.internal.view.DTUIViewRoot.VersionStamp;
@@ -121,8 +121,7 @@ public class DTFaceletViewHandler extends DefaultDTViewHandler
@Override
public boolean supportsViewDefinition(final IFile file)
{
- // XXX: cover case where we are in a JSF 1.2 project and the file is facelet.
- return JSFAppConfigUtils.isValidJSFProject(file.getProject(), "2.0") && //$NON-NLS-1$
+ return JSFVersion.guessAtLeast(JSFVersion.V2_0, file.getProject()) &&
(JSPUtil.isJSPContentType(file) || isHTMLContent(file));
}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/view/FaceletViewDefnAdapter.java b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/view/FaceletViewDefnAdapter.java
index 6eb5021f9..366802331 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/view/FaceletViewDefnAdapter.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/view/FaceletViewDefnAdapter.java
@@ -16,9 +16,9 @@ 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.TaglibBasedViewDefnAdapter;
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.TaglibBasedViewDefnAdapter;
import org.eclipse.jst.jsf.designtime.internal.view.model.ITagRegistry;
import org.eclipse.wst.sse.core.StructuredModelManager;
import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
@@ -36,7 +36,10 @@ import org.w3c.dom.NamedNodeMap;
*/
public class FaceletViewDefnAdapter extends TaglibBasedViewDefnAdapter
{
- FaceletViewDefnAdapter(final ITagRegistry tagRegistry)
+ /**
+ * @param tagRegistry
+ */
+ protected FaceletViewDefnAdapter(final ITagRegistry tagRegistry)
{
super(tagRegistry);
}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.facelet.ui/src/org/eclipse/jst/jsf/facelet/ui/internal/FaceletUiPlugin.java b/jsf/plugins/org.eclipse.jst.jsf.facelet.ui/src/org/eclipse/jst/jsf/facelet/ui/internal/FaceletUiPlugin.java
index 99b338667..3742e9ab4 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.facelet.ui/src/org/eclipse/jst/jsf/facelet/ui/internal/FaceletUiPlugin.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.facelet.ui/src/org/eclipse/jst/jsf/facelet/ui/internal/FaceletUiPlugin.java
@@ -75,6 +75,9 @@ public class FaceletUiPlugin extends AbstractUIPlugin
}
+ /**
+ * @return the validation strategy extension data
+ */
public Map<String, ExtensionData<AbstractFaceletValidationStrategy>> getValidationStrategy()
{
synchronized (this.extensionLock) {
diff --git a/jsf/plugins/org.eclipse.jst.jsf.facelet.ui/src/org/eclipse/jst/jsf/facelet/ui/internal/contentassist/CompositeAttributeAssistProcessor.java b/jsf/plugins/org.eclipse.jst.jsf.facelet.ui/src/org/eclipse/jst/jsf/facelet/ui/internal/contentassist/CompositeAttributeAssistProcessor.java
index 13312faec..bad97fd52 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.facelet.ui/src/org/eclipse/jst/jsf/facelet/ui/internal/contentassist/CompositeAttributeAssistProcessor.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.facelet.ui/src/org/eclipse/jst/jsf/facelet/ui/internal/contentassist/CompositeAttributeAssistProcessor.java
@@ -7,10 +7,8 @@ import org.eclipse.jface.text.contentassist.IContextInformation;
import org.eclipse.jface.text.contentassist.IContextInformationValidator;
import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext;
import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContextFactory;
-import org.eclipse.jst.jsf.designtime.DTAppManagerUtil;
-import org.eclipse.jst.jsf.designtime.internal.view.XMLViewDefnAdapter;
-import org.eclipse.jst.jsf.designtime.internal.view.IDTViewHandler.ViewHandlerException;
import org.eclipse.jst.jsf.designtime.internal.view.XMLViewDefnAdapter.DTELExpression;
+import org.eclipse.jst.jsf.facelet.core.internal.util.ViewUtil;
import org.eclipse.jst.jsf.ui.internal.contentassist.JSFContentAssistProcessor;
import org.eclipse.jst.jsf.ui.internal.contentassist.el.JSFELContentAssistProcessor;
@@ -36,7 +34,7 @@ public class CompositeAttributeAssistProcessor implements
{
_nonELProcessor = new JSFContentAssistProcessor();
_elProcessor = new JSFELContentAssistProcessor();
-
+
char[] nonELChars =
_nonELProcessor.getCompletionProposalAutoActivationCharacters();
char[] elChars =
@@ -44,9 +42,8 @@ public class CompositeAttributeAssistProcessor implements
_activationChars = new char[nonELChars.length+elChars.length];
System.arraycopy(nonELChars, 0, _activationChars, 0, nonELChars.length);
System.arraycopy(elChars, 0, _activationChars, nonELChars.length, elChars.length);
-
-
}
+
public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer,
int offset)
{
@@ -97,24 +94,12 @@ public class CompositeAttributeAssistProcessor implements
if (context != null)
{
- XMLViewDefnAdapter adapter =
- DTAppManagerUtil.getXMLViewDefnAdapter(context);
- if (adapter != null)
+ DTELExpression elExpression = ViewUtil.getDTELExpression(context);
+
+ // only return true if we definitively find EL
+ if(elExpression != null)
{
- try
- {
- DTELExpression elExpression = adapter.getELExpression(context);
-
- // only return true if we definitively find EL
- if(elExpression != null)
- {
- return true;
- }
- }
- catch (ViewHandlerException e)
- {
- // fall through to false, no el
- }
+ return true;
}
}
// all other cases, return false
diff --git a/jsf/plugins/org.eclipse.jst.jsf.facelet.ui/src/org/eclipse/jst/jsf/facelet/ui/internal/contentassist/XHTMLContentAssistProcessor.java b/jsf/plugins/org.eclipse.jst.jsf.facelet.ui/src/org/eclipse/jst/jsf/facelet/ui/internal/contentassist/XHTMLContentAssistProcessor.java
index 0b2afd49f..51c8272ec 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.facelet.ui/src/org/eclipse/jst/jsf/facelet/ui/internal/contentassist/XHTMLContentAssistProcessor.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.facelet.ui/src/org/eclipse/jst/jsf/facelet/ui/internal/contentassist/XHTMLContentAssistProcessor.java
@@ -44,6 +44,7 @@ import org.w3c.dom.Node;
* @author cbateman
*
*/
+@SuppressWarnings("deprecation")
public class XHTMLContentAssistProcessor extends AbstractContentAssistProcessor
{
private IFile _file;
diff --git a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/tagregistry/TagRegistryMasterForm.java b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/tagregistry/TagRegistryMasterForm.java
index a43c7aa8b..f2f951ec4 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/tagregistry/TagRegistryMasterForm.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.ui/src/org/eclipse/jst/jsf/ui/internal/tagregistry/TagRegistryMasterForm.java
@@ -40,7 +40,7 @@ import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.Namespace;
import org.eclipse.jst.jsf.common.ui.JSFUICommonPlugin;
import org.eclipse.jst.jsf.common.ui.internal.form.AbstractMasterForm;
import org.eclipse.jst.jsf.common.ui.internal.utils.JSFSharedImages;
-import org.eclipse.jst.jsf.core.jsfappconfig.JSFAppConfigUtils;
+import org.eclipse.jst.jsf.core.JSFVersion;
import org.eclipse.jst.jsf.designtime.internal.view.model.ITagRegistry;
import org.eclipse.jst.jsf.ui.internal.JSFUITraceOptions;
import org.eclipse.jst.jsf.ui.internal.tagregistry.ProjectTracker.ProjectAdvisor;
@@ -75,7 +75,7 @@ public class TagRegistryMasterForm extends AbstractMasterForm
{
private static final String REFRESH_NAV_IMAGE_FILE = "refresh_nav_16.gif"; //$NON-NLS-1$
- private TreeViewer _registryTreeViewer;
+ private TreeViewer _registryTreeViewer;
// private Action _selectProjectAction;
private Action _refreshAction;
@@ -94,7 +94,8 @@ public class TagRegistryMasterForm extends AbstractMasterForm
@Override
public boolean shouldTrack(final IProject project)
{
- return JSFAppConfigUtils.isValidJSFProject(project);
+ JSFVersion guessJSFVersion = JSFVersion.guessJSFVersion(project);
+ return guessJSFVersion != null;
}
};
@@ -420,7 +421,7 @@ public class TagRegistryMasterForm extends AbstractMasterForm
{
private static final String CONFIGS_IMAGE_FILE = "configs.gif"; //$NON-NLS-1$
- @Override
+ @Override
public String getText(final Object obj)
{
if (obj instanceof TagRegistryInstance)

Back to the top