/** * Copyright (c) 2011 - 2014, Hans Georg Glöckler, Loetz KG (Heidelberg) * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html */ package org.lunifera.dsl.entity.xtext.ui; 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 EntityHighlightingConfiguration implements IHighlightingConfiguration { public static final String COMMENT_ID = "comment"; public static final String KEYWORD_ID = "keyword"; public static final String MODIFIER_ID = "modifier"; public static final String STRING_ID = "string"; public static final String NUMBER_ID = "number"; public static final String DEFAULT_ID = "default"; public static final String INVALID_TOKEN_ID = "error"; public void configure(IHighlightingConfigurationAcceptor acceptor) { acceptor.acceptDefaultHighlighting(DEFAULT_ID, "Default", defaultTextStyle()); acceptor.acceptDefaultHighlighting(COMMENT_ID, "Comment", commentTextStyle()); acceptor.acceptDefaultHighlighting(KEYWORD_ID, "Keyword", keywordTextStyle()); acceptor.acceptDefaultHighlighting(MODIFIER_ID, "Modifier", modifierTextStyle()); acceptor.acceptDefaultHighlighting(STRING_ID, "String", stringTextStyle()); acceptor.acceptDefaultHighlighting(NUMBER_ID, "Number", numberTextStyle()); acceptor.acceptDefaultHighlighting(INVALID_TOKEN_ID, "Invalid Symbol", errorTextStyle()); } public TextStyle defaultTextStyle() { TextStyle textStyle = new TextStyle(); textStyle.setBackgroundColor(new RGB(255, 255, 255)); textStyle.setColor(new RGB(0, 0, 0)); return textStyle; } public TextStyle commentTextStyle() { TextStyle textStyle = defaultTextStyle().copy(); textStyle.setColor(new RGB(63, 127, 95)); return textStyle; } public TextStyle keywordTextStyle() { TextStyle textStyle = defaultTextStyle().copy(); textStyle.setColor(new RGB(127, 0, 85)); textStyle.setStyle(SWT.BOLD); return textStyle; } public TextStyle modifierTextStyle() { TextStyle textStyle = defaultTextStyle().copy(); textStyle.setColor(new RGB(127, 0, 85)); textStyle.setStyle(SWT.BOLD); return textStyle; } public TextStyle stringTextStyle() { TextStyle textStyle = defaultTextStyle().copy(); textStyle.setColor(new RGB(42, 0, 255)); return textStyle; } public TextStyle errorTextStyle() { TextStyle textStyle = defaultTextStyle().copy(); return textStyle; } public TextStyle numberTextStyle() { TextStyle textStyle = defaultTextStyle().copy(); textStyle.setColor(new RGB(125, 125, 125)); return textStyle; } }