Lexical Hightlighting [message #890197] |
Thu, 21 June 2012 08:28  |
Eclipse User |
|
|
|
Hey,
I have implemented Lexical Highlighting in my Grammar but it don't work.
I want to can customize preference page for my DSL like described in:
http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/extension-points/org_eclipse_core_runtime_contentTypes.html.
Please can you help me why it don't work.
package org.lunifera.metamodel.dsl.jpa.ui.labeling;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.xtext.ui.editor.syntaxcoloring.IHighlightingConfiguration;
import org.eclipse.xtext.ui.editor.syntaxcoloring.IHighlightingConfigurationAcceptor;
import org.eclipse.xtext.ui.editor.utils.TextStyle;
public class JpaHighlightingConfiguration implements IHighlightingConfiguration {
public static final String JPA_ANNOTATION_ID = "jpaAnnotation";
public void configure(IHighlightingConfigurationAcceptor acceptor) {
acceptor.acceptDefaultHighlighting(JPA_ANNOTATION_ID, "JpaAnnotation",
annotationTextStyle());
}
public TextStyle annotationTextStyle() {
TextStyle textStyle = new TextStyle();
textStyle.setColor(new RGB(100, 100, 100));
textStyle.setStyle(SWT.ITALIC);
return textStyle;
}
}
package org.lunifera.metamodel.dsl.jpa.ui;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.eclipse.xtext.ui.editor.syntaxcoloring.IHighlightingConfiguration;
import org.eclipse.xtext.ui.editor.syntaxcoloring.ISemanticHighlightingCalculator;
import org.lunifera.metamodel.dsl.jpa.ui.labeling.JpaHighlightingConfiguration;
import org.lunifera.metamodel.dsl.jpa.ui.labeling.JpaSemanticHighlightingCalculator;
import com.google.inject.Binder;
/**
* Use this class to register components to be used within the IDE.
*/
public class JpaUiModule extends
org.lunifera.metamodel.dsl.jpa.ui.AbstractJpaUiModule {
public JpaUiModule(AbstractUIPlugin plugin) {
super(plugin);
}
@Override
public void configure(Binder binder) {
super.configure(binder);
}
public Class<? extends IHighlightingConfiguration> bindIHighlightingConfiguration() {
return JpaHighlightingConfiguration.class;
}
public Class<? extends ISemanticHighlightingCalculator> bindISemanticHighlightingCalculator() {
return JpaSemanticHighlightingCalculator.class;
}
}
I use Xtext 2.3 with XbaseWithAnnotations
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.06004 seconds