Bug 532733 - set the default root path to "" for src.zip

Change-Id: Ieb11a289c067bbf0cc2319fe26b684078a73c2b4
Signed-off-by: Tom Schindl <tom.schindl@bestsolution.at>
diff --git a/org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/launching/macosx/MacOSXVMInstallType.java b/org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/launching/macosx/MacOSXVMInstallType.java
index 153e2e2..bb5fe91 100644
--- a/org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/launching/macosx/MacOSXVMInstallType.java
+++ b/org.eclipse.jdt.launching.macosx/macosx/org/eclipse/jdt/internal/launching/macosx/MacOSXVMInstallType.java
@@ -288,17 +288,19 @@
 		File lib = new File(installLocation, "lib"); //$NON-NLS-1$
 		File extDir = new File(lib, "ext"); //$NON-NLS-1$
 		String[] dirs = null;
-		if (extDir.exists())
+		if (extDir.exists()) {
 			dirs = new String[] {extDir.getAbsolutePath()};
-		else
+		} else {
 			dirs = new String[0];
+		}
 
 		File endDir = new File(lib, "endorsed"); //$NON-NLS-1$
 		String[] endDirs = null;
-		if (endDir.exists())
+		if (endDir.exists()) {
 			endDirs = new String[] {endDir.getAbsolutePath()};
-		else
-			endDirs = new String[0]; 
+		} else {
+			endDirs = new String[0];
+		} 
 		
 		return new LibraryInfo("???", libs, dirs, endDirs);		 //$NON-NLS-1$
 	}
@@ -324,7 +326,12 @@
 				src = getSourceInParent(parent);
 			}
 			if(src != null) {
-				setDefaultRootPath(SRC_NAME);
+				if (src.getName().endsWith(".jar")) { //$NON-NLS-1$
+					setDefaultRootPath(SRC_NAME);
+				} else {
+					setDefaultRootPath(""); //$NON-NLS-1$
+				}
+
 				return new Path(src.getPath());
 			}
 			parent = parent.getParentFile();
@@ -366,7 +373,9 @@
 		String id= MacOSXLaunchingPlugin.getUniqueIdentifier();
 		File java= new File(javaHome, "bin"+File.separator+"java"); //$NON-NLS-2$ //$NON-NLS-1$
 		if (java.isFile())
+		 {
 			return new Status(IStatus.OK, id, 0, "ok", null); //$NON-NLS-1$
+		}
 		return new Status(IStatus.ERROR, id, 0, Messages.MacOSXVMInstallType_2, null);
 	}
 	
@@ -380,8 +389,9 @@
 		try {
 			String post= File.separator + JVM_HOME;
 			String path= installLocation.getCanonicalPath();
-			if (path.startsWith(JVM_VERSION_LOC) && path.endsWith(post))
+			if (path.startsWith(JVM_VERSION_LOC) && path.endsWith(post)) {
 				id= path.substring(JVM_VERSION_LOC.length(), path.length()-post.length());
+			}
 		} catch (IOException ex) {
 			// we use the fall back from below
 		}
@@ -391,8 +401,9 @@
 			if (!docLocation.exists()) {
 				s= JAVADOC_LOC + id;
 				docLocation= new File(s);
-				if (!docLocation.exists())
+				if (!docLocation.exists()) {
 					s= null;
+				}
 			}
 			if (s != null) {
 				try {