Skip to main content



      Home
Home » Eclipse Projects » GEF » File chooser in the property sheet
File chooser in the property sheet [message #675523] Tue, 31 May 2011 14:26 Go to next message
Eclipse UserFriend
Hi,

I am implementing a workflow editor and I would like to add a file chooser in the property sheet of my application.
For example, when I select a file, I can see its attributes (name, type, ...) and I would like to add its location.
For me, the easiest solution would be to have a "three dots button" on the line File location of the property sheet and when clicking on this button, it would open a file chooser window and save the selected file location in the object's attributes.

Is this possible? How could I do that in another way than enter it manually in the property field?

Thank you.
Regards,
Greg

[Updated on: Tue, 31 May 2011 14:27] by Moderator

Re: File chooser in the property sheet [message #693825 is a reply to message #675523] Thu, 07 July 2011 05:20 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

you can extend PropertyDescriptor and override
public CellEditor createPropertyEditor(Composite parent)
to return an instance of the following class.

public final class FileDialogCellEditor extends DialogCellEditor {

	private final String[] filterNames;
	private final String[] filterExtensions;
	private final String filterPath;
	private final String dialogText;

	
	public FileDialogCellEditor(Composite parent,
	        		    String[] filterNames,
				    String[] filterExtensions,
				    String filterPath,
				    String dialogText) {
		super(parent);
		
		this.filterNames = filterNames;
		this.filterExtensions = filterExtensions;
		this.filterPath = filterPath;
		this.dialogText = dialogText;

	}

	@Override
	protected Object openDialogBox(Control cellEditorWindow) {
		
		setErrorMessage(null);
		
		FileDialog dialog = new FileDialog(cellEditorWindow.getShell());
		dialog.setFilterExtensions(filterExtensions);
		dialog.setFilterNames(filterNames);
		dialog.setFilterPath(filterPath);
		dialog.setText(dialogText);

		String absolutePath = dialog.open();
		
		return absolutePath;
	}

}

[Updated on: Thu, 07 July 2011 05:24] by Moderator

Re: File chooser in the property sheet [message #758481 is a reply to message #693825] Wed, 23 November 2011 07:27 Go to previous message
Eclipse UserFriend
Hi Christian,

I have tried your solution, but the Choose button does not appear in the Property Sheet in order to open the Dialog box. Could you please explain further?
Previous Topic:Scaled SWTGraphics draws
Next Topic:GEF documentation is not included on the on-line version of latest release of eclipse help.
Goto Forum:
  


Current Time: Fri Jul 04 11:05:40 EDT 2025

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

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

Back to the top