FileSelectionDialog deprecated [message #227125] |
Mon, 12 April 2004 16:03  |
Eclipse User |
|
|
|
Hi,
I would like to use the FileSelectionDialog, but the java doc suggests
using FileDialog instead, because FileSelectionDialog is deprecated.
FileDialog allows users to select outside the workspace, which I want to
prevent. I have looked at ResourceListSelectionDialog but i can't figure
out how to have the pattern matching preset so that the user doesn't have
to fill anything out.
Does anyone have any suggestions? Which class are you guys using now that
FileSelectionDialog is deprecated? Or how can I get a better usage of
ResourceListSelectionDialog or one its siblings.
Thanks, Bob
|
|
|
|
Re: FileSelectionDialog deprecated [message #227628 is a reply to message #227171] |
Tue, 13 April 2004 10:08  |
Eclipse User |
|
|
|
Thanks.
I took what you have an augmented it and it works really well.
Bob
Genady wrote:
> Try this code snippet
> ILabelProvider lp= new WorkbenchLabelProvider();
> ITreeContentProvider cp= new WorkbenchContentProvider();
> ElementTreeSelectionDialog dialog= new
> ElementTreeSelectionDialog(getShell(),
> lp, cp);
> dialog.setValidator(null);
> dialog.setAllowMultiple(false);
> dialog.setTitle("XXXXXXX"); //$NON-NLS-1$
> dialog.setMessage("YYYYYYYYYYYYY"); //$NON-NLS-1$
> //dialog.addFilter(filter);
> dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
> dialog.setSorter(new ResourceSorter(ResourceSorter.NAME));
> if (dialog.open() == ElementTreeSelectionDialog.OK) {
> Object[] elements= dialog.getResult();
> if (elements.length == 1) {
> String file =
> ((IResource)elements[0]).getLocation().toOSString();
> }
> }
> Bob Donovan wrote:
> >Hi,
> >
> >I would like to use the FileSelectionDialog, but the java doc suggests
> >using FileDialog instead, because FileSelectionDialog is deprecated.
> >
> >FileDialog allows users to select outside the workspace, which I want to
> >prevent. I have looked at ResourceListSelectionDialog but i can't figure
> >out how to have the pattern matching preset so that the user doesn't have
> >to fill anything out.
> >
> >Does anyone have any suggestions? Which class are you guys using now that
> >FileSelectionDialog is deprecated? Or how can I get a better usage of
> >ResourceListSelectionDialog or one its siblings.
> >
> >Thanks, Bob
> >
> >
> >
|
|
|
Powered by
FUDForum. Page generated in 0.09164 seconds