Code cleanup.
diff --git a/com.google.eclipse.protobuf.ui.test/src/com/google/eclipse/protobuf/ui/editor/ModelObjectDefinitionNavigator_navigateToDefinition_Test.java b/com.google.eclipse.protobuf.ui.test/src/com/google/eclipse/protobuf/ui/editor/ModelObjectDefinitionNavigator_navigateToDefinition_Test.java
deleted file mode 100644
index 75ce83f..0000000
--- a/com.google.eclipse.protobuf.ui.test/src/com/google/eclipse/protobuf/ui/editor/ModelObjectDefinitionNavigator_navigateToDefinition_Test.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright (c) 2012 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.editor;
-
-import static com.google.eclipse.protobuf.junit.core.UnitTestModule.unitTestModule;
-import static com.google.eclipse.protobuf.junit.core.XtextRule.overrideRuntimeModuleWith;
-import static com.google.eclipse.protobuf.ui.editor.ModelObjectDefinitionNavigator.Query.newQuery;
-import static java.util.Collections.singletonList;
-import static org.eclipse.core.runtime.Status.*;
-import static org.eclipse.emf.common.util.URI.createURI;
-import static org.hamcrest.core.IsEqual.equalTo;
-import static org.junit.Assert.assertThat;
-import static org.mockito.Mockito.*;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.xtext.naming.*;
-import org.eclipse.xtext.naming.QualifiedName;
-import org.eclipse.xtext.resource.IResourceDescription;
-import org.eclipse.xtext.ui.editor.IURIEditorOpener;
-import org.junit.*;
-
-import com.google.eclipse.protobuf.junit.core.*;
-import com.google.eclipse.protobuf.resource.*;
-import com.google.eclipse.protobuf.ui.editor.ModelObjectDefinitionNavigator.Query;
-import com.google.inject.Inject;
-
-/**
- * Tests for <code>{@link ModelObjectDefinitionNavigator#navigateToDefinition(Query)}</code>.
- *
- * @author alruiz@google.com (Alex Ruiz)
- */
-public class ModelObjectDefinitionNavigator_navigateToDefinition_Test {
-  private static IPath filePath;
-
-  @BeforeClass public static void setUpOnce() {
-    filePath = new Path("/src/protos/test.proto");
-  }
-
-  @Rule public XtextRule xtext = overrideRuntimeModuleWith(unitTestModule(), new TestModule());
-
-  @Inject private IURIEditorOpener editorOpener;
-  @Inject private IQualifiedNameConverter fqnConverter;
-  @Inject private IndexLookup indexLookup;
-  @Inject private ResourceDescriptions resources;
-  @Inject private ModelObjectDefinitionNavigator navigator;
-
-  private IResourceDescription resource;
-
-  @Before public void setUp() {
-    resource = mock(IResourceDescription.class);
-  }
-
-  @Test public void should_navigate_to_model_object_if_URI_is_found() {
-    when(indexLookup.resourceIn(filePath)).thenReturn(resource);
-    QualifiedName qualifiedName = fqnConverter.toQualifiedName("com.google.proto.Type");
-    URI uri = createURI("file:/usr/local/project/src/protos/test.proto");
-    when(resources.modelObjectUri(resource, qualifiedName)).thenReturn(uri);
-    IStatus result = navigator.navigateToDefinition(newQuery(singletonList(qualifiedName), filePath));
-    assertThat(result, equalTo(OK_STATUS));
-    verify(editorOpener).open(uri, true);
-  }
-
-  @Test public void should_not_navigate_to_model_object_if_URI_is_not_found() {
-    when(indexLookup.resourceIn(filePath)).thenReturn(resource);
-    QualifiedName qualifiedName = fqnConverter.toQualifiedName("com.google.proto.Person");
-    when(resources.modelObjectUri(resource, qualifiedName)).thenReturn(null);
-    IStatus result = navigator.navigateToDefinition(newQuery(singletonList(qualifiedName), filePath));
-    assertThat(result, equalTo(CANCEL_STATUS));
-    verifyZeroInteractions(editorOpener);
-  }
-
-  private static class TestModule extends AbstractTestModule {
-    @Override protected void configure() {
-      mockAndBind(IURIEditorOpener.class);
-      mockAndBind(IndexLookup.class);
-      mockAndBind(ResourceDescriptions.class);
-    }
-  }
-}
diff --git a/com.google.eclipse.protobuf.ui.test/src/com/google/eclipse/protobuf/ui/scoping/MultipleDirectoriesFileResolverStrategy_resolveUri_Test.java b/com.google.eclipse.protobuf.ui.test/src/com/google/eclipse/protobuf/ui/scoping/MultipleDirectoriesFileResolverStrategy_resolveUri_Test.java
index d176e4e..c3149d8 100644
--- a/com.google.eclipse.protobuf.ui.test/src/com/google/eclipse/protobuf/ui/scoping/MultipleDirectoriesFileResolverStrategy_resolveUri_Test.java
+++ b/com.google.eclipse.protobuf.ui.test/src/com/google/eclipse/protobuf/ui/scoping/MultipleDirectoriesFileResolverStrategy_resolveUri_Test.java
@@ -57,7 +57,7 @@
   @Test public void should_resolve_platform_resource_URI() {
     String expected = "platform:/resource/src/protos/imported.proto";
     when(directoryPaths.getValue()).thenReturn("${workspace_loc:/src/protos}");
-    when(uris.exists(URI.createURI(expected))).thenReturn(true);
+    when(uris.referredResourceExists(URI.createURI(expected))).thenReturn(true);
     String resolved = resolver.resolveUri("imported.proto", declaringResourceUri, allPreferences);
     assertThat(resolved, equalTo(expected));
   }
@@ -65,7 +65,7 @@
   @Test public void should_resolve_file_URI() {
     String expected = "file:/usr/local/project/src/protos/imported.proto";
     when(directoryPaths.getValue()).thenReturn("/usr/local/project/src/protos");
-    when(uris.exists(URI.createURI(expected))).thenReturn(true);
+    when(uris.referredResourceExists(URI.createURI(expected))).thenReturn(true);
     String resolved = resolver.resolveUri("imported.proto", declaringResourceUri, allPreferences);
     assertThat(resolved, equalTo(expected));
   }
@@ -74,24 +74,24 @@
     String expected = "file:/usr/local/project/src/protos/imported.proto";
     when(directoryPaths.getValue()).thenReturn("${workspace_loc:/src/protos}");
     // try the first time as resource platform
-    when(uris.exists(URI.createURI("platform:/resource/src/protos/imported.proto"))).thenReturn(false);
+    when(uris.referredResourceExists(URI.createURI("platform:/resource/src/protos/imported.proto"))).thenReturn(false);
     // try again, but in the file system this time
     when(mapping.directoryLocation("/src/protos")).thenReturn("/usr/local/project/src/protos");
-    when(uris.exists(URI.createURI(expected))).thenReturn(true);
+    when(uris.referredResourceExists(URI.createURI(expected))).thenReturn(true);
     String resolved = resolver.resolveUri("imported.proto", declaringResourceUri, allPreferences);
     assertThat(resolved, equalTo(expected));
   }
 
   @Test public void should_return_null_if_platform_resource_URI_cannot_be_resolved() {
     when(directoryPaths.getValue()).thenReturn("${workspace_loc:/src/protos}");
-    when(uris.exists(any(URI.class))).thenReturn(false);
+    when(uris.referredResourceExists(any(URI.class))).thenReturn(false);
     String resolved = resolver.resolveUri("imported.proto", declaringResourceUri, allPreferences);
     assertNull(resolved);
   }
 
   @Test public void should_return_null_if_file_URI_cannot_be_resolved() {
     when(directoryPaths.getValue()).thenReturn("/usr/local/project/src/protos");
-    when(uris.exists(any(URI.class))).thenReturn(false);
+    when(uris.referredResourceExists(any(URI.class))).thenReturn(false);
     String resolved = resolver.resolveUri("imported.proto", declaringResourceUri, allPreferences);
     assertNull(resolved);
   }
diff --git a/com.google.eclipse.protobuf.ui.test/src/com/google/eclipse/protobuf/ui/scoping/UrisStub.java b/com.google.eclipse.protobuf.ui.test/src/com/google/eclipse/protobuf/ui/scoping/UrisStub.java
index 26fe226..3bd174f 100644
--- a/com.google.eclipse.protobuf.ui.test/src/com/google/eclipse/protobuf/ui/scoping/UrisStub.java
+++ b/com.google.eclipse.protobuf.ui.test/src/com/google/eclipse/protobuf/ui/scoping/UrisStub.java
@@ -30,7 +30,7 @@
     exist = shouldExist;
   }
 
-  @Override public boolean exists(URI uri) {
+  @Override public boolean referredResourceExists(URI uri) {
     return exist;
   }
 }
diff --git a/com.google.eclipse.protobuf.ui.test/src/com/google/eclipse/protobuf/ui/util/Uris_exists_withFile_Test.java b/com.google.eclipse.protobuf.ui.test/src/com/google/eclipse/protobuf/ui/util/Uris_exists_withFile_Test.java
index 4e4c18e..6cc5109 100644
--- a/com.google.eclipse.protobuf.ui.test/src/com/google/eclipse/protobuf/ui/util/Uris_exists_withFile_Test.java
+++ b/com.google.eclipse.protobuf.ui.test/src/com/google/eclipse/protobuf/ui/util/Uris_exists_withFile_Test.java
@@ -22,7 +22,7 @@
 import com.google.inject.Inject;
 
 /**
- * Tests for <code>{@link Uris#exists(URI)}</code>
+ * Tests for <code>{@link Uris#referredResourceExists(URI)}</code>
  *
  * @author alruiz@google.com (Alex Ruiz)
  */
@@ -35,11 +35,11 @@
   @Test public void should_return_true_if_file_resource_exists() throws IOException {
     File file = folder.newFile("existing_file.txt");
     URI fileUri = URI.createFileURI(file.getAbsolutePath());
-    assertTrue(uris.exists(fileUri));
+    assertTrue(uris.referredResourceExists(fileUri));
   }
 
   @Test public void should_return_false_if_file_resource_does_not_exist() {
     URI fileUri = URI.createFileURI("/usr/local/not_existing_file.txt");
-    assertFalse(uris.exists(fileUri));
+    assertFalse(uris.referredResourceExists(fileUri));
   }
 }
diff --git a/com.google.eclipse.protobuf.ui.test/src/com/google/eclipse/protobuf/ui/util/Uris_exists_withPlatformResource_Test.java b/com.google.eclipse.protobuf.ui.test/src/com/google/eclipse/protobuf/ui/util/Uris_exists_withPlatformResource_Test.java
deleted file mode 100644
index 7bc6301..0000000
--- a/com.google.eclipse.protobuf.ui.test/src/com/google/eclipse/protobuf/ui/util/Uris_exists_withPlatformResource_Test.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 2012 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.util;
-
-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.*;
-import static org.mockito.Mockito.when;
-
-import org.eclipse.emf.common.util.URI;
-import org.junit.*;
-
-import com.google.eclipse.protobuf.junit.core.*;
-import com.google.inject.Inject;
-
-/**
- * Tests for <code>{@link Uris#exists(URI)}</code>
- *
- * @author alruiz@google.com (Alex Ruiz)
- */
-public class Uris_exists_withPlatformResource_Test {
-  private static URI resourceUri;
-
-  @BeforeClass public static void setUpOnce() {
-    resourceUri = URI.createURI("platform:/resource/project/src/protos/test.proto");
-  }
-
-  @Rule public XtextRule xtext = overrideRuntimeModuleWith(unitTestModule(), new TestModule());
-
-  @Inject private Resources resources;
-  @Inject private Uris uris;
-
-  @Test public void should_return_true_if_platform_resource_exists() {
-    when(resources.fileExists(resourceUri)).thenReturn(true);
-    assertTrue(uris.exists(resourceUri));
-  }
-
-  @Test public void should_return_false_if_platform_resource_does_not_exist() {
-    when(resources.fileExists(resourceUri)).thenReturn(false);
-    assertFalse(uris.exists(resourceUri));
-  }
-
-  private static class TestModule extends AbstractTestModule {
-    @Override protected void configure() {
-      mockAndBind(Resources.class);
-    }
-  }
-}
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/editor/FileOpener.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/editor/FileOpener.java
index 645bb8f..af68bd5 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/editor/FileOpener.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/editor/FileOpener.java
@@ -10,8 +10,7 @@
 
 import static com.google.eclipse.protobuf.ui.util.Workbenches.activeWorkbenchPage;
 
-import org.eclipse.core.filesystem.EFS;
-import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.filesystem.*;
 import org.eclipse.core.resources.IFile;
 import org.eclipse.core.runtime.Path;
 import org.eclipse.emf.common.util.URI;
@@ -19,9 +18,8 @@
 import org.eclipse.ui.ide.FileStoreEditorInput;
 import org.eclipse.ui.part.FileEditorInput;
 
-import com.google.eclipse.protobuf.ui.util.Resources;
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
+import com.google.eclipse.protobuf.ui.util.Uris;
+import com.google.inject.*;
 
 /**
  * Utility methods related to open file from different type of locations.
@@ -29,10 +27,10 @@
  * @author alruiz@google.com (Alex Ruiz)
  */
 @Singleton public class FileOpener {
-  @Inject private Resources resources;
+  @Inject private Uris uris;
 
   public IEditorPart openProtoFileInWorkspace(URI uri) throws PartInitException {
-    IFile file = resources.file(uri);
+    IFile file = uris.referredFile(uri);
     IEditorInput editorInput = new FileEditorInput(file);
     return openFile(editorInput);
   }
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/editor/ModelObjectDefinitionNavigator.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/editor/ModelObjectDefinitionNavigator.java
deleted file mode 100644
index 3cec964..0000000
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/editor/ModelObjectDefinitionNavigator.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (c) 2012 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.editor;
-
-import static com.google.common.collect.Lists.newLinkedList;
-import static org.eclipse.core.runtime.Status.*;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.xtext.naming.QualifiedName;
-import org.eclipse.xtext.resource.IResourceDescription;
-import org.eclipse.xtext.ui.editor.IURIEditorOpener;
-
-import com.google.eclipse.protobuf.resource.*;
-import com.google.inject.Inject;
-
-/**
- * Navigates to the definition of a model object, opening necessary files if necessary.
- *
- * @author alruiz@google.com (Alex Ruiz)
- */
-public class ModelObjectDefinitionNavigator {
-  @Inject private IndexLookup lookup;
-  @Inject private IURIEditorOpener editorOpener;
-  @Inject private ResourceDescriptions resources;
-
-  /**
-   * Navigates to the definition of the model object whose qualified name matches any of the given ones. This method
-   * will open the file containing the model object definition if necessary.
-   * @param query information needed to find the object model to navigate to.
-   * @return the result of the operation.
-    */
-  public IStatus navigateToDefinition(Query query) {
-    IResourceDescription resource = lookup.resourceIn(query.filePath);
-    if (resource == null) {
-      return CANCEL_STATUS;
-    }
-    for (QualifiedName qualifiedName : query.qualifiedNames) {
-      URI uri = resources.modelObjectUri(resource, qualifiedName);
-      if (uri != null) {
-        editorOpener.open(uri, true);
-        return OK_STATUS;
-      }
-    }
-    return CANCEL_STATUS;
-  }
-
-  /**
-   * Information needed to find the object model to navigate to.
-   *
-   * @author alruiz@google.com (Alex Ruiz)
-   */
-  public static class Query {
-    final Iterable<QualifiedName> qualifiedNames;
-    final IPath filePath;
-
-    /**
-     * Creates a new <code>{@link Query}</code>, to be used by
-     * <code>{@link ModelObjectDefinitionNavigator#navigateToDefinition(Query)}</code>.
-     * @param qualifiedNames all the possible qualified names the model object to look for may have.
-     * @param filePath the path and name of the file where to perform the lookup.
-     * @return the created {@code Query}.
-     */
-    public static Query newQuery(Iterable<QualifiedName> qualifiedNames, IPath filePath) {
-      return new Query(qualifiedNames, filePath);
-    }
-
-    private Query(Iterable<QualifiedName> qualifiedNames, IPath filePath) {
-      this.qualifiedNames = newLinkedList(qualifiedNames);
-      this.filePath = filePath;
-    }
-
-    @Override public String toString() {
-      String format = "%s[qualifiedNames=%s, filePath=%s]";
-      return String.format(format, getClass().getSimpleName(), qualifiedNames, filePath);
-    }
-  }
-}
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/editor/model/ProtobufDocumentProvider.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/editor/model/ProtobufDocumentProvider.java
index 6ef56c9..a32555e 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/editor/model/ProtobufDocumentProvider.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/editor/model/ProtobufDocumentProvider.java
@@ -26,7 +26,7 @@
 import org.eclipse.xtext.ui.editor.preferences.IPreferenceStoreAccess;
 
 import com.google.eclipse.protobuf.ui.preferences.editor.save.core.SaveActionsPreferences;
-import com.google.eclipse.protobuf.ui.util.editor.Editors;
+import com.google.eclipse.protobuf.ui.util.editor.ChangedLineRegionCalculator;
 import com.google.inject.Inject;
 
 /**
@@ -35,7 +35,7 @@
 public class ProtobufDocumentProvider extends XtextDocumentProvider {
   private static final IRegion[] NO_CHANGE = new IRegion[0];
 
-  @Inject private Editors editors;
+  @Inject private ChangedLineRegionCalculator calculator;
   @Inject private DocumentContentsFactoryRegistry documentContentsFactories;
   @Inject private IPreferenceStoreAccess storeAccess;
   @Inject private SaveActions saveActions;
@@ -112,7 +112,7 @@
       return NO_CHANGE;
     }
     if (preferences.inEditedLines().getValue()) {
-      return editors.calculateChangedLineRegions(textFileBuffer(monitor, editorInput), document, monitor);
+      return calculator.calculateChangedLineRegions(textFileBuffer(monitor, editorInput), document, monitor);
     }
     return new IRegion[] { new Region(0, document.getLength()) };
   }
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/resource/XtextResourceFactory.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/resource/XtextResourceFactory.java
index c6ccbe1..e678e26 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/resource/XtextResourceFactory.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/resource/XtextResourceFactory.java
@@ -17,8 +17,7 @@
 import static org.eclipse.xtext.resource.XtextResource.OPTION_ENCODING;
 import static org.eclipse.xtext.util.CancelIndicator.NullImpl;
 
-import com.google.eclipse.protobuf.ui.util.Resources;
-import com.google.inject.*;
+import java.io.IOException;
 
 import org.eclipse.emf.common.util.URI;
 import org.eclipse.emf.ecore.resource.ResourceSet;
@@ -26,7 +25,8 @@
 import org.eclipse.xtext.ui.resource.IResourceSetProvider;
 import org.eclipse.xtext.util.StringInputStream;
 
-import java.io.IOException;
+import com.google.eclipse.protobuf.ui.util.IProjects;
+import com.google.inject.*;
 
 /**
  * Factory of <code>{@link XtextResource}</code>s.
@@ -35,7 +35,7 @@
  */
 @Singleton public class XtextResourceFactory {
   @Inject private IResourceSetProvider resourceSetProvider;
-  @Inject private Resources resources;
+  @Inject private IProjects projects;
 
   /**
    * Creates a new <code>{@link XtextResource}</code>.
@@ -57,7 +57,7 @@
    */
   public XtextResource createResource(URI uri, String contents) throws IOException {
     // TODO get project from URI.
-    ResourceSet resourceSet = resourceSetProvider.get(resources.activeProject());
+    ResourceSet resourceSet = resourceSetProvider.get(projects.activeProject());
     XtextResource resource = (XtextResource) resourceSet.createResource(uri, UNSPECIFIED_CONTENT_TYPE);
     resource.load(new StringInputStream(contents), singletonMap(OPTION_ENCODING, UTF_8));
     resolveLazyCrossReferences(resource, NullImpl);
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/scoping/FileUriResolver.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/scoping/FileUriResolver.java
index 1956404..ea39979 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/scoping/FileUriResolver.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/scoping/FileUriResolver.java
@@ -11,12 +11,7 @@
 import static com.google.common.collect.Lists.newArrayList;
 import static java.util.Collections.*;
 
-import com.google.eclipse.protobuf.model.util.Imports;
-import com.google.eclipse.protobuf.protobuf.Import;
-import com.google.eclipse.protobuf.scoping.*;
-import com.google.eclipse.protobuf.ui.preferences.paths.core.PathsPreferences;
-import com.google.eclipse.protobuf.ui.util.Resources;
-import com.google.inject.Inject;
+import java.util.List;
 
 import org.eclipse.core.resources.*;
 import org.eclipse.emf.common.util.URI;
@@ -24,7 +19,12 @@
 import org.eclipse.xtext.ui.XtextProjectHelper;
 import org.eclipse.xtext.ui.editor.preferences.IPreferenceStoreAccess;
 
-import java.util.List;
+import com.google.eclipse.protobuf.model.util.Imports;
+import com.google.eclipse.protobuf.protobuf.Import;
+import com.google.eclipse.protobuf.scoping.*;
+import com.google.eclipse.protobuf.ui.preferences.paths.core.PathsPreferences;
+import com.google.eclipse.protobuf.ui.util.Uris;
+import com.google.inject.Inject;
 
 /**
  * Resolves "import" URIs.
@@ -35,7 +35,7 @@
   @Inject private ProtoDescriptorProvider descriptorProvider;
   @Inject private Imports imports;
   @Inject private MultipleDirectoriesFileResolverStrategy multipleDirectories;
-  @Inject private Resources resources;
+  @Inject private Uris uris;
   @Inject private SingleDirectoryFileResolverStrategy singleDirectory;
   @Inject private IPreferenceStoreAccess storeAccess;
 
@@ -70,7 +70,7 @@
       return location.toString();
     }
     URI resourceUri = resource.getURI();
-    IProject project = resources.project(resourceUri);
+    IProject project = uris.projectOfReferredFile(resourceUri);
     FileResolverStrategy resolver = multipleDirectories;
     if (project == null) {
       return resolver.resolveUri(importUri, resourceUri, preferencesFromAllProjects());
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/scoping/MultipleDirectoriesFileResolverStrategy.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/scoping/MultipleDirectoriesFileResolverStrategy.java
index 21364a1..b01f48e 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/scoping/MultipleDirectoriesFileResolverStrategy.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/scoping/MultipleDirectoriesFileResolverStrategy.java
@@ -83,6 +83,6 @@
   }
 
   private String resolveUri(URI uri) {
-    return (uris.exists(uri)) ? uri.toString() : null;
+    return (uris.referredResourceExists(uri)) ? uri.toString() : null;
   }
 }
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/scoping/SingleDirectoryFileResolverStrategy.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/scoping/SingleDirectoryFileResolverStrategy.java
index 1c37ca6..57de868 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/scoping/SingleDirectoryFileResolverStrategy.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/scoping/SingleDirectoryFileResolverStrategy.java
@@ -42,7 +42,7 @@
       pathBuilder.append(segment).append(SEPARATOR);
     }
     String resolved = createResolvedUri(pathBuilder.toString(), importUri, declaringResourceUri);
-    return uris.exists(createURI(resolved)) ? resolved : null;
+    return uris.referredResourceExists(createURI(resolved)) ? resolved : null;
   }
 
   private String createResolvedUri(String path, URI importUri, URI declaringResourceUri) {
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/util/Editors.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/util/Editors.java
new file mode 100644
index 0000000..2eb1974
--- /dev/null
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/util/Editors.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2012 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.util;
+
+import org.eclipse.core.resources.*;
+import org.eclipse.ui.IEditorPart;
+
+import com.google.inject.Singleton;
+
+/**
+ * Utility methods related to editors.
+ *
+ * @author alruiz@google.com (Alex Ruiz)
+ */
+@Singleton public class Editors {
+
+  /**
+   * Returns the project owning the file displayed in the given editor.
+   * @param editor the given editor.
+   * @return the project owning the file displayed in the given editor.
+   */
+  public IProject projectOwningFileDisplayedIn(IEditorPart editor) {
+    IResource resource = resourceFrom(editor);
+    return (resource == null) ? null : resource.getProject();
+  }
+
+  private IResource resourceFrom(IEditorPart editor) {
+    if (editor == null) {
+      return null;
+    }
+    Object adapter = editor.getEditorInput().getAdapter(IResource.class);
+    return (adapter == null) ? null : (IResource) adapter;
+  }
+}
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/util/IProjects.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/util/IProjects.java
new file mode 100644
index 0000000..7758f8d
--- /dev/null
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/util/IProjects.java
@@ -0,0 +1,50 @@
+/*
+ * 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.util;
+
+import static com.google.eclipse.protobuf.ui.util.Workbenches.activeWorkbenchPage;
+
+import org.eclipse.core.resources.*;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.ui.*;
+import org.eclipse.ui.views.navigator.ResourceNavigator;
+
+import com.google.inject.Singleton;
+
+/**
+ * Utility methods related to <code>{@link IProject}</code>s.
+ *
+ * @author alruiz@google.com (Alex Ruiz)
+ */
+@SuppressWarnings("deprecation")
+@Singleton public class IProjects {
+  private static final IViewReference[] NO_VIEW_REFERENCES = new IViewReference[0];
+
+  public IProject activeProject() {
+    for (IViewReference reference : viewReferencesInActivePage()) {
+      IViewPart part = reference.getView(false);
+      if (part instanceof ResourceNavigator) {
+        ResourceNavigator navigator = (ResourceNavigator) part;
+        StructuredSelection selection = (StructuredSelection) navigator.getTreeViewer().getSelection();
+        IResource resource = (IResource) selection.getFirstElement();
+        return resource.getProject();
+      }
+    }
+    return null;
+  }
+
+  private IViewReference[] viewReferencesInActivePage() {
+    IWorkbenchPage page = activeWorkbenchPage();
+    if (page == null) {
+      return NO_VIEW_REFERENCES;
+    }
+    IViewReference[] references = page.getViewReferences();
+    return (references == null) ? NO_VIEW_REFERENCES : references;
+  }
+}
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/util/Resources.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/util/Resources.java
deleted file mode 100644
index d3e94d3..0000000
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/util/Resources.java
+++ /dev/null
@@ -1,108 +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.ui.util;
-
-import static com.google.eclipse.protobuf.ui.util.Workbenches.activeWorkbenchPage;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.ui.*;
-import org.eclipse.ui.views.navigator.ResourceNavigator;
-
-import com.google.inject.Singleton;
-
-/**
- * Utility methods related to resources (e.g. files, directories.)
- *
- * @author alruiz@google.com (Alex Ruiz)
- */
-@SuppressWarnings("deprecation")
-@Singleton public class Resources {
-  private static final IViewReference[] NO_VIEW_REFERENCES = new IViewReference[0];
-
-  /**
-   * Returns the project that contains the resource at the given URI.
-   * @param resourceUri the given URI.
-   * @return the project that contains the resource at the given URI, or {@code null} if the resource at the given URI
-   * is not in a workspace.
-   */
-  public IProject project(URI resourceUri) {
-    IFile file = file(resourceUri);
-    return (file != null) ? file.getProject() : null;
-  }
-
-  public IProject activeProject() {
-    for (IViewReference reference : viewReferencesInActivePage()) {
-      IViewPart part = reference.getView(false);
-      if (part instanceof ResourceNavigator) {
-        ResourceNavigator navigator = (ResourceNavigator) part;
-        StructuredSelection selection = (StructuredSelection) navigator.getTreeViewer().getSelection();
-        IResource resource = (IResource) selection.getFirstElement();
-        return resource.getProject();
-      }
-    }
-    return null;
-  }
-
-  private IViewReference[] viewReferencesInActivePage() {
-    IWorkbenchPage page = activeWorkbenchPage();
-    if (page == null) {
-      return NO_VIEW_REFERENCES;
-    }
-    IViewReference[] references = page.getViewReferences();
-    return (references == null) ? NO_VIEW_REFERENCES : references;
-  }
-
-  /**
-   * Indicates whether the given URI belongs to an existing file.
-   * @param fileUri the URI to check, as a {@code String}.
-   * @return {@code true} if the given URI belongs to an existing file, {@code false} otherwise.
-   */
-  public boolean fileExists(URI fileUri) {
-    IFile file = file(fileUri);
-    return (file != null) ? file.exists() : false;
-  }
-
-  /**
-   * Returns a handle to a workspace file identified by the given URI.
-   * @param uri the given URI.
-   * @return a handle to a workspace file identified by the given URI or
-   * {@code null} if the URI does not belong to a workspace file.
-   */
-  public IFile file(URI uri) {
-    IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
-    IPath path = pathOf(uri);
-    return (path != null) ? root.getFile(path) : null;
-  }
-
-  /**
-   * Returns the project owning the file displayed in the given editor.
-   * @param editor the given editor.
-   * @return the project owning the file displayed in the given editor.
-   */
-  public IProject project(IEditorPart editor) {
-    IResource resource = resourceFrom(editor);
-    return (resource == null) ? null : resource.getProject();
-  }
-
-  private IResource resourceFrom(IEditorPart editor) {
-    if (editor == null) {
-      return null;
-    }
-    Object adapter = editor.getEditorInput().getAdapter(IResource.class);
-    return (adapter == null) ? null : (IResource) adapter;
-  }
-
-  private IPath pathOf(URI uri) {
-    String platformUri = uri.toPlatformString(true);
-    return (platformUri != null) ? new Path(platformUri) : null;
-  }
-}
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/util/SimpleReference.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/util/SimpleReference.java
deleted file mode 100644
index 1cbcb95..0000000
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/util/SimpleReference.java
+++ /dev/null
@@ -1,49 +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.ui.util;
-
-/**
- * A reference to an object. This class is not thread-safe.
- * @param <T> the type of object this reference holds.
- *
- * @author alruiz@google.com (Alex Ruiz)
- */
-public class SimpleReference<T> {
-  private T value;
-
-  /**
-   * Creates a new <code>{@link SimpleReference}</code> with a {@code null} value.
-   */
-  public SimpleReference() {}
-
-  /**
-   * Creates a new <code>{@link SimpleReference}</code>.
-   * @param value the initial value of this reference.
-   */
-  public SimpleReference(T value) {
-    this.value = value;
-  }
-
-  /**
-   * Returns this reference's value.
-   * @return this reference's value.
-   */
-  public T get() {
-    return value;
-  }
-
-  /**
-   * Sets this reference's value.
-   * @param newValue the new value to set.
-   */
-  public void set(T newValue) {
-    value = newValue;
-  }
-}
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/util/Uris.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/util/Uris.java
index a7d3527..f51caee 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/util/Uris.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/util/Uris.java
@@ -14,9 +14,11 @@
 import java.io.File;
 import java.util.List;
 
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.*;
 import org.eclipse.emf.common.util.URI;
 
-import com.google.inject.*;
+import com.google.inject.Singleton;
 
 /**
  * Utility methods related to URIs.
@@ -27,20 +29,18 @@
   public static String PLATFORM_RESOURCE_PREFIX = "platform:/resource";
   public static String FILE_PREFIX = "file:";
 
-  @Inject private Resources resources;
-
   /**
    * Indicates whether the resource or file referred by the given URI exists.
    * @param uri the URI to check.
    * @return {@code true} if the resource or file referred by the given URI exists, {@code false} otherwise.
    */
-  public boolean exists(URI uri) {
+  public boolean referredResourceExists(URI uri) {
     if (uri.isFile()) {
       File file = new File(uri.path());
       return file.exists();
     }
     if (uri.isPlatformResource()) {
-      return resources.fileExists(uri);
+      return referredFileExists(uri);
     }
     return false;
   }
@@ -63,6 +63,16 @@
     return unmodifiableList(segments);
   }
 
+  /**
+   * Returns the "prefix" of the given URI as follows:
+   * <ul>
+   * <li><code>{@link #PLATFORM_RESOURCE_PREFIX}</code>, if the URI refers to a platform resource</li>
+   * <li><code>{@link #FILE_PREFIX}</code>, if the URI refers to a file</li>
+   * <li>{@code null} otherwise</li>
+   * </ul>
+   * @param uri the given URI.
+   * @return the "prefix" of the given URI.
+   */
   public String prefixOf(URI uri) {
     if (uri.isFile()) {
       return FILE_PREFIX;
@@ -72,4 +82,42 @@
     }
     return "";
   }
+
+  /**
+   * Returns the project that contains the file referred by the given URI.
+   * @param resourceUri the given URI.
+   * @return the project that contains the file referred by the given URI, or {@code null} if the resource referred by
+   * the given URI is not a file in the workspace.
+   */
+  public IProject projectOfReferredFile(URI resourceUri) {
+    IFile file = referredFile(resourceUri);
+    return (file != null) ? file.getProject() : null;
+  }
+
+  /**
+   * Indicates whether the given URI refers to an existing file.
+   * @param fileUri the URI to check, as a {@code String}.
+   * @return {@code true} if the given URI refers to an existing file, {@code false} otherwise.
+   */
+  public boolean referredFileExists(URI fileUri) {
+    IFile file = referredFile(fileUri);
+    return (file != null) ? file.exists() : false;
+  }
+
+  /**
+   * Returns a handle to a workspace file referred by the given URI.
+   * @param uri the given URI.
+   * @return a handle to a workspace file referred by the given URI or {@code null} if the URI does not refer a
+   * workspace file.
+   */
+  public IFile referredFile(URI uri) {
+    IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+    IPath path = pathOf(uri);
+    return (path != null) ? root.getFile(path) : null;
+  }
+
+  private IPath pathOf(URI uri) {
+    String uriAsText = uri.toPlatformString(true);
+    return (uriAsText != null) ? new Path(uriAsText) : null;
+  }
 }
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/util/editor/Editors.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/util/editor/ChangedLineRegionCalculator.java
similarity index 91%
rename from com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/util/editor/Editors.java
rename to com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/util/editor/ChangedLineRegionCalculator.java
index 34d1378..6057149 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/util/editor/Editors.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/util/editor/ChangedLineRegionCalculator.java
@@ -19,6 +19,7 @@
 import static org.eclipse.core.runtime.SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK;
 
 import java.util.List;
+import java.util.concurrent.atomic.AtomicReference;
 
 import org.apache.log4j.Logger;
 import org.eclipse.compare.rangedifferencer.RangeDifference;
@@ -27,7 +28,6 @@
 import org.eclipse.core.runtime.*;
 import org.eclipse.jface.text.*;
 
-import com.google.eclipse.protobuf.ui.util.SimpleReference;
 import com.google.inject.Singleton;
 
 /**
@@ -36,13 +36,13 @@
  *
  * @author alruiz@google.com (Alex Ruiz)
  */
-@Singleton public class Editors {
-  private static Logger logger = Logger.getLogger(Editors.class);
+@Singleton public class ChangedLineRegionCalculator {
+  private static Logger logger = Logger.getLogger(ChangedLineRegionCalculator.class);
 
   public IRegion[] calculateChangedLineRegions(final ITextFileBuffer buffer, final IDocument current,
       final IProgressMonitor monitor) throws CoreException {
-    final SimpleReference<IRegion[]> result = new SimpleReference<IRegion[]>();
-    final SimpleReference<IStatus> errorStatus = new SimpleReference<IStatus>(OK_STATUS);
+    final AtomicReference<IRegion[]> result = new AtomicReference<IRegion[]>();
+    final AtomicReference<IStatus> errorStatus = new AtomicReference<IStatus>(OK_STATUS);
     try {
       SafeRunner.run(new ISafeRunnable() {
         @Override public void handleException(Throwable exception) {
@@ -66,9 +66,8 @@
         }
 
         /*
-         * Returns regions of all lines which differ comparing {@code old}s
-         * content with {@code current}s content. Successive lines are merged
-         * into one region.
+         * Returns regions of all lines which differ comparing {@code old}s content with {@code current}s content.
+         * Successive lines are merged into one region.
          */
         private IRegion[] getChangedLineRegions(IDocument old) {
           RangeDifference[] differences = differencesWith(old);
@@ -82,8 +81,7 @@
               try {
                 startLineRegion = current.getLineInformation(startLine);
                 if (startLine >= endLine) {
-                  // startLine > endLine indicates a deletion of one or more
-                  // lines.
+                  // startLine > endLine indicates a deletion of one or more lines.
                   // Deletions are ignored except at the end of the document.
                   if (startLine == endLine
                       || startLineRegion.getOffset() + startLineRegion.getLength() == current.getLength()) {
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 67fa6b3..2eaddc5 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
@@ -44,8 +44,8 @@
   }
 
   private IProject projectFrom(IEditorPart editor) {
-    Resources resources = ProtobufPlugIn.getInstance(Resources.class);
-    return resources.project(editor);
+    Editors editors = ProtobufPlugIn.getInstance(Editors.class);
+    return editors.projectOwningFileDisplayedIn(editor);
   }
 
   private boolean shouldValidateEditor(IProject project) {
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/validation/ValidationTrigger.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/validation/ValidationTrigger.java
index 5370560..2973efd 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/validation/ValidationTrigger.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/validation/ValidationTrigger.java
@@ -16,7 +16,7 @@
 import org.eclipse.core.resources.IProject;
 import org.eclipse.ui.*;
 
-import com.google.eclipse.protobuf.ui.util.Resources;
+import com.google.eclipse.protobuf.ui.util.Editors;
 import com.google.inject.*;
 
 /**
@@ -27,7 +27,7 @@
 @Singleton public class ValidationTrigger {
   private final String PROTO_EDITOR_ID = "com.google.eclipse.protobuf.Protobuf";
 
-  @Inject private Resources resources;
+  @Inject private Editors editors;
 
   /**
    * Triggers validation of all open .proto files belonging to the given project.
@@ -48,7 +48,7 @@
       return;
     }
     IEditorPart editor = editorRef.getEditor(true);
-    IProject fileProject = resources.project(editor);
+    IProject fileProject = editors.projectOwningFileDisplayedIn(editor);
     if (fileProject == null || !haveEqualUris(project, fileProject)) {
       return;
     }