Author: scabanovich
Date: 2007-07-17 11:29:09 -0400 (Tue, 17 Jul 2007)
New Revision: 2474
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/RootContentProvider.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/SeamLabelProvider.java
Log:
EXIN-218 JDT icons used
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/RootContentProvider.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/RootContentProvider.java 2007-07-17
15:25:26 UTC (rev 2473)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/RootContentProvider.java 2007-07-17
15:29:09 UTC (rev 2474)
@@ -71,7 +71,7 @@
children.addAll(rs);
}
}
- return ((ISeamComponent)parentElement).getAllDeclarations().toArray(new Object[0]);
+ return children.toArray(new Object[0]);
}
return null;
}
@@ -79,6 +79,9 @@
public Object getParent(Object element) {
if(element instanceof ISeamProject) {
return root;
+ } else if(element instanceof IRole) {
+ ISeamElement p = ((IRole)element).getParent();
+ return p == null ? p : p.getParent();
} else if(element instanceof ISeamElement) {
return ((ISeamElement)element).getParent();
}
@@ -87,6 +90,7 @@
public boolean hasChildren(Object element) {
if(element instanceof ISeamComponentDeclaration) return false;
+ if(element instanceof IRole) return false;
return true;
}
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-17
15:25:26 UTC (rev 2473)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/SeamLabelProvider.java 2007-07-17
15:29:09 UTC (rev 2474)
@@ -2,8 +2,12 @@
import org.eclipse.core.resources.IProjectNature;
import org.eclipse.core.resources.IResource;
+import org.eclipse.jdt.core.IClassFile;
+import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IMember;
import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.internal.ui.JavaPluginImages;
+import org.eclipse.jdt.internal.ui.viewsupport.JavaElementImageProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.ISharedImages;
@@ -16,8 +20,11 @@
import org.jboss.tools.seam.core.ISeamJavaSourceReference;
import org.jboss.tools.seam.core.ISeamProject;
import org.jboss.tools.seam.core.ISeamScope;
+import org.jboss.tools.seam.internal.core.SeamComponentDeclaration;
+import org.jboss.tools.seam.internal.core.SeamProject;
public class SeamLabelProvider extends LabelProvider {
+ JavaElementImageProvider jip = new JavaElementImageProvider();
public String getText(Object element) {
if(element instanceof ISeamProject) {
@@ -50,7 +57,9 @@
public Image getImage(Object obj) {
String imageKey = ISharedImages.IMG_OBJ_ELEMENT;
if (obj instanceof ISeamProject) {
- imageKey = org.eclipse.ui.ide.IDE.SharedImages.IMG_OBJ_PROJECT;
+ SeamProject p = (SeamProject)obj;
+ return jip.getImageLabel(p.getProject(), 3);
+// imageKey = org.eclipse.ui.ide.IDE.SharedImages.IMG_OBJ_PROJECT;
} else if(obj instanceof ISeamScope) {
imageKey = ISharedImages.IMG_OBJ_FOLDER;
} else if(obj instanceof ISeamComponent) {
@@ -58,9 +67,22 @@
} else if(obj instanceof IRole) {
//
} else if(obj instanceof ISeamJavaComponentDeclaration) {
- imageKey = org.eclipse.jdt.ui.ISharedImages.IMG_OBJS_CLASS;
- return new org.eclipse.jdt.internal.ui.SharedImages().getImage(imageKey);
+ 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);
+ }
+ 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 new
org.eclipse.jdt.internal.ui.SharedImages().getImage(JavaPluginImages.IMG_OBJS_CFILECLASS);
} 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(imageKey);