aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorszarnekow2009-02-13 05:13:56 (EST)
committersefftinge2009-02-13 05:13:56 (EST)
commita74fa98862010c7771522356bf1152d96f355707 (patch)
tree1699b3cc3ff43f774981265090a4d0140cedeb4d
parent0a27ae9927c4fd791e3f2caaea251577a6c812e4 (diff)
downloadorg.eclipse.xtext-a74fa98862010c7771522356bf1152d96f355707.zip
org.eclipse.xtext-a74fa98862010c7771522356bf1152d96f355707.tar.gz
org.eclipse.xtext-a74fa98862010c7771522356bf1152d96f355707.tar.bz2
Fix: Added missing Named-Annotation and use Constants.LANGUAGE_NAME instead of literal
-rw-r--r--plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/editor/syntaxcoloring/AbstractTokenScanner.java4
-rw-r--r--plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/editor/syntaxcoloring/DefaultTokenScanner.java4
-rw-r--r--plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/editor/syntaxcoloring/SyntaxColoringPreferencePage.java9
-rw-r--r--plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/editor/syntaxcoloring/antlr/AntlrTokenScanner.java20
-rw-r--r--plugins/org.eclipse.xtext.ui.core/src/org/eclipse/xtext/ui/core/editor/preferences/AbstractPreferencePage.java16
5 files changed, 30 insertions, 23 deletions
diff --git a/plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/editor/syntaxcoloring/AbstractTokenScanner.java b/plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/editor/syntaxcoloring/AbstractTokenScanner.java
index f7d7c3c..b950d00 100644
--- a/plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/editor/syntaxcoloring/AbstractTokenScanner.java
+++ b/plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/editor/syntaxcoloring/AbstractTokenScanner.java
@@ -13,6 +13,7 @@ import org.eclipse.jface.text.rules.ITokenScanner;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Font;
import org.eclipse.ui.PlatformUI;
+import org.eclipse.xtext.Constants;
import org.eclipse.xtext.ui.core.editor.preferences.PreferenceConstants;
import org.eclipse.xtext.ui.core.editor.utils.TextStyle;
@@ -27,7 +28,8 @@ public abstract class AbstractTokenScanner implements ITokenScanner {
private final PreferenceStoreAccessor preferenceStoreAccessor;
- protected AbstractTokenScanner(final @Named("languageName") String languageName,
+ protected AbstractTokenScanner(
+ final @Named(Constants.LANGUAGE_NAME) String languageName,
final Provider<SyntaxColoringPreferencePage> preferencePageProvider,
final PreferenceStoreAccessor accessor) {
this.preferenceStoreAccessor = accessor;
diff --git a/plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/editor/syntaxcoloring/DefaultTokenScanner.java b/plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/editor/syntaxcoloring/DefaultTokenScanner.java
index 68f3e3d..996469c 100644
--- a/plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/editor/syntaxcoloring/DefaultTokenScanner.java
+++ b/plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/editor/syntaxcoloring/DefaultTokenScanner.java
@@ -10,6 +10,7 @@ package org.eclipse.xtext.ui.common.editor.syntaxcoloring;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.rules.IToken;
import org.eclipse.jface.text.rules.Token;
+import org.eclipse.xtext.Constants;
import com.google.inject.Inject;
import com.google.inject.Provider;
@@ -21,7 +22,8 @@ import com.google.inject.name.Named;
public class DefaultTokenScanner extends AbstractTokenScanner {
@Inject
- public DefaultTokenScanner(final @Named("languageName") String languageName,
+ public DefaultTokenScanner(
+ final @Named(Constants.LANGUAGE_NAME) String languageName,
final Provider<SyntaxColoringPreferencePage> preferencePageProvider,
final PreferenceStoreAccessor accessor) {
super(languageName, preferencePageProvider, accessor);
diff --git a/plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/editor/syntaxcoloring/SyntaxColoringPreferencePage.java b/plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/editor/syntaxcoloring/SyntaxColoringPreferencePage.java
index d091244..8ce9bdc 100644
--- a/plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/editor/syntaxcoloring/SyntaxColoringPreferencePage.java
+++ b/plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/editor/syntaxcoloring/SyntaxColoringPreferencePage.java
@@ -11,13 +11,11 @@ package org.eclipse.xtext.ui.common.editor.syntaxcoloring;
import java.util.Arrays;
import java.util.List;
-import org.eclipse.xtext.Constants;
import org.eclipse.xtext.ui.common.editor.preferencepage.CommonPreferenceConstants;
import org.eclipse.xtext.ui.core.editor.preferences.AbstractPreferencePage;
import org.eclipse.xtext.ui.core.editor.utils.TextStyle;
import com.google.inject.Inject;
-import com.google.inject.name.Named;
/**
* @author Dennis Hübner - Initial contribution and API
@@ -27,16 +25,13 @@ public class SyntaxColoringPreferencePage extends AbstractPreferencePage {
@Inject
private ITokenStyleProvider tokenStyleProvider;
-
+
@Inject
private PreferenceStoreAccessor preferenceStoreAccessor;
-
- @Inject @Named(Constants.LANGUAGE_NAME)
- private String languageName;
@Override
protected String qualifiedName() {
- return PreferenceStoreAccessor.syntaxColorerTag(languageName);
+ return PreferenceStoreAccessor.syntaxColorerTag(getLanguageName());
}
@Override
diff --git a/plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/editor/syntaxcoloring/antlr/AntlrTokenScanner.java b/plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/editor/syntaxcoloring/antlr/AntlrTokenScanner.java
index c172f19..2480f57 100644
--- a/plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/editor/syntaxcoloring/antlr/AntlrTokenScanner.java
+++ b/plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/editor/syntaxcoloring/antlr/AntlrTokenScanner.java
@@ -13,6 +13,7 @@ import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.rules.IToken;
import org.eclipse.jface.text.rules.Token;
+import org.eclipse.xtext.Constants;
import org.eclipse.xtext.parser.antlr.Lexer;
import org.eclipse.xtext.ui.common.editor.syntaxcoloring.AbstractTokenScanner;
import org.eclipse.xtext.ui.common.editor.syntaxcoloring.PreferenceStoreAccessor;
@@ -20,6 +21,7 @@ import org.eclipse.xtext.ui.common.editor.syntaxcoloring.SyntaxColoringPreferenc
import com.google.inject.Inject;
import com.google.inject.Provider;
+import com.google.inject.name.Named;
/**
* Default implementation for the ITokenScanner. Uses an AntLR based
@@ -29,19 +31,23 @@ import com.google.inject.Provider;
public class AntlrTokenScanner extends AbstractTokenScanner {
@Inject
- public AntlrTokenScanner(String languageName, Provider<SyntaxColoringPreferencePage> preferencePageProvider,
- PreferenceStoreAccessor accessor,ITokenColorer tokenColorer,Lexer lexer) {
+ public AntlrTokenScanner(
+ final @Named(Constants.LANGUAGE_NAME) String languageName,
+ final Provider<SyntaxColoringPreferencePage> preferencePageProvider,
+ final PreferenceStoreAccessor accessor,
+ final ITokenColorer tokenColorer,
+ final Lexer lexer) {
super(languageName, preferencePageProvider, accessor);
this.tokenColorer = tokenColorer;
this.lexer = lexer;
}
- private ITokenColorer tokenColorer;
-
- private Lexer lexer;
+ private final ITokenColorer tokenColorer;
+
+ private final Lexer lexer;
private int dirtyRegionOffset;
-
+
private CommonToken currentAntlrToken;
public int getTokenLength() {
@@ -54,7 +60,7 @@ public class AntlrTokenScanner extends AbstractTokenScanner {
public IToken nextToken() {
currentAntlrToken = (CommonToken) lexer.nextToken();
- if (currentAntlrToken.getType() == CommonToken.EOF) {
+ if (currentAntlrToken.getType() == org.antlr.runtime.Token.EOF) {
return Token.EOF;
}
return new Token(createTextAttribute(tokenColorer.getTokenStyle(Integer.toString(currentAntlrToken.getType()))));
diff --git a/plugins/org.eclipse.xtext.ui.core/src/org/eclipse/xtext/ui/core/editor/preferences/AbstractPreferencePage.java b/plugins/org.eclipse.xtext.ui.core/src/org/eclipse/xtext/ui/core/editor/preferences/AbstractPreferencePage.java
index d073937..d8e1f17 100644
--- a/plugins/org.eclipse.xtext.ui.core/src/org/eclipse/xtext/ui/core/editor/preferences/AbstractPreferencePage.java
+++ b/plugins/org.eclipse.xtext.ui.core/src/org/eclipse/xtext/ui/core/editor/preferences/AbstractPreferencePage.java
@@ -47,7 +47,7 @@ import com.google.inject.name.Named;
/**
* @author Dennis Hübner - Initial contribution and API
- *
+ *
*/
public abstract class AbstractPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage,
IWorkbenchPropertyPage {
@@ -60,7 +60,7 @@ public abstract class AbstractPreferencePage extends FieldEditorPreferencePage i
private IProject project;
private Button useProjectSettingsButton;
- private List<FieldEditor> editors = new ArrayList<FieldEditor>();
+ private final List<FieldEditor> editors = new ArrayList<FieldEditor>();
private Link link;
@@ -119,7 +119,7 @@ public abstract class AbstractPreferencePage extends FieldEditorPreferencePage i
/*
* (non-Javadoc)
- *
+ *
* @see
* org.eclipse.jface.preference.FieldEditorPreferencePage#createContents
* (org.eclipse.swt.widgets.Composite)
@@ -155,6 +155,7 @@ public abstract class AbstractPreferencePage extends FieldEditorPreferencePage i
link.setFont(projectSettingsParent.getFont());
link.setText("<A>" + "Configure Workspace Settings..." + "</A>"); //$NON-NLS-1$//$NON-NLS-3$
link.addSelectionListener(new SelectionAdapter() {
+ @Override
public void widgetSelected(SelectionEvent e) {
String id = qualifiedName();
PreferencesUtil.createPreferenceDialogOn(getShell(), id, new String[] { id }, null).open();
@@ -182,7 +183,7 @@ public abstract class AbstractPreferencePage extends FieldEditorPreferencePage i
throw new IllegalStateException("Not a property page case, but current project was requested.");
return project;
}
-
+
@Inject @Named("languageName")
private String languageName;
@@ -192,7 +193,7 @@ public abstract class AbstractPreferencePage extends FieldEditorPreferencePage i
/*
* (non-Javadoc)
- *
+ *
* @see
* org.eclipse.jface.preference.PreferencePage#createControl(org.eclipse
* .swt.widgets.Composite)
@@ -204,6 +205,7 @@ public abstract class AbstractPreferencePage extends FieldEditorPreferencePage i
handleUseProjectSettings();
}
+ @Override
protected void addField(FieldEditor editor) {
editor.setPreferenceName(qualifiedName() + "." + editor.getPreferenceName());
editors.add(editor);
@@ -230,7 +232,7 @@ public abstract class AbstractPreferencePage extends FieldEditorPreferencePage i
Composite parent = getFieldEditorParent();
Iterator<FieldEditor> it = editors.iterator();
while (it.hasNext()) {
- FieldEditor editor = (FieldEditor) it.next();
+ FieldEditor editor = it.next();
if (enabled)
editor.load();
else
@@ -241,7 +243,7 @@ public abstract class AbstractPreferencePage extends FieldEditorPreferencePage i
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.jface.preference.FieldEditorPreferencePage#performOk()
*/
@Override