How to set the title of wizard window in Eclipse RCP 3.x?
This code
Shell shell = HandlerUtil.getActiveWorkbenchWindow(event).getShell();
WizardDialog dialog = new WizardDialog(shell, new ChatNewWizard());
dialog.setTitle("New chat");
dialog.open();
executed from handler, has no effect.
This code
getShell().setText("New chat");
and this code
((WizardDialog)getContainer()).setTitle("New chat");
both executed from addPages()
also have no effect.
UPDATE
The following code
public class RunWizardHandler extends AbstractHandler {
public static class MyWizardPage extends WizardPage {
protected MyWizardPage() {
super("Page Name", "Page Title", null);
setDescription("Page Description");
}
@Override
public void createControl(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
composite.setLayout(new FillLayout());
Label label = new Label(composite, SWT.NONE);
label.setText("Label Text");
setControl(composite);
}
}
public static class MyWizard extends Wizard {
@Override
public void addPages() {
addPage(new MyWizardPage());
}
@Override
public boolean performFinish() {
return false;
}
}
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
Shell shell = HandlerUtil.getActiveWorkbenchWindow(event).getShell();
WizardDialog dialog = new WizardDialog(shell, new MyWizard());
dialog.open();
return event;
}
}
ran from simple sample, gives the following window
I.e. it places "Page Title" into location 1
, while I want to set text in location 2
.
Use the WizardPage(String pageName, String title, ImageDescriptor titleImage)
constructor to specify a title for each page. Or call WizardPage.setTitle(xxx)
whenever you want to change the title.
The current wizard page title overrides the normal dialog title (even if it is not set).
Update:
For the title in the dialog tile bar use the WizardDialog.setWindowTitle
call (usually in the constructor).