Moved settings for parser checks from extension point to preferences.
diff --git a/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/junit/core/OverrideRuntimeModuleSetup.java b/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/junit/core/OverrideRuntimeModuleSetup.java
index b1d1146..251358f 100644
--- a/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/junit/core/OverrideRuntimeModuleSetup.java
+++ b/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/junit/core/OverrideRuntimeModuleSetup.java
@@ -7,10 +7,13 @@
* http://www.eclipse.org/legal/epl-v10.html
*/
package com.google.eclipse.protobuf.junit.core;
-import static com.google.inject.util.Modules.override;
+
+import static org.eclipse.xtext.util.Modules2.mixin;
import com.google.eclipse.protobuf.*;
import com.google.inject.*;
+
+
/**
* @author alruiz@google.com (Alex Ruiz)
*/
@@ -22,7 +25,7 @@
}
@Override public Injector createInjector() {
- Module newModule = override(new ProtobufRuntimeModule()).with(module);
- return Guice.createInjector(newModule);
+ Module mixin = mixin(new ProtobufRuntimeModule(), module);
+ return Guice.createInjector(mixin);
}
}
diff --git a/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/junit/core/XtextRule.java b/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/junit/core/XtextRule.java
index 9a2ae03..13d06c1 100644
--- a/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/junit/core/XtextRule.java
+++ b/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/junit/core/XtextRule.java
@@ -46,15 +46,19 @@
private Finder finder;
public static XtextRule overrideRuntimeModuleWith(Module testModule) {
- return new XtextRule(new OverrideRuntimeModuleSetup(testModule));
+ return createWith(new OverrideRuntimeModuleSetup(testModule));
}
public static XtextRule createWith(ISetup setup) {
- return new XtextRule(setup);
+ return createWith(setup.createInjectorAndDoEMFRegistration());
}
- private XtextRule(ISetup setup) {
- injector = setup.createInjectorAndDoEMFRegistration();
+ public static XtextRule createWith(Injector injector) {
+ return new XtextRule(injector);
+ }
+
+ private XtextRule(Injector injector) {
+ this.injector = injector;
reader = new TestSourceReader();
}
diff --git a/com.google.eclipse.protobuf.ui.functional.test/.classpath b/com.google.eclipse.protobuf.ui.functional.test/.classpath
new file mode 100644
index 0000000..ad32c83
--- /dev/null
+++ b/com.google.eclipse.protobuf.ui.functional.test/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/com.google.eclipse.protobuf.ui.functional.test/.gitignore b/com.google.eclipse.protobuf.ui.functional.test/.gitignore
new file mode 100644
index 0000000..5e56e04
--- /dev/null
+++ b/com.google.eclipse.protobuf.ui.functional.test/.gitignore
@@ -0,0 +1 @@
+/bin
diff --git a/com.google.eclipse.protobuf.ui.functional.test/.project b/com.google.eclipse.protobuf.ui.functional.test/.project
new file mode 100644
index 0000000..b0c832e
--- /dev/null
+++ b/com.google.eclipse.protobuf.ui.functional.test/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>com.google.eclipse.protobuf.ui.functional.test</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/com.google.eclipse.protobuf.ui.functional.test/.settings/org.eclipse.jdt.core.prefs b/com.google.eclipse.protobuf.ui.functional.test/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..dd7d0d5
--- /dev/null
+++ b/com.google.eclipse.protobuf.ui.functional.test/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Thu Dec 29 17:04:14 EST 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/com.google.eclipse.protobuf.ui.functional.test/META-INF/MANIFEST.MF b/com.google.eclipse.protobuf.ui.functional.test/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..cc5ba7d
--- /dev/null
+++ b/com.google.eclipse.protobuf.ui.functional.test/META-INF/MANIFEST.MF
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Test
+Bundle-SymbolicName: com.google.eclipse.protobuf.ui.functional.test
+Bundle-Version: 1.0.0.qualifier
+Bundle-Vendor: Google Inc.
+Fragment-Host: com.google.eclipse.protobuf.ui;bundle-version="1.1.1"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Require-Bundle: org.eclipse.swtbot.go;bundle-version="2.0.5",
+ org.mockito;bundle-version="1.8.5"
diff --git a/com.google.eclipse.protobuf.ui.functional.test/build.properties b/com.google.eclipse.protobuf.ui.functional.test/build.properties
new file mode 100644
index 0000000..34d2e4d
--- /dev/null
+++ b/com.google.eclipse.protobuf.ui.functional.test/build.properties
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
diff --git a/com.google.eclipse.protobuf.ui.functional.test/src/com/google/eclipse/protobuf/ui/junit/core/OverrideUiModuleSetup.java b/com.google.eclipse.protobuf.ui.functional.test/src/com/google/eclipse/protobuf/ui/junit/core/OverrideUiModuleSetup.java
new file mode 100644
index 0000000..8552cef
--- /dev/null
+++ b/com.google.eclipse.protobuf.ui.functional.test/src/com/google/eclipse/protobuf/ui/junit/core/OverrideUiModuleSetup.java
@@ -0,0 +1,44 @@
+/*
+ * 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.junit.core;
+
+import static org.eclipse.xtext.util.Modules2.mixin;
+
+import org.eclipse.xtext.ISetup;
+import org.eclipse.xtext.ui.shared.SharedStateModule;
+
+import com.google.eclipse.protobuf.*;
+import com.google.eclipse.protobuf.junit.core.XtextRule;
+import com.google.eclipse.protobuf.ui.ProtobufUiModule;
+import com.google.eclipse.protobuf.ui.internal.ProtobufActivator;
+import com.google.inject.*;
+
+/**
+ * @author alruiz@google.com (Alex Ruiz)
+ */
+public class OverrideUiModuleSetup extends ProtobufStandaloneSetup {
+ private final Module module;
+
+ public static XtextRule overrideUiModuleWith(Module module) {
+ ISetup setup = new OverrideUiModuleSetup(module);
+ return XtextRule.createWith(setup);
+ }
+
+ OverrideUiModuleSetup(Module module) {
+ this.module = module;
+ }
+
+ @Override public Injector createInjector() {
+ Module mixin = mixin(new ProtobufRuntimeModule(),
+ new SharedStateModule(),
+ new ProtobufUiModule(ProtobufActivator.getInstance()),
+ module);
+ return Guice.createInjector(mixin);
+ }
+}
diff --git a/com.google.eclipse.protobuf.ui.functional.test/src/com/google/eclipse/protobuf/ui/parser/PreferenceDrivenProtobufParser_doParse_Test.java b/com.google.eclipse.protobuf.ui.functional.test/src/com/google/eclipse/protobuf/ui/parser/PreferenceDrivenProtobufParser_doParse_Test.java
new file mode 100644
index 0000000..c01d672
--- /dev/null
+++ b/com.google.eclipse.protobuf.ui.functional.test/src/com/google/eclipse/protobuf/ui/parser/PreferenceDrivenProtobufParser_doParse_Test.java
@@ -0,0 +1,64 @@
+/*
+ * 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.parser;
+
+import static com.google.eclipse.protobuf.junit.core.XtextRule.createWith;
+import static com.google.eclipse.protobuf.ui.Internals.injector;
+import static org.hamcrest.core.IsInstanceOf.instanceOf;
+import static org.junit.Assert.*;
+
+import org.antlr.runtime.CharStream;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.xtext.nodemodel.impl.NodeModelBuilder;
+import org.eclipse.xtext.ui.editor.preferences.IPreferenceStoreAccess;
+import org.junit.*;
+
+import com.google.eclipse.protobuf.junit.core.XtextRule;
+import com.google.eclipse.protobuf.junit.util.MultiLineTextBuilder;
+import com.google.eclipse.protobuf.parser.NonProto2Protobuf;
+import com.google.eclipse.protobuf.protobuf.Protobuf;
+
+/**
+ * Tests for <code>{@link PreferenceDrivenProtobufParser#doParse(String, CharStream, NodeModelBuilder, int)}</code>.
+ *
+ * @author alruiz@google.com (Alex Ruiz)
+ */
+public class PreferenceDrivenProtobufParser_doParse_Test {
+ private static String proto1;
+
+ @BeforeClass public static void setUpOnce() {
+ MultiLineTextBuilder proto = new MultiLineTextBuilder();
+ proto.append("// ignore errors")
+ .append("c++header #include 'test/common/proto_class.h'");
+ proto1 = proto.toString();
+ }
+
+ @Rule public XtextRule xtext = createWith(injector());
+
+ private IPreferenceStore store;
+
+ @Before public void setUp() {
+ IPreferenceStoreAccess storeAccess = xtext.getInstanceOf(IPreferenceStoreAccess.class);
+ store = storeAccess.getWritablePreferenceStore();
+ }
+
+ @Test public void should_recognize_proto1_syntax() {
+ store.setValue("parser.checkProto2Only", true);
+ xtext.parseText(proto1);
+ Protobuf root = xtext.root();
+ assertThat(root, instanceOf(NonProto2Protobuf.class));
+ }
+
+ @Test public void should_not_recognize_proto1_syntax() {
+ store.setValue("parser.checkProto2Only", false);
+ xtext.parseText(proto1);
+ Protobuf root = xtext.root();
+ assertNull(root);
+ }
+}
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 51e8274..76d3e0e 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
@@ -17,6 +17,7 @@
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
import org.eclipse.xtext.documentation.IEObjectDocumentationProvider;
+import org.eclipse.xtext.parser.IParser;
import org.eclipse.xtext.ui.LanguageSpecific;
import org.eclipse.xtext.ui.editor.*;
import org.eclipse.xtext.ui.editor.model.XtextDocumentProvider;
@@ -36,11 +37,13 @@
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.parser.PreferenceDrivenProtobufParser;
import com.google.eclipse.protobuf.ui.preferences.PreferenceStoreAccess;
import com.google.eclipse.protobuf.ui.preferences.compiler.core.CompilerPreferenceStoreInitializer;
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.paths.core.PathsPreferenceStoreInitializer;
import com.google.eclipse.protobuf.ui.quickfix.ProtobufQuickAssistProcessor;
import com.google.eclipse.protobuf.ui.scoping.FileUriResolver;
@@ -80,6 +83,10 @@
return ProtobufHyperlinkDetector.class;
}
+ public Class<? extends IParser> bindIParser() {
+ return PreferenceDrivenProtobufParser.class;
+ }
+
public Class<? extends IPreferenceStoreAccess> bindIPreferenceStoreAccess() {
return PreferenceStoreAccess.class;
}
@@ -127,6 +134,7 @@
configurePreferenceInitializer(binder, "compilerPreferences", CompilerPreferenceStoreInitializer.class);
configurePreferenceInitializer(binder, "generalPreferences", GeneralPreferenceStoreInitializer.class);
configurePreferenceInitializer(binder, "numericTagPreferences", NumericTagPreferenceStoreInitializer.class);
+ configurePreferenceInitializer(binder, "parserChecksPreferences", ParserChecksPreferenceStoreInitializer.class);
configurePreferenceInitializer(binder, "pathsPreferences", PathsPreferenceStoreInitializer.class);
configurePreferenceInitializer(binder, "saveActionsPreferences", SaveActionsPreferenceStoreInitializer.class);
}
diff --git a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/parser/Proto2OnlyParser.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/parser/PreferenceDrivenProtobufParser.java
similarity index 72%
rename from com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/parser/Proto2OnlyParser.java
rename to com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/parser/PreferenceDrivenProtobufParser.java
index b456a0d..4cb578d 100644
--- a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/parser/Proto2OnlyParser.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/parser/PreferenceDrivenProtobufParser.java
@@ -6,33 +6,36 @@
*
* http://www.eclipse.org/legal/epl-v10.html
*/
-package com.google.eclipse.protobuf.parser;
+package com.google.eclipse.protobuf.ui.parser;
import org.antlr.runtime.CharStream;
import org.eclipse.xtext.nodemodel.*;
import org.eclipse.xtext.nodemodel.impl.NodeModelBuilder;
import org.eclipse.xtext.parser.*;
+import org.eclipse.xtext.ui.editor.preferences.IPreferenceStoreAccess;
+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.inject.Inject;
/**
- * Parser that only parses protocol buffers with "proto2" syntax, older syntax is ignored completely.
- *
* @author alruiz@google.com (Alex Ruiz)
*/
-public class Proto2OnlyParser extends ProtobufParser {
+public class PreferenceDrivenProtobufParser extends ProtobufParser {
private static final String[] ERRORS_TO_LOOK_FOR = { "missing EOF at 'c'", "missing EOF at 'java'",
"missing EOF at 'parsed'", "missing EOF at 'python'", "no viable alternative at input '<'" };
- @Inject private ParserChecksSettingsProvider settingsProvider;
+ @Inject private IPreferenceStoreAccess storeAccess;
+ // @Inject private ParserChecksSettingsProvider settingsProvider;
@Override protected IParseResult doParse(String ruleName, CharStream in, NodeModelBuilder builder,
int initialLookAhead) {
IParseResult result = super.doParse(ruleName, in, builder, initialLookAhead);
- if (settingsProvider.shouldCheckProto2Only() && isNotProto2(result)) {
- return new ParseResult(new NonProto2Protobuf(), result.getRootNode(), false);
+ ParserChecksPreferences preferences = new ParserChecksPreferences(storeAccess);
+ if (preferences.enableProto2OnlyChecks().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/parser/core/ParserChecksPreferenceStoreInitializer.java
new file mode 100644
index 0000000..240342a
--- /dev/null
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/parser/core/ParserChecksPreferenceStoreInitializer.java
@@ -0,0 +1,23 @@
+/*
+ * 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.xtext.ui.editor.preferences.*;
+
+/**
+ * Initializes default values for the "parser checks" preferences.
+ *
+ * @author alruiz@google.com (Alex Ruiz)
+ */
+public class ParserChecksPreferenceStoreInitializer implements IPreferenceStoreInitializer {
+ @Override public void initialize(IPreferenceStoreAccess storeAccess) {
+ ParserChecksPreferences preferences = new ParserChecksPreferences(storeAccess);
+ preferences.enableProto2OnlyChecks().setDefaultValue(false);
+ }
+}
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
new file mode 100644
index 0000000..795155b
--- /dev/null
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/parser/core/ParserChecksPreferences.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.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 {
+ 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;
+ }
+}
diff --git a/com.google.eclipse.protobuf/plugin.xml b/com.google.eclipse.protobuf/plugin.xml
index 79c091c..abdcd04 100644
--- a/com.google.eclipse.protobuf/plugin.xml
+++ b/com.google.eclipse.protobuf/plugin.xml
@@ -5,7 +5,6 @@
id="descriptorSource"
name="descriptor-source"
schema="schema/descriptor-source.exsd" />
- <extension-point id="parserChecks" name="parser-checks" schema="schema/parser-checks.exsd"/>
<extension point="org.eclipse.emf.ecore.generated_package">
<package
uri="http://www.google.com/eclipse/protobuf/Protobuf"
diff --git a/com.google.eclipse.protobuf/schema/parser-checks.exsd b/com.google.eclipse.protobuf/schema/parser-checks.exsd
deleted file mode 100644
index e0b6653..0000000
--- a/com.google.eclipse.protobuf/schema/parser-checks.exsd
+++ /dev/null
@@ -1,67 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="com.google.eclipse.protobuf" xmlns="http://www.w3.org/2001/XMLSchema">
-<annotation>
- <appInfo>
- <meta.schema plugin="com.google.eclipse.protobuf" id="parserChecks" name="parser-checks"/>
- </appInfo>
- <documentation>Parser checks for proto files.</documentation>
- </annotation>
- <element name="extension">
- <annotation>
- <appInfo>
- <meta.element />
- </appInfo>
- </annotation>
- <complexType>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation></documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation></documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation></documentation>
- <appInfo>
- <meta.attribute translatable="true"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
- <element name="checks">
- <complexType>
- <attribute name="proto2OnlyCheck" type="boolean" use="default" value="false">
- <annotation>
- <documentation></documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
- <annotation>
- <appInfo>
- <meta.section type="since"/>
- </appInfo>
- <documentation>1.3</documentation>
- </annotation>
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
-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
-
-Contributors:
-Google, Inc. - initial API and implementation
- </documentation>
- </annotation>
-</schema>
diff --git a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/ProtobufRuntimeModule.java b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/ProtobufRuntimeModule.java
index 585e0e2..4a1d22a 100644
--- a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/ProtobufRuntimeModule.java
+++ b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/ProtobufRuntimeModule.java
@@ -11,7 +11,6 @@
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.xtext.conversion.IValueConverterService;
import org.eclipse.xtext.naming.IQualifiedNameProvider;
-import org.eclipse.xtext.parser.IParser;
import org.eclipse.xtext.parser.antlr.ISyntaxErrorMessageProvider;
import org.eclipse.xtext.resource.*;
import org.eclipse.xtext.scoping.impl.ImportUriResolver;
@@ -20,7 +19,6 @@
import com.google.eclipse.protobuf.conversion.ProtobufTerminalConverters;
import com.google.eclipse.protobuf.linking.ProtobufResource;
import com.google.eclipse.protobuf.naming.ProtobufQualifiedNameProvider;
-import com.google.eclipse.protobuf.parser.Proto2OnlyParser;
import com.google.eclipse.protobuf.resource.ResourceServiceProvider;
import com.google.eclipse.protobuf.scoping.*;
import com.google.eclipse.protobuf.validation.*;
@@ -38,10 +36,6 @@
return ProtobufImportUriResolver.class;
}
- @Override public Class<? extends IParser> bindIParser() {
- return Proto2OnlyParser.class;
- }
-
@Override public Class<? extends IQualifiedNameProvider> bindIQualifiedNameProvider() {
return ProtobufQualifiedNameProvider.class;
}
diff --git a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/parser/ParserChecksSettingsProvider.java b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/parser/ParserChecksSettingsProvider.java
deleted file mode 100644
index 5bd2a67..0000000
--- a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/parser/ParserChecksSettingsProvider.java
+++ /dev/null
@@ -1,59 +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.parser;
-
-import org.eclipse.core.runtime.*;
-
-import com.google.inject.*;
-
-/**
- * Provider of settings of parser checks.
- *
- * @author alruiz@google.com (Alex Ruiz)
- */
-@Singleton public class ParserChecksSettingsProvider {
- private static final String EXTENSION_ID = "com.google.eclipse.protobuf.parserChecks";
-
- @Inject private IExtensionRegistry registry;
-
- private boolean initialized;
- private boolean proto2OnlyCheck;
-
- private final Object lock = new Object();
-
- /**
- * Indicates whether the parser should ensure .proto files have "proto2" syntax.
- * @return {@code true} if the parser should ensure .proto files have "proto2" syntax, {@code false} otherwise.
- */
- public boolean shouldCheckProto2Only() {
- ensureIsInitialized();
- return proto2OnlyCheck;
- }
-
- private void ensureIsInitialized() {
- synchronized (lock) {
- if (initialized) {
- return;
- }
- initialized = true;
- initializeFromExtensionPoint();
- }
- }
-
- private void initializeFromExtensionPoint() {
- IConfigurationElement[] config = registry.getConfigurationElementsFor(EXTENSION_ID);
- if (config == null) {
- return;
- }
- for (IConfigurationElement e : config) {
- String proto2OnlyCheckAttribure = e.getAttribute("proto2OnlyCheck");
- proto2OnlyCheck = Boolean.parseBoolean(proto2OnlyCheckAttribure);
- }
- }
-}