当我为我的java插件设置徽标时,更改了eclipse
的其他窗口的徽标。
我有一个类扩展Wizard
并实现IObjectActionDelegate
。然后,我重写了run
函数并在其中编写下面的代码。
wizard = new StartWizard();
dialog = new WizardDialog(Display.getDefault().getActiveShell(), wizard);
Bundle bundle = Platform.getBundle("Plugin");
URL url = FileLocator.find(bundle, new Path("icon/Logo.png"), null);
ImageDescriptor desc = ImageDescriptor.createFromURL(url);
Image image = desc.createImage();
WizardDialog.setDefaultImage(image);
我已经阅读了Only changing the logo of special plugin上类似帖子中提出的解决方案。问题是我扩展了Wizard
而不能扩展WizardDialog
。
由于您自己创建WizardDialog
,因此您可以根据需要扩展该类。
在Wizard
中,您可以通过以下方式获取当前的Shell
:
Shell shell = getContainer().getShell();
shell.setImage(your image);
看起来向导addPages
方法适合此代码。