aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzzhongwei2012-10-05 10:12:12 (EDT)
committerzzhongwei2012-10-14 22:54:48 (EDT)
commite1d52fa27b9337182b1c0e64ef8f7fd6ae0bdff7 (patch)
tree0af9bcbd185f95a6637d91ac08ac57d941a1fcc3
parent8970773d6b160a4df46bab40bf8d90ad3c22b8dc (diff)
downloadorg.eclipse.pdt-e1d52fa27b9337182b1c0e64ef8f7fd6ae0bdff7.zip
org.eclipse.pdt-e1d52fa27b9337182b1c0e64ef8f7fd6ae0bdff7.tar.gz
org.eclipse.pdt-e1d52fa27b9337182b1c0e64ef8f7fd6ae0bdff7.tar.bz2
391239: A class icon appears when hovering a trait in a class which
includes it, should be a trait icon. https://bugs.eclipse.org/bugs/show_bug.cgi?id=391239
-rw-r--r--plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/viewsupport/ImagesOnFileSystemRegistry.java26
1 files changed, 23 insertions, 3 deletions
diff --git a/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/viewsupport/ImagesOnFileSystemRegistry.java b/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/viewsupport/ImagesOnFileSystemRegistry.java
index 1aef9a6..e93c37c 100644
--- a/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/viewsupport/ImagesOnFileSystemRegistry.java
+++ b/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/viewsupport/ImagesOnFileSystemRegistry.java
@@ -6,9 +6,13 @@ import java.net.URL;
import java.util.HashMap;
import org.eclipse.dltk.core.IModelElement;
+import org.eclipse.dltk.core.IType;
+import org.eclipse.dltk.core.ModelException;
import org.eclipse.dltk.ui.ScriptElementImageProvider;
import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.php.core.compiler.PHPFlags;
import org.eclipse.php.internal.ui.PHPUiPlugin;
+import org.eclipse.php.internal.ui.util.PHPPluginImages;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.graphics.ImageLoader;
@@ -30,14 +34,30 @@ public class ImagesOnFileSystemRegistry {
public ImagesOnFileSystemRegistry() {
fURLMap = new HashMap();
fTempDir = getTempDir();
- fImageProvider = new ScriptElementImageProvider();
+ fImageProvider = new ScriptElementImageProvider() {
+ @Override
+ public ImageDescriptor getBaseImageDescriptor(
+ IModelElement element, int renderFlags) {
+ // TODO Auto-generated method stub
+ if (element.getElementType() == IModelElement.TYPE) {
+ IType type = (IType) element;
+ try {
+ if (PHPFlags.isTrait(type.getFlags())) {
+ return PHPPluginImages.DESC_OBJS_TRAIT;
+ }
+ } catch (ModelException e) {
+ }
+ }
+ return super.getBaseImageDescriptor(element, renderFlags);
+ }
+ };
fImageCount = 0;
}
private File getTempDir() {
try {
- File imageDir = PHPUiPlugin.getDefault().getStateLocation().append(
- IMAGE_DIR).toFile();
+ File imageDir = PHPUiPlugin.getDefault().getStateLocation()
+ .append(IMAGE_DIR).toFile();
if (imageDir.exists()) {
// has not been deleted on previous shutdown
delete(imageDir);