【发布时间】:2014-02-12 17:46:34
【问题描述】:
Eclipse RCP 3.x中如何设置向导窗口的标题?
这段代码
Shell shell = HandlerUtil.getActiveWorkbenchWindow(event).getShell();
WizardDialog dialog = new WizardDialog(shell, new ChatNewWizard());
dialog.setTitle("New chat");
dialog.open();
从处理程序执行,没有效果。
这段代码
getShell().setText("New chat");
还有这段代码
((WizardDialog)getContainer()).setTitle("New chat");
从addPages() 执行的都没有效果。
更新
以下代码
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;
}
}
从简单示例运行,给出以下窗口
即它将“页面标题”放置在位置1,而我想在位置设置文本2。
【问题讨论】:
标签: java eclipse eclipse-plugin eclipse-rcp jface