Author: rob.stryker(a)jboss.com
Date: 2009-11-19 12:44:48 -0500 (Thu, 19 Nov 2009)
New Revision: 18753
Added:
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/filesets/vcf/
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/filesets/vcf/FilesetComponentResolver.java
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/filesets/vcf/WorkspaceFilesetVirtualComponent.java
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/ui/FilesetReferenceWizardFragment.java
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.core/src/org/jboss/ide/eclipse/as/wtp/core/util/ResourceFilter.java
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.core/src/org/jboss/ide/eclipse/as/wtp/core/vcf/AbstractFilesetVirtualComponent.java
Removed:
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.core/src/org/jboss/ide/eclipse/as/wtp/core/vcf/FilesetVirtualComponent.java
Modified:
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/DirectoryScannerFactory.java
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/META-INF/MANIFEST.MF
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/plugin.xml
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.core/src/org/jboss/ide/eclipse/as/wtp/core/util/ResourceListVirtualFolder.java
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.core/src/org/jboss/ide/eclipse/as/wtp/core/vcf/ExportedClasspathFoldersVirtualComponent.java
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.core/src/org/jboss/ide/eclipse/as/wtp/core/vcf/OutputFoldersVirtualComponent.java
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/META-INF/MANIFEST.MF
Log:
JBIDE-4955 - adding fileset capability for workspace filesets
Modified:
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/DirectoryScannerFactory.java
===================================================================
---
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/DirectoryScannerFactory.java 2009-11-19
17:21:15 UTC (rev 18752)
+++
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/DirectoryScannerFactory.java 2009-11-19
17:44:48 UTC (rev 18753)
@@ -235,9 +235,9 @@
}
}
- public boolean couldBeIncluded(String name, boolean inWorkspace) {
+ public boolean couldBeIncluded(String path, boolean inWorkspace) {
IPath targetBase = ((FileWrapper)getBasedir()).getWrapperPath();
- IPath[] questionFiles = new IPath[] { new Path(name) };
+ IPath[] questionFiles = new IPath[] { new Path(path) };
if( workspaceRelative && !inWorkspace) {
questionFiles =
ArchivesCore.getInstance().getVFS().absolutePathToWorkspacePath(questionFiles[0]);
} else if( !workspaceRelative && inWorkspace) {
Modified: trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/META-INF/MANIFEST.MF
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/META-INF/MANIFEST.MF 2009-11-19
17:21:15 UTC (rev 18752)
+++
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/META-INF/MANIFEST.MF 2009-11-19
17:44:48 UTC (rev 18753)
@@ -21,7 +21,11 @@
org.eclipse.core.filesystem;bundle-version="1.2.0",
org.eclipse.ui.navigator;bundle-version="3.3.100",
org.jboss.tools.jmx.core;bundle-version="0.2.1",
- org.eclipse.core.variables;bundle-version="3.2.200"
+ org.eclipse.core.variables;bundle-version="3.2.200",
+ org.jboss.ide.eclipse.as.wtp.core;bundle-version="1.0.0",
+ org.jboss.ide.eclipse.as.wtp.ui;bundle-version="1.0.0",
+ org.eclipse.emf.common;bundle-version="2.5.0",
+ org.eclipse.emf.ecore;bundle-version="2.5.0"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Export-Package: org.jboss.ide.eclipse.archives.webtools,
Modified: trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/plugin.xml
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/plugin.xml 2009-11-19
17:21:15 UTC (rev 18752)
+++ trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/plugin.xml 2009-11-19
17:44:48 UTC (rev 18753)
@@ -172,4 +172,21 @@
</page>
</extension>
+ <!-- Fileset integration for WTP Projects -->
+ <extension
+ point="org.jboss.ide.eclipse.as.wtp.core.referenceResolver">
+ <resolver
+
class="org.jboss.ide.eclipse.archives.webtools.filesets.vcf.FilesetComponentResolver"
+
id="org.jboss.ide.eclipse.archives.webtools.filesets.vcf.FilesetComponentResolver">
+ </resolver>
+ </extension>
+ <extension
+ point="org.jboss.ide.eclipse.as.wtp.ui.referenceWizardFragment">
+ <referenceFragment
+
class="org.jboss.ide.eclipse.archives.webtools.ui.FilesetReferenceWizardFragment"
+ icon="icons/multiple_files.gif"
+
id="org.jboss.ide.eclipse.archives.webtools.FilesetReferenceWizardFragment"
+ name="Fileset">
+ </referenceFragment>
+ </extension>
</plugin>
Added:
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/filesets/vcf/FilesetComponentResolver.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/filesets/vcf/FilesetComponentResolver.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/filesets/vcf/FilesetComponentResolver.java 2009-11-19
17:44:48 UTC (rev 18753)
@@ -0,0 +1,97 @@
+package org.jboss.ide.eclipse.archives.webtools.filesets.vcf;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.net.URLEncoder;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.internal.ComponentcorePackage;
+import org.eclipse.wst.common.componentcore.internal.DependencyType;
+import org.eclipse.wst.common.componentcore.internal.ReferencedComponent;
+import org.eclipse.wst.common.componentcore.internal.impl.PlatformURLModuleConnection;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualReference;
+import org.jboss.ide.eclipse.as.wtp.core.vcf.IReferenceResolver;
+import org.jboss.ide.eclipse.as.wtp.core.vcf.OutputFoldersVirtualComponent;
+
+public class FilesetComponentResolver implements IReferenceResolver {
+ public static final String FILESET_SEGMENT =
"org.jboss.ide.eclipse.archives.webtools.filesets.vcf.FilesetComponentResolver";
//$NON-NLS-1$
+ public static final String FILESET_PROTOCOL =
PlatformURLModuleConnection.MODULE_PROTOCOL
+ +IPath.SEPARATOR+ FILESET_SEGMENT + IPath.SEPARATOR;
+ public boolean canResolve(IVirtualComponent context,
+ ReferencedComponent referencedComponent) {
+ URI handle = referencedComponent.getHandle();
+ String s = handle.toString();
+ if(s.startsWith(FILESET_PROTOCOL))
+ return true;
+ return false;
+ }
+
+ public boolean canResolve(IVirtualReference reference) {
+ IVirtualComponent vc = reference.getReferencedComponent();
+ if( vc instanceof WorkspaceFilesetVirtualComponent)
+ return true;
+ return false;
+ }
+
+ public IVirtualReference resolve(IVirtualComponent context,
+ ReferencedComponent referencedComponent) {
+ IProject p = context.getProject();
+ URI uri = referencedComponent.getHandle();
+ String main = uri.segment(1);
+ String[] split = main.split("&"); //$NON-NLS-1$
+ String path, includes, excludes;
+ path = includes = excludes = null;
+ try {
+ for( int i = 0; i < split.length; i++ ) {
+ boolean hasEquals = split[i].contains("="); //$NON-NLS-1$
+ String pre = split[i].substring(0, split[i].indexOf("=")); //$NON-NLS-1$
+ String post = split[i].substring(split[i].indexOf("=") + 1); //$NON-NLS-1$
+ post = URLDecoder.decode(post, "UTF-8"); //$NON-NLS-1$
+ if( "path".equals(pre)) //$NON-NLS-1$
+ path = post;
+ else if( "includes".equals(pre)) //$NON-NLS-1$
+ includes = post;
+ else if( "excludes".equals(pre)) //$NON-NLS-1$
+ excludes = post;
+ }
+ } catch( UnsupportedEncodingException uee) {}
+ WorkspaceFilesetVirtualComponent comp = new WorkspaceFilesetVirtualComponent(p,
context, path);
+ comp.setIncludes(includes);
+ comp.setExcludes(excludes);
+ IVirtualReference ref = ComponentCore.createReference(context, comp);
+ ref.setArchiveName(referencedComponent.getArchiveName());
+ ref.setRuntimePath(referencedComponent.getRuntimePath());
+ ref.setDependencyType(referencedComponent.getDependencyType().getValue());
+ return ref;
+ }
+
+ public ReferencedComponent resolve(IVirtualReference reference) {
+ IVirtualComponent vc = reference.getReferencedComponent();
+ WorkspaceFilesetVirtualComponent fsvc = (WorkspaceFilesetVirtualComponent)vc;
+ String path = fsvc.getRootFolderPath();
+ String includes = fsvc.getIncludes();
+ String excludes = fsvc.getExcludes();
+ try {
+ String url = "path=" + URLEncoder.encode(path, "UTF-8");
//$NON-NLS-1$//$NON-NLS-2$
+ url += "&includes=" + URLEncoder.encode(includes, "UTF-8");
//$NON-NLS-1$ //$NON-NLS-2$
+ url += "&excludes=" + URLEncoder.encode(excludes, "UTF-8");
//$NON-NLS-1$ //$NON-NLS-2$
+
+ ReferencedComponent rc =
ComponentcorePackage.eINSTANCE.getComponentcoreFactory().createReferencedComponent();
+ rc.setArchiveName(reference.getArchiveName());
+ rc.setRuntimePath(reference.getRuntimePath());
+ String tmp = fsvc.getId();
+ rc.setHandle(URI.createURI(fsvc.getId() + url));
+ rc.setDependencyType(DependencyType.CONSUMES_LITERAL);
+ return rc;
+
+ } catch( UnsupportedEncodingException uee) {}
+ int x = 5;
+ return null;
+ }
+
+}
Added:
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/filesets/vcf/WorkspaceFilesetVirtualComponent.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/filesets/vcf/WorkspaceFilesetVirtualComponent.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/filesets/vcf/WorkspaceFilesetVirtualComponent.java 2009-11-19
17:44:48 UTC (rev 18753)
@@ -0,0 +1,97 @@
+package org.jboss.ide.eclipse.archives.webtools.filesets.vcf;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
+import org.jboss.ide.eclipse.archives.core.model.DirectoryScannerFactory;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveModelRootNode;
+import
org.jboss.ide.eclipse.archives.core.model.DirectoryScannerFactory.DirectoryScannerExtension;
+import org.jboss.ide.eclipse.as.wtp.core.util.ResourceFilter;
+import org.jboss.ide.eclipse.as.wtp.core.util.ResourceListVirtualFolder;
+import org.jboss.ide.eclipse.as.wtp.core.vcf.AbstractFilesetVirtualComponent;
+
+public class WorkspaceFilesetVirtualComponent extends AbstractFilesetVirtualComponent {
+ private String rootFolderPath, includes, excludes;
+ public WorkspaceFilesetVirtualComponent(IProject p,
+ IVirtualComponent referencingComponent, String rootPath) {
+ super(p, referencingComponent);
+ this.rootFolderPath = rootPath;
+ includes = "**"; //$NON-NLS-1$
+ excludes = ""; //$NON-NLS-1$
+ }
+
+ protected String getFirstIdSegment() {
+ return FilesetComponentResolver.FILESET_PROTOCOL;
+ }
+
+ @Override
+ public String getId() {
+ return getFirstIdSegment();
+ }
+
+ public IVirtualFolder getRootFolder() {
+ ResourceListVirtualFolder folder = (ResourceListVirtualFolder)super.getRootFolder();
+ folder.setFilter(new WorkspaceFilter());
+ return folder;
+ }
+
+
+ protected IResource[] getLooseResources() {
+ return new IResource[]{};
+ }
+
+ protected IContainer[] getUnderlyingContainers() {
+ if( rootFolderPath != null ) {
+ IPath p = new Path(rootFolderPath);
+ IContainer c = p.segmentCount() > 1 ?
+ ResourcesPlugin.getWorkspace().getRoot().getFolder(p)
+ : ResourcesPlugin.getWorkspace().getRoot().getProject(p.segment(0));
+ return new IContainer[] { c };
+ }
+ return new IContainer[] { };
+ }
+
+ public void setRootFolderPath(String rootFolder) {
+ this.rootFolderPath = rootFolder;
+ }
+
+ public String getRootFolderPath() {
+ return rootFolderPath;
+ }
+
+ public void setIncludes(String includes) {
+ this.includes = includes;
+ }
+
+ public String getIncludes() {
+ return includes;
+ }
+
+ public void setExcludes(String excludes) {
+ this.excludes = excludes;
+ }
+
+ public String getExcludes() {
+ return excludes;
+ }
+
+ public class WorkspaceFilter implements ResourceFilter {
+ private DirectoryScannerExtension scanner;
+ public WorkspaceFilter() {
+ scanner = DirectoryScannerFactory.createDirectoryScanner(
+ rootFolderPath, new Path(""), //$NON-NLS-1$
+ includes, excludes, getProject().getName(), true,
+ IArchiveModelRootNode.DESCRIPTOR_VERSION_1_3, false);
+ }
+ public boolean accepts(IResource resource) {
+ boolean b = scanner.couldBeIncluded(resource.getFullPath().toString(), true);
+ return b;
+ }
+ }
+
+}
Added:
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/ui/FilesetReferenceWizardFragment.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/ui/FilesetReferenceWizardFragment.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/ui/FilesetReferenceWizardFragment.java 2009-11-19
17:44:48 UTC (rev 18753)
@@ -0,0 +1,146 @@
+package org.jboss.ide.eclipse.archives.webtools.ui;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.dialogs.ContainerSelectionDialog;
+import org.eclipse.wst.common.componentcore.internal.DependencyType;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.server.ui.wizard.IWizardHandle;
+import org.eclipse.wst.server.ui.wizard.WizardFragment;
+import
org.jboss.ide.eclipse.archives.webtools.filesets.vcf.WorkspaceFilesetVirtualComponent;
+import org.jboss.ide.eclipse.as.wtp.ui.propertypage.NewReferenceWizard;
+
+public class FilesetReferenceWizardFragment extends WizardFragment {
+ public boolean hasComposite() {
+ return true;
+ }
+
+ private boolean hasEntered = false;
+ public boolean isComplete() {
+ return hasEntered;
+ }
+
+ private Text incText, excText, rootText;
+ private String includes, excludes, folder;
+ public Composite createComposite(Composite parent, IWizardHandle handle) {
+ hasEntered = true;
+ handle.setTitle("Add a fileset"); //$NON-NLS-1$
+ handle.setDescription("This will let you select a root folder and some matching
patterns"); //$NON-NLS-1$
+
+ Composite child = new Composite(parent, SWT.NONE);
+
+ // root folder, text, browse
+ child.setLayout(new FormLayout());
+ Control top = null;
+ addLabel("Root Folder", child, top); //$NON-NLS-1$
+ top = rootText = addText(child, top, true);
+ addLabel("Includes", child, top); //$NON-NLS-1$
+ top = incText = addText(child, top, false);
+ addLabel("Excludes", child, top); //$NON-NLS-1$
+ top = excText = addText(child, top, false);
+ ModifyListener listener = new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ textModified();
+ }
+ };
+ IProject p = (IProject)getTaskModel().getObject(NewReferenceWizard.PROJECT);
+ rootText.setText(p.getFullPath().toString());
+ incText.setText("**"); //$NON-NLS-1$
+ rootText.addModifyListener(listener);
+ incText.addModifyListener(listener);
+ excText.addModifyListener(listener);
+ textModified();
+ return child;
+ }
+
+ protected void textModified() {
+ includes = incText.getText();
+ excludes = excText.getText();
+ folder = rootText.getText();
+ }
+
+ protected Text addText(Composite parent, Control top, boolean includeBrowse) {
+ Text t = new Text(parent, SWT.BORDER);
+ Button b = null;
+ if( includeBrowse ) {
+ b = new Button(parent, SWT.NONE);
+ b.setText("Browse..."); //$NON-NLS-1$
+ addBrowseListener(b,t);
+ FormData bData = new FormData();
+ bData.right = new FormAttachment(100,-5);
+ bData.top = top == null ? new FormAttachment(0, 5) : new FormAttachment(top, 5);
+ b.setLayoutData(bData);
+ }
+ FormData fd = new FormData();
+ fd.top = top == null ? new FormAttachment(0,5) : new FormAttachment(top, 5);
+ fd.left = new FormAttachment(25, 0);
+ fd.right = b == null ? new FormAttachment(100, -5) : new FormAttachment(b, -5);
+ t.setLayoutData(fd);
+ return t;
+ }
+
+ protected void addBrowseListener(final Button b, final Text t) {
+ b.addSelectionListener(new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ browsePressed(b, t);
+ }
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ });
+ }
+ protected void browsePressed(Button b, Text t) {
+ // show the dialog, then set the proper text
+ ContainerSelectionDialog d = new ContainerSelectionDialog(b.getShell(), null,
+ false, "Please select a root folder"); //$NON-NLS-1$
+ if(d.open() == Dialog.OK) {
+ Object[] o = d.getResult();
+ if( o != null && o.length > 0) {
+ IPath path = (IPath)o[0];
+ t.setText(path.toString());
+ }
+ }
+ }
+
+ protected Label addLabel(String text, Composite parent, Control top) {
+ Label l = new Label(parent, SWT.NONE);
+ l.setText(text);
+ FormData fd = new FormData();
+ fd.left = new FormAttachment(0, 5);
+ fd.top = top == null ? new FormAttachment(0,5) : new FormAttachment(top, 5);
+ l.setLayoutData(fd);
+ return l;
+ }
+
+ public void performFinish(IProgressMonitor monitor) throws CoreException {
+ getTaskModel().putObject(NewReferenceWizard.COMPONENT, getFilesetComponent());
+ getTaskModel().putObject(NewReferenceWizard.COMPONENT_PATH, "/");
//$NON-NLS-1$
+ getTaskModel().putObject(NewReferenceWizard.DEPENDENCY_TYPE,
DependencyType.CONSUMES_LITERAL);
+ }
+
+ protected IVirtualComponent getFilesetComponent() {
+ IVirtualComponent root =
(IVirtualComponent)getTaskModel().getObject(NewReferenceWizard.ROOT_COMPONENT);
+ WorkspaceFilesetVirtualComponent vc = new WorkspaceFilesetVirtualComponent(
+ root.getProject(), root, new Path(folder).makeAbsolute().toString());
+ vc.setIncludes(includes);
+ vc.setExcludes(excludes);
+ return vc;
+ }
+
+}
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.core/src/org/jboss/ide/eclipse/as/wtp/core/util/ResourceFilter.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.core/src/org/jboss/ide/eclipse/as/wtp/core/util/ResourceFilter.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.core/src/org/jboss/ide/eclipse/as/wtp/core/util/ResourceFilter.java 2009-11-19
17:44:48 UTC (rev 18753)
@@ -0,0 +1,7 @@
+package org.jboss.ide.eclipse.as.wtp.core.util;
+
+import org.eclipse.core.resources.IResource;
+
+public interface ResourceFilter {
+ public boolean accepts(IResource resource);
+}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.core/src/org/jboss/ide/eclipse/as/wtp/core/util/ResourceListVirtualFolder.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.core/src/org/jboss/ide/eclipse/as/wtp/core/util/ResourceListVirtualFolder.java 2009-11-19
17:21:15 UTC (rev 18752)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.core/src/org/jboss/ide/eclipse/as/wtp/core/util/ResourceListVirtualFolder.java 2009-11-19
17:44:48 UTC (rev 18753)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.ide.eclipse.as.wtp.core.util;
+import java.io.FileFilter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@@ -30,6 +31,7 @@
private ArrayList<IResource> children;
private ArrayList<IContainer> underlying;
+ private ResourceFilter filter;
public ResourceListVirtualFolder(
IProject aComponentProject,
IPath aRuntimePath) {
@@ -53,6 +55,10 @@
addChildren(looseResources);
}
+ public void setFilter(ResourceFilter filter) {
+ this.filter = filter;
+ }
+
protected void addUnderlyingResource(IResource resource) {
if( resource instanceof IContainer ) {
underlying.add((IContainer)resource);
@@ -97,7 +103,6 @@
public IContainer[] getUnderlyingFolders() {
return (IContainer[]) underlying.toArray(new IContainer[underlying.size()]);
}
-
public IVirtualResource[] members(int memberFlags) throws CoreException {
HashMap<String, IVirtualResource> virtualResources = new HashMap<String,
IVirtualResource>(); // result
@@ -110,6 +115,9 @@
}
protected void handleResource(IResource resource, HashMap<String,
IVirtualResource> map, int memberFlags) throws CoreException {
+ if( filter != null && !filter.accepts(resource))
+ return;
+
if( resource instanceof IFile ) {
if( !map.containsKey(resource.getName()) ) {
IVirtualFile virtFile = new VirtualFile(getProject(),
@@ -128,6 +136,8 @@
ResourceListVirtualFolder childFolder =
new ResourceListVirtualFolder(getProject(),
getRuntimePath().append(resource.getName()));
childFolder.addUnderlyingResource(realContainer);
+ if( filter != null )
+ childFolder.setFilter(filter);
map.put(resource.getName(), childFolder);
}
} // end container
Copied:
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.core/src/org/jboss/ide/eclipse/as/wtp/core/vcf/AbstractFilesetVirtualComponent.java
(from rev 18393,
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.core/src/org/jboss/ide/eclipse/as/wtp/core/vcf/FilesetVirtualComponent.java)
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.core/src/org/jboss/ide/eclipse/as/wtp/core/vcf/AbstractFilesetVirtualComponent.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.core/src/org/jboss/ide/eclipse/as/wtp/core/vcf/AbstractFilesetVirtualComponent.java 2009-11-19
17:44:48 UTC (rev 18753)
@@ -0,0 +1,135 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.wtp.core.vcf;
+
+import java.util.Properties;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+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.jboss.ide.eclipse.as.wtp.core.util.ResourceListVirtualFolder;
+
+public abstract class AbstractFilesetVirtualComponent implements IVirtualComponent {
+ protected IProject project;
+ protected IVirtualComponent referencingComp;
+
+ public AbstractFilesetVirtualComponent(IProject p, IVirtualComponent
referencingComponent) {
+ this.project = p;
+ this.referencingComp = referencingComponent;
+ }
+
+ public void create(int updateFlags, IProgressMonitor aMonitor)
+ throws CoreException {
+ // Ignore
+ }
+
+ public boolean exists() {
+ return true;
+ }
+
+ public IVirtualComponent getComponent() {
+ return this;
+ }
+
+ public String getName() {
+ return getId();
+ }
+
+ public String getDeployedName() {
+ return getName();
+ }
+
+ public String getId() {
+ String firstSegment = getFirstIdSegment();
+ if (project != null && project.equals(
+ referencingComp.getProject()))
+ return firstSegment;
+ return firstSegment + Path.SEPARATOR + project.getName();
+ }
+
+ protected abstract String getFirstIdSegment();
+
+ public IProject getProject() {
+ return project;
+ }
+
+ public IVirtualComponent[] getReferencingComponents() {
+ return referencingComp == null ? new IVirtualComponent[] {}
+ : new IVirtualComponent[] { referencingComp };
+ }
+
+ public IVirtualFolder getRootFolder() {
+ // Creates a new instance each time to ensure it's not cached
+ IContainer[] containers = getUnderlyingContainers();
+ IResource[] looseResources = getLooseResources();
+ ResourceListVirtualFolder folder =
+ new ResourceListVirtualFolder(project, new Path("/"), containers,
looseResources);
+ return folder;
+ }
+
+ protected abstract IContainer[] getUnderlyingContainers();
+ protected abstract IResource[] getLooseResources();
+
+ public Properties getMetaProperties() {
+ return null;
+ }
+
+ public IPath[] getMetaResources() {
+ return null;
+ }
+
+ public IVirtualReference getReference(String aComponentName) {
+ // Ignore
+ return null;
+ }
+
+ public IVirtualReference[] getReferences() {
+ // Ignore; no children
+ return new IVirtualReference[] {};
+ }
+
+ public boolean isBinary() {
+ return false;
+ }
+
+ public void setMetaProperties(Properties properties) {
+ // Ignore
+ }
+
+ public void setMetaProperty(String name, String value) {
+ // Ignore
+ }
+
+ public void setMetaResources(IPath[] theMetaResourcePaths) {
+ // Ignore
+ }
+
+ public void setReferences(IVirtualReference[] theReferences) {
+ // Ignore
+ }
+
+ public Object getAdapter(Class adapter) {
+ // Ignore
+ return null;
+ }
+
+ public void addReferences(IVirtualReference[] references) {
+ // Ignore
+ }
+
+}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.core/src/org/jboss/ide/eclipse/as/wtp/core/vcf/ExportedClasspathFoldersVirtualComponent.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.core/src/org/jboss/ide/eclipse/as/wtp/core/vcf/ExportedClasspathFoldersVirtualComponent.java 2009-11-19
17:21:15 UTC (rev 18752)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.core/src/org/jboss/ide/eclipse/as/wtp/core/vcf/ExportedClasspathFoldersVirtualComponent.java 2009-11-19
17:44:48 UTC (rev 18753)
@@ -25,7 +25,7 @@
import org.eclipse.jst.j2ee.classpathdep.ClasspathDependencyUtil;
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-public class ExportedClasspathFoldersVirtualComponent extends FilesetVirtualComponent {
+public class ExportedClasspathFoldersVirtualComponent extends
AbstractFilesetVirtualComponent {
public ExportedClasspathFoldersVirtualComponent(IProject p, IVirtualComponent
referencingComponent) {
super(p,referencingComponent);
}
Deleted:
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.core/src/org/jboss/ide/eclipse/as/wtp/core/vcf/FilesetVirtualComponent.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.core/src/org/jboss/ide/eclipse/as/wtp/core/vcf/FilesetVirtualComponent.java 2009-11-19
17:21:15 UTC (rev 18752)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.core/src/org/jboss/ide/eclipse/as/wtp/core/vcf/FilesetVirtualComponent.java 2009-11-19
17:44:48 UTC (rev 18753)
@@ -1,134 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.ide.eclipse.as.wtp.core.vcf;
-
-import java.util.Properties;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Path;
-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.jboss.ide.eclipse.as.wtp.core.util.ResourceListVirtualFolder;
-
-public abstract class FilesetVirtualComponent implements IVirtualComponent {
- protected IProject project;
- protected IVirtualComponent referencingComp;
-
- public FilesetVirtualComponent(IProject p, IVirtualComponent referencingComponent) {
- this.project = p;
- this.referencingComp = referencingComponent;
- }
-
- public void create(int updateFlags, IProgressMonitor aMonitor)
- throws CoreException {
- // Ignore
- }
-
- public boolean exists() {
- return true;
- }
-
- public IVirtualComponent getComponent() {
- return this;
- }
-
- public String getName() {
- return getId();
- }
-
- public String getDeployedName() {
- return getName();
- }
-
- protected String getId() {
- String firstSegment = getFirstIdSegment();
- if (project.equals(referencingComp.getProject()))
- return firstSegment;
- return firstSegment + Path.SEPARATOR + project.getName();
- }
-
- protected abstract String getFirstIdSegment();
-
- public IProject getProject() {
- return project;
- }
-
- public IVirtualComponent[] getReferencingComponents() {
- return referencingComp == null ? new IVirtualComponent[] {}
- : new IVirtualComponent[] { referencingComp };
- }
-
- public IVirtualFolder getRootFolder() {
- // Creates a new instance each time to ensure it's not cached
- IContainer[] containers = getUnderlyingContainers();
- IResource[] looseResources = getLooseResources();
- ResourceListVirtualFolder folder =
- new ResourceListVirtualFolder(project, new Path("/"), containers,
looseResources);
- return folder;
- }
-
- protected abstract IContainer[] getUnderlyingContainers();
- protected abstract IResource[] getLooseResources();
-
- public Properties getMetaProperties() {
- return null;
- }
-
- public IPath[] getMetaResources() {
- return null;
- }
-
- public IVirtualReference getReference(String aComponentName) {
- // Ignore
- return null;
- }
-
- public IVirtualReference[] getReferences() {
- // Ignore; no children
- return new IVirtualReference[] {};
- }
-
- public boolean isBinary() {
- return false;
- }
-
- public void setMetaProperties(Properties properties) {
- // Ignore
- }
-
- public void setMetaProperty(String name, String value) {
- // Ignore
- }
-
- public void setMetaResources(IPath[] theMetaResourcePaths) {
- // Ignore
- }
-
- public void setReferences(IVirtualReference[] theReferences) {
- // Ignore
- }
-
- public Object getAdapter(Class adapter) {
- // Ignore
- return null;
- }
-
- public void addReferences(IVirtualReference[] references) {
- // Ignore
- }
-
-}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.core/src/org/jboss/ide/eclipse/as/wtp/core/vcf/OutputFoldersVirtualComponent.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.core/src/org/jboss/ide/eclipse/as/wtp/core/vcf/OutputFoldersVirtualComponent.java 2009-11-19
17:21:15 UTC (rev 18752)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.core/src/org/jboss/ide/eclipse/as/wtp/core/vcf/OutputFoldersVirtualComponent.java 2009-11-19
17:44:48 UTC (rev 18753)
@@ -23,7 +23,7 @@
import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-public class OutputFoldersVirtualComponent extends FilesetVirtualComponent {
+public class OutputFoldersVirtualComponent extends AbstractFilesetVirtualComponent {
public OutputFoldersVirtualComponent(IProject p, IVirtualComponent referencingComponent)
{
super(p, referencingComponent);
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/META-INF/MANIFEST.MF 2009-11-19
17:21:15 UTC (rev 18752)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/META-INF/MANIFEST.MF 2009-11-19
17:44:48 UTC (rev 18753)
@@ -29,3 +29,4 @@
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-Vendor: JBoss by Red Hat
+Export-Package: org.jboss.ide.eclipse.as.wtp.ui.propertypage