1 11 package org.eclipse.jdt.internal.debug.ui.sourcelookup; 12 13 import org.eclipse.core.runtime.IPath; 14 import org.eclipse.debug.core.sourcelookup.ISourceContainer; 15 import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector; 16 import org.eclipse.debug.ui.sourcelookup.AbstractSourceContainerBrowser; 17 import org.eclipse.jdt.launching.sourcelookup.containers.ClasspathVariableSourceContainer; 18 import org.eclipse.jdt.ui.wizards.BuildPathDialogAccess; 19 import org.eclipse.swt.widgets.Shell; 20 21 26 public class ClasspathVariableSourceContainerBrowser extends AbstractSourceContainerBrowser { 27 30 public boolean canEditSourceContainers(ISourceLookupDirector director, ISourceContainer[] containers) { 31 return containers.length == 1; 32 } 33 36 public ISourceContainer[] editSourceContainers(Shell shell, ISourceLookupDirector director, ISourceContainer[] containers) { 37 ClasspathVariableSourceContainer container = (ClasspathVariableSourceContainer) containers[0]; 38 IPath path = BuildPathDialogAccess.configureVariableEntry(shell, container.getPath(), new IPath[]{container.getPath()}); 39 if (path != null) { 40 containers = new ISourceContainer[1]; 41 containers[0] = new ClasspathVariableSourceContainer(path); 42 return containers; 43 } 44 return new ISourceContainer[0]; 45 } 46 49 public ISourceContainer[] addSourceContainers(Shell shell, ISourceLookupDirector director) { 50 IPath[] paths = BuildPathDialogAccess.chooseVariableEntries(shell, new IPath[0]); 51 if (paths != null) { 52 ISourceContainer[] containers = new ISourceContainer[paths.length]; 53 for (int i = 0; i < containers.length; i++) { 54 containers[i] = new ClasspathVariableSourceContainer(paths[i]); 55 } 56 return containers; 57 } 58 return new ISourceContainer[0]; 59 } 60 } 61 | Popular Tags |