[udig-devel] [jira] Created: (UDIG-1290) save as for texteditors
sufferng from icon bug
Andrea Antonello (JIRA)
jira at codehaus.org
Sun Sep 16 06:19:11 PDT 2007
save as for texteditors sufferng from icon bug
----------------------------------------------
Key: UDIG-1290
URL: http://jira.codehaus.org/browse/UDIG-1290
Project: uDIG
Issue Type: Wish
Components: ui
Affects Versions: UDIG 1.1 RC11
Environment: all
Reporter: Andrea Antonello
Fix For: UDIG 1.1.1
When using standard editors from org.eclipse.ui.ide, the default Save As action usually fails, throwing a NullPointerException. This happens when the program tries to create a Save As Dialog. A particular exception usually looks something like:
java.lang.NullPointerException
at org.eclipse.ui.dialogs.SaveAsDialog.createContents(SaveAsDialog.java:102)
at org.eclipse.jface.window.Window.create(Window.java:426)
at org.eclipse.jface.dialogs.Dialog.create(Dialog.java:1124)
at org.eclipse.ui.texteditor.AbstractDecoratedTextEditor.performSaveAs(AbstractDecoratedTextEditor.java:1580)
at org.eclipse.ui.editors.text.TextEditor.performSaveAs(TextEditor.java:115)
at org.eclipse.ui.texteditor.AbstractTextEditor.doSaveAs(AbstractTextEditor.java:3538)
at ....MultiPageEditor.doSaveAs(MultiPageEditor.java:196)
....
This, actually, happens when the dialog tries to set the banner image for the dialog, but the image is not available. The default IDEWorkbenchAdvisor registers such an image for the default IDE, so must your application. The solution is the following:
1) Make sure you add org.eclipse.ui.ide to the dependencies of your plugin
2) In your WorkbenchAdvisor class add the following code to the initialise() method implementation:
Bundle ideBundle = Platform.getBundle(IDEWorkbenchPlugin.IDE_WORKBENCH);
final String banner = "/icons/full/wizban/saveas_wiz.png";
URL url = ideBundle.getEntry(banner);
ImageDescriptor desc = ImageDescriptor.createFromURL(url);
configurer.declareImage(IDEInternalWorkbenchImages.IMG_DLGBAN_SAVEAS_DLG, desc, true);
This will declare a standard banner image from the org.eclipse.ui.ide plugin as the proper banner image for SaveAs dialog in the same way as it is done in the IDEWorkbenchAdvisor. Running your application again demonstrates the correct behaviour. If you are still getting a NullPointerException, check whether you declared plugin dependencies, and whether you included org.eclipse.ui.ide to your target platform.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the udig-devel
mailing list