In the middle of a refactoring.
diff --git a/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/scoping/ImportUriFixer_fixUri_Test.java b/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/scoping/ImportUriFixer_fixUri_Test.java index 149e7b7..a168d75 100644 --- a/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/scoping/ImportUriFixer_fixUri_Test.java +++ b/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/scoping/ImportUriFixer_fixUri_Test.java
@@ -17,7 +17,7 @@ import org.junit.Test; /** - * Tests for <code>{@link ImportUriFixer#fixUri(String, URI, ResourceChecker)}</code>. + * Tests for <code>{@link ProtobufImportUriFixer#fixUri(String, URI, ResourceChecker)}</code>. * * @author alruiz@google.com (Alex Ruiz) */ @@ -25,13 +25,13 @@ private URI resourceUri; private ResourceCheckerStub resourceChecker; - private ImportUriFixer fixer; + private ProtobufImportUriFixer fixer; @Before public void setUp() { resourceUri = createURI("platform:/resource/src/proto/person.proto"); resourceChecker = new ResourceCheckerStub(); resourceChecker.resourceShouldAlwaysExist = true; - fixer = new ImportUriFixer(); + fixer = new ProtobufImportUriFixer(); } @Test public void should_fix_import_URI_if_missing_scheme() {
diff --git a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/ImportUriFixer.java b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/ProtobufImportUriFixer.java similarity index 93% rename from com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/ImportUriFixer.java rename to com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/ProtobufImportUriFixer.java index 4b1dc5c..d1b9360 100644 --- a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/ImportUriFixer.java +++ b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/ProtobufImportUriFixer.java
@@ -20,9 +20,9 @@ /** * @author alruiz@google.com (Alex Ruiz) */ -class ImportUriFixer { +public class ProtobufImportUriFixer { - static final String PREFIX = "platform:/resource"; + public static final String PREFIX = "platform:/resource"; private static final String SEPARATOR = "/"; @@ -41,7 +41,7 @@ * If we import "folder/proto2.proto" into proto1.proto, proto1.proto will compile fine, but the editor will complain. * We need to have the import URI as "platform:/resource/protobuf-test/folder/proto2.proto" for the editor to see it. */ - String fixUri(String importUri, URI resourceUri, ResourceChecker checker) { + public String fixUri(String importUri, URI resourceUri, ResourceChecker checker) { if (importUri.startsWith(PREFIX)) return importUri; Pair<String, List<String>> importUriPair = pair(importUri, createURI(importUri).segmentsList()); String fixed = fixUri(importUriPair, resourceUri, checker);
diff --git a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/ProtobufImportUriResolver.java b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/ProtobufImportUriResolver.java index e5c4332..e35f303 100644 --- a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/ProtobufImportUriResolver.java +++ b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/ProtobufImportUriResolver.java
@@ -8,7 +8,7 @@ */ package com.google.eclipse.protobuf.scoping; -import static com.google.eclipse.protobuf.scoping.ImportUriFixer.PREFIX; +import static com.google.eclipse.protobuf.scoping.ProtobufImportUriFixer.PREFIX; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.resource.Resource; @@ -30,7 +30,7 @@ */ public class ProtobufImportUriResolver extends ImportUriResolver { - @Inject private ImportUriFixer uriFixer; + @Inject private ProtobufImportUriFixer uriFixer; /** * Prefix used by EMF for resource URIs: "platform:/resource/". @@ -48,9 +48,10 @@ return super.apply(from); } - private void fixUri(Import i) { - Resource resource = i.eResource(); - String fixed = uriFixer.fixUri(i.getImportURI(), resource.getURI(), new ResourceChecker(resource.getResourceSet())); - i.setImportURI(fixed); + private void fixUri(Import anImport) { + Resource resource = anImport.eResource(); + ResourceChecker resourceChecker = new ResourceChecker(resource.getResourceSet()); + String fixed = uriFixer.fixUri(anImport.getImportURI(), resource.getURI(), resourceChecker); + anImport.setImportURI(fixed); } }