Fixed: [ Issue 62 ] Outline View should show import URI as the user entered
https://code.google.com/p/protobuf-dt/issues/detail?id=62

diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/editor/syntaxcoloring/ProtobufSemanticHighlightingCalculator.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/editor/syntaxcoloring/ProtobufSemanticHighlightingCalculator.java
index e560ad3..11b60a4 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/editor/syntaxcoloring/ProtobufSemanticHighlightingCalculator.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/editor/syntaxcoloring/ProtobufSemanticHighlightingCalculator.java
@@ -13,6 +13,7 @@
 
 import java.util.List;
 
+import org.eclipse.emf.common.util.EList;
 import org.eclipse.emf.ecore.*;
 import org.eclipse.xtext.nodemodel.INode;
 import org.eclipse.xtext.resource.XtextResource;
@@ -27,8 +28,10 @@
 public class ProtobufSemanticHighlightingCalculator implements ISemanticHighlightingCalculator {
 
   public void provideHighlightingFor(XtextResource resource, IHighlightedPositionAcceptor acceptor) {
-    if (resource.getContents().isEmpty()) return;
-    Protobuf protobuf = (Protobuf) resource.getContents().get(0);
+    if (resource == null) return;
+    EList<EObject> contents = resource.getContents();
+    if (contents == null || contents.isEmpty()) return;
+    Protobuf protobuf = (Protobuf) contents.get(0);
     highlightAllNames(protobuf, acceptor, DEFAULT_ID);
   }
 
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/labeling/Labels.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/labeling/Labels.java
index 189f736..496ffd4 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/labeling/Labels.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/labeling/Labels.java
@@ -9,8 +9,13 @@
 package com.google.eclipse.protobuf.ui.labeling;
 
 import static org.eclipse.jface.viewers.StyledString.DECORATIONS_STYLER;
+import static org.eclipse.xtext.nodemodel.util.NodeModelUtils.findNodesForFeature;
+import static com.google.eclipse.protobuf.protobuf.ProtobufPackage.Literals.*;
 
 import org.eclipse.jface.viewers.StyledString;
+import org.eclipse.xtext.nodemodel.INode;
+
+import java.util.List;
 
 import com.google.eclipse.protobuf.protobuf.*;
 import com.google.eclipse.protobuf.ui.util.Properties;
@@ -56,7 +61,10 @@
   }
 
   private Object labelFor(Import i) {
-    return i.getImportURI();
+    List<INode> nodes = findNodesForFeature(i, IMPORT__IMPORT_URI);
+    if (nodes.size() != 1) return i.getImportURI();
+    INode node = nodes.get(0);
+    return node.getText();
   }
 
   private Object labelFor(Literal l) {
@@ -68,7 +76,9 @@
 
   private Object labelFor(Property p) {
     StyledString text = new StyledString(p.getName());
-    String indexAndType = String.format(" [%d] : %s", p.getIndex(), properties.typeNameOf(p));
+    String typeName = properties.typeNameOf(p);
+    if (typeName == null) typeName = "<unable to resolve type reference>";
+    String indexAndType = String.format(" [%d] : %s", p.getIndex(), typeName);
     text.append(indexAndType, DECORATIONS_STYLER);
     return text;
   }
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/outline/ProtobufOutlineTreeProvider.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/outline/ProtobufOutlineTreeProvider.java
index 8a6913f..3b25837 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/outline/ProtobufOutlineTreeProvider.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/outline/ProtobufOutlineTreeProvider.java
@@ -41,20 +41,22 @@
     return true;
   }
 
-  protected void _createChildren(DocumentRootNode parentNode, Protobuf protobuf) {
+  protected void _createChildren(DocumentRootNode parent, Protobuf protobuf) {
     OutlineViewModel model = new OutlineViewModel(protobuf);
-    for (EObject aPackage : model.packages()) createNode(parentNode, aPackage);
-    addGroup(parentNode, model.imports(), "imports", importDeclarations);
-    addGroup(parentNode, model.options(), "options", optionDeclarations);
+    for (EObject aPackage : model.packages()) createNode(parent, aPackage);
+    addGroup(parent, protobuf, model.imports(), "imports", importDeclarations);
+    addGroup(parent, protobuf, model.options(), "options", optionDeclarations);
     for (EObject e : model.remainingElements()) {
-      createNode(parentNode, e);
+      createNode(parent, e);
     }
   }
 
-  private void addGroup(DocumentRootNode parent, List<? extends EObject> group, String imageKey, String text) {
-    if (!group.isEmpty()) {
-      SimpleOutlineNode groupNode = new SimpleOutlineNode(parent, labelProvider.getImage(imageKey), text, false);
-      for (EObject o : group) createNode(groupNode, o);
+  private void addGroup(DocumentRootNode parent, Protobuf protobuf, List<? extends EObject> group, String imageKey,
+      String text) {
+    if (group.isEmpty()) return;
+    SimpleOutlineNode groupNode = new SimpleOutlineNode(parent, protobuf, labelProvider.getImage(imageKey), text, false);
+    for (EObject o : group) {
+      createNode(groupNode, o);
     }
   }
 
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/outline/SimpleOutlineNode.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/outline/SimpleOutlineNode.java
index f7787ff..ae89fac 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/outline/SimpleOutlineNode.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/outline/SimpleOutlineNode.java
@@ -8,6 +8,9 @@
  */
 package com.google.eclipse.protobuf.ui.outline;
 
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.util.EcoreUtil;
 import org.eclipse.swt.graphics.Image;
 import org.eclipse.xtext.ui.editor.outline.IOutlineNode;
 import org.eclipse.xtext.ui.editor.outline.impl.AbstractOutlineNode;
@@ -17,7 +20,14 @@
  */
 class SimpleOutlineNode extends AbstractOutlineNode {
 
-  SimpleOutlineNode(IOutlineNode parent, Image image, Object text, boolean isLeaf) {
+  private final URI ownerUri;
+  
+  SimpleOutlineNode(IOutlineNode parent, EObject owner, Image image, Object text, boolean isLeaf) {
     super(parent, image, text, isLeaf);
+    ownerUri = EcoreUtil.getURI(owner);
+  }
+
+  @Override protected URI getEObjectURI() {
+    return ownerUri;
   }
 }
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 70fe2cf..48a35ce 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
@@ -149,8 +149,10 @@
   }
 
   private String directoryNames() {
+    List<DirectoryPath> paths = directoryPathsEditor.directoryPaths();
+    if (paths.isEmpty()) return "";
     List<String> pathsAsText = new ArrayList<String>();
-    for (DirectoryPath path : directoryPathsEditor.directoryPaths()) {
+    for (DirectoryPath path : paths) {
       pathsAsText.add(path.toString());
     }
     return concat(COMMA_DELIMITER, pathsAsText);