[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [pdt-dev] org.eclipse.wst.sse.ui.semanticHighlighting extension

hi,

Does this patch work?

2011/6/27 Robert GrÃndler <r.gruendler@xxxxxxxxx>
Hi again,

i tried to follow the Wiki entry to add SemanticHighlighting to my plugin for
PHP Annotations:

http://wiki.eclipse.org/PDT/Dev2Dev/Semantic

by adding an extension point like this:

<extension
   point="org.eclipse.wst.sse.ui.semanticHighlighting">
<highlighting
    Âclass="org.eclipse.symfony.ui.editor.highlighting.AnnotationHighlighting"
    Âtarget="org.eclipse.php.core.phpsource">
</highlighting>
</extension>

I'm getting a ClassNotFoundException during startup for org.eclipse.symfony.ui.editor.highlighting.AnnotationHighlighting,
although my plugin is exporting the necessary packages.

According to the eclipse irc channel, the way the SemanticHighlighting extensions are loaded by the PDT plugin will only work for internal pdt-bundle classes (in SemanticHighlightingManager line 71).

Is this a bug in PDT or am i just not providing the extension point correctly?

thanks!

-robert




_______________________________________________
pdt-dev mailing list
pdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/pdt-dev



--

Thanks!

Best Regards!

Zhao
### Eclipse Workspace Patch 1.0
#P org.eclipse.php.ui
Index: src/org/eclipse/php/internal/ui/editor/SemanticHighlightingManager.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/editor/SemanticHighlightingManager.java,v
retrieving revision 1.7
diff -u -r1.7 SemanticHighlightingManager.java
--- src/org/eclipse/php/internal/ui/editor/SemanticHighlightingManager.java	21 Apr 2011 06:28:23 -0000	1.7
+++ src/org/eclipse/php/internal/ui/editor/SemanticHighlightingManager.java	27 Jun 2011 12:20:21 -0000
@@ -55,29 +55,13 @@
 		}
 	}
 
-	@SuppressWarnings("unchecked")
-	private SemanticHighlightingManager loadSemanticHighlighter(String className)
-			throws Exception {
-		Class<? extends AbstractSemanticHighlighting> clazz = (Class<? extends AbstractSemanticHighlighting>) Class
-				.forName(className);
-		return loadSemanticHighlighter(clazz);
-	}
-
-	private SemanticHighlightingManager loadSemanticHighlighter(
-			Class<? extends AbstractSemanticHighlighting> clazz)
-			throws Exception {
-		AbstractSemanticHighlighting instance = clazz.newInstance();
-		rules.add(instance);
-		return this;
-	}
-
 	private SemanticHighlightingManager loadContributor(
 			IConfigurationElement[] elements) throws Exception {
 		for (IConfigurationElement element : elements) {
 			String target = element.getAttribute("target");
 			if ("org.eclipse.php.core.phpsource".equals(target)) {
-				String className = element.getAttribute("class");
-				loadSemanticHighlighter(className);
+				rules.add((AbstractSemanticHighlighting) element
+						.createExecutableExtension("class"));
 			}
 		}
 		return this;
@@ -99,18 +83,21 @@
 		for (AbstractSemanticHighlighting rule : semanticHighlightings) {
 			rule.initDefaultPreferences();
 			SemanticHighlightingStyle style = rule.getStyle();
-			setDefaultAndFireEvent(store, rule.getColorPreferenceKey(), style
-					.getDefaultTextColor());
-			store.setDefault(rule.getBoldPreferenceKey(), style
-					.isBoldByDefault());
-			store.setDefault(rule.getItalicPreferenceKey(), style
-					.isItalicByDefault());
-			store.setDefault(rule.getStrikethroughPreferenceKey(), style
-					.isStrikethroughByDefault());
-			store.setDefault(rule.getUnderlinePreferenceKey(), style
-					.isUnderlineByDefault());
-			store.setDefault(rule.getEnabledPreferenceKey(), style
-					.isEnabledByDefault());
+			setDefaultAndFireEvent(store, rule.getColorPreferenceKey(),
+					style.getDefaultTextColor());
+			// setDefaultAndFireEvent(store,
+			// rule.getBackgroundColorPreferenceKey(), style
+			// .);
+			store.setDefault(rule.getBoldPreferenceKey(),
+					style.isBoldByDefault());
+			store.setDefault(rule.getItalicPreferenceKey(),
+					style.isItalicByDefault());
+			store.setDefault(rule.getStrikethroughPreferenceKey(),
+					style.isStrikethroughByDefault());
+			store.setDefault(rule.getUnderlinePreferenceKey(),
+					style.isUnderlineByDefault());
+			store.setDefault(rule.getEnabledPreferenceKey(),
+					style.isEnabledByDefault());
 		}
 		return this;
 	}