Author: scabanovich
Date: 2007-07-24 07:06:29 -0400 (Tue, 24 Jul 2007)
New Revision: 2617
Added:
trunk/seam/plugins/org.jboss.tools.seam.ui/icons/view/
trunk/seam/plugins/org.jboss.tools.seam.ui/icons/view/component.gif
trunk/seam/plugins/org.jboss.tools.seam.ui/icons/view/component_new.gif
trunk/seam/plugins/org.jboss.tools.seam.ui/icons/view/java.gif
trunk/seam/plugins/org.jboss.tools.seam.ui/icons/view/java_binary.gif
trunk/seam/plugins/org.jboss.tools.seam.ui/icons/view/java_binary_new.gif
trunk/seam/plugins/org.jboss.tools.seam.ui/icons/view/java_new.gif
trunk/seam/plugins/org.jboss.tools.seam.ui/icons/view/role.gif
trunk/seam/plugins/org.jboss.tools.seam.ui/icons/view/role_new.gif
trunk/seam/plugins/org.jboss.tools.seam.ui/icons/view/scope.gif
trunk/seam/plugins/org.jboss.tools.seam.ui/icons/view/scope_new.gif
trunk/seam/plugins/org.jboss.tools.seam.ui/icons/view/seam_project.gif
trunk/seam/plugins/org.jboss.tools.seam.ui/icons/view/seam_project_new.gif
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/SeamUiImages.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/SeamLabelProvider.java
Log:
EXIN-218 Icons added to seam components view
Added: trunk/seam/plugins/org.jboss.tools.seam.ui/icons/view/component.gif
===================================================================
(Binary files differ)
Property changes on: trunk/seam/plugins/org.jboss.tools.seam.ui/icons/view/component.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/seam/plugins/org.jboss.tools.seam.ui/icons/view/component_new.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/seam/plugins/org.jboss.tools.seam.ui/icons/view/component_new.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/seam/plugins/org.jboss.tools.seam.ui/icons/view/java.gif
===================================================================
(Binary files differ)
Property changes on: trunk/seam/plugins/org.jboss.tools.seam.ui/icons/view/java.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/seam/plugins/org.jboss.tools.seam.ui/icons/view/java_binary.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/seam/plugins/org.jboss.tools.seam.ui/icons/view/java_binary.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/seam/plugins/org.jboss.tools.seam.ui/icons/view/java_binary_new.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/seam/plugins/org.jboss.tools.seam.ui/icons/view/java_binary_new.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/seam/plugins/org.jboss.tools.seam.ui/icons/view/java_new.gif
===================================================================
(Binary files differ)
Property changes on: trunk/seam/plugins/org.jboss.tools.seam.ui/icons/view/java_new.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/seam/plugins/org.jboss.tools.seam.ui/icons/view/role.gif
===================================================================
(Binary files differ)
Property changes on: trunk/seam/plugins/org.jboss.tools.seam.ui/icons/view/role.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/seam/plugins/org.jboss.tools.seam.ui/icons/view/role_new.gif
===================================================================
(Binary files differ)
Property changes on: trunk/seam/plugins/org.jboss.tools.seam.ui/icons/view/role_new.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/seam/plugins/org.jboss.tools.seam.ui/icons/view/scope.gif
===================================================================
(Binary files differ)
Property changes on: trunk/seam/plugins/org.jboss.tools.seam.ui/icons/view/scope.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/seam/plugins/org.jboss.tools.seam.ui/icons/view/scope_new.gif
===================================================================
(Binary files differ)
Property changes on: trunk/seam/plugins/org.jboss.tools.seam.ui/icons/view/scope_new.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/seam/plugins/org.jboss.tools.seam.ui/icons/view/seam_project.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/seam/plugins/org.jboss.tools.seam.ui/icons/view/seam_project.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/seam/plugins/org.jboss.tools.seam.ui/icons/view/seam_project_new.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/seam/plugins/org.jboss.tools.seam.ui/icons/view/seam_project_new.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/SeamUiImages.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/SeamUiImages.java
(rev 0)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/SeamUiImages.java 2007-07-24
11:06:29 UTC (rev 2617)
@@ -0,0 +1,81 @@
+package org.jboss.tools.seam.ui;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.graphics.Image;
+
+public class SeamUiImages {
+
+ private static SeamUiImages INSTANCE;
+
+ static {
+ try {
+ INSTANCE = new SeamUiImages(new
URL(SeamGuiPlugin.getDefault().getBundle().getEntry("/"), "icons/"));
+ } catch (MalformedURLException e) {
+ SeamGuiPlugin.getPluginLog().logError(e);
+ }
+ }
+
+ public static Image SCOPE_IMAGE = getImage("view/scope.gif");
+ public static Image PROJECT_IMAGE = getImage("view/seam_project.gif");
+ public static Image COMPONENT_IMAGE = getImage("view/component.gif");
+ public static Image ROLE_IMAGE = getImage("view/role.gif");
+ public static Image JAVA_IMAGE = getImage("view/java.gif");
+ public static Image JAVA_BINARY_IMAGE = getImage("view/java_binary.gif");
+
+ public static Image getImage(String key) {
+ return INSTANCE.createImageDescriptor(key).createImage();
+ }
+
+ public static ImageDescriptor getImageDescriptor(String key) {
+ return INSTANCE.createImageDescriptor(key);
+ }
+
+ public static void setImageDescriptors(IAction action, String iconName) {
+ action.setImageDescriptor(INSTANCE.createImageDescriptor(iconName));
+ }
+
+ public static SeamUiImages getInstance() {
+ return INSTANCE;
+ }
+
+ private URL baseUrl;
+ private SeamUiImages parentRegistry;
+
+ protected SeamUiImages(URL registryUrl, SeamUiImages parent){
+
+ if(registryUrl == null) throw new NullPointerException("Base url for image
registry cannot be null.");
+ baseUrl = registryUrl;
+ parentRegistry = parent;
+ }
+
+ protected SeamUiImages(URL url){
+ this(url,null);
+ }
+
+ public Image getImageByFileName(String key) {
+ return createImageDescriptor(key).createImage();
+ }
+
+ public ImageDescriptor createImageDescriptor(String key) {
+ try {
+ return ImageDescriptor.createFromURL(makeIconFileURL(key));
+ } catch (MalformedURLException e) {
+ if(parentRegistry == null) {
+ return ImageDescriptor.getMissingImageDescriptor();
+ } else {
+ return parentRegistry.createImageDescriptor(key);
+ }
+
+ }
+ }
+
+ private URL makeIconFileURL(String name) throws MalformedURLException {
+ if (name == null) throw new MalformedURLException("Image name cannot be
null.");
+ return new URL(baseUrl, name);
+ }
+
+}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/SeamLabelProvider.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/SeamLabelProvider.java 2007-07-24
10:40:52 UTC (rev 2616)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/SeamLabelProvider.java 2007-07-24
11:06:29 UTC (rev 2617)
@@ -33,6 +33,7 @@
import org.jboss.tools.seam.core.ISeamScope;
import org.jboss.tools.seam.internal.core.SeamComponentDeclaration;
import org.jboss.tools.seam.internal.core.SeamProject;
+import org.jboss.tools.seam.ui.SeamUiImages;
/**
* @author Viacheslav Kabanovich
@@ -71,37 +72,31 @@
}
public Image getImage(Object obj) {
- String imageKey = ISharedImages.IMG_OBJ_ELEMENT;
if (obj instanceof ISeamProject) {
- SeamProject p = (SeamProject)obj;
- return jip.getImageLabel(p.getProject(), 3);
-// imageKey = org.eclipse.ui.ide.IDE.SharedImages.IMG_OBJ_PROJECT;
+ return SeamUiImages.PROJECT_IMAGE;
} else if(obj instanceof ISeamScope) {
- imageKey = ISharedImages.IMG_OBJ_FOLDER;
+ return SeamUiImages.SCOPE_IMAGE;
} else if(obj instanceof ISeamComponent) {
- imageKey = ISharedImages.IMG_OBJ_ELEMENT;
+ return SeamUiImages.COMPONENT_IMAGE;
} else if(obj instanceof IRole) {
- //
+ return SeamUiImages.ROLE_IMAGE;
} else if(obj instanceof ISeamJavaComponentDeclaration) {
ISeamJavaComponentDeclaration d = (ISeamJavaComponentDeclaration)obj;
IType type = (IType)d.getSourceMember();
if(type != null) {
if(type.isBinary()) {
- return new
org.eclipse.jdt.internal.ui.SharedImages().getImage(JavaPluginImages.IMG_OBJS_CFILE);
+ return SeamUiImages.JAVA_BINARY_IMAGE;
}
- IResource r = d.getResource();
- if(r != null) return jip.getImageLabel(r, 3);
- ICompilationUnit f = type.getCompilationUnit();
- return(f != null) ? jip.getImageLabel(f, 0) : jip.getImageLabel(type, 3);
+ return SeamUiImages.JAVA_IMAGE;
}
- return new
org.eclipse.jdt.internal.ui.SharedImages().getImage(JavaPluginImages.IMG_OBJS_CFILECLASS);
+ return SeamUiImages.JAVA_IMAGE;
} else if(obj instanceof ISeamComponentDeclaration) {
SeamComponentDeclaration d = (SeamComponentDeclaration)obj;
IResource r = d.getResource();
if(r != null) return jip.getImageLabel(r, 3);
- imageKey = ISharedImages.IMG_OBJ_FILE;
+ return
PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FILE);
}
- return PlatformUI.getWorkbench().getSharedImages().getImage(imageKey);
+ return
PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_ELEMENT);
}
}