| Summary: | [EditorMgmt] editor extension panel missing * for icon | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Bryan Hunt <bhunt> | ||||||||||
| Component: | UI | Assignee: | Boris Bokowski <bokowski> | ||||||||||
| Status: | VERIFIED FIXED | QA Contact: | |||||||||||
| Severity: | normal | ||||||||||||
| Priority: | P3 | CC: | alicebot, cpuidle, daniel_megert, eclipse, elias, Randy_Giffen, remy.suen, saveez, thatnitind, wmitsuda | ||||||||||
| Version: | 3.0 | Keywords: | helpwanted | ||||||||||
| Target Milestone: | 3.4 M3 | ||||||||||||
| Hardware: | All | ||||||||||||
| OS: | All | ||||||||||||
| Whiteboard: | |||||||||||||
| Attachments: |
|
||||||||||||
|
Description
Bryan Hunt
The schema for org.eclipse.ui.editors indicates that the 'icon' attribute is not required, so no PDE bug here. If, however, your extension does not function if it lacks an icon, then reopen the bug and forward it to the Platform/UI component to update their schema. Think platorm needs to update schema to indicate an icon for the editor extension point is required. Do you have problems creating an editor without an icon definition, or do you just a message in the log file. The schema says it is optional, an the EditorDescriptor *seems* to handle the missing icon. However, EditorRegistryReader logs is as a "required" attribute if it is missing. What are the symptoms you are seeing? Could you include the log entries that apply? If you create an editor and do not supply an icon, the editor will not work. To reproduce: create a plug-in create an editor extension supply an editor class set the extension run the run-time workbench an error is logged - see below create a project create a file with an extension associated with the editor double click the file the editor will not appear I've also discovered that class does not appear to be a required field either. Here is the log file: !SESSION Jul 15, 2004 15:17:46.414 --------------------------------------------- eclipse.buildId=unknown java.version=1.4.2_03 java.vendor=Apple Computer, Inc. BootLoader constants: OS=macosx, ARCH=ppc, WS=carbon, NL=en_US Command-line arguments: -application org.eclipse.ui.ide.workbench !ENTRY org.eclipse.ui 4 4 Jul 15, 2004 15:17:46.417 !MESSAGE Plugin test.editor, extension org.eclipse.ui.editors Required attribute 'icon' not defined Created attachment 13317 [details]
sample project
sample project demonstrating the problem. If you supply an icon, the editor
will work properly.
Using your sample editor on Linux GTK+, I can open it successfully. Is this still a problem for you? I'll check this out in M7 and post my findings This is still broken ... class is still not a required field, and if you don't specify an icon, the editor does not load. I was also just caught by this exact problem on Windows XP using eclipse: Version: 3.2.0 Build id: I20051102-1600 Moving Dougs bugs problem still exists with the 3.2rc7 build! Any chance this one can get squashed - I just ran into it again in 3.3 M6 because I forgot to specify an icon for an editor. Just to re-iterate the problem: if you create an editor without an icon, it will not work. *** Bug 164954 has been marked as a duplicate of this bug. *** *** Bug 129765 has been marked as a duplicate of this bug. *** *** Bug 20845 has been marked as a duplicate of this bug. *** 3.4 candidate? Created attachment 73841 [details]
Patch to set the 'icon' attribute as 'required'.
One-line patch for the exsd file.
It probably isn't "required", because it depends on the type of editor. In the icon field's tooltip, it says that an icon "is not required if you specify a command rather than a class" (but who looks at the tooltip of the icon field when your editor isn't working?) I didn't even get a stack trace, just an error saying "Plugin test.propertyeditor, extension org.eclipse.ui.editors" in the org.eclipse.ui plugin. Running Eclipse Europa 3.3 on win XP. BTW, is this an issue of fixing the plugin editor to show that the icon is required when a class is specified, or is it a bug in the actual platform that should allow launching class based editors without an icon? Created attachment 73848 [details]
patch
Who would like to test this before I release it?
(In reply to comment #18) > BTW, is this an issue of fixing the plugin editor to show that the icon is > required when a class is specified, or is it a bug in the actual platform that > should allow launching class based editors without an icon? Neither of these - the description for the icon attribute says that "An icon is not required if you specify a command rather than a class. In that case, the workbench will use the icon provided by the operating system." Unfortunately, this cannot be expressed in the schema definition which is used for validation by the plug-in editor. Everybody was correctly implementing the specification - it's just a case of (at least) unhelpful error reporting and perhaps an overly restrictive specification. After applying my patch, the missing attribute will still be reported in the error log, but unlike before, the editor will be added to the editor registry so that it can be opened. 3.4 M1 pending verification by the community. I'd like to see the editor working without a icon. I don't think it should be a hard work to make it assume some default icon if none is present. Actions display a strong pink icon if there is some error loading the image, making it easy to see there is a problem. Editors could show the same. (In reply to comment #21) > 3.4 M1 pending verification by the community. I have tested the patch and it is working with no 'icon' attribute set in the plugin.xml file. It was not kicking in initially but then it "suddenly" worked. The only reason I can think of was that I deleted the entire target workspace between it working and not working. (In reply to comment #22) > I'd like to see the editor working without a icon. I don't think it should be a > hard work to make it assume some default icon if none is present. I was testing it with text files and it used the regular file icon. Comment on attachment 73848 [details]
patch
The patch is not OK. If you don't mark the icon to be required in your schema definition then it is a bug if you report this:
!ENTRY org.eclipse.ui 4 4 2007-08-30 09:02:32.844
!MESSAGE Plugin org.eclipse.ui.editors, extension org.eclipse.ui.editors, id org.eclipse.ui.DefaultTextEditor: Required attribute 'icon' not defined
Either mark in the schema that the icon is required and .log it - no code change needed. Or leave the schema as is, remove the logging code and commit your patch.
NOTE: the code change in RegistryReader is good in any case as it improves the logged message in general.
Moving target milestone as M1 is already out the door. Created attachment 77364 [details] Patch to not log anything per Daniel's comment #24. The icon is not really required (since the editor still shows up and depending on the editor type, per comment #18, there is no icon to be had) so I think simply not logging anything is the correct course of action. (In reply to comment #24) > Either mark in the schema that the icon is required and .log it - no code > change needed. Or leave the schema as is, remove the logging code and commit > your patch. See comment 18 - we cannot mark the icon as use="required" because there are cases - specifying a command rather than a class - where you don't need to specify an icon. If you specify a class, the icon is required. Unfortunately, is is important that clients read the full specification (parts of which are written in natural language, not the formal language). This is like a method declaration with two arguments where you write in the Javadoc that one of the arguments can be null, but not both. The icon is required as per the schema specification (at least in the normal case), although I admit that the specification could be improved as it does not directly state the constraint, it says "is not required if a command is specified" and should say "is required unless a command is specified". Since an editor without an icon did not even open until now, I thought it was appropriate to log a warning. Is it that an error is logged and you would like it to be a warning? > If you specify a class, the icon is required.
This could be lifted, couldn't it? Why force clients to give an icon? If you apply the latest patch everything runs just smooth and a default icon is used. Of course the schema def would need to be updated i.e. remove:
"An icon is not required if you specify a command rather than a class. In that case, the workbench will use the icon provided by the operating system."
If we want to keep it required then the correct fix is to simply improve the error message i.e. tell that editor xy will not be available.
Moving to M3. Released latest patch, and updated the schema definition file. Verified in I20071030-0010. |