In progress: [ Issue 40 ] Add support for import resolution across multiple folders
https://code.google.com/p/protobuf-dt/issues/detail?id=40

Code cleanup.
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/paths/Messages.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/paths/Messages.java
index 7b99fad..83e2534 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/paths/Messages.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/paths/Messages.java
@@ -15,11 +15,11 @@
  */
 public class Messages extends NLS {
   
-  public static String allProtosInMultipleFolders;
-  public static String allProtosInOneFolder;
-  public static String errorNoFolderNames;
-  public static String folderNameHint;
-  public static String importedFilesResolution;
+  public static String directoryNameHint;
+  public static String errorNoDirectoryNames;
+  public static String filesInMultipleDirectories;
+  public static String filesInOneDirectoryOnly;
+  public static String importedFilesPathResolution;
 
   static {
     Class<Messages> targetType = Messages.class;
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/paths/Messages.properties b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/paths/Messages.properties
index 3cb933a..8424e7e 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/paths/Messages.properties
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/paths/Messages.properties
@@ -1,5 +1,5 @@
-allProtosInMultipleFolders=Look for imported files in folders:*
-allProtosInOneFolder=One folder for all .proto files
-errorNoFolderNames=Enter the name of the folders
-folderNameHint=*comma-separated values (e.g. 'src, src-gen, src-readonly')
-importedFilesResolution=Resolution of imported files
+directoryNameHint=*comma-separated values (e.g. 'src, src-gen, src-readonly')
+errorNoDirectoryNames=Enter the name of the directories
+filesInMultipleDirectories=Look for imported files in directories:*
+filesInOneDirectoryOnly=One directory for all .proto files
+importedFilesPathResolution=Path resolution of imported files
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/paths/PathsPreferenceNames.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/paths/PathsPreferenceNames.java
index e419776..9950298 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/paths/PathsPreferenceNames.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/paths/PathsPreferenceNames.java
@@ -14,9 +14,9 @@
 final class PathsPreferenceNames {
 
   static final String ENABLE_PROJECT_SETTINGS = "paths.enableProjectSettings";
-  static final String ALL_PROTOS_IN_ONE_FOLDER_ONLY = "paths.oneFolderOnly";
-  static final String PROTOS_IN_MULTIPLE_FOLDERS = "paths.multipleFolders";
-  static final String FOLDER_NAMES = "paths.folderNames";
+  static final String FILES_IN_ONE_DIRECTORY_ONLY = "paths.filesInOneDirectoryOnly";
+  static final String FILES_IN_MULTIPLE_DIRECTORIES = "paths.filesInMultipleDirectories";
+  static final String DIRECTORY_NAMES = "paths.directoryNames";
 
   private PathsPreferenceNames() {}
 }
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/paths/PathsPreferencePage.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/paths/PathsPreferencePage.java
index ec8e0c8..de99706 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/paths/PathsPreferencePage.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/paths/PathsPreferencePage.java
@@ -55,21 +55,21 @@
     grpResolutionOfImported = new Group(contents, SWT.NONE);
     grpResolutionOfImported.setLayout(new GridLayout(1, false));
     grpResolutionOfImported.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
-    grpResolutionOfImported.setText(importedFilesResolution);
+    grpResolutionOfImported.setText(importedFilesPathResolution);
     
     btnOneFolderOnly = new Button(grpResolutionOfImported, SWT.RADIO);
     btnOneFolderOnly.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1));
-    btnOneFolderOnly.setText(allProtosInOneFolder);
+    btnOneFolderOnly.setText(filesInOneDirectoryOnly);
     
     btnMultipleFolders = new Button(grpResolutionOfImported, SWT.RADIO);
     btnMultipleFolders.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1));
-    btnMultipleFolders.setText(allProtosInMultipleFolders);
+    btnMultipleFolders.setText(filesInMultipleDirectories);
     
     txtFolderNames = new Text(grpResolutionOfImported, SWT.BORDER);
     txtFolderNames.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
     
     Label label = new Label(grpResolutionOfImported, SWT.NONE);
-    label.setText(folderNameHint);
+    label.setText(directoryNameHint);
     new Label(contents, SWT.NONE);
     
     updateFromPreferenceStore();
@@ -80,9 +80,9 @@
 
   private void updateFromPreferenceStore() {
     IPreferenceStore store = doGetPreferenceStore();
-    btnOneFolderOnly.setSelection(store.getBoolean(ALL_PROTOS_IN_ONE_FOLDER_ONLY));
-    btnMultipleFolders.setSelection(store.getBoolean(PROTOS_IN_MULTIPLE_FOLDERS));
-    txtFolderNames.setText(store.getString(FOLDER_NAMES));
+    btnOneFolderOnly.setSelection(store.getBoolean(FILES_IN_ONE_DIRECTORY_ONLY));
+    btnMultipleFolders.setSelection(store.getBoolean(FILES_IN_MULTIPLE_DIRECTORIES));
+    txtFolderNames.setText(store.getString(DIRECTORY_NAMES));
     boolean shouldEnablePathsOptions = true;
     if (isPropertyPage()) {
       boolean useProjectSettings = store.getBoolean(ENABLE_PROJECT_SETTINGS);
@@ -111,7 +111,7 @@
     if (txtFolderNames.isEnabled()) {
       String folderNames = txtFolderNames.getText().trim();
       if (isEmpty(folderNames)) {
-        pageIsNowInvalid(errorNoFolderNames);
+        pageIsNowInvalid(errorNoDirectoryNames);
         return;
       }
       for (String folderName : folderNames.split(CSV_PATTERN)) {
@@ -132,9 +132,9 @@
 
   @Override protected void performDefaults() {
     IPreferenceStore store = doGetPreferenceStore();
-    btnOneFolderOnly.setSelection(store.getDefaultBoolean(ALL_PROTOS_IN_ONE_FOLDER_ONLY));
-    btnMultipleFolders.setSelection(store.getDefaultBoolean(PROTOS_IN_MULTIPLE_FOLDERS));
-    txtFolderNames.setText(store.getDefaultString(FOLDER_NAMES));
+    btnOneFolderOnly.setSelection(store.getDefaultBoolean(FILES_IN_ONE_DIRECTORY_ONLY));
+    btnMultipleFolders.setSelection(store.getDefaultBoolean(FILES_IN_MULTIPLE_DIRECTORIES));
+    txtFolderNames.setText(store.getDefaultString(DIRECTORY_NAMES));
     boolean shouldEnablePathsOptions = true;
     if (isPropertyPage()) {
       boolean useProjectSettings = store.getDefaultBoolean(ENABLE_PROJECT_SETTINGS);
@@ -156,9 +156,9 @@
   @Override protected void savePreferences() {
     IPreferenceStore store = getPreferenceStore();
     if (isPropertyPage()) store.setValue(ENABLE_PROJECT_SETTINGS, areProjectSettingsActive());
-    store.setValue(ALL_PROTOS_IN_ONE_FOLDER_ONLY, btnOneFolderOnly.getSelection());
-    store.setValue(PROTOS_IN_MULTIPLE_FOLDERS, btnMultipleFolders.getSelection());
-    store.setValue(FOLDER_NAMES, txtFolderNames.getText().trim());
+    store.setValue(FILES_IN_ONE_DIRECTORY_ONLY, btnOneFolderOnly.getSelection());
+    store.setValue(FILES_IN_MULTIPLE_DIRECTORIES, btnMultipleFolders.getSelection());
+    store.setValue(DIRECTORY_NAMES, txtFolderNames.getText().trim());
   }
 
   /** {@inheritDoc} */
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/paths/PathsPreferenceStoreInitializer.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/paths/PathsPreferenceStoreInitializer.java
index 0c5417a..6fa71ed 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/paths/PathsPreferenceStoreInitializer.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/paths/PathsPreferenceStoreInitializer.java
@@ -24,9 +24,9 @@
   /** {@inheritDoc} */
   public void initialize(IPreferenceStoreAccess access) {
     IPreferenceStore store = access.getWritablePreferenceStore();
-    store.setDefault(ALL_PROTOS_IN_ONE_FOLDER_ONLY, true);
-    store.setDefault(PROTOS_IN_MULTIPLE_FOLDERS, false);
-    store.setDefault(FOLDER_NAMES, "");
+    store.setDefault(FILES_IN_ONE_DIRECTORY_ONLY, true);
+    store.setDefault(FILES_IN_MULTIPLE_DIRECTORIES, false);
+    store.setDefault(DIRECTORY_NAMES, "");
   }
 
 }
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/paths/PathsPreferences.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/paths/PathsPreferences.java
index 20ef81a..5f6fa68 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/paths/PathsPreferences.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/paths/PathsPreferences.java
@@ -8,8 +8,8 @@
  */
 package com.google.eclipse.protobuf.ui.preferences.paths;
 
-import static com.google.eclipse.protobuf.ui.preferences.paths.PathsResolutionType.SINGLE_FOLDER;
-import static com.google.eclipse.protobuf.ui.preferences.paths.PathsPreferenceNames.FOLDER_NAMES;
+import static com.google.eclipse.protobuf.ui.preferences.paths.PathsResolutionType.SINGLE_DIRECTORY;
+import static com.google.eclipse.protobuf.ui.preferences.paths.PathsPreferenceNames.DIRECTORY_NAMES;
 import static com.google.eclipse.protobuf.ui.util.Strings.CSV_PATTERN;
 import static java.util.Arrays.asList;
 import static java.util.Collections.*;
@@ -34,8 +34,8 @@
   }
   
   private static List<String> folderNames(PathsResolutionType types, IPreferenceStore store) {
-    if (types.equals(SINGLE_FOLDER)) return emptyList();
-    String[] folderNames = store.getString(FOLDER_NAMES).split(CSV_PATTERN);
+    if (types.equals(SINGLE_DIRECTORY)) return emptyList();
+    String[] folderNames = store.getString(DIRECTORY_NAMES).split(CSV_PATTERN);
     return unmodifiableList(asList(folderNames));
   }
 
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/paths/PathsResolutionType.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/paths/PathsResolutionType.java
index a8c2a84..c24670a 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/paths/PathsResolutionType.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/paths/PathsResolutionType.java
@@ -7,7 +7,7 @@
  * http://www.eclipse.org/legal/epl-v10.html
  */package com.google.eclipse.protobuf.ui.preferences.paths;
 
-import static com.google.eclipse.protobuf.ui.preferences.paths.PathsPreferenceNames.ALL_PROTOS_IN_ONE_FOLDER_ONLY;
+import static com.google.eclipse.protobuf.ui.preferences.paths.PathsPreferenceNames.FILES_IN_ONE_DIRECTORY_ONLY;
 
 import org.eclipse.jface.preference.IPreferenceStore;
 
@@ -18,10 +18,10 @@
  */
 public enum PathsResolutionType {
 
-  SINGLE_FOLDER, MULTIPLE_FOLDERS;
+  SINGLE_DIRECTORY, MULTIPLE_DIRECTORIES;
   
   static PathsResolutionType find(IPreferenceStore store) {
-    if (store.getBoolean(ALL_PROTOS_IN_ONE_FOLDER_ONLY)) return SINGLE_FOLDER;
-    return MULTIPLE_FOLDERS;
+    if (store.getBoolean(FILES_IN_ONE_DIRECTORY_ONLY)) return SINGLE_DIRECTORY;
+    return MULTIPLE_DIRECTORIES;
   }
 }
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 5c57348..68d26a1 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
@@ -8,7 +8,7 @@
  */
 package com.google.eclipse.protobuf.ui.scoping;
 
-import static com.google.eclipse.protobuf.ui.preferences.paths.PathsResolutionType.SINGLE_FOLDER;
+import static com.google.eclipse.protobuf.ui.preferences.paths.PathsResolutionType.SINGLE_DIRECTORY;
 import static org.eclipse.emf.common.util.URI.createURI;
 import static org.eclipse.xtext.util.Tuples.pair;
 
@@ -65,7 +65,7 @@
     IProject project = resources.project(resourceUri);
     PathsPreferences preferences = preferenceReader.readFromPrefereceStore(project);
     List<String> segments = removeFirstAndLast(resourceUri.segmentsList());
-    if (preferences.fileResolutionType().equals(SINGLE_FOLDER)) {
+    if (preferences.fileResolutionType().equals(SINGLE_DIRECTORY)) {
       return resolveUri(importUri, segments);
     }
     for (String folderName : preferences.folderNames()) {