Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNitin Dahyabhai2013-01-29 20:22:17 +0000
committerNitin Dahyabhai2013-01-29 20:24:33 +0000
commit05551a5686200b7320de96608601370a3603eabc (patch)
tree0e7173fe5d1f79082734eb443ecef74cd33ea48d /bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal
parentb8d5142d3bd1fd6616d4ebb419507ea10442fb97 (diff)
downloadwebtools.sourceediting-05551a5686200b7320de96608601370a3603eabc.tar.gz
webtools.sourceediting-05551a5686200b7320de96608601370a3603eabc.tar.xz
webtools.sourceediting-05551a5686200b7320de96608601370a3603eabc.zip
[399337] Support tag libraries from Web Fragment projectsv201201292024
Diffstat (limited to 'bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal')
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/wizard/FacetModuleCoreSupport.java5
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/wizard/FacetModuleCoreSupportDelegate.java62
2 files changed, 54 insertions, 13 deletions
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/wizard/FacetModuleCoreSupport.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/wizard/FacetModuleCoreSupport.java
index db540b8a7d..cbe87982d0 100644
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/wizard/FacetModuleCoreSupport.java
+++ b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/wizard/FacetModuleCoreSupport.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2012 IBM Corporation and others.
+ * Copyright (c) 2007, 2013 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -12,6 +12,7 @@ package org.eclipse.wst.css.ui.internal.wizard;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
/**
* This class encapsulates any used Module Core and Facets APIs along with
@@ -24,6 +25,8 @@ import org.eclipse.core.runtime.IPath;
*/
final class FacetModuleCoreSupport {
static final boolean _dump_NCDFE = false;
+ static final String META_INF_RESOURCES = "META-INF/resources/"; //$NON-NLS-1$
+ static final IPath META_INF_RESOURCES_PATH = new Path(META_INF_RESOURCES);
/**
* @param project
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/wizard/FacetModuleCoreSupportDelegate.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/wizard/FacetModuleCoreSupportDelegate.java
index 12ff6f2953..9a5b2cff51 100644
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/wizard/FacetModuleCoreSupportDelegate.java
+++ b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/wizard/FacetModuleCoreSupportDelegate.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2012 IBM Corporation and others.
+ * Copyright (c) 2007, 2013 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse License v1.0
* which accompanies this distribution, and is available at
@@ -10,6 +10,9 @@
*******************************************************************************/
package org.eclipse.wst.css.ui.internal.wizard;
+import java.util.ArrayList;
+import java.util.List;
+
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
@@ -19,6 +22,7 @@ import org.eclipse.wst.common.componentcore.ComponentCore;
import org.eclipse.wst.common.componentcore.ModuleCoreNature;
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
+import org.eclipse.wst.common.componentcore.resources.IVirtualReference;
import org.eclipse.wst.common.project.facet.core.IFacetedProject;
import org.eclipse.wst.common.project.facet.core.IProjectFacet;
import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
@@ -41,22 +45,26 @@ final class FacetModuleCoreSupportDelegate {
private final static String JST_WEB_MODULE = "jst.web"; //$NON-NLS-1$
private final static String WST_WEB_MODULE = "wst.web"; //$NON-NLS-1$
+ private final static String JST_WEBFRAGMENT_MODULE = "jst.webfragment"; //$NON-NLS-1$
/**
* @param project
* @return the IPath to the "root" of the web contents
*/
static IPath getWebContentRootPath(IProject project) {
+ if (project == null)
+ return null;
+
if (!ModuleCoreNature.isFlexibleProject(project))
- return project.getFullPath();
+ return null;
IPath path = null;
IVirtualComponent component = ComponentCore.createComponent(project);
- if (component != null && component.exists()) {
+ if (component != null && component.exists() && component.getRootFolder() != null) {
path = component.getRootFolder().getWorkspaceRelativePath();
- }
- else {
- path = project.getFullPath();
+ if (component.getRootFolder().getFolder(FacetModuleCoreSupport.META_INF_RESOURCES_PATH).getUnderlyingFolder().isAccessible()) {
+ path = path.append(FacetModuleCoreSupport.META_INF_RESOURCES_PATH);
+ }
}
return path;
}
@@ -74,10 +82,14 @@ final class FacetModuleCoreSupportDelegate {
IProjectFacet facet = ProjectFacetsManager.getProjectFacet(JST_WEB_MODULE);
is = is || (faceted != null && faceted.hasProjectFacet(facet));
}
- if (ProjectFacetsManager.isProjectFacetDefined(WST_WEB_MODULE)) {
+ if (!is && ProjectFacetsManager.isProjectFacetDefined(WST_WEB_MODULE)) {
IProjectFacet facet = ProjectFacetsManager.getProjectFacet(WST_WEB_MODULE);
is = is || (faceted != null && faceted.hasProjectFacet(facet));
}
+ if (!is && ProjectFacetsManager.isProjectFacetDefined(JST_WEBFRAGMENT_MODULE)) {
+ IProjectFacet facet = ProjectFacetsManager.getProjectFacet(JST_WEBFRAGMENT_MODULE);
+ is = is || (faceted != null && faceted.hasProjectFacet(facet));
+ }
}
catch (CoreException e) {
Logger.logException(e);
@@ -90,19 +102,45 @@ final class FacetModuleCoreSupportDelegate {
return new IPath[]{project.getFullPath()};
}
- IPath[] paths = null;
+ List paths = new ArrayList();
IVirtualFolder componentFolder = ComponentCore.createFolder(project, Path.ROOT);
if (componentFolder != null && componentFolder.exists()) {
IContainer[] workspaceFolders = componentFolder.getUnderlyingFolders();
- paths = new IPath[workspaceFolders.length];
for (int i = 0; i < workspaceFolders.length; i++) {
- paths[i] = workspaceFolders[i].getFullPath();
+ if (workspaceFolders[i].getFolder(FacetModuleCoreSupport.META_INF_RESOURCES_PATH).isAccessible())
+ paths.add(workspaceFolders[i].getFullPath().append(FacetModuleCoreSupport.META_INF_RESOURCES_PATH));
+ else
+ paths.add(workspaceFolders[i].getFullPath());
}
+
+ IVirtualReference[] references = ComponentCore.createComponent(project).getReferences();
+ if (references != null) {
+ for (int i = 0; i < references.length; i++) {
+ IVirtualComponent referencedComponent = references[i].getReferencedComponent();
+ if (referencedComponent == null)
+ continue;
+ IVirtualComponent component = referencedComponent.getComponent();
+ if (component == null)
+ continue;
+ IVirtualFolder rootFolder = component.getRootFolder();
+ if (rootFolder == null)
+ continue;
+ IPath referencedPathRoot = rootFolder.getWorkspaceRelativePath();
+ /*
+ * See Servlet 3.0, section 4.6 ; this is the only
+ * referenced module/component type we support
+ */
+ IPath resources = referencedPathRoot.append(FacetModuleCoreSupport.META_INF_RESOURCES);
+ if (resources != null && component.getProject().findMember(resources.removeFirstSegments(1)) != null)
+ paths.add(resources);
+ }
+ }
+
}
else {
- paths = new IPath[]{project.getFullPath()};
+ paths.add(new IPath[]{project.getFullPath()});
}
- return paths;
+ return (IPath[]) paths.toArray(new IPath[paths.size()]);
}
static IPath getDefaultRoot(IProject project) {

Back to the top