1 11 package org.eclipse.jdt.internal.debug.ui.actions; 12 13 14 import org.eclipse.core.runtime.CoreException; 15 import org.eclipse.debug.core.ILaunchConfiguration; 16 import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; 17 import org.eclipse.jdt.debug.ui.launchConfigurations.JavaClasspathTab; 18 import org.eclipse.jdt.internal.debug.ui.launcher.IClasspathViewer; 19 import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants; 20 import org.eclipse.jdt.launching.JavaRuntime; 21 import org.eclipse.jface.viewers.IStructuredSelection; 22 23 26 public class RestoreDefaultEntriesAction extends RuntimeClasspathAction { 27 28 private JavaClasspathTab fTab; 29 30 35 public RestoreDefaultEntriesAction(IClasspathViewer viewer, JavaClasspathTab tab) { 36 super(ActionMessages.RestoreDefaultEntriesAction_0, viewer); 37 fTab = tab; 38 } 39 40 45 public void run() { 46 try { 47 ILaunchConfiguration config = fTab.getLaunchConfiguration(); 48 if(!config.getAttribute(IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH, false)) { 49 ILaunchConfigurationWorkingCopy copy = null; 50 if(config.isWorkingCopy()) { 51 copy = (ILaunchConfigurationWorkingCopy) config; 52 } 53 else { 54 copy = config.getWorkingCopy(); 55 } 56 copy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH, true); 57 getViewer().setEntries(JavaRuntime.computeUnresolvedRuntimeClasspath(copy)); 58 } 59 } 60 catch (CoreException e) {return;} 61 } 62 63 66 protected boolean updateSelection(IStructuredSelection selection) { 67 return true; 68 } 69 } 70 | Popular Tags |