Author: rob.stryker(a)jboss.com
Date: 2009-12-17 13:30:12 -0500 (Thu, 17 Dec 2009)
New Revision: 19441
Added:
branches/jbosstools-3.1.0.RC1/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/SharedImages.java
branches/jbosstools-3.1.0.RC1/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/filesets/vcf/FilesetVCLabelProvider.java
Modified:
branches/jbosstools-3.1.0.RC1/as/plugins/org.jboss.ide.eclipse.archives.webtools/plugin.xml
branches/jbosstools-3.1.0.RC1/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/IntegrationPlugin.java
branches/jbosstools-3.1.0.RC1/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/ui/FilesetReferenceWizardFragment.java
Log:
Beautify filesets in module assembly page
Modified:
branches/jbosstools-3.1.0.RC1/as/plugins/org.jboss.ide.eclipse.archives.webtools/plugin.xml
===================================================================
---
branches/jbosstools-3.1.0.RC1/as/plugins/org.jboss.ide.eclipse.archives.webtools/plugin.xml 2009-12-17
18:25:16 UTC (rev 19440)
+++
branches/jbosstools-3.1.0.RC1/as/plugins/org.jboss.ide.eclipse.archives.webtools/plugin.xml 2009-12-17
18:30:12 UTC (rev 19441)
@@ -184,9 +184,16 @@
point="org.jboss.ide.eclipse.as.wtp.ui.referenceWizardFragment">
<referenceFragment
class="org.jboss.ide.eclipse.archives.webtools.ui.FilesetReferenceWizardFragment"
- icon="icons/multiple_files.gif"
+ icon="$nl$/icons/multiple_files.gif"
id="org.jboss.ide.eclipse.archives.webtools.FilesetReferenceWizardFragment"
name="Fileset">
</referenceFragment>
</extension>
+ <extension
+
point="org.jboss.ide.eclipse.as.wtp.ui.virtualComponentLabelProvider">
+ <provider
+
class="org.jboss.ide.eclipse.archives.webtools.filesets.vcf.FilesetVCLabelProvider"
+ weight="5">
+ </provider>
+ </extension>
</plugin>
Modified:
branches/jbosstools-3.1.0.RC1/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/IntegrationPlugin.java
===================================================================
---
branches/jbosstools-3.1.0.RC1/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/IntegrationPlugin.java 2009-12-17
18:25:16 UTC (rev 19440)
+++
branches/jbosstools-3.1.0.RC1/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/IntegrationPlugin.java 2009-12-17
18:30:12 UTC (rev 19441)
@@ -49,8 +49,9 @@
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext context) throws Exception {
+ SharedImages.instance().cleanup();
+ UnitedServerListenerManager.getDefault().removeListener(NewServerFilesetHandler.getDefault());
plugin = null;
- UnitedServerListenerManager.getDefault().removeListener(NewServerFilesetHandler.getDefault());
super.stop(context);
}
Added:
branches/jbosstools-3.1.0.RC1/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/SharedImages.java
===================================================================
---
branches/jbosstools-3.1.0.RC1/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/SharedImages.java
(rev 0)
+++
branches/jbosstools-3.1.0.RC1/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/SharedImages.java 2009-12-17
18:30:12 UTC (rev 19441)
@@ -0,0 +1,72 @@
+package org.jboss.ide.eclipse.archives.webtools;
+
+import java.util.Hashtable;
+import java.util.Iterator;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.graphics.Image;
+import org.osgi.framework.Bundle;
+
+public class SharedImages {
+ private static SharedImages instance;
+ public static final String FILESET_IMAGE = "multiple_files"; //$NON-NLS-1$
+
+ private Hashtable<String, Object> images, descriptors;
+
+ private SharedImages () {
+ instance = this;
+ images = new Hashtable<String, Object>();
+ descriptors = new Hashtable<String, Object>();
+ Bundle pluginBundle = IntegrationPlugin.getDefault().getBundle();
+
+ descriptors.put(FILESET_IMAGE, createImageDescriptor(pluginBundle,
"/icons/multiple_files.gif")); //$NON-NLS-1$
+ Iterator<String> iter = descriptors.keySet().iterator();
+ while (iter.hasNext()) {
+ String key = iter.next();
+ ImageDescriptor descriptor = descriptor(key);
+ images.put(key, descriptor.createImage());
+ }
+ }
+
+ private ImageDescriptor createImageDescriptor (Bundle pluginBundle, String relativePath)
{
+ return ImageDescriptor.createFromURL(pluginBundle.getEntry(relativePath));
+ }
+
+ public static SharedImages instance() {
+ if (instance == null)
+ instance = new SharedImages();
+ return instance;
+ }
+
+ public static Image getImage(String key) {
+ return instance().image(key);
+ }
+
+ public static ImageDescriptor getImageDescriptor(String key) {
+ return instance().descriptor(key);
+ }
+
+ public Image image(String key) {
+ return (Image) images.get(key);
+ }
+
+ public ImageDescriptor descriptor(String key) {
+ return (ImageDescriptor) descriptors.get(key);
+ }
+
+ public void cleanup() {
+ Iterator<String> iter = images.keySet().iterator();
+ while (iter.hasNext()) {
+ Image image = (Image) images.get(iter.next());
+ image.dispose();
+ }
+ images = null;
+ instance = null;
+ }
+
+ protected void finalize() throws Throwable {
+ cleanup();
+ super.finalize();
+ }
+
+}
Added:
branches/jbosstools-3.1.0.RC1/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/filesets/vcf/FilesetVCLabelProvider.java
===================================================================
---
branches/jbosstools-3.1.0.RC1/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/filesets/vcf/FilesetVCLabelProvider.java
(rev 0)
+++
branches/jbosstools-3.1.0.RC1/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/filesets/vcf/FilesetVCLabelProvider.java 2009-12-17
18:30:12 UTC (rev 19441)
@@ -0,0 +1,31 @@
+package org.jboss.ide.eclipse.archives.webtools.filesets.vcf;
+
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.jboss.ide.eclipse.archives.webtools.SharedImages;
+import org.jboss.ide.eclipse.as.wtp.ui.propertypage.IVirtualComponentLabelProvider;
+
+public class FilesetVCLabelProvider implements IVirtualComponentLabelProvider {
+
+ public FilesetVCLabelProvider() {
+ }
+
+ public boolean canHandle(IVirtualComponent component) {
+ return component instanceof WorkspaceFilesetVirtualComponent;
+ }
+
+ public Image getSourceImage(IVirtualComponent component) {
+ return SharedImages.getImage(SharedImages.FILESET_IMAGE);
+ }
+
+ public String getSourceText(IVirtualComponent component) {
+ WorkspaceFilesetVirtualComponent fileset =
(WorkspaceFilesetVirtualComponent)component;
+ String base = fileset.getRootFolderPath();
+ if( fileset.getIncludes() != null &&
!fileset.getIncludes().equals("")) //$NON-NLS-1$
+ base += " [" + fileset.getIncludes() + "]"; //$NON-NLS-1$
//$NON-NLS-2$
+ if( fileset.getExcludes() != null &&
!fileset.getExcludes().equals("")) //$NON-NLS-1$
+ base += " [" + fileset.getExcludes() + "]"; //$NON-NLS-1$
//$NON-NLS-2$
+ return base;
+ }
+
+}
Modified:
branches/jbosstools-3.1.0.RC1/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/ui/FilesetReferenceWizardFragment.java
===================================================================
---
branches/jbosstools-3.1.0.RC1/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/ui/FilesetReferenceWizardFragment.java 2009-12-17
18:25:16 UTC (rev 19440)
+++
branches/jbosstools-3.1.0.RC1/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/ui/FilesetReferenceWizardFragment.java 2009-12-17
18:30:12 UTC (rev 19441)
@@ -25,9 +25,10 @@
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.IReferenceEditor;
import org.jboss.ide.eclipse.as.wtp.ui.propertypage.NewReferenceWizard;
-public class FilesetReferenceWizardFragment extends WizardFragment {
+public class FilesetReferenceWizardFragment extends WizardFragment implements
IReferenceEditor {
public boolean hasComposite() {
return true;
}
@@ -41,7 +42,7 @@
private String includes, excludes, folder;
public Composite createComposite(Composite parent, IWizardHandle handle) {
hasEntered = true;
- handle.setTitle("Add a fileset"); //$NON-NLS-1$
+ handle.setTitle("Add a fileset reference"); //$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);
@@ -67,6 +68,11 @@
incText.addModifyListener(listener);
excText.addModifyListener(listener);
textModified();
+ if( original != null ) {
+ rootText.setText(original.getRootFolderPath());
+ incText.setText(original.getIncludes());
+ excText.setText(original.getExcludes());
+ }
return child;
}
@@ -143,4 +149,11 @@
return vc;
}
+ private WorkspaceFilesetVirtualComponent original;
+ public boolean canEdit(IVirtualComponent vc) {
+ if( vc instanceof WorkspaceFilesetVirtualComponent)
+ original = (WorkspaceFilesetVirtualComponent)vc;
+ return original != null;
+ }
+
}
Show replies by date