Updates to 1.5.5
Added support for """...""" templates.
Fixed updating of indexed elements with "// Next id:" comments.
Added support for both < > and { } when defining complex field values.
Change-Id: Ibff2c4a3659e24c4bb79a1772466cf21986d0310
diff --git a/com.google.eclipse.protobuf.integration.test/src/com/google/eclipse/protobuf/bugs/Issue185_CustomOptionsShouldAllowEmptyBracesAsValue_Test.java b/com.google.eclipse.protobuf.integration.test/src/com/google/eclipse/protobuf/bugs/Issue185_CustomOptionsShouldAllowEmptyBracesAsValue_Test.java
index cebe45c..bb82dcf 100644
--- a/com.google.eclipse.protobuf.integration.test/src/com/google/eclipse/protobuf/bugs/Issue185_CustomOptionsShouldAllowEmptyBracesAsValue_Test.java
+++ b/com.google.eclipse.protobuf.integration.test/src/com/google/eclipse/protobuf/bugs/Issue185_CustomOptionsShouldAllowEmptyBracesAsValue_Test.java
@@ -8,7 +8,7 @@
*/
package com.google.eclipse.protobuf.bugs;
-import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
import static com.google.eclipse.protobuf.junit.core.IntegrationTestModule.integrationTestModule;
import static com.google.eclipse.protobuf.junit.core.XtextRule.overrideRuntimeModuleWith;
@@ -17,7 +17,9 @@
import org.junit.Test;
import com.google.eclipse.protobuf.junit.core.XtextRule;
+import com.google.eclipse.protobuf.protobuf.ComplexValue;
import com.google.eclipse.protobuf.protobuf.CustomFieldOption;
+import com.google.eclipse.protobuf.protobuf.Value;
/**
* Tests fix for <a href="http://code.google.com/p/protobuf-dt/issues/detail?id=185">Issue 185</a>.
@@ -47,6 +49,8 @@
// }
@Test public void should_allow_empty_braces_as_value() {
CustomFieldOption option = xtext.find("fileopt", ")", CustomFieldOption.class);
- assertNull(option.getValue());
+ Value value = option.getValue();
+ ComplexValue complexValue = value instanceof ComplexValue ? (ComplexValue) value : null;
+ assertTrue(complexValue != null && complexValue.getFields().isEmpty());
}
}
diff --git a/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/bugs/SupportCurlyAndAngleBracketsForComplexValues.java b/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/bugs/SupportCurlyAndAngleBracketsForComplexValues.java
new file mode 100644
index 0000000..8f4e387
--- /dev/null
+++ b/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/bugs/SupportCurlyAndAngleBracketsForComplexValues.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2013 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.bugs;
+
+import static com.google.eclipse.protobuf.junit.core.UnitTestModule.unitTestModule;
+import static com.google.eclipse.protobuf.junit.core.XtextRule.overrideRuntimeModuleWith;
+import static org.junit.Assert.assertTrue;
+
+import com.google.eclipse.protobuf.junit.core.XtextRule;
+import com.google.eclipse.protobuf.validation.ProtobufJavaValidator;
+import com.google.inject.Inject;
+
+import org.eclipse.emf.common.util.BasicDiagnostic;
+import org.junit.Rule;
+import org.junit.Test;
+
+/**
+ * Test that complex values can be enclosed in {...} or <...>
+ */
+public class SupportCurlyAndAngleBracketsForComplexValues {
+ @Rule public XtextRule xtext = overrideRuntimeModuleWith(unitTestModule());
+
+ @Inject private ProtobufJavaValidator validator;
+
+ // syntax = "proto2";
+ //
+ // package test;
+ //
+ // message AttributeOptions {
+ // message CommonAttributes {
+ // optional bool boolValue = 1;
+ // optional int32 intValue = 2;
+ // }
+ //
+ // optional group MainAttribute = 2 {
+ // optional CommonAttributes attrs = 5;
+ // }
+ //
+ // optional group ExtraAttribute = 6 {
+ // optional CommonAttributes attrs = 7;
+ // }
+ //
+ // optional int32 value = 8;
+ // }
+ //
+ // extend google.protobuf.MessageOptions {
+ // optional AttributeOptions main_options = 16662875;
+ // optional AttributeOptions.CommonAttributes common_options = 16662876;
+ // }
+ //
+ // message TestMessage {
+ // option (main_options) = {
+ // value: 10,
+ //
+ // MainAttribute <
+ // attrs {
+ // boolValue: false
+ // }
+ // >
+ //
+ // ExtraAttribute {
+ // attrs {
+ // boolValue: false
+ // }
+ // }
+ // };
+ //
+ // option (.test.common_options) = {
+ // intValue: 3
+ // };
+ // }
+ @Test public void should_allow_curly_and_angle_brackets_in_complex_value() {
+ boolean isValid = validator.validate(xtext.root(), new BasicDiagnostic(), null);
+ assertTrue(isValid);
+ }
+}
diff --git a/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/bugs/SupportTripleQuotes.java b/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/bugs/SupportTripleQuotes.java
new file mode 100644
index 0000000..ee420c1
--- /dev/null
+++ b/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/bugs/SupportTripleQuotes.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2013 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.bugs;
+
+import static com.google.eclipse.protobuf.junit.core.UnitTestModule.unitTestModule;
+import static com.google.eclipse.protobuf.junit.core.XtextRule.overrideRuntimeModuleWith;
+import static org.junit.Assert.assertTrue;
+
+import com.google.eclipse.protobuf.junit.core.XtextRule;
+import com.google.eclipse.protobuf.validation.ProtobufJavaValidator;
+import com.google.inject.Inject;
+
+import org.eclipse.emf.common.util.BasicDiagnostic;
+import org.junit.Rule;
+import org.junit.Test;
+
+/**
+ * Test the parser correctly handles """...""" template strings
+ */
+public class SupportTripleQuotes {
+ @Rule public XtextRule xtext = overrideRuntimeModuleWith(unitTestModule());
+
+ @Inject private ProtobufJavaValidator validator;
+
+ // syntax = "proto2";
+ //
+ // package test;
+ //
+ // extend google.protobuf.MessageOptions {
+ // optional string value = 16662875;
+ // }
+ //
+ // message TestMessage {
+ // option (value) = """test""";
+ // }
+ @Test public void should_allow_template_quotes() {
+ boolean isValid = validator.validate(xtext.root(), new BasicDiagnostic(), null);
+ assertTrue(isValid);
+ }
+}
diff --git a/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/bugs/b10744621_AllowSemicolonAfterOptionValue_Test.java b/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/bugs/b10744621_AllowSemicolonAfterOptionValue_Test.java
new file mode 100644
index 0000000..0f6994c
--- /dev/null
+++ b/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/bugs/b10744621_AllowSemicolonAfterOptionValue_Test.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2013 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.bugs;
+
+import static org.junit.Assert.assertTrue;
+
+import static com.google.eclipse.protobuf.junit.core.UnitTestModule.unitTestModule;
+import static com.google.eclipse.protobuf.junit.core.XtextRule.overrideRuntimeModuleWith;
+
+import org.eclipse.emf.common.util.BasicDiagnostic;
+import org.junit.Rule;
+import org.junit.Test;
+
+import com.google.eclipse.protobuf.junit.core.XtextRule;
+import com.google.eclipse.protobuf.validation.ProtobufJavaValidator;
+import com.google.inject.Inject;
+
+/**
+ * Tests fix for b/10744621.
+ */
+public class b10744621_AllowSemicolonAfterOptionValue_Test {
+ @Rule public XtextRule xtext = overrideRuntimeModuleWith(unitTestModule());
+
+ @Inject private ProtobufJavaValidator validator;
+
+ // syntax = "proto2";
+ //
+ // package abc;
+ //
+ // message TestValues {
+ // optional string value1 = 1;
+ // optional string value2 = 2;
+ // }
+ //
+ // extend google.protobuf.MessageOptions {
+ // optional TestValues test_values = 42180343;
+ // }
+ //
+ // message TestMessage {
+ // option (test_values) = {
+ // value1: "Value 1";
+ // value2: "Value 2"
+ // };
+ // }
+ @Test public void should_allow_semicolon_in_complex_value() {
+ boolean isValid = validator.validate(xtext.root(), new BasicDiagnostic(), null);
+ assertTrue(isValid);
+ }
+}
diff --git a/com.google.eclipse.protobuf.ui/META-INF/MANIFEST.MF b/com.google.eclipse.protobuf.ui/META-INF/MANIFEST.MF
index df7482b..7f042ad 100644
--- a/com.google.eclipse.protobuf.ui/META-INF/MANIFEST.MF
+++ b/com.google.eclipse.protobuf.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 1.5.3.qualifier
+Bundle-Version: 1.5.5.qualifier
Bundle-Activator: com.google.eclipse.protobuf.ui.internal.ProtobufActivator
Bundle-SymbolicName: com.google.eclipse.protobuf.ui; singleton:=true
Bundle-ActivationPolicy: lazy
@@ -31,3 +31,4 @@
com.google.eclipse.protobuf.ui.preferences.compiler,
com.google.eclipse.protobuf.ui.util,
com.google.eclipse.protobuf.ui.quickfix
+Import-Package: org.apache.log4j
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/commands/semicolon/SmartSemicolonHandler.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/commands/semicolon/SmartSemicolonHandler.java
index f3d607a..5c21247 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/commands/semicolon/SmartSemicolonHandler.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/commands/semicolon/SmartSemicolonHandler.java
@@ -8,32 +8,11 @@
*/
package com.google.eclipse.protobuf.ui.commands.semicolon;
+import static com.google.eclipse.protobuf.protobuf.ProtobufPackage.Literals.LITERAL__INDEX;
import static java.util.regex.Pattern.compile;
-
import static org.eclipse.xtext.util.Strings.isEmpty;
-import static com.google.eclipse.protobuf.protobuf.ProtobufPackage.Literals.LITERAL__INDEX;
-import static com.google.eclipse.protobuf.protobuf.ProtobufPackage.Literals.MESSAGE_FIELD__INDEX;
-
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.apache.log4j.Logger;
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.xtext.nodemodel.INode;
-import org.eclipse.xtext.resource.XtextResource;
-import org.eclipse.xtext.ui.editor.XtextEditor;
-import org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext;
-import org.eclipse.xtext.ui.editor.contentassist.antlr.ParserBasedContentAssistContextFactory;
-import org.eclipse.xtext.ui.editor.model.IXtextDocument;
-import org.eclipse.xtext.ui.editor.preferences.IPreferenceStoreAccess;
-import org.eclipse.xtext.util.Pair;
-import org.eclipse.xtext.util.concurrent.IUnitOfWork;
-
+import com.google.common.collect.Lists;
import com.google.eclipse.protobuf.grammar.CommonKeyword;
import com.google.eclipse.protobuf.model.util.INodes;
import com.google.eclipse.protobuf.model.util.IndexedElements;
@@ -49,12 +28,31 @@
import com.google.eclipse.protobuf.ui.preferences.editor.numerictag.NumericTagPreferences;
import com.google.inject.Inject;
+import org.apache.log4j.Logger;
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.xtext.nodemodel.INode;
+import org.eclipse.xtext.resource.XtextResource;
+import org.eclipse.xtext.ui.editor.XtextEditor;
+import org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext;
+import org.eclipse.xtext.ui.editor.contentassist.antlr.ParserBasedContentAssistContextFactory;
+import org.eclipse.xtext.ui.editor.model.IXtextDocument;
+import org.eclipse.xtext.ui.editor.preferences.IPreferenceStoreAccess;
+import org.eclipse.xtext.util.Pair;
+import org.eclipse.xtext.util.Tuples;
+import org.eclipse.xtext.util.concurrent.IUnitOfWork;
+
+import java.util.List;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
/**
* Inserts a semicolon at the end of a line, regardless of the current position of the caret in the editor. If the line
* of code being edited is a field or enum literal and if it does not have an index yet, this handler will insert an
* index with a proper value as well.
- *
- * @author alruiz@google.com (Alex Ruiz)
*/
public class SmartSemicolonHandler extends SmartInsertHandler {
private static final Pattern NUMBERS_PATTERN = compile("[\\d]+");
@@ -90,8 +88,15 @@
private void insertContent(final XtextEditor editor, final StyledTextAccess styledTextAccess) {
final AtomicBoolean shouldInsertSemicolon = new AtomicBoolean(true);
final IXtextDocument document = editor.getDocument();
+ final List<Pair<EObject, Long>> commentsToUpdate = Lists.newLinkedList();
+
document.readOnly(NULL_UNIT_OF_WORK); // wait for reconciler to finish its work.
try {
+ /*
+ * Textual and semantic updates cannot be done in the same IUnitOfWork (throws an
+ * IllegalStateException), so index updates (semantic) are done first and tracked in the
+ * commentsToUpdate list, then a 2nd IUnitOfWork processes the comment updates (textual).
+ */
document.modify(new IUnitOfWork.Void<XtextResource>() {
@Override public void process(XtextResource resource) {
Protobuf root = resources.rootOf(resource);
@@ -114,7 +119,7 @@
if (shouldCalculateIndex(literal, LITERAL__INDEX)) {
long index = literals.calculateNewIndexOf(literal);
literal.setIndex(index);
- updateIndexInCommentOfParent(literal, index, document);
+ commentsToUpdate.add(Tuples.create(model, index));
shouldInsertSemicolon.set(false);
}
}
@@ -123,13 +128,23 @@
if (shouldCalculateIndex(field)) {
long index = indexedElements.calculateNewIndexFor(field);
field.setIndex(index);
- updateIndexInCommentOfParent(field, index, document);
+ commentsToUpdate.add(Tuples.create(model, index));
shouldInsertSemicolon.set(false);
}
}
}
}
});
+
+ if (!commentsToUpdate.isEmpty()) {
+ document.modify(new IUnitOfWork.Void<XtextResource>() {
+ @Override public void process(XtextResource resource) {
+ for (Pair<EObject, Long> updateInfo : commentsToUpdate) {
+ updateIndexInCommentOfParent(updateInfo.getFirst(), updateInfo.getSecond(), document);
+ }
+ }
+ });
+ }
} catch (Throwable t) {
shouldInsertSemicolon.set(true);
logger.error("Unable to generate tag number", t);
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 6238844..345e829 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
@@ -44,6 +44,6 @@
return root == null || root.getSyntax() == null;
}
- return false;
+ return rootObj == null;
}
}
diff --git a/com.google.eclipse.protobuf/META-INF/MANIFEST.MF b/com.google.eclipse.protobuf/META-INF/MANIFEST.MF
index 7d8fc0f..c87bed9 100644
--- a/com.google.eclipse.protobuf/META-INF/MANIFEST.MF
+++ b/com.google.eclipse.protobuf/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@
Eclipse-ExtensibleAPI: true
Bundle-Name: %Bundle-Name
Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 1.5.3.qualifier
+Bundle-Version: 1.5.5.qualifier
Bundle-SymbolicName: com.google.eclipse.protobuf; singleton:=true
Bundle-ActivationPolicy: lazy
Require-Bundle: org.antlr.runtime,
@@ -11,6 +11,9 @@
org.apache.log4j,
org.eclipse.core.resources,
org.eclipse.core.runtime,
+ org.eclipse.emf.ecore,
+ org.eclipse.emf.common,
+ org.eclipse.emf.mwe2.launch;resolution:=optional,
org.eclipse.xtext,
org.eclipse.xtext.generator;resolution:=optional,
org.eclipse.xtext.util
diff --git a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/Protobuf.xtext b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/Protobuf.xtext
index eb022ea..dddd42f 100644
--- a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/Protobuf.xtext
+++ b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/Protobuf.xtext
@@ -211,24 +211,20 @@
// { foo: 1, bar: 2 }
ComplexValueCurlyBracket:
- '{'
- fields+=ValueField ((',')? fields+=ValueField)* (',')?
- '}';
+ '{' {ComplexValueCurlyBracket} (fields+=ValueField (',')?)* '}';
// < foo: 1, bar: 2 >
ComplexValueAngleBracket:
- '<'
- fields+=ValueField ((',')? fields+=ValueField)* (',')?
- '>';
+ '<' {ComplexValueAngleBracket} (fields+=ValueField (',')?)* '>';
ValueField:
SimpleValueField | ComplexValueField;
SimpleValueField:
- name=FieldName ':' value=SimpleValueLink;
+ name=FieldName ':' value=SimpleValueLink ';'?;
ComplexValueField:
- name=FieldName ':'? values=ComplexValue;
+ name=FieldName ':'? values=ComplexValue ';'?;
FieldName:
NormalFieldName | ExtensionFieldName;
diff --git a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/ModelElementFinder.java b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/ModelElementFinder.java
index e121a84..7ff86e6 100644
--- a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/ModelElementFinder.java
+++ b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/ModelElementFinder.java
@@ -8,25 +8,12 @@
*/
package com.google.eclipse.protobuf.scoping;
+import static com.google.common.collect.Sets.newHashSet;
import static java.util.Collections.emptyList;
import static java.util.Collections.emptySet;
import static java.util.Collections.unmodifiableSet;
-
import static org.eclipse.emf.ecore.util.EcoreUtil.getAllContents;
-import static com.google.common.collect.Sets.newHashSet;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.emf.common.util.TreeIterator;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.xtext.resource.IEObjectDescription;
-
import com.google.eclipse.protobuf.model.util.Imports;
import com.google.eclipse.protobuf.model.util.ModelObjects;
import com.google.eclipse.protobuf.model.util.Packages;
@@ -39,10 +26,25 @@
import com.google.eclipse.protobuf.protobuf.Protobuf;
import com.google.eclipse.protobuf.resource.ResourceSets;
import com.google.inject.Inject;
+import com.google.inject.Provider;
+import com.google.inject.Singleton;
+
+import org.eclipse.emf.common.util.TreeIterator;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.xtext.resource.IEObjectDescription;
+import org.eclipse.xtext.util.IResourceScopeCache;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;
/**
* @author alruiz@google.com (Alex Ruiz)
*/
+@Singleton
class ModelElementFinder {
@Inject private Imports imports;
@Inject private ModelObjects modelObjects;
@@ -50,7 +52,67 @@
@Inject private Protobufs protobufs;
@Inject private Resources resources;
@Inject private ResourceSets resourceSets;
+
+ @Inject private IResourceScopeCache cache;
+ private class GetLocal<T> implements Provider<Collection<IEObjectDescription>> {
+ private final EObject start;
+ private final FinderStrategy<T> strategy;
+ private final T criteria;
+
+ public GetLocal(EObject start, FinderStrategy<T> strategy, T criteria) {
+ this.start = start;
+ this.strategy = strategy;
+ this.criteria = criteria;
+ }
+
+ @Override
+ public Collection<IEObjectDescription> get() {
+ UniqueDescriptions descriptions = new UniqueDescriptions();
+ EObject current = start.eContainer();
+ while (current != null) {
+ descriptions.addAll(local(current, strategy, criteria, 0));
+ current = current.eContainer();
+ }
+ return descriptions.values();
+ }
+ }
+
+ private class GetImports<T> implements Provider<Set<IEObjectDescription>> {
+ private final Package fromImporter;
+ private final Resource imported;
+ private final FinderStrategy<T> strategy;
+ private final T criteria;
+
+ public GetImports(Package fromImporter, Resource imported, FinderStrategy<T> strategy, T criteria) {
+ this.fromImporter = fromImporter;
+ this.imported = imported;
+ this.strategy = strategy;
+ this.criteria = criteria;
+ }
+
+ @Override
+ public Set<IEObjectDescription> get() {
+ Set<IEObjectDescription> descriptions = newHashSet();
+
+ Protobuf rootOfImported = resources.rootOf(imported);
+ if (!protobufs.isProto2(rootOfImported)) {
+ return descriptions;
+ }
+ if (rootOfImported != null) {
+ descriptions.addAll(publicImported(rootOfImported, strategy, criteria));
+ if (arePackagesRelated(fromImporter, rootOfImported)) {
+ descriptions.addAll(local(rootOfImported, strategy, criteria, 0));
+ return descriptions;
+ }
+ Package packageOfImported = modelObjects.packageOf(rootOfImported);
+ descriptions.addAll(imported(fromImporter, packageOfImported, imported, strategy, criteria));
+ }
+
+ return descriptions;
+ }
+ }
+
<T> Collection<IEObjectDescription> find(EObject start, FinderStrategy<T> strategy, T criteria) {
Set<IEObjectDescription> descriptions = newHashSet();
descriptions.addAll(local(start, strategy, criteria));
@@ -60,13 +122,7 @@
}
private <T> Collection<IEObjectDescription> local(EObject start, FinderStrategy<T> strategy, T criteria) {
- UniqueDescriptions descriptions = new UniqueDescriptions();
- EObject current = start.eContainer();
- while (current != null) {
- descriptions.addAll(local(current, strategy, criteria, 0));
- current = current.eContainer();
- }
- return descriptions.values();
+ return cache.get(start, start.eResource(), new GetLocal<T>(start, strategy, criteria));
}
<T> Collection<IEObjectDescription> find(Protobuf start, FinderStrategy<T> strategy, T criteria) {
@@ -112,19 +168,9 @@
if (imported == null) {
continue;
}
- Protobuf rootOfImported = resources.rootOf(imported);
- if (!protobufs.isProto2(rootOfImported)) {
- continue;
- }
- if (rootOfImported != null) {
- descriptions.addAll(publicImported(rootOfImported, strategy, criteria));
- if (arePackagesRelated(fromImporter, rootOfImported)) {
- descriptions.addAll(local(rootOfImported, strategy, criteria, 0));
- continue;
- }
- Package packageOfImported = modelObjects.packageOf(rootOfImported);
- descriptions.addAll(imported(fromImporter, packageOfImported, imported, strategy, criteria));
- }
+
+ Set<IEObjectDescription> cached = cache.get(criteria, imported, new GetImports<T>(fromImporter, imported, strategy, criteria));
+ descriptions.addAll(cached);
}
return descriptions;
}
diff --git a/update-site/artifacts.jar b/update-site/artifacts.jar
index e8eb1d9..5369f31 100644
--- a/update-site/artifacts.jar
+++ b/update-site/artifacts.jar
Binary files differ
diff --git a/update-site/content.jar b/update-site/content.jar
index 9f40b7d..5b75215 100644
--- a/update-site/content.jar
+++ b/update-site/content.jar
Binary files differ
diff --git a/update-site/features/com.google.eclipse.protobuf_1.5.5.201309031601.jar b/update-site/features/com.google.eclipse.protobuf_1.5.5.201309031601.jar
new file mode 100644
index 0000000..1b854c9
--- /dev/null
+++ b/update-site/features/com.google.eclipse.protobuf_1.5.5.201309031601.jar
Binary files differ
diff --git a/update-site/plugins/com.google.eclipse.protobuf.internal_1.5.5.201309031601.jar b/update-site/plugins/com.google.eclipse.protobuf.internal_1.5.5.201309031601.jar
new file mode 100644
index 0000000..d208791
--- /dev/null
+++ b/update-site/plugins/com.google.eclipse.protobuf.internal_1.5.5.201309031601.jar
Binary files differ
diff --git a/update-site/plugins/com.google.eclipse.protobuf.ui_1.5.5.201309031601.jar b/update-site/plugins/com.google.eclipse.protobuf.ui_1.5.5.201309031601.jar
new file mode 100644
index 0000000..657acf0
--- /dev/null
+++ b/update-site/plugins/com.google.eclipse.protobuf.ui_1.5.5.201309031601.jar
Binary files differ
diff --git a/update-site/plugins/com.google.eclipse.protobuf_1.5.5.201309031601.jar b/update-site/plugins/com.google.eclipse.protobuf_1.5.5.201309031601.jar
new file mode 100644
index 0000000..2a21541
--- /dev/null
+++ b/update-site/plugins/com.google.eclipse.protobuf_1.5.5.201309031601.jar
Binary files differ
diff --git a/update-site/site.xml b/update-site/site.xml
index e1fa512..5fb91b2 100644
--- a/update-site/site.xml
+++ b/update-site/site.xml
@@ -3,10 +3,7 @@
<description name="protobuf-dt" url="http://protobuf-dt.googlecode.com/git/update-site">
Update site for protobuf-dt, an Eclipse-based Development Environment for Protocol Buffers.
</description>
- <feature url="features/com.google.eclipse.protobuf_1.4.1.201306170929.jar" id="com.google.eclipse.protobuf" version="1.4.1.201306170929">
- <category name="google"/>
- </feature>
- <feature url="features/com.google.eclipse.protobuf_1.4.3.201307151341.jar" id="com.google.eclipse.protobuf" version="1.4.3.201307151341">
+ <feature url="features/com.google.eclipse.protobuf_1.5.5.201309031601.jar" id="com.google.eclipse.protobuf" version="1.5.5.201309031601">
<category name="google"/>
</feature>
<category-def name="google" label="Google Inc."/>