aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzzhongwei2012-09-04 23:03:16 (EDT)
committerzzhongwei2012-09-04 23:03:16 (EDT)
commit9aa7f40f5e6f147e87360141a1f6d5f72050acbf (patch)
treee33a0a4945bfee707be2421b0ea69089b5d09aef
parentbee4500e7332b915a579d10bf60134310e3f71f4 (diff)
downloadorg.eclipse.pdt-9aa7f40f5e6f147e87360141a1f6d5f72050acbf.zip
org.eclipse.pdt-9aa7f40f5e6f147e87360141a1f6d5f72050acbf.tar.gz
org.eclipse.pdt-9aa7f40f5e6f147e87360141a1f6d5f72050acbf.tar.bz2
388806: After cretion of a trait, it appears with the class icon in the
php explorer and outline view. https://bugs.eclipse.org/bugs/show_bug.cgi?id=388806
-rw-r--r--plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/explorer/PHPExplorerLabelProvider.java9
-rw-r--r--plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/outline/PHPContentOutlineConfiguration.java17
-rw-r--r--plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/outline/PHPOutlineLabelProvider.java11
-rw-r--r--plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/util/PHPPluginImages.java3
4 files changed, 34 insertions, 6 deletions
diff --git a/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/explorer/PHPExplorerLabelProvider.java b/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/explorer/PHPExplorerLabelProvider.java
index b8550b4..e7b86fd 100644
--- a/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/explorer/PHPExplorerLabelProvider.java
+++ b/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/explorer/PHPExplorerLabelProvider.java
@@ -21,6 +21,7 @@ import org.eclipse.dltk.internal.core.ExternalProjectFragment;
import org.eclipse.dltk.internal.ui.navigator.ScriptExplorerContentProvider;
import org.eclipse.dltk.internal.ui.navigator.ScriptExplorerLabelProvider;
import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.php.core.compiler.PHPFlags;
import org.eclipse.php.internal.core.includepath.IncludePath;
import org.eclipse.php.internal.core.language.LanguageModelInitializer;
import org.eclipse.php.internal.ui.util.LabelProviderUtil;
@@ -116,7 +117,13 @@ public class PHPExplorerLabelProvider extends ScriptExplorerLabelProvider {
.get(PHPPluginImages.IMG_OBJS_PHPFOLDER_ROOT);
}
}
-
+ try {
+ if (element instanceof IType
+ && PHPFlags.isTrait(((IType) element).getFlags())) {
+ return PHPPluginImages.get(PHPPluginImages.IMG_OBJS_TRAIT);
+ }
+ } catch (ModelException e) {
+ }
return super.getImage(element);
}
diff --git a/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/outline/PHPContentOutlineConfiguration.java b/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/outline/PHPContentOutlineConfiguration.java
index 1f2a79d..702fac1 100644
--- a/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/outline/PHPContentOutlineConfiguration.java
+++ b/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/outline/PHPContentOutlineConfiguration.java
@@ -12,9 +12,7 @@
package org.eclipse.php.internal.ui.outline;
import org.eclipse.dltk.ast.references.SimpleReference;
-import org.eclipse.dltk.core.IModelElement;
-import org.eclipse.dltk.core.ISourceModule;
-import org.eclipse.dltk.core.ISourceReference;
+import org.eclipse.dltk.core.*;
import org.eclipse.dltk.internal.ui.filters.FilterMessages;
import org.eclipse.dltk.ui.DLTKPluginImages;
import org.eclipse.dltk.ui.DLTKUIPlugin;
@@ -34,6 +32,7 @@ import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.*;
import org.eclipse.osgi.util.NLS;
+import org.eclipse.php.core.compiler.PHPFlags;
import org.eclipse.php.internal.core.typeinference.UseStatementElement;
import org.eclipse.php.internal.ui.PHPUIMessages;
import org.eclipse.php.internal.ui.PHPUiPlugin;
@@ -41,6 +40,7 @@ import org.eclipse.php.internal.ui.actions.SortAction;
import org.eclipse.php.internal.ui.editor.PHPStructuredEditor;
import org.eclipse.php.internal.ui.outline.PHPOutlineContentProvider.UseStatementsNode;
import org.eclipse.php.internal.ui.preferences.PreferenceConstants;
+import org.eclipse.php.internal.ui.util.PHPPluginImages;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
@@ -85,8 +85,8 @@ public class PHPContentOutlineConfiguration extends
public PHPContentOutlineConfiguration() {
super();
- mode = PHPUiPlugin.getDefault().getPreferenceStore().getInt(
- PreferenceConstants.PREF_OUTLINEMODE);
+ mode = PHPUiPlugin.getDefault().getPreferenceStore()
+ .getInt(PreferenceConstants.PREF_OUTLINEMODE);
}
public int getMode() {
@@ -384,6 +384,13 @@ public class PHPContentOutlineConfiguration extends
return DLTKPluginImages.DESC_METHOD_PUBLIC;
}
}
+ try {
+ if (element instanceof IType
+ && PHPFlags.isTrait(((IType) element).getFlags())) {
+ return PHPPluginImages.DESC_OBJS_TRAIT;
+ }
+ } catch (ModelException e) {
+ }
return super.getBaseImageDescriptor(element, renderFlags);
}
diff --git a/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/outline/PHPOutlineLabelProvider.java b/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/outline/PHPOutlineLabelProvider.java
index 23a548d..953a90c 100644
--- a/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/outline/PHPOutlineLabelProvider.java
+++ b/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/outline/PHPOutlineLabelProvider.java
@@ -12,7 +12,11 @@
package org.eclipse.php.internal.ui.outline;
import org.eclipse.dltk.core.IModelElement;
+import org.eclipse.dltk.core.IType;
+import org.eclipse.dltk.core.ModelException;
import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.php.core.compiler.PHPFlags;
+import org.eclipse.php.internal.ui.util.PHPPluginImages;
import org.eclipse.swt.graphics.Image;
/**
@@ -33,6 +37,13 @@ public class PHPOutlineLabelProvider extends XMLLabelProvider {
}
public Image getImage(Object o) {
+
+ try {
+ if (o instanceof IType && PHPFlags.isTrait(((IType) o).getFlags())) {
+ return PHPPluginImages.get(PHPPluginImages.IMG_OBJS_TRAIT);
+ }
+ } catch (ModelException e) {
+ }
if (o instanceof IModelElement) {
return modelElementLabelProvider.getImage(o);
}
diff --git a/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/util/PHPPluginImages.java b/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/util/PHPPluginImages.java
index 417a447..5d2ada7 100644
--- a/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/util/PHPPluginImages.java
+++ b/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/util/PHPPluginImages.java
@@ -126,6 +126,7 @@ public class PHPPluginImages {
+ "namespace_group.gif"; //$NON-NLS-1$
public static final String IMG_OBJS_OCCURRENCES = NAME_PREFIX
+ "searchm_obj.gif"; //$NON-NLS-1$
+ public static final String IMG_OBJS_TRAIT = NAME_PREFIX + "trait_obj.png"; //$NON-NLS-1$
public static final String IMG_OBJS_ZIP = NAME_PREFIX + "zip_obj.gif"; //$NON-NLS-1$
public static final String IMG_OBJS_EXTZIP = NAME_PREFIX + "zip_l_obj.gif"; //$NON-NLS-1$
@@ -275,6 +276,8 @@ public class PHPPluginImages {
CLASS_BROWSER, IMG_TEMPLATE);//$NON-NLS-1$
public static final ImageDescriptor DESC_OBJS_EXTJAR = createManaged(T_OBJ,
IMG_OBJS_EXTJAR);
+ public static final ImageDescriptor DESC_OBJS_TRAIT = createManaged(T_OBJ,
+ IMG_OBJS_TRAIT);
/**
* Returns the image managed under the given key in this registry.