Code cleanup.
diff --git a/com.google.eclipse.protobuf.cdt/src/com/google/eclipse/protobuf/cdt/ProtobufObjectsProvider.java b/com.google.eclipse.protobuf.cdt/src/com/google/eclipse/protobuf/cdt/ProtobufObjectsProvider.java
index 216d64a..aba1212 100644
--- a/com.google.eclipse.protobuf.cdt/src/com/google/eclipse/protobuf/cdt/ProtobufObjectsProvider.java
+++ b/com.google.eclipse.protobuf.cdt/src/com/google/eclipse/protobuf/cdt/ProtobufObjectsProvider.java
@@ -8,7 +8,7 @@
*/
package com.google.eclipse.protobuf.cdt;
-import com.google.eclipse.protobuf.ui.util.ProtobufEditorPlugIn;
+import com.google.eclipse.protobuf.ui.plugin.ProtobufEditorPlugIn;
import com.google.inject.Provider;
/**
diff --git a/com.google.eclipse.protobuf.ui.functional.test/.gitignore b/com.google.eclipse.protobuf.ui.functional.test/.gitignore
index 5e56e04..e60a143 100644
--- a/com.google.eclipse.protobuf.ui.functional.test/.gitignore
+++ b/com.google.eclipse.protobuf.ui.functional.test/.gitignore
@@ -1 +1,2 @@
/bin
+/test-protos
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
index 62b11ef..58b2799 100644
--- 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
@@ -22,7 +22,7 @@
import com.google.eclipse.protobuf.junit.util.MultiLineTextBuilder;
import com.google.eclipse.protobuf.parser.NonProto2Protobuf;
import com.google.eclipse.protobuf.protobuf.Protobuf;
-import com.google.eclipse.protobuf.ui.util.ProtobufEditorPlugIn;
+import com.google.eclipse.protobuf.ui.plugin.ProtobufEditorPlugIn;
import com.google.inject.Inject;
/**
diff --git a/com.google.eclipse.protobuf.ui/META-INF/MANIFEST.MF b/com.google.eclipse.protobuf.ui/META-INF/MANIFEST.MF
index 851a715..768fff7 100644
--- a/com.google.eclipse.protobuf.ui/META-INF/MANIFEST.MF
+++ b/com.google.eclipse.protobuf.ui/META-INF/MANIFEST.MF
@@ -27,6 +27,7 @@
Export-Package: com.google.eclipse.protobuf.ui.contentassist,
com.google.eclipse.protobuf.ui.contentassist.antlr,
com.google.eclipse.protobuf.ui.editor,
+ com.google.eclipse.protobuf.ui.plugin,
com.google.eclipse.protobuf.ui.preferences,
com.google.eclipse.protobuf.ui.preferences.compiler.core,
com.google.eclipse.protobuf.ui.util
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/util/ProtobufEditorPlugIn.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/plugin/ProtobufEditorPlugIn.java
similarity index 69%
rename from com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/util/ProtobufEditorPlugIn.java
rename to com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/plugin/ProtobufEditorPlugIn.java
index 64b029c..2062240 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/util/ProtobufEditorPlugIn.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/plugin/ProtobufEditorPlugIn.java
@@ -6,7 +6,7 @@
*
* http://www.eclipse.org/legal/epl-v10.html
*/
-package com.google.eclipse.protobuf.ui.util;
+package com.google.eclipse.protobuf.ui.plugin;
import com.google.eclipse.protobuf.ui.internal.ProtobufActivator;
import com.google.inject.Injector;
@@ -18,14 +18,6 @@
private static final String LANGUAGE_NAME = "com.google.eclipse.protobuf.Protobuf";
/**
- * Returns the name of the supported language.
- * @return "com.google.eclipse.protobuf.Protobuf".
- */
- public static String languageName() {
- return LANGUAGE_NAME;
- }
-
- /**
* Returns the appropriate instance for the given injection type.
* @param type the given injection type.
* @return the appropriate instance for the given injection type.
@@ -35,11 +27,19 @@
}
/**
- * Returns the plug-in's injector for the language "com.google.eclipse.protobuf.Protobuf".
- * @return the plug-in's injector for the language "com.google.eclipse.protobuf.Protobuf".
+ * Returns the plug-in's injector for the 'Protocol Buffer' language.
+ * @return the plug-in's injector for the 'Protocol Buffer' language.
*/
public static Injector injector() {
- return ProtobufActivator.getInstance().getInjector(languageName());
+ return ProtobufActivator.getInstance().getInjector(protobufLanguageName());
+ }
+
+ /**
+ * Returns the name of the 'Protocol Buffer' language.
+ * @return the name of the 'Protocol Buffer' language.
+ */
+ public static String protobufLanguageName() {
+ return LANGUAGE_NAME;
}
private ProtobufEditorPlugIn() {}
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/validation/ProtobufValidation.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/validation/ProtobufValidation.java
index 2d2fb8d..eca5199 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/validation/ProtobufValidation.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/validation/ProtobufValidation.java
@@ -23,7 +23,7 @@
import com.google.eclipse.protobuf.model.util.Imports;
import com.google.eclipse.protobuf.protobuf.Import;
-import com.google.eclipse.protobuf.ui.util.ProtobufEditorPlugIn;
+import com.google.eclipse.protobuf.ui.plugin.ProtobufEditorPlugIn;
/**
* @author alruiz@google.com (Alex Ruiz)
@@ -34,7 +34,7 @@
return;
}
XtextEditor xtextEditor = (XtextEditor) editor;
- if (!ProtobufEditorPlugIn.languageName().equals(xtextEditor.getLanguageName())) {
+ if (!ProtobufEditorPlugIn.protobufLanguageName().equals(xtextEditor.getLanguageName())) {
return;
}
validate(xtextEditor);
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/validation/ValidateFileOnActivation.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/validation/ValidateFileOnActivation.java
index 7cc2a8b..6762641 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/validation/ValidateFileOnActivation.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/validation/ValidateFileOnActivation.java
@@ -16,6 +16,7 @@
import org.eclipse.ui.*;
import org.eclipse.xtext.ui.editor.preferences.IPreferenceStoreAccess;
+import com.google.eclipse.protobuf.ui.plugin.ProtobufEditorPlugIn;
import com.google.eclipse.protobuf.ui.preferences.general.core.GeneralPreferences;
import com.google.eclipse.protobuf.ui.util.*;
diff --git a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/model/util/IndexedElements.java b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/model/util/IndexedElements.java
index af8d242..f77721c 100644
--- a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/model/util/IndexedElements.java
+++ b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/model/util/IndexedElements.java
@@ -107,9 +107,6 @@
* {@code IndexedElement} is {@code null}.
*/
public EStructuralFeature indexFeatureOf(IndexedElement e) {
- if (e != null) {
- return INDEX_RESOLVER.getAttribute(e);
- }
- return null;
+ return (e != null) ? INDEX_RESOLVER.getAttribute(e) : null;
}
}
diff --git a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/resource/ResourceServiceProvider.java b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/resource/ResourceServiceProvider.java
index ed1cb45..cf59dc9 100644
--- a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/resource/ResourceServiceProvider.java
+++ b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/resource/ResourceServiceProvider.java
@@ -13,6 +13,7 @@
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.xtext.resource.IGlobalServiceProvider.ResourceServiceProviderImpl;
import org.eclipse.xtext.resource.*;
+import org.eclipse.xtext.resource.IResourceServiceProvider.Registry;
import com.google.inject.Inject;
@@ -20,19 +21,16 @@
* @author alruiz@google.com (Alex Ruiz)
*/
public class ResourceServiceProvider extends ResourceServiceProviderImpl {
- @Inject
- public ResourceServiceProvider(IResourceServiceProvider.Registry registry, IResourceServiceProvider provider) {
+ @Inject public ResourceServiceProvider(Registry registry, IResourceServiceProvider provider) {
super(registry, provider);
}
@Override public <T> T findService(EObject e, Class<T> serviceType) {
if (e.eIsProxy()) {
- return findService(((InternalEObject) e).eProxyURI(), serviceType);
+ InternalEObject internalEObject = (InternalEObject) e;
+ return findService(internalEObject.eProxyURI(), serviceType);
}
Resource resource = e.eResource();
- if (resource == null) {
- return null;
- }
- return findService(resource.getURI(), serviceType);
+ return (resource != null) ? findService(resource.getURI(), serviceType) : null;
}
}