org.eclipse.swt.widgets.DirectoryDialog
extends Dialog
and can only be used as a pop-up dialog. It cannot be embedded in a wizard.
You can put a Button
on the wizard page that displays the directory dialog when clicked.
문제
I have to create a custom wizard to develop a Eclipse Plug-in. I wish to use a DirectoryDialog but I can't get work with the other elements. I'm seeing that the DirectoyDialog is used in a "extends composite" class, but, is there any way to use in a "wizardPage"?
Thanks at all!
해결책
org.eclipse.swt.widgets.DirectoryDialog
extends Dialog
and can only be used as a pop-up dialog. It cannot be embedded in a wizard.
You can put a Button
on the wizard page that displays the directory dialog when clicked.
다른 팁
Use the following code in your WizardPage
Button btnBrowse = new Button(container, SWT.NONE);
btnBrowse.setText("Browse..");
btnBrowse.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event e) {
DirectoryDialog dirDialog = new DirectoryDialog(getShell());
dirDialog.setText("Select the parent directory for tools");
String location = dirDialog.open();
}
});
getShell() api used in 4th line is from WizardPage class.