1 11 package org.eclipse.debug.internal.ui.sourcelookup.browsers; 12 13 import java.util.ArrayList ; 14 15 import org.eclipse.debug.core.sourcelookup.ISourceContainer; 16 import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector; 17 import org.eclipse.debug.ui.sourcelookup.AbstractSourceContainerBrowser; 18 import org.eclipse.debug.ui.sourcelookup.WorkingSetSourceContainer; 19 import org.eclipse.jface.window.Window; 20 import org.eclipse.swt.widgets.Shell; 21 import org.eclipse.ui.IWorkingSet; 22 import org.eclipse.ui.PlatformUI; 23 import org.eclipse.ui.dialogs.IWorkingSetSelectionDialog; 24 25 30 public class WorkingSetSourceContainerBrowser extends AbstractSourceContainerBrowser { 31 32 35 public ISourceContainer[] addSourceContainers(Shell shell, ISourceLookupDirector director) { 36 ArrayList containers = new ArrayList (); 37 IWorkingSetSelectionDialog dialog = PlatformUI.getWorkbench().getWorkingSetManager().createWorkingSetSelectionDialog(shell,true); 38 39 if(dialog.open() == Window.OK) 40 { 41 IWorkingSet[] selections = dialog.getSelection(); 42 if(selections != null) 43 { 44 for(int i=0; i<selections.length; i++) 45 { 46 containers.add(new WorkingSetSourceContainer(selections[i])); 47 } 48 } 49 } 50 51 return (ISourceContainer[])containers.toArray(new ISourceContainer[containers.size()]); 52 } 53 54 } 55 | Popular Tags |