Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcbateman2013-03-13 06:42:51 +0000
committercbateman2013-03-13 06:42:51 +0000
commite43a6c5b934150f661eb3c2f5dfadf0b6d852727 (patch)
tree8e1723e7421d2aef340e4a6ff9e38ad9d8c4fcd9 /jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org
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
Diffstat (limited to 'jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org')
-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
14 files changed, 234 insertions, 95 deletions
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);
}

Back to the top