From be4f78978faba3d3ceb88df02a7f93a2e09ff1e0 Mon Sep 17 00:00:00 2001 From: Kenji Hosokawa Date: Tue, 3 Aug 2021 18:42:39 +0900 Subject: Initial commit Bug-AGL: SPEC-4033 Signed-off-by: Kenji Hosokawa --- .../RBAModelAntlrTokenToAttributeIdMapper.xtend | 14 +++++++++++ .../RBAModelHighlightingConfiguration.xtend | 27 ++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 rba.tool.editor.ui/src/rba/tool/editor/ui/syntaxcoloring/RBAModelAntlrTokenToAttributeIdMapper.xtend create mode 100644 rba.tool.editor.ui/src/rba/tool/editor/ui/syntaxcoloring/RBAModelHighlightingConfiguration.xtend (limited to 'rba.tool.editor.ui/src/rba/tool/editor/ui/syntaxcoloring') diff --git a/rba.tool.editor.ui/src/rba/tool/editor/ui/syntaxcoloring/RBAModelAntlrTokenToAttributeIdMapper.xtend b/rba.tool.editor.ui/src/rba/tool/editor/ui/syntaxcoloring/RBAModelAntlrTokenToAttributeIdMapper.xtend new file mode 100644 index 0000000..f4118b9 --- /dev/null +++ b/rba.tool.editor.ui/src/rba/tool/editor/ui/syntaxcoloring/RBAModelAntlrTokenToAttributeIdMapper.xtend @@ -0,0 +1,14 @@ +package rba.tool.editor.ui.syntaxcoloring + +import org.eclipse.xtext.ui.editor.syntaxcoloring.DefaultAntlrTokenToAttributeIdMapper + +class RBAModelAntlrTokenToAttributeIdMapper extends DefaultAntlrTokenToAttributeIdMapper { + + override protected calculateId(String tokenName, int tokenType) { + if ("\'Area\'".equals(tokenName)) { + return RBAModelHighlightingConfiguration.AREA; + } + return super.calculateId(tokenName, tokenType); + } + +} diff --git a/rba.tool.editor.ui/src/rba/tool/editor/ui/syntaxcoloring/RBAModelHighlightingConfiguration.xtend b/rba.tool.editor.ui/src/rba/tool/editor/ui/syntaxcoloring/RBAModelHighlightingConfiguration.xtend new file mode 100644 index 0000000..266be2a --- /dev/null +++ b/rba.tool.editor.ui/src/rba/tool/editor/ui/syntaxcoloring/RBAModelHighlightingConfiguration.xtend @@ -0,0 +1,27 @@ +package rba.tool.editor.ui.syntaxcoloring + +import org.eclipse.swt.SWT +import org.eclipse.swt.graphics.RGB +import org.eclipse.xtext.ui.editor.syntaxcoloring.DefaultHighlightingConfiguration +import org.eclipse.xtext.ui.editor.syntaxcoloring.IHighlightingConfigurationAcceptor +import org.eclipse.xtext.ui.editor.utils.TextStyle + +class RBAModelHighlightingConfiguration extends DefaultHighlightingConfiguration { + + public static final String AREA = "Area"; + + override public void configure(IHighlightingConfigurationAcceptor acceptor) { + super.configure(acceptor); + acceptor.acceptDefaultHighlighting(AREA, "Area", areaStyle()); + } + + def public TextStyle areaStyle() { + val textStyle = defaultTextStyle().copy(); + //val color = JFaceResources.getColorRegistry().getRGB(JFacePreferences.ACTIVE_HYPERLINK_COLOR); + textStyle.color = new RGB(0, 0, 255); + //val backgroundColor = JFaceResources.getColorRegistry().getRGB(JFacePreferences.CONTENT_ASSIST_FOREGROUND_COLOR); + //textStyle.backgroundColor = backgroundColor; + textStyle.setStyle(SWT.BOLD); + return textStyle; + } +} \ No newline at end of file -- cgit 1.2.3-korg