문제

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top