Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Is there a JFace directory dialog that presents a list of files found given the starting directory a
Is there a JFace directory dialog that presents a list of files found given the starting directory a [message #294379] Thu, 10 November 2005 17:27 Go to next message
Eclipse UserFriend
Is there a JFace directory dialog that presents a list of files found
given the starting directory and the file extension?

Thanks for any tips!
Re: Is there a JFace directory dialog that presents a list of files found [message #294391 is a reply to message #294379] Thu, 10 November 2005 23:34 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: automatic.javalobby.org

Cooked up one fastly with org.eclipse.ui.dialogs.ElementListSelectionDialog. Try this ...

private void openFileList(String dirPath)
{
ElementListSelectionDialog dlg = new ElementListSelectionDialog(window.getShell(), new FileLblProvider());
dlg.setMultipleSelection(true);
File directory = new File(dirPath);
dlg.setElements(directory.listFiles());/* filter just files if you need to */
dlg.open();
}

class FileLblProvider extends LabelProvider
{
public String getText(Object element) {
return ((File)element).getName();
}

public Image getImage(Object element) {
return null; /* TODO: Show file/folder image */
}
}

Hope that helps.

Thanks
Venkat
Re: Is there a JFace directory dialog that presents a list of files found [message #294392 is a reply to message #294379] Thu, 10 November 2005 23:36 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: automatic.javalobby.org

Cooked up one fastly with org.eclipse.ui.dialogs.ElementListSelectionDialog. Try this ...

private void openFileList(String dirPath)
{		
	ElementListSelectionDialog dlg = new ElementListSelectionDialog(window.getShell(), new FileLblProvider());
	dlg.setMultipleSelection(true);
	File directory = new File(dirPath);
	dlg.setElements(directory.listFiles());/* filter just files if you need to */
	dlg.open();
}

class FileLblProvider extends LabelProvider
{
	public String getText(Object element) {
		return ((File)element).getName();
	}
	
	public Image getImage(Object element) {
		return null; /* TODO: Show file/folder image */
	}
}


Hope that helps.

Thanks
Venkat
Re: Is there a JFace directory dialog that presents a list of files found [message #295013 is a reply to message #294392] Mon, 21 November 2005 19:38 Go to previous message
Eclipse UserFriend
Thank you very much!

venkataramana wrote:

> Cooked up one fastly with org.eclipse.ui.dialogs.ElementListSelectionDialog. Try this ...
>
>
> private void openFileList(String dirPath)
> {		
> 	ElementListSelectionDialog dlg = new ElementListSelectionDialog(window.getShell(), new FileLblProvider());
> 	dlg.setMultipleSelection(true);
> 	File directory = new File(dirPath);
> 	dlg.setElements(directory.listFiles());/* filter just files if you need to */
> 	dlg.open();
> }
> 
> class FileLblProvider extends LabelProvider
> {
> 	public String getText(Object element) {
> 		return ((File)element).getName();
> 	}
> 	
> 	public Image getImage(Object element) {
> 		return null; /* TODO: Show file/folder image */
> 	}
> }
> 

>
> Hope that helps.
>
> Thanks
> Venkat
Previous Topic:Keys don't work
Next Topic:tree viewer and expaneded state
Goto Forum:
  


Current Time: Fri May 09 17:19:54 EDT 2025

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

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

Back to the top