Merge branch 'master' of https://code.google.com/p/protobuf-dt/
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/commands/SmartSemicolonHandler.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/commands/SmartSemicolonHandler.java
index be09d33..455003e 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/commands/SmartSemicolonHandler.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/commands/SmartSemicolonHandler.java
@@ -140,11 +140,7 @@
private ContentToInsert newContent(Literal literal) {
INode indexNode = nodes.firstNodeForFeature(literal, LITERAL__INDEX);
- ContentToInsert content = newContent(indexNode);
- if (content.equals(ContentToInsert.TAG_NUMBER_INSERTED)) {
- literal.setIndex(-1); // reset to make at semicolon work when new index is zero (TODO fix bug.)
- }
- return content;
+ return newContent(indexNode);
}
private ContentToInsert newContent(MessageField field) {
@@ -204,7 +200,6 @@
this.location = location;
}
- /** {@inheritDoc} */
@Override public String toString() {
return String.format("ContentToInsert [value=%s, location=%s]", value, location);
}
diff --git a/com.google.eclipse.protobuf/.classpath b/com.google.eclipse.protobuf/.classpath
index ff72560..a376b7c 100644
--- a/com.google.eclipse.protobuf/.classpath
+++ b/com.google.eclipse.protobuf/.classpath
@@ -2,7 +2,6 @@
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="src-gen"/>
- <classpathentry kind="src" path="xtend-gen"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="output" path="bin"/>
diff --git a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/ExtendedGenerator.java b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/ExtendedGenerator.java
index b14a3c0..458741b 100644
--- a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/ExtendedGenerator.java
+++ b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/ExtendedGenerator.java
@@ -20,14 +20,18 @@
@SuppressWarnings("restriction")
public class ExtendedGenerator extends Generator {
public ExtendedGenerator() {
- new XtextStandaloneSetup() {
- @Override public Injector createInjector() {
- return Guice.createInjector(new XtextRuntimeModule() {
- @Override public Class<? extends IXtext2EcorePostProcessor> bindIXtext2EcorePostProcessor() {
- return ProtobufEcorePostProcessor.class;
- }
- });
- }
- }.createInjectorAndDoEMFRegistration();
+ new XtextStandaloneSetupExtension().createInjectorAndDoEMFRegistration();
+ }
+
+ private static class XtextStandaloneSetupExtension extends XtextStandaloneSetup {
+ @Override public Injector createInjector() {
+ return Guice.createInjector(new XtextRuntimeModuleExtension());
+ }
+ }
+
+ private static class XtextRuntimeModuleExtension extends XtextRuntimeModule {
+ @Override public Class<? extends IXtext2EcorePostProcessor> bindIXtext2EcorePostProcessor() {
+ return ProtobufEcorePostProcessor.class;
+ }
}
}
diff --git a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/ProtobufEcorePostProcessor.java b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/ProtobufEcorePostProcessor.java
index cda0500..d0d9ea1 100644
--- a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/ProtobufEcorePostProcessor.java
+++ b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/ProtobufEcorePostProcessor.java
@@ -22,12 +22,12 @@
EPackage p = metamodel.getEPackage();
for (EClassifier c : p.getEClassifiers()) {
if (c instanceof EClass && "Literal".equals(c.getName())) {
- setDefaultValueOfIndexInLiteral((EClass) c);
+ processLiteralClass((EClass) c);
}
}
}
- private void setDefaultValueOfIndexInLiteral(EClass c) {
+ private void processLiteralClass(EClass c) {
for (EAttribute a : c.getEAllAttributes()) {
if ("index".equals(a.getName())) {
a.setDefaultValue(-1L);