1 11 package org.eclipse.jdt.internal.debug.ui.actions; 12 13 14 import org.eclipse.core.runtime.IPath; 15 import org.eclipse.jdt.internal.debug.ui.launcher.IClasspathViewer; 16 import org.eclipse.jdt.launching.IRuntimeClasspathEntry; 17 import org.eclipse.jdt.launching.JavaRuntime; 18 import org.eclipse.jdt.ui.wizards.BuildPathDialogAccess; 19 20 23 public class AddVariableAction extends RuntimeClasspathAction { 24 25 public AddVariableAction(IClasspathViewer viewer) { 26 super(ActionMessages.AddVariableAction_Add_Variables_1, viewer); 27 } 28 29 34 public void run() { 35 36 IPath[] paths = BuildPathDialogAccess.chooseVariableEntries(getShell(), new IPath[0]); 37 if (paths != null) { 38 IRuntimeClasspathEntry[] entries = new IRuntimeClasspathEntry[paths.length]; 39 for (int i = 0; i < paths.length; i++) { 40 entries[i] = JavaRuntime.newVariableRuntimeClasspathEntry(paths[i]); 41 } 42 getViewer().addEntries(entries); 43 } 44 } 45 46 protected int getActionType() { 47 return ADD; 48 } 49 } 50 | Popular Tags |