问题
When I set the logo for my java plugin, the logo of other windows of eclipse
are changed.
I have a class which extends Wizard
and implements IObjectActionDelegate
. Then, I have override the run
function and write the below code in it.
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);
I have read the solution set forth to the similar post on Only changing the logo of special plugin. The problem is that I have extended Wizard
and cannot extend WizardDialog
instead.
回答1:
Since you are creating WizardDialog
yourself you can actually extend that class if you want.
In a Wizard
you can get the current Shell
by calling:
Shell shell = getContainer().getShell();
shell.setImage(your image);
It looks like the wizard addPages
method would be suitable for this code.
来源:https://stackoverflow.com/questions/55878345/changing-the-logo-of-wizards-of-special-plugin