Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsben-zeev2006-08-01 10:56:42 -0400
committersben-zeev2006-08-01 10:56:42 -0400
commitb7cf7b85125bde0d455d93a8d5a1106efdef09e0 (patch)
treed4bbb57cf388bde8c005ad750d85e351e02a4fe1
parenta3b415f5993dbe3cbf2d6e73190252ff939ab6ba (diff)
downloadorg.eclipse.pdt-b7cf7b85125bde0d455d93a8d5a1106efdef09e0.tar.gz
org.eclipse.pdt-b7cf7b85125bde0d455d93a8d5a1106efdef09e0.tar.xz
org.eclipse.pdt-b7cf7b85125bde0d455d93a8d5a1106efdef09e0.zip
show framework project icon in PHP Explorer and MVC outline.
-rw-r--r--plugins/org.eclipse.php.ui/plugin.xml3
-rw-r--r--plugins/org.eclipse.php.ui/schema/org.eclipse.php.ui.phplabeldecorator.exsd119
-rw-r--r--plugins/org.eclipse.php.ui/src/org/eclipse/php/ui/util/PHPUILabelProvider.java52
3 files changed, 155 insertions, 19 deletions
diff --git a/plugins/org.eclipse.php.ui/plugin.xml b/plugins/org.eclipse.php.ui/plugin.xml
index b63d26652..396d480d1 100644
--- a/plugins/org.eclipse.php.ui/plugin.xml
+++ b/plugins/org.eclipse.php.ui/plugin.xml
@@ -12,6 +12,7 @@
<extension-point id="hyperlinkDetectorForPHP" name="hyperlinkDetectorForPHP" schema="schema/hyperlinkDetectorForPHP.exsd"/>
<extension-point id="phpOutlineElementComparer" name="phpOutlineElementComparer" schema="schema/phpOutlineElementComparer.exsd"/>
<extension-point id="actionFilterDelegatorForPHPCodeData" name="actionFilterDelegatorForPHPCodeData" schema="schema/actionFilterDelegatorForPHPCodeData.exsd"/>
+ <extension-point id="phpLabelDecorator" name="phpLabelDecorator" schema="schema/org.eclipse.php.ui.phplabeldecorator.exsd"/>
<!--extension point="org.eclipse.ui.editors.documentProviders">
<provider
@@ -1265,4 +1266,4 @@
label="PHP"/>
</extension>
-</plugin> \ No newline at end of file
+</plugin>
diff --git a/plugins/org.eclipse.php.ui/schema/org.eclipse.php.ui.phplabeldecorator.exsd b/plugins/org.eclipse.php.ui/schema/org.eclipse.php.ui.phplabeldecorator.exsd
new file mode 100644
index 000000000..aaae3e608
--- /dev/null
+++ b/plugins/org.eclipse.php.ui/schema/org.eclipse.php.ui.phplabeldecorator.exsd
@@ -0,0 +1,119 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.php.ui">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.php.ui" id="org.eclipse.php.ui.phplabeldecorator" name="phpLabelDecorator"/>
+ </appInfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <complexType>
+ <sequence minOccurs="0" maxOccurs="unbounded">
+ <element ref="PHPLabelDecorator" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="PHPLabelDecorator">
+ <complexType>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn="org.eclipse.jface.viewers.ILabelDecorator"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiInfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/plugins/org.eclipse.php.ui/src/org/eclipse/php/ui/util/PHPUILabelProvider.java b/plugins/org.eclipse.php.ui/src/org/eclipse/php/ui/util/PHPUILabelProvider.java
index 12387a60b..e9fb89257 100644
--- a/plugins/org.eclipse.php.ui/src/org/eclipse/php/ui/util/PHPUILabelProvider.java
+++ b/plugins/org.eclipse.php.ui/src/org/eclipse/php/ui/util/PHPUILabelProvider.java
@@ -13,6 +13,9 @@ package org.eclipse.php.ui.util;
import java.util.ArrayList;
import org.eclipse.core.resources.IStorage;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.viewers.IColorProvider;
import org.eclipse.jface.viewers.ILabelDecorator;
import org.eclipse.jface.viewers.ILabelProviderListener;
@@ -31,13 +34,13 @@ public class PHPUILabelProvider extends LabelProvider implements IColorProvider
private int fImageFlags;
private int fTextFlags;
- IPHPTreeContentProvider []treeProviders;
-
+ IPHPTreeContentProvider[] treeProviders;
+
/**
* Creates a new label provider with default flags.
*/
public PHPUILabelProvider() {
- this(PHPElementLabels.M_PARAMETER_TYPES | PHPElementLabels.M_PARAMETER_NAMES, PHPElementImageProvider.OVERLAY_ICONS | PHPElementImageProvider.SMALL_ICONS);
+ this(PHPElementLabels.M_PARAMETER_TYPES | PHPElementLabels.M_PARAMETER_NAMES, PHPElementImageProvider.OVERLAY_ICONS | PHPElementImageProvider.SMALL_ICONS);
}
/**
@@ -51,14 +54,29 @@ public class PHPUILabelProvider extends LabelProvider implements IColorProvider
fStorageLabelProvider = new StorageLabelProvider();
fImageFlags = imageFlags;
fTextFlags = textFlags;
+
+ initExtensions();
}
-
- public void setTreeProviders(IPHPTreeContentProvider []providers)
- {
- this.treeProviders=providers;
+ private void initExtensions() {
+ IConfigurationElement[] elements = Platform.getExtensionRegistry().getConfigurationElementsFor("org.eclipse.php.ui.phpLabelDecorator");
+ for (int i = 0; i < elements.length; i++) {
+ IConfigurationElement element = elements[i];
+ if (element.getName().equals("PHPLabelDecorator")) {
+ try {
+ ILabelDecorator decorator = (ILabelDecorator) element.createExecutableExtension("class");
+ addLabelDecorator(decorator);
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ }
+ }
}
-
+
+ public void setTreeProviders(IPHPTreeContentProvider[] providers) {
+ this.treeProviders = providers;
+ }
+
/**
* Adds a decorator to the label provider
*/
@@ -131,10 +149,9 @@ public class PHPUILabelProvider extends LabelProvider implements IColorProvider
public Image getImage(Object element) {
Image result = fImageLabelProvider.getImageLabel(element, evaluateImageFlags(element));
- if (result==null && treeProviders!=null)
- {
- for (int i = 0; i < treeProviders.length&&result==null; i++) {
- result=treeProviders[i].getImage(element);
+ if (result == null && treeProviders != null) {
+ for (int i = 0; i < treeProviders.length && result == null; i++) {
+ result = treeProviders[i].getImage(element);
}
}
if (result == null && (element instanceof IStorage)) {
@@ -156,15 +173,14 @@ public class PHPUILabelProvider extends LabelProvider implements IColorProvider
public String getText(Object element) {
String result = PHPElementLabels.getTextLabel(element, evaluateTextFlags(element));
- if (result.length() == 0 && treeProviders!=null)
- {
+ if (result.length() == 0 && treeProviders != null) {
for (int i = 0; i < treeProviders.length; i++) {
- result=treeProviders[i].getText(element);
- if (result!=null && result.length()>0)
+ result = treeProviders[i].getText(element);
+ if (result != null && result.length() > 0)
break;
}
- if (result==null)
- result="";
+ if (result == null)
+ result = "";
}
if (result.length() == 0 && (element instanceof IStorage)) {
result = fStorageLabelProvider.getText(element);

Back to the top