Fixed: [ Issue 76 ] Syntax Coloring entity names are not consistent with other languages (C++, Java) https://code.google.com/p/protobuf-dt/issues/detail?id=76
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/ProtobufUiModule.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/ProtobufUiModule.java index a8b5b8e..d8d1779 100644 --- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/ProtobufUiModule.java +++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/ProtobufUiModule.java
@@ -11,23 +11,12 @@ import static com.google.inject.name.Names.named; import static org.eclipse.ui.PlatformUI.isWorkbenchRunning; -import org.eclipse.jface.text.hyperlink.IHyperlinkDetector; -import org.eclipse.ui.*; -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.eclipse.ui.views.contentoutline.IContentOutlinePage; -import org.eclipse.xtext.ui.LanguageSpecific; -import org.eclipse.xtext.ui.editor.*; -import org.eclipse.xtext.ui.editor.model.XtextDocumentProvider; -import org.eclipse.xtext.ui.editor.outline.actions.IOutlineContribution; -import org.eclipse.xtext.ui.editor.preferences.*; -import org.eclipse.xtext.ui.editor.syntaxcoloring.ISemanticHighlightingCalculator; - import com.google.eclipse.protobuf.scoping.IFileUriResolver; import com.google.eclipse.protobuf.ui.builder.AutoAddNatureEditorCallback; import com.google.eclipse.protobuf.ui.editor.ProtobufUriEditorOpener; import com.google.eclipse.protobuf.ui.editor.hyperlinking.ProtobufHyperlinkDetector; import com.google.eclipse.protobuf.ui.editor.model.ProtobufDocumentProvider; -import com.google.eclipse.protobuf.ui.editor.syntaxcoloring.ProtobufSemanticHighlightingCalculator; +import com.google.eclipse.protobuf.ui.editor.syntaxcoloring.*; import com.google.eclipse.protobuf.ui.internal.ProtobufActivator; import com.google.eclipse.protobuf.ui.outline.*; import com.google.eclipse.protobuf.ui.preferences.PreferenceStoreAccess; @@ -38,6 +27,17 @@ import com.google.eclipse.protobuf.ui.validation.ValidateOnActivation; import com.google.inject.Binder; +import org.eclipse.jface.text.hyperlink.IHyperlinkDetector; +import org.eclipse.ui.*; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.eclipse.ui.views.contentoutline.IContentOutlinePage; +import org.eclipse.xtext.ui.LanguageSpecific; +import org.eclipse.xtext.ui.editor.*; +import org.eclipse.xtext.ui.editor.model.XtextDocumentProvider; +import org.eclipse.xtext.ui.editor.outline.actions.IOutlineContribution; +import org.eclipse.xtext.ui.editor.preferences.*; +import org.eclipse.xtext.ui.editor.syntaxcoloring.*; + /** * Use this class to register components to be used within the IDE. * @@ -115,4 +115,8 @@ public void configurePreferenceStoreAccess(Binder binder) { binder.bind(IPreferenceStoreAccess.class).to(PreferenceStoreAccess.class); } + + public void configureHighlightingConfiguration(Binder binder) { + binder.bind(IHighlightingConfiguration.class).to(HighlightingConfiguration.class); + } }
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/editor/syntaxcoloring/HighlightingConfiguration.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/editor/syntaxcoloring/HighlightingConfiguration.java new file mode 100644 index 0000000..0daf9ca --- /dev/null +++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/editor/syntaxcoloring/HighlightingConfiguration.java
@@ -0,0 +1,30 @@ +/* + * Copyright (c) 2011 Google Inc. + * + * 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 com.google.eclipse.protobuf.ui.editor.syntaxcoloring; + +import static com.google.eclipse.protobuf.ui.editor.syntaxcoloring.Messages.*; + +import org.eclipse.xtext.ui.editor.syntaxcoloring.*; + +/** + * @author alruiz@google.com (Alex Ruiz) + */ +public class HighlightingConfiguration extends DefaultHighlightingConfiguration { + + @Override public void configure(IHighlightingConfigurationAcceptor acceptor) { + acceptor.acceptDefaultHighlighting(KEYWORD_ID, keywords, keywordTextStyle()); + acceptor.acceptDefaultHighlighting(PUNCTUATION_ID, punctuationCharacters, punctuationTextStyle()); + acceptor.acceptDefaultHighlighting(COMMENT_ID, comments, commentTextStyle()); + acceptor.acceptDefaultHighlighting(STRING_ID, strings, stringTextStyle()); + acceptor.acceptDefaultHighlighting(NUMBER_ID, numbers, numberTextStyle()); + acceptor.acceptDefaultHighlighting(DEFAULT_ID, defaults, defaultTextStyle()); + acceptor.acceptDefaultHighlighting(INVALID_TOKEN_ID, invalidSymbols, errorTextStyle()); + } + +}
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/editor/syntaxcoloring/Messages.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/editor/syntaxcoloring/Messages.java new file mode 100644 index 0000000..4b00690 --- /dev/null +++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/editor/syntaxcoloring/Messages.java
@@ -0,0 +1,33 @@ +/* + * Copyright (c) 2011 Google Inc. + * + * 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 com.google.eclipse.protobuf.ui.editor.syntaxcoloring; + +import org.eclipse.osgi.util.NLS; + +/** + * @author alruiz@google.com (Alex Ruiz) + */ +public class Messages extends NLS { + + public static String comments; + public static String defaults; + public static String invalidSymbols; + public static String keywords; + public static String numbers; + public static String punctuationCharacters; + public static String strings; + + static { + // initialize resource bundle + Class<Messages> type = Messages.class; + NLS.initializeMessages(type.getName(), type); + } + + private Messages() {} +}
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/editor/syntaxcoloring/Messages.properties b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/editor/syntaxcoloring/Messages.properties new file mode 100644 index 0000000..29861d4 --- /dev/null +++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/editor/syntaxcoloring/Messages.properties
@@ -0,0 +1,7 @@ +comments=Comments +defaults=Defaults +invalidSymbols=Invalid Symbols +keywords=Keywords +numbers=Numbers +punctuationCharacters=Punctuation characters +strings=Strings