Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » FileSelectionDialog deprecated
FileSelectionDialog deprecated [message #227125] Mon, 12 April 2004 16:03 Go to next message
Eclipse UserFriend
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 #227171 is a reply to message #227125] Mon, 12 April 2004 18:08 Go to previous messageGo to next message
Eclipse UserFriend
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
>
>
>

--
Genady Beryozkin
http://www.genady.net/
Re: FileSelectionDialog deprecated [message #227628 is a reply to message #227171] Tue, 13 April 2004 10:08 Go to previous message
Eclipse UserFriend
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
> >
> >
> >
Previous Topic:Integrate a plug-in using Swing
Next Topic:need help for using decorators.
Goto Forum:
  


Current Time: Wed Jul 23 11:19:22 EDT 2025

Powered by FUDForum. Page generated in 0.09164 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top