KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > debug > internal > ui > sourcelookup > browsers > WorkingSetSourceContainerBrowser


1 /*******************************************************************************
2  * Copyright (c) 2003, 2005 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.debug.internal.ui.sourcelookup.browsers;
12
13 import java.util.ArrayList JavaDoc;
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 /**
26  * The browser for creating working set source containers.
27  *
28  * @since 3.0
29  */

30 public class WorkingSetSourceContainerBrowser extends AbstractSourceContainerBrowser {
31     
32     /* (non-Javadoc)
33      * @see org.eclipse.debug.internal.ui.sourcelookup.ISourceContainerBrowser#createSourceContainers(org.eclipse.swt.widgets.Shell, org.eclipse.debug.core.ILaunchConfiguration)
34      */

35     public ISourceContainer[] addSourceContainers(Shell shell, ISourceLookupDirector director) {
36         ArrayList JavaDoc containers = new ArrayList JavaDoc();
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