Code cleanup.
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 bab7f24..c69af20 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
@@ -48,7 +48,7 @@
import com.google.eclipse.protobuf.ui.preferences.editor.numerictag.core.NumericTagPreferenceStoreInitializer;
import com.google.eclipse.protobuf.ui.preferences.editor.save.core.SaveActionsPreferenceStoreInitializer;
import com.google.eclipse.protobuf.ui.preferences.general.core.GeneralPreferenceStoreInitializer;
-import com.google.eclipse.protobuf.ui.preferences.parser.core.ParserChecksPreferenceStoreInitializer;
+import com.google.eclipse.protobuf.ui.preferences.misc.core.MiscellaneousPreferenceStoreInitializer;
import com.google.eclipse.protobuf.ui.preferences.paths.core.PathsPreferenceStoreInitializer;
import com.google.eclipse.protobuf.ui.quickfix.ProtobufQuickAssistProcessor;
import com.google.eclipse.protobuf.ui.scoping.FileUriResolver;
@@ -136,7 +136,7 @@
configurePreferenceInitializer(binder, "compilerPreferences", CompilerPreferenceStoreInitializer.class);
configurePreferenceInitializer(binder, "generalPreferences", GeneralPreferenceStoreInitializer.class);
configurePreferenceInitializer(binder, "numericTagPreferences", NumericTagPreferenceStoreInitializer.class);
- configurePreferenceInitializer(binder, "parserChecksPreferences", ParserChecksPreferenceStoreInitializer.class);
+ configurePreferenceInitializer(binder, "parserChecksPreferences", MiscellaneousPreferenceStoreInitializer.class);
configurePreferenceInitializer(binder, "pathsPreferences", PathsPreferenceStoreInitializer.class);
configurePreferenceInitializer(binder, "saveActionsPreferences", SaveActionsPreferenceStoreInitializer.class);
}
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/parser/PreferenceDrivenProtobufParser.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/parser/PreferenceDrivenProtobufParser.java
index 8d09e77..bc32bf4 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/parser/PreferenceDrivenProtobufParser.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/parser/PreferenceDrivenProtobufParser.java
@@ -11,7 +11,7 @@
import com.google.eclipse.protobuf.parser.NonProto2Protobuf;
import com.google.eclipse.protobuf.parser.antlr.ProtobufParser;
import com.google.eclipse.protobuf.protobuf.Protobuf;
-import com.google.eclipse.protobuf.ui.preferences.parser.core.ParserChecksPreferences;
+import com.google.eclipse.protobuf.ui.preferences.misc.core.MiscellaneousPreferences;
import com.google.inject.Inject;
import org.antlr.runtime.CharStream;
@@ -28,8 +28,8 @@
@Override protected IParseResult doParse(String ruleName, CharStream in, NodeModelBuilder builder,
int initialLookAhead) {
IParseResult result = super.doParse(ruleName, in, builder, initialLookAhead);
- ParserChecksPreferences preferences = new ParserChecksPreferences(storeAccess);
- if (preferences.enableProto2OnlyChecks().getValue() && isNotProto2(result)) {
+ MiscellaneousPreferences preferences = new MiscellaneousPreferences(storeAccess);
+ if (preferences.isGoogleInternal().getValue() && isNotProto2(result)) {
return new ParseResult(new NonProto2Protobuf(), result.getRootNode(), false);
}
return result;
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/parser/core/ParserChecksPreferenceStoreInitializer.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/misc/core/MiscellaneousPreferenceStoreInitializer.java
similarity index 63%
rename from com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/parser/core/ParserChecksPreferenceStoreInitializer.java
rename to com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/misc/core/MiscellaneousPreferenceStoreInitializer.java
index 240342a..0d394fe 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/parser/core/ParserChecksPreferenceStoreInitializer.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/misc/core/MiscellaneousPreferenceStoreInitializer.java
@@ -6,7 +6,7 @@
*
* http://www.eclipse.org/legal/epl-v10.html
*/
-package com.google.eclipse.protobuf.ui.preferences.parser.core;
+package com.google.eclipse.protobuf.ui.preferences.misc.core;
import org.eclipse.xtext.ui.editor.preferences.*;
@@ -15,9 +15,9 @@
*
* @author alruiz@google.com (Alex Ruiz)
*/
-public class ParserChecksPreferenceStoreInitializer implements IPreferenceStoreInitializer {
+public class MiscellaneousPreferenceStoreInitializer implements IPreferenceStoreInitializer {
@Override public void initialize(IPreferenceStoreAccess storeAccess) {
- ParserChecksPreferences preferences = new ParserChecksPreferences(storeAccess);
- preferences.enableProto2OnlyChecks().setDefaultValue(false);
+ MiscellaneousPreferences preferences = new MiscellaneousPreferences(storeAccess);
+ preferences.isGoogleInternal().setDefaultValue(false);
}
}
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/misc/core/MiscellaneousPreferences.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/misc/core/MiscellaneousPreferences.java
new file mode 100644
index 0000000..a4f2aed
--- /dev/null
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/misc/core/MiscellaneousPreferences.java
@@ -0,0 +1,47 @@
+/*
+ * 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.preferences.misc.core;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.xtext.ui.editor.preferences.IPreferenceStoreAccess;
+
+import com.google.eclipse.protobuf.ui.preferences.BooleanPreference;
+
+/**
+ * "Miscellaneous" preferences, retrieved from an <code>{@link IPreferenceStore}</code>.
+ *
+ * @author alruiz@google.com (Alex Ruiz)
+ */
+public class MiscellaneousPreferences {
+ private final BooleanPreference googleInternal;
+
+ /**
+ * Creates a new <code>{@link MiscellaneousPreferences}</code>.
+ * @param storeAccess simplified access to Eclipse's preferences.
+ */
+ public MiscellaneousPreferences(IPreferenceStoreAccess storeAccess) {
+ this(storeAccess.getWritablePreferenceStore());
+ }
+
+ /**
+ * Creates a new <code>{@link MiscellaneousPreferences}</code>.
+ * @param store a table mapping named preferences to values.
+ */
+ public MiscellaneousPreferences(IPreferenceStore store) {
+ googleInternal = new BooleanPreference("misc.googleInternal", store);
+ }
+
+ /**
+ * Returns the setting that specifies whether the editor is being used inside Google.
+ * @return the setting that specifies whether the editor is being used inside Google.
+ */
+ public BooleanPreference isGoogleInternal() {
+ return googleInternal;
+ }
+}
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/parser/core/ParserChecksPreferences.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/parser/core/ParserChecksPreferences.java
deleted file mode 100644
index 352a056..0000000
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/parser/core/ParserChecksPreferences.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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.preferences.parser.core;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.xtext.ui.editor.preferences.IPreferenceStoreAccess;
-
-import com.google.eclipse.protobuf.ui.preferences.BooleanPreference;
-
-/**
- * "Parser checks" preferences, retrieved from an <code>{@link IPreferenceStore}</code>.
- *
- * @author alruiz@google.com (Alex Ruiz)
- */
-public class ParserChecksPreferences {
- // TODO change name to "googleInternal" or something similar.
- private final BooleanPreference enableProto2OnlyChecks;
-
- /**
- * Creates a new <code>{@link ParserChecksPreferences}</code>.
- * @param storeAccess simplified access to Eclipse's preferences.
- */
- public ParserChecksPreferences(IPreferenceStoreAccess storeAccess) {
- this(storeAccess.getWritablePreferenceStore());
- }
-
- /**
- * Creates a new <code>{@link ParserChecksPreferences}</code>.
- * @param store a table mapping named preferences to values.
- */
- public ParserChecksPreferences(IPreferenceStore store) {
- enableProto2OnlyChecks = new BooleanPreference("parser.checkProto2Only", store);
- }
-
- /**
- * Returns the setting that specifies if "proto2" only files are allowed.
- * @return the setting that specifies if "proto2" only files are allowed.
- */
- public BooleanPreference enableProto2OnlyChecks() {
- return enableProto2OnlyChecks;
- }
-}