KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > ui > wizards > BuildPathDialogAccess


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 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.jdt.ui.wizards;
12
13 import java.net.URL JavaDoc;
14 import java.util.ArrayList JavaDoc;
15
16 import org.eclipse.core.runtime.IPath;
17 import org.eclipse.core.runtime.Path;
18
19 import org.eclipse.core.resources.IContainer;
20 import org.eclipse.core.resources.IFile;
21 import org.eclipse.core.resources.IFolder;
22 import org.eclipse.core.resources.IProject;
23 import org.eclipse.core.resources.IResource;
24 import org.eclipse.core.resources.IWorkspaceRoot;
25 import org.eclipse.core.resources.ResourcesPlugin;
26
27 import org.eclipse.swt.SWT;
28 import org.eclipse.swt.widgets.FileDialog;
29 import org.eclipse.swt.widgets.Shell;
30
31 import org.eclipse.jface.window.Window;
32
33 import org.eclipse.ui.dialogs.ElementTreeSelectionDialog;
34 import org.eclipse.ui.model.WorkbenchContentProvider;
35 import org.eclipse.ui.model.WorkbenchLabelProvider;
36
37 import org.eclipse.ui.views.navigator.ResourceComparator;
38
39 import org.eclipse.jdt.core.IClasspathEntry;
40 import org.eclipse.jdt.core.IJavaProject;
41
42 import org.eclipse.jdt.ui.JavaUI;
43
44 import org.eclipse.jdt.internal.ui.IUIConstants;
45 import org.eclipse.jdt.internal.ui.JavaPlugin;
46 import org.eclipse.jdt.internal.ui.wizards.NewWizardMessages;
47 import org.eclipse.jdt.internal.ui.wizards.TypedElementSelectionValidator;
48 import org.eclipse.jdt.internal.ui.wizards.TypedViewerFilter;
49 import org.eclipse.jdt.internal.ui.wizards.buildpaths.ArchiveFileFilter;
50 import org.eclipse.jdt.internal.ui.wizards.buildpaths.CPListElement;
51 import org.eclipse.jdt.internal.ui.wizards.buildpaths.ClasspathContainerWizard;
52 import org.eclipse.jdt.internal.ui.wizards.buildpaths.EditVariableEntryDialog;
53 import org.eclipse.jdt.internal.ui.wizards.buildpaths.JavadocLocationDialog;
54 import org.eclipse.jdt.internal.ui.wizards.buildpaths.MultipleFolderSelectionDialog;
55 import org.eclipse.jdt.internal.ui.wizards.buildpaths.NewVariableEntryDialog;
56 import org.eclipse.jdt.internal.ui.wizards.buildpaths.SourceAttachmentDialog;
57
58 /**
59  * Class that gives access to dialogs used by the Java build path page to configure classpath entries
60  * and properties of classpath entries.
61  * Static methods are provided to show dialogs for:
62  * <ul>
63  * <li> configuration of source attachments</li>
64  * <li> configuration of Javadoc locations</li>
65  * <li> configuration and selection of classpath variable entries</li>
66  * <li> configuration and selection of classpath container entries</li>
67  * <li> configuration and selection of JAR and external JAR entries</li>
68  * <li> selection of class and source folders</li>
69  * </ul>
70  * <p>
71  * This class is not intended to be instantiated or subclassed by clients.
72  * </p>
73  * @since 3.0
74  */

75 public final class BuildPathDialogAccess {
76
77     private BuildPathDialogAccess() {
78         // do not instantiate
79
}
80     
81     /**
82      * Shows the UI for configuring source attachments. <code>null</code> is returned
83      * if the user cancels the dialog. The dialog does not apply any changes.
84      *
85      * @param shell The parent shell for the dialog
86      * @param initialEntry The entry to edit. The kind of the classpath entry must be either
87      * <code>IClasspathEntry.CPE_LIBRARY</code> or <code>IClasspathEntry.CPE_VARIABLE</code>.
88      * @return Returns the resulting classpath entry containing a potentially modified source attachment path and
89      * source attachment root. The resulting entry can be used to replace the original entry on the classpath.
90      * Note that the dialog does not make any changes on the passed entry nor on the classpath that
91      * contains it.
92      */

93     public static IClasspathEntry configureSourceAttachment(Shell shell, IClasspathEntry initialEntry) {
94         if (initialEntry == null) {
95             throw new IllegalArgumentException JavaDoc();
96         }
97         int entryKind= initialEntry.getEntryKind();
98         if (entryKind != IClasspathEntry.CPE_LIBRARY && entryKind != IClasspathEntry.CPE_VARIABLE) {
99             throw new IllegalArgumentException JavaDoc();
100         }
101         
102         SourceAttachmentDialog dialog= new SourceAttachmentDialog(shell, initialEntry);
103         if (dialog.open() == Window.OK) {
104             return dialog.getResult();
105         }
106         return null;
107     }
108         
109     /**
110      * Shows the UI for configuring a javadoc location. <code>null</code> is returned
111      * if the user cancels the dialog. If OK is pressed, an array of length 1 containing the configured URL is
112      * returned. Note that the configured URL can be <code>null</code> when the user
113      * wishes to have no URL location specified. The dialog does not apply any changes.
114      * Use {@link org.eclipse.jdt.ui.JavaUI} to access and configure
115      * Javadoc locations.
116      *
117      * @param shell The parent shell for the dialog.
118      * @param libraryName Name of of the library to which configured javadoc location belongs.
119      * @param initialURL The initial URL or <code>null</code>.
120      * @return Returns an array of size 1 that contains the resulting javadoc location or
121      * <code>null</code> if the dialog has been canceled. Note that the configured URL can be <code>null</code> when the user
122      * wishes to have no URL location specified.
123      */

124     public static URL JavaDoc[] configureJavadocLocation(Shell shell, String JavaDoc libraryName, URL JavaDoc initialURL) {
125         if (libraryName == null) {
126             throw new IllegalArgumentException JavaDoc();
127         }
128         
129         JavadocLocationDialog dialog= new JavadocLocationDialog(shell, libraryName, initialURL);
130         if (dialog.open() == Window.OK) {
131             return new URL JavaDoc[] { dialog.getResult() };
132         }
133         return null;
134     }
135     
136     /**
137      * Shows the UI for configuring a javadoc location attribute of the classpath entry. <code>null</code> is returned
138      * if the user cancels the dialog. The dialog does not apply any changes.
139      *
140      * @param shell The parent shell for the dialog.
141      * @param initialEntry The entry to edit. The kind of the classpath entry must be either
142      * <code>IClasspathEntry.CPE_LIBRARY</code> or <code>IClasspathEntry.CPE_VARIABLE</code>.
143      * @return Returns the resulting classpath entry containing a potentially modified javadoc location attribute
144      * The resulting entry can be used to replace the original entry on the classpath.
145      * Note that the dialog does not make any changes on the passed entry nor on the classpath that
146      * contains it.
147      *
148      * @since 3.1
149      */

150     public static IClasspathEntry configureJavadocLocation(Shell shell, IClasspathEntry initialEntry) {
151         if (initialEntry == null) {
152             throw new IllegalArgumentException JavaDoc();
153         }
154         int entryKind= initialEntry.getEntryKind();
155         if (entryKind != IClasspathEntry.CPE_LIBRARY && entryKind != IClasspathEntry.CPE_VARIABLE) {
156             throw new IllegalArgumentException JavaDoc();
157         }
158         
159         URL JavaDoc location= JavaUI.getLibraryJavadocLocation(initialEntry);
160         JavadocLocationDialog dialog= new JavadocLocationDialog(shell, initialEntry.getPath().toString(), location);
161         if (dialog.open() == Window.OK) {
162             CPListElement element= CPListElement.createFromExisting(initialEntry, null);
163             URL JavaDoc res= dialog.getResult();
164             element.setAttribute(CPListElement.JAVADOC, res != null ? res.toExternalForm() : null);
165             return element.getClasspathEntry();
166         }
167         return null;
168     }
169     
170     /**
171      * Shows the UI for configuring a variable classpath entry. See {@link IClasspathEntry#CPE_VARIABLE} for
172      * details about variable classpath entries.
173      * The dialog returns the configured classpath entry path or <code>null</code> if the dialog has
174      * been canceled. The dialog does not apply any changes.
175      *
176      * @param shell The parent shell for the dialog.
177      * @param initialEntryPath The initial variable classpath variable path or <code>null</code> to use
178      * an empty path.
179      * @param existingPaths An array of paths that are already on the classpath and therefore should not be
180      * selected again.
181      * @return Returns the configures classpath entry path or <code>null</code> if the dialog has
182      * been canceled.
183      */

184     public static IPath configureVariableEntry(Shell shell, IPath initialEntryPath, IPath[] existingPaths) {
185         if (existingPaths == null) {
186             throw new IllegalArgumentException JavaDoc();
187         }
188         
189         EditVariableEntryDialog dialog= new EditVariableEntryDialog(shell, initialEntryPath, existingPaths);
190         if (dialog.open() == Window.OK) {
191             return dialog.getPath();
192         }
193         return null;
194     }
195     
196     /**
197      * Shows the UI for selecting new variable classpath entries. See {@link IClasspathEntry#CPE_VARIABLE} for
198      * details about variable classpath entries.
199      * The dialog returns an array of the selected variable entries or <code>null</code> if the dialog has
200      * been canceled. The dialog does not apply any changes.
201      *
202      * @param shell The parent shell for the dialog.
203      * @param existingPaths An array of paths that are already on the classpath and therefore should not be
204      * selected again.
205      * @return Returns an non empty array of the selected variable entries or <code>null</code> if the dialog has
206      * been canceled.
207      */

208     public static IPath[] chooseVariableEntries(Shell shell, IPath[] existingPaths) {
209         if (existingPaths == null) {
210             throw new IllegalArgumentException JavaDoc();
211         }
212         NewVariableEntryDialog dialog= new NewVariableEntryDialog(shell);
213         if (dialog.open() == Window.OK) {
214             return dialog.getResult();
215         }
216         return null;
217     }
218     
219     /**
220      * Shows the UI to configure a classpath container classpath entry. See {@link IClasspathEntry#CPE_CONTAINER} for
221      * details about container classpath entries.
222      * The dialog returns the configured classpath entry or <code>null</code> if the dialog has
223      * been canceled. The dialog does not apply any changes.
224      *
225      * @param shell The parent shell for the dialog.
226      * @param initialEntry The initial classpath container entry.
227      * @param project The project the entry belongs to. The project does not have to exist and can also be <code>null</code>.
228      * @param currentClasspath The class path entries currently selected to be set as the projects classpath. This can also
229      * include the entry to be edited. The dialog uses these entries as information only (e.g. to avoid duplicate entries); The user still can make changes after the
230      * the classpath container dialog has been closed. See {@link IClasspathContainerPageExtension} for
231      * more information.
232      * @return Returns the configured classpath container entry or <code>null</code> if the dialog has
233      * been canceled by the user.
234      */

235     public static IClasspathEntry configureContainerEntry(Shell shell, IClasspathEntry initialEntry, IJavaProject project, IClasspathEntry[] currentClasspath) {
236         if (initialEntry == null || currentClasspath == null) {
237             throw new IllegalArgumentException JavaDoc();
238         }
239         
240         ClasspathContainerWizard wizard= new ClasspathContainerWizard(initialEntry, project, currentClasspath);
241         if (ClasspathContainerWizard.openWizard(shell, wizard) == Window.OK) {
242             IClasspathEntry[] created= wizard.getNewEntries();
243             if (created != null && created.length == 1) {
244                 return created[0];
245             }
246         }
247         return null;
248     }
249     
250     /**
251      * Shows the UI to choose new classpath container classpath entries. See {@link IClasspathEntry#CPE_CONTAINER} for
252      * details about container classpath entries.
253      * The dialog returns the selected classpath entries or <code>null</code> if the dialog has
254      * been canceled. The dialog does not apply any changes.
255      *
256      * @param shell The parent shell for the dialog.
257      * @param project The project the entry belongs to. The project does not have to exist and
258      * can also be <code>null</code>.
259      * @param currentClasspath The class path entries currently selected to be set as the projects classpath. This can also
260      * include the entry to be edited. The dialog uses these entries as information only; The user still can make changes after the
261      * the classpath container dialog has been closed. See {@link IClasspathContainerPageExtension} for
262      * more information.
263      * @return Returns the selected classpath container entries or <code>null</code> if the dialog has
264      * been canceled by the user.
265      */

266     public static IClasspathEntry[] chooseContainerEntries(Shell shell, IJavaProject project, IClasspathEntry[] currentClasspath) {
267         if (currentClasspath == null) {
268             throw new IllegalArgumentException JavaDoc();
269         }
270         
271         ClasspathContainerWizard wizard= new ClasspathContainerWizard((IClasspathEntry) null, project, currentClasspath);
272         if (ClasspathContainerWizard.openWizard(shell, wizard) == Window.OK) {
273             return wizard.getNewEntries();
274         }
275         return null;
276     }
277     
278     
279     /**
280      * Shows the UI to configure a JAR or ZIP archive located in the workspace.
281      * The dialog returns the configured classpath entry path or <code>null</code> if the dialog has
282      * been canceled. The dialog does not apply any changes.
283      *
284      * @param shell The parent shell for the dialog.
285      * @param initialEntry The path of the initial archive entry
286      * @param usedEntries An array of paths that are already on the classpath and therefore should not be
287      * selected again.
288      * @return Returns the configured classpath container entry path or <code>null</code> if the dialog has
289      * been canceled by the user.
290      */

291     public static IPath configureJAREntry(Shell shell, IPath initialEntry, IPath[] usedEntries) {
292         if (initialEntry == null || usedEntries == null) {
293             throw new IllegalArgumentException JavaDoc();
294         }
295         
296         Class JavaDoc[] acceptedClasses= new Class JavaDoc[] { IFile.class };
297         TypedElementSelectionValidator validator= new TypedElementSelectionValidator(acceptedClasses, false);
298         
299         ArrayList JavaDoc usedJars= new ArrayList JavaDoc(usedEntries.length);
300         IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot();
301         for (int i= 0; i < usedEntries.length; i++) {
302             IPath curr= usedEntries[i];
303             if (!curr.equals(initialEntry)) {
304                 IResource resource= root.findMember(usedEntries[i]);
305                 if (resource instanceof IFile) {
306                     usedJars.add(resource);
307                 }
308             }
309         }
310         
311         IResource existing= root.findMember(initialEntry);
312         
313         ElementTreeSelectionDialog dialog= new ElementTreeSelectionDialog(shell, new WorkbenchLabelProvider(), new WorkbenchContentProvider());
314         dialog.setValidator(validator);
315         dialog.setTitle(NewWizardMessages.BuildPathDialogAccess_JARArchiveDialog_edit_title);
316         dialog.setMessage(NewWizardMessages.BuildPathDialogAccess_JARArchiveDialog_edit_description);
317         dialog.addFilter(new ArchiveFileFilter(usedJars, true));
318         dialog.setInput(root);
319         dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
320         dialog.setInitialSelection(existing);
321
322         if (dialog.open() == Window.OK) {
323             IResource element= (IResource) dialog.getFirstResult();
324             return element.getFullPath();
325         }
326         return null;
327     }
328     
329     /**
330      * Shows the UI to select new JAR or ZIP archive entries located in the workspace.
331      * The dialog returns the selected entries or <code>null</code> if the dialog has
332      * been canceled. The dialog does not apply any changes.
333      *
334      * @param shell The parent shell for the dialog.
335      * @param initialSelection The path of the element (container or archive) to initially select or <code>null</code> to not select an entry.
336      * @param usedEntries An array of paths that are already on the classpath and therefore should not be
337      * selected again.
338      * @return Returns the new classpath container entry paths or <code>null</code> if the dialog has
339      * been canceled by the user.
340      */

341     public static IPath[] chooseJAREntries(Shell shell, IPath initialSelection, IPath[] usedEntries) {
342         if (usedEntries == null) {
343             throw new IllegalArgumentException JavaDoc();
344         }
345         
346         Class JavaDoc[] acceptedClasses= new Class JavaDoc[] { IFile.class };
347         TypedElementSelectionValidator validator= new TypedElementSelectionValidator(acceptedClasses, true);
348         ArrayList JavaDoc usedJars= new ArrayList JavaDoc(usedEntries.length);
349         IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot();
350         for (int i= 0; i < usedEntries.length; i++) {
351             IResource resource= root.findMember(usedEntries[i]);
352             if (resource instanceof IFile) {
353                 usedJars.add(resource);
354             }
355         }
356         IResource focus= initialSelection != null ? root.findMember(initialSelection) : null;
357         
358         ElementTreeSelectionDialog dialog= new ElementTreeSelectionDialog(shell, new WorkbenchLabelProvider(), new WorkbenchContentProvider());
359         dialog.setHelpAvailable(false);
360         dialog.setValidator(validator);
361         dialog.setTitle(NewWizardMessages.BuildPathDialogAccess_JARArchiveDialog_new_title);
362         dialog.setMessage(NewWizardMessages.BuildPathDialogAccess_JARArchiveDialog_new_description);
363         dialog.addFilter(new ArchiveFileFilter(usedJars, true));
364         dialog.setInput(root);
365         dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
366         dialog.setInitialSelection(focus);
367
368         if (dialog.open() == Window.OK) {
369             Object JavaDoc[] elements= dialog.getResult();
370             IPath[] res= new IPath[elements.length];
371             for (int i= 0; i < res.length; i++) {
372                 IResource elem= (IResource)elements[i];
373                 res[i]= elem.getFullPath();
374             }
375             return res;
376         }
377         return null;
378     }
379     
380     /**
381      * Shows the UI to configure an external JAR or ZIP archive.
382      * The dialog returns the configured or <code>null</code> if the dialog has
383      * been canceled. The dialog does not apply any changes.
384      *
385      * @param shell The parent shell for the dialog.
386      * @param initialEntry The path of the initial archive entry.
387      * @return Returns the configured classpath container entry path or <code>null</code> if the dialog has
388      * been canceled by the user.
389      */

390     public static IPath configureExternalJAREntry(Shell shell, IPath initialEntry) {
391         if (initialEntry == null) {
392             throw new IllegalArgumentException JavaDoc();
393         }
394         
395         String JavaDoc lastUsedPath= initialEntry.removeLastSegments(1).toOSString();
396         
397         FileDialog dialog= new FileDialog(shell, SWT.SINGLE);
398         dialog.setText(NewWizardMessages.BuildPathDialogAccess_ExtJARArchiveDialog_edit_title);
399         dialog.setFilterExtensions(ArchiveFileFilter.FILTER_EXTENSIONS);
400         dialog.setFilterPath(lastUsedPath);
401         dialog.setFileName(initialEntry.lastSegment());
402         
403         String JavaDoc res= dialog.open();
404         if (res == null) {
405             return null;
406         }
407         JavaPlugin.getDefault().getDialogSettings().put(IUIConstants.DIALOGSTORE_LASTEXTJAR, dialog.getFilterPath());
408
409         return Path.fromOSString(res).makeAbsolute();
410     }
411     
412     /**
413      * Shows the UI to select new external JAR or ZIP archive entries.
414      * The dialog returns the selected entry paths or <code>null</code> if the dialog has
415      * been canceled. The dialog does not apply any changes.
416      *
417      * @param shell The parent shell for the dialog.
418      * @return Returns the new classpath container entry paths or <code>null</code> if the dialog has
419      * been canceled by the user.
420      */

421     public static IPath[] chooseExternalJAREntries(Shell shell) {
422         String JavaDoc lastUsedPath= JavaPlugin.getDefault().getDialogSettings().get(IUIConstants.DIALOGSTORE_LASTEXTJAR);
423         if (lastUsedPath == null) {
424             lastUsedPath= ""; //$NON-NLS-1$
425
}
426         FileDialog dialog= new FileDialog(shell, SWT.MULTI);
427         dialog.setText(NewWizardMessages.BuildPathDialogAccess_ExtJARArchiveDialog_new_title);
428         dialog.setFilterExtensions(ArchiveFileFilter.FILTER_EXTENSIONS);
429         dialog.setFilterPath(lastUsedPath);
430         
431         String JavaDoc res= dialog.open();
432         if (res == null) {
433             return null;
434         }
435         String JavaDoc[] fileNames= dialog.getFileNames();
436         int nChosen= fileNames.length;
437             
438         IPath filterPath= Path.fromOSString(dialog.getFilterPath());
439         IPath[] elems= new IPath[nChosen];
440         for (int i= 0; i < nChosen; i++) {
441             elems[i]= filterPath.append(fileNames[i]).makeAbsolute();
442         }
443         JavaPlugin.getDefault().getDialogSettings().put(IUIConstants.DIALOGSTORE_LASTEXTJAR, dialog.getFilterPath());
444         
445         return elems;
446     }
447         
448     /**
449      * Shows the UI to select new class folders.
450      * The dialog returns the selected classpath entry paths or <code>null</code> if the dialog has
451      * been canceled. The dialog does not apply any changes.
452      *
453      * @param shell The parent shell for the dialog.
454      * @param initialSelection The path of the element to initially select or <code>null</code>.
455      * @param usedEntries An array of paths that are already on the classpath and therefore should not be
456      * selected again.
457      * @return Returns the configured classpath container entry path or <code>null</code> if the dialog has
458      * been canceled by the user.
459      */

460     public static IPath[] chooseClassFolderEntries(Shell shell, IPath initialSelection, IPath[] usedEntries) {
461         if (usedEntries == null) {
462             throw new IllegalArgumentException JavaDoc();
463         }
464         String JavaDoc title= NewWizardMessages.BuildPathDialogAccess_ExistingClassFolderDialog_new_title;
465         String JavaDoc message= NewWizardMessages.BuildPathDialogAccess_ExistingClassFolderDialog_new_description;
466         return internalChooseFolderEntry(shell, initialSelection, usedEntries, title, message);
467     }
468     
469     /**
470      * Shows the UI to select new source folders.
471      * The dialog returns the selected classpath entry paths or <code>null</code> if the dialog has
472      * been canceled The dialog does not apply any changes.
473      *
474      * @param shell The parent shell for the dialog.
475      * @param initialSelection The path of the element to initially select or <code>null</code>
476      * @param usedEntries An array of paths that are already on the classpath and therefore should not be
477      * selected again.
478      * @return Returns the configured classpath container entry path or <code>null</code> if the dialog has
479      * been canceled by the user.
480      */

481     public static IPath[] chooseSourceFolderEntries(Shell shell, IPath initialSelection, IPath[] usedEntries) {
482         if (usedEntries == null) {
483             throw new IllegalArgumentException JavaDoc();
484         }
485         String JavaDoc title= NewWizardMessages.BuildPathDialogAccess_ExistingSourceFolderDialog_new_title;
486         String JavaDoc message= NewWizardMessages.BuildPathDialogAccess_ExistingSourceFolderDialog_new_description;
487         return internalChooseFolderEntry(shell, initialSelection, usedEntries, title, message);
488     }
489     
490         
491     private static IPath[] internalChooseFolderEntry(Shell shell, IPath initialSelection, IPath[] usedEntries, String JavaDoc title, String JavaDoc message) {
492         Class JavaDoc[] acceptedClasses= new Class JavaDoc[] { IProject.class, IFolder.class };
493
494         ArrayList JavaDoc usedContainers= new ArrayList JavaDoc(usedEntries.length);
495         IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot();
496         for (int i= 0; i < usedEntries.length; i++) {
497             IResource resource= root.findMember(usedEntries[i]);
498             if (resource instanceof IContainer) {
499                 usedContainers.add(resource);
500             }
501         }
502         
503         IResource focus= initialSelection != null ? root.findMember(initialSelection) : null;
504         Object JavaDoc[] used= usedContainers.toArray();
505         
506         MultipleFolderSelectionDialog dialog= new MultipleFolderSelectionDialog(shell, new WorkbenchLabelProvider(), new WorkbenchContentProvider());
507         dialog.setExisting(used);
508         dialog.setTitle(title);
509         dialog.setMessage(message);
510         dialog.setHelpAvailable(false);
511         dialog.addFilter(new TypedViewerFilter(acceptedClasses, used));
512         dialog.setInput(root);
513         dialog.setInitialFocus(focus);
514         
515         if (dialog.open() == Window.OK) {
516             Object JavaDoc[] elements= dialog.getResult();
517             IPath[] res= new IPath[elements.length];
518             for (int i= 0; i < res.length; i++) {
519                 IResource elem= (IResource) elements[i];
520                 res[i]= elem.getFullPath();
521             }
522             return res;
523         }
524         return null;
525     }
526 }
527
Popular Tags