[jbosstools-commits] JBoss Tools SVN: r44008 - trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/preferences.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Tue Sep 25 11:57:07 EDT 2012


Author: snjeza
Date: 2012-09-25 11:57:07 -0400 (Tue, 25 Sep 2012)
New Revision: 44008

Modified:
   trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/preferences/RuntimePreferencePage.java
Log:
JBIDE-12716 - Remove button does not work properly

Modified: trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/preferences/RuntimePreferencePage.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/preferences/RuntimePreferencePage.java	2012-09-25 15:51:56 UTC (rev 44007)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/preferences/RuntimePreferencePage.java	2012-09-25 15:57:07 UTC (rev 44008)
@@ -396,9 +396,13 @@
 		RuntimeUIActivator.launchSearchRuntimePathDialog(getShell(), 
 				new RuntimePath[]{runtimePath}, true, 15);
 		configureSearch();
-		RuntimeUIActivator.getDefault().getModel().addRuntimePath(runtimePath);
-		runtimePaths = RuntimeUIActivator.getRuntimePaths();
-		runtimePathViewer.setInput(runtimePath.getRuntimeDefinitions());
+		//RuntimeUIActivator.getDefault().getModel().addRuntimePath(runtimePath);
+		//runtimePaths = RuntimeUIActivator.getRuntimePaths();
+		//runtimePathViewer.setInput(runtimePath.getRuntimeDefinitions());
+		RuntimePath[] newRuntimePaths = new RuntimePath[runtimePaths.length+1];
+		System.arraycopy(runtimePaths, 0, newRuntimePaths, 0, runtimePaths.length);
+		newRuntimePaths[runtimePaths.length] = runtimePath;
+		runtimePaths = newRuntimePaths;
 		runtimePathViewer.refresh();
 		
 	}
@@ -409,9 +413,14 @@
 			IStructuredSelection selection = (IStructuredSelection) sel;
 			Object object = selection.getFirstElement();
 			if (object instanceof RuntimePath) {
+				RuntimePath[] newRuntimePaths = new RuntimePath[runtimePaths.length-1];
 				ArrayList<RuntimePath> l = new ArrayList<RuntimePath>(Arrays.asList(runtimePaths));
 				l.remove(object);
-				runtimePaths = (RuntimePath[]) l.toArray(new RuntimePath[l.size()]);
+				int i = 0;
+				for (RuntimePath path:l) {
+					newRuntimePaths[i++] = path;
+				}
+				runtimePaths = newRuntimePaths;
 				configureSearch();
 				runtimePathViewer.refresh();
 			}



More information about the jbosstools-commits mailing list