Author: rob.stryker(a)jboss.com
Date: 2009-12-17 13:22:10 -0500 (Thu, 17 Dec 2009)
New Revision: 19439
Added:
branches/jbosstools-3.1.0.RC1/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/icons/folder.gif
Modified:
branches/jbosstools-3.1.0.RC1/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/Messages.java
branches/jbosstools-3.1.0.RC1/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/WTPOveridePlugin.java
branches/jbosstools-3.1.0.RC1/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/messages.properties
branches/jbosstools-3.1.0.RC1/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/propertypage/AddModuleDependenciesPropertiesPage.java
branches/jbosstools-3.1.0.RC1/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/propertypage/ComponentDependencyContentProvider.java
Log:
Merging in UI changes to beautify module assembly page
Added:
branches/jbosstools-3.1.0.RC1/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/icons/folder.gif
===================================================================
(Binary files differ)
Property changes on:
branches/jbosstools-3.1.0.RC1/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/icons/folder.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified:
branches/jbosstools-3.1.0.RC1/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/Messages.java
===================================================================
---
branches/jbosstools-3.1.0.RC1/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/Messages.java 2009-12-17
18:17:51 UTC (rev 19438)
+++
branches/jbosstools-3.1.0.RC1/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/Messages.java 2009-12-17
18:22:10 UTC (rev 19439)
@@ -4,6 +4,7 @@
public class Messages extends NLS {
private static final String BUNDLE_NAME =
"org.jboss.ide.eclipse.as.wtp.ui.messages"; //$NON-NLS-1$
+ public static String ModuleDependencyDescription;
public static String AddModuleDependenciesPropertiesPage_AddProjectButton;
public static String AddModuleDependenciesPropertiesPage_DeployPathColumn;
public static String AddModuleDependenciesPropertiesPage_RemoveSelectedButton;
Modified:
branches/jbosstools-3.1.0.RC1/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/WTPOveridePlugin.java
===================================================================
---
branches/jbosstools-3.1.0.RC1/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/WTPOveridePlugin.java 2009-12-17
18:17:51 UTC (rev 19438)
+++
branches/jbosstools-3.1.0.RC1/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/WTPOveridePlugin.java 2009-12-17
18:22:10 UTC (rev 19439)
@@ -1,10 +1,19 @@
package org.jboss.ide.eclipse.as.wtp.ui;
+import java.net.MalformedURLException;
+import java.net.URL;
+
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
/**
@@ -14,10 +23,19 @@
// The plug-in ID
public static final String PLUGIN_ID = "org.jboss.ide.eclipse.as.wtp.ui";
//$NON-NLS-1$
-
+ public static final String[] ICON_DIRS = new String[]{"icons/full/obj16",
//$NON-NLS-1$
+ "icons/full/cview16", //$NON-NLS-1$
+ "icons/full/ctool16", //$NON-NLS-1$
+ "icons/full/clcl16", //$NON-NLS-1$
+ "icons/full/ovr16", //$NON-NLS-1$
+ "icons/full/extra", //$NON-NLS-1$
+ "icons/full/wizban", //$NON-NLS-1$
+ "icons", //$NON-NLS-1$
+ ""}; //$NON-NLS-1$
+
// The shared instance
private static WTPOveridePlugin plugin;
-
+
/**
* The constructor
*/
@@ -43,11 +61,58 @@
}
/**
+ * Get a .gif from the image registry.
+ */
+ public Image getImage(String key) {
+ ImageRegistry imageRegistry = getImageRegistry();
+ Image image = imageRegistry.get(key);
+ if (image == null || image.isDisposed()) {
+ ImageDescriptor descriptor = getImageDescriptor(key);
+ if (descriptor != null) {
+ image = descriptor.createImage();
+ imageRegistry.put(key, image);
+ }
+ }
+ return image;
+ }
+
+ /**
+ * This gets a .gif from the icons folder.
+ */
+ public ImageDescriptor getImageDescriptor(String key) {
+ ImageDescriptor imageDescriptor = null;
+ URL gifImageURL = getImageURL(key,getBundle());
+ if (gifImageURL != null)
+ imageDescriptor = ImageDescriptor.createFromURL(gifImageURL);
+ return imageDescriptor;
+ }
+
+ /**
+ * This gets a .gif from the icons folder.
+ */
+ public URL getImageURL(String key, Bundle bundle) {
+ String gif = "/" + key + ".gif"; //$NON-NLS-1$ //$NON-NLS-2$
+ IPath path = null;
+ for (int i = 0; i < ICON_DIRS.length; i++) {
+ path = new Path(ICON_DIRS[i]).append(gif);
+ if (Platform.find(bundle,path) == null)
+ continue;
+ try {
+ return new URL( bundle.getEntry("/"), path.toString()); //$NON-NLS-1$
+ } catch (MalformedURLException exception) {
+ logError(exception);
+ continue;
+ }
+ }
+ return null;
+ }
+
+ /**
* Returns the shared instance
*
* @return the shared instance
*/
- public static WTPOveridePlugin getDefault() {
+ public static WTPOveridePlugin getInstance() {
return plugin;
}
@@ -57,7 +122,7 @@
public static void log(String message, Exception e) {
IStatus status = new Status(IStatus.ERROR, PLUGIN_ID, message, e);
- getDefault().getLog().log(status);
+ getInstance().getLog().log(status);
}
public static IStatus createStatus(int severity, int aCode,
String aMessage, Throwable exception) {
Modified:
branches/jbosstools-3.1.0.RC1/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/messages.properties
===================================================================
---
branches/jbosstools-3.1.0.RC1/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/messages.properties 2009-12-17
18:17:51 UTC (rev 19438)
+++
branches/jbosstools-3.1.0.RC1/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/messages.properties 2009-12-17
18:22:10 UTC (rev 19439)
@@ -1,3 +1,4 @@
+ModuleDependencyDescription=Adjust the project's module assembly structure
AddModuleDependenciesPropertiesPage_AddProjectButton=Add Project...
AddModuleDependenciesPropertiesPage_DeployPathColumn=Deploy Path
AddModuleDependenciesPropertiesPage_RemoveSelectedButton=Remove selected...
Modified:
branches/jbosstools-3.1.0.RC1/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/propertypage/AddModuleDependenciesPropertiesPage.java
===================================================================
---
branches/jbosstools-3.1.0.RC1/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/propertypage/AddModuleDependenciesPropertiesPage.java 2009-12-17
18:17:51 UTC (rev 19438)
+++
branches/jbosstools-3.1.0.RC1/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/propertypage/AddModuleDependenciesPropertiesPage.java 2009-12-17
18:22:10 UTC (rev 19439)
@@ -35,9 +35,11 @@
import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.ColumnWeightData;
import org.eclipse.jface.viewers.ICellModifier;
+import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.LabelProviderChangedEvent;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.TableLayout;
import org.eclipse.jface.viewers.TableViewer;
@@ -85,7 +87,7 @@
import org.jboss.ide.eclipse.as.wtp.ui.WTPOveridePlugin;
public class AddModuleDependenciesPropertiesPage implements Listener,
- IModuleDependenciesControl {
+ IModuleDependenciesControl, ILabelProviderListener {
private static final String DEPLOY_PATH_PROPERTY = new Integer(0).toString();
private static final String SOURCE_PROPERTY = new Integer(1).toString();
@@ -142,7 +144,7 @@
composite.setLayout(layout);
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
ModuleAssemblyRootPage.createDescriptionComposite(composite,
- "TODO Change this: Create and change packaging structure for this project
");
+ Messages.ModuleDependencyDescription);
createListGroup(composite);
refresh();
Dialog.applyDialogFont(parent);
@@ -244,7 +246,7 @@
* Subclasses should over-ride this and extend the class
*/
protected ComponentDependencyContentProvider createProvider() {
- return new ComponentDependencyContentProvider();
+ return new ComponentDependencyContentProvider(this);
}
/*
@@ -970,4 +972,10 @@
return uriMapName;
}
+
+ public void labelProviderChanged(LabelProviderChangedEvent event) {
+ if(!availableComponentsViewer.getTable().isDisposed())
+ availableComponentsViewer.refresh(true);
+ }
+
}
Modified:
branches/jbosstools-3.1.0.RC1/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/propertypage/ComponentDependencyContentProvider.java
===================================================================
---
branches/jbosstools-3.1.0.RC1/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/propertypage/ComponentDependencyContentProvider.java 2009-12-17
18:17:51 UTC (rev 19438)
+++
branches/jbosstools-3.1.0.RC1/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/propertypage/ComponentDependencyContentProvider.java 2009-12-17
18:22:10 UTC (rev 19439)
@@ -18,14 +18,17 @@
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.viewers.DecoratingLabelProvider;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.wst.common.componentcore.internal.ComponentResource;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.model.WorkbenchLabelProvider;
import org.eclipse.wst.common.componentcore.internal.resources.VirtualArchiveComponent;
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.jboss.ide.eclipse.as.wtp.ui.WTPOveridePlugin;
import
org.jboss.ide.eclipse.as.wtp.ui.propertypage.AddModuleDependenciesPropertiesPage.ComponentResourceProxy;
@@ -43,8 +46,13 @@
private HashMap<IVirtualComponent, String> runtimePaths;
private ArrayList<ComponentResourceProxy> resourceMappings;
- public ComponentDependencyContentProvider() {
+ private DecoratingLabelProvider decProvider = new DecoratingLabelProvider(
+ new WorkbenchLabelProvider(), PlatformUI.getWorkbench().
+ getDecoratorManager().getLabelDecorator());
+
+ public ComponentDependencyContentProvider(AddModuleDependenciesPropertiesPage
addModuleDependenciesPropertiesPage) {
super();
+ decProvider.addListener(addModuleDependenciesPropertiesPage);
}
public void setRuntimePaths(HashMap<IVirtualComponent, String> paths) {
@@ -66,6 +74,21 @@
}
public Image getColumnImage(Object element, int columnIndex) {
+ if( element instanceof ComponentResourceProxy) {
+ return WTPOveridePlugin.getInstance().getImage("folder");
+ }
+ if (element instanceof IVirtualComponent) {
+ if (columnIndex == 0)
+ return WTPOveridePlugin.getInstance().getImage("jar_obj");
+ else
+ if(((IVirtualComponent)element).isBinary())
+ return WTPOveridePlugin.getInstance().getImage("jar_obj");
+ else return decProvider.getImage(((IVirtualComponent)element).getProject());
+ //return ModuleCoreUIPlugin.getInstance().getImage("prj_obj");
+ }
+ if (element instanceof IProject){
+ return decProvider.getImage(element);
+ }
return null;
}
@@ -84,13 +107,7 @@
}
return runtimePaths.get(element);
} else if (columnIndex == 1) {
- if( comp.isBinary() && comp instanceof VirtualArchiveComponent) {
- IPath p = ((VirtualArchiveComponent)comp).getWorkspaceRelativePath();
- if( p == null )
- p = new
Path(((VirtualArchiveComponent)comp).getUnderlyingDiskFile().getAbsolutePath());
- return p.toString();
- }
- return comp.getName();
+ return handleSourceText(comp);
}
} else if (element instanceof IProject){
if (columnIndex == 0) {
@@ -105,6 +122,17 @@
return null;
}
+ private String handleSourceText(IVirtualComponent comp) {
+ if( comp.isBinary() && comp instanceof VirtualArchiveComponent) {
+ IPath p = ((VirtualArchiveComponent)comp).getWorkspaceRelativePath();
+ if( p == null )
+ p = new
Path(((VirtualArchiveComponent)comp).getUnderlyingDiskFile().getAbsolutePath());
+ return p.toString();
+ }
+ return comp.getProject().getName();
+ }
+
+
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
}
}