pjfogarty Registered User
#1

Hi,
I am using a FileDialog dialog and i am wondering if there is a way of changing the text on the buttons,eg change open to something else.I am just using it for selecting a files path by browsing.I am not opening the file,just grabing the path,so something like select would be better.

eg:
import org.eclipse.swt.widgets.FileDialog;

FileDialog out = new FileDialog(shell,SWT.OPEN);
out.setText("Find or create a file to save output of xslt transform");
out.setFilterPath("C:/");
String[] filterExt = { "*.xml" };
out.setFilterExtensions(filterExt);

Thanks
Pj

timeout Registered User
#2

Well you could subclass it, add a new constructorer and implement that instead. Somebody might have done this already or there might be an alternative method. Just can't think of any right now.

Hobbes Registered User
#3

You would be quicker creating your own dialog.

Dr Pepper Registered User
#4

JFileChooser has a method called setApproveButtonText for the very thing. Is is possible you could use that instead?
I'm not familiar with org.eclipse.swt.widgets.FileDialog so couldn't tell ya how to do it with that dialog!

GreeBo Registered User
#5

yeah, nothing obvious in org.eclipse.swt.widgets.FileDialog or its parents..
I'd set about extending it, I dont have the code but Im sure the Open button is just some sort of Button object contained within FileDialog, should be easy to entend FileDialog, maybe with a constructor that takes in the button label as a param or something?

Want to share your thoughts?

Login here to discuss!