I made a custom Eclipse plugin that uses and displays multiple dialogs, and I want to know if I could set the top left icon image with the one I use in the plugin's icons
folder. I want to get that icon and set it instead of the default one that Eclipse uses.
I'm overriding the configureShell()
method to change the dialog title, and I also want to change the icon.
@Override
protected void configureShell(Shell parent){
super.configureShell(parent);
parent.setText("Choose variant...");
Image icon = new Image(parent.getDisplay(), "icons/best.gif"); - this method does not work as it cannot find the file
parent.setImage(icon);
}
I also tried using the getClass().getResource("best.gif")
and having the image in the same package, still can't find the location I'm giving(FileNotFoundException), and also, the Image
constructor does not accept URL objects.
@Override
protected void configureShell(Shell parent){
super.configureShell(parent);
parent.setText("Choose variant...");
Image icon = new Image(parent.getDisplay(), getClass().getResource("icons/best.gif"));
parent.setImage(icon);
}
Is there a way to use the icon that I already have in my eclipse plugin?
The main problem is getting the icon from the icons
folder of the plugin and making it a Image
object.
Thank you.