Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 65731

Summary: [EditorMgmt] editor extension panel missing * for icon
Product: [Eclipse Project] Platform Reporter: Bryan Hunt <bhunt>
Component: UIAssignee: 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.0Keywords: helpwanted
Target Milestone: 3.4 M3   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
sample project
none
Patch to set the 'icon' attribute as 'required'.
none
patch
daniel_megert: review-
Patch to not log anything per Daniel's comment #24. none

Description Bryan Hunt CLA 2004-06-04 11:26:15 EDT
Eclipse 3.0 M9

The plugin.xml editor page used to edit an editor extension does not indicate that the icon field is 
required (I'm assuming the * next to the names indicates required field).
Comment 1 Wassim Melhem CLA 2004-06-04 11:32:04 EDT
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.
Comment 2 Bryan Hunt CLA 2004-06-04 11:40:31 EDT
Think platorm needs to update schema to indicate an icon for the editor extension point is required.
Comment 3 Douglas Pollock CLA 2004-07-15 16:10:59 EDT
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? 
Comment 4 Bryan Hunt CLA 2004-07-15 16:35:00 EDT
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
Comment 5 Bryan Hunt CLA 2004-07-15 16:36:14 EDT
Created attachment 13317 [details]
sample project

sample project demonstrating the problem.  If you supply an icon, the editor
will work properly.
Comment 6 Douglas Pollock CLA 2005-05-02 11:50:40 EDT
Using your sample editor on Linux GTK+, I can open it successfully.  Is this
still a problem for you?
Comment 7 Bryan Hunt CLA 2005-05-12 16:22:43 EDT
I'll check this out in M7 and post my findings
Comment 8 Bryan Hunt CLA 2005-05-18 23:41:06 EDT
This is still broken ... class is still not a required field, and if you don't specify an icon, the editor does not 
load.
Comment 9 Jason Miller CLA 2005-11-30 10:03:41 EST
I was also just caught by this exact problem on Windows XP using eclipse:
Version: 3.2.0
Build id: I20051102-1600
Comment 10 Michael Van Meekeren CLA 2006-04-21 13:19:10 EDT
Moving Dougs bugs
Comment 11 Christian Köstlin CLA 2006-06-04 06:11:39 EDT
problem still exists with the 3.2rc7 build!
Comment 12 Bryan Hunt CLA 2007-04-20 17:10:10 EDT
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.
Comment 13 Kim Horne CLA 2007-04-20 17:14:30 EDT
*** Bug 164954 has been marked as a duplicate of this bug. ***
Comment 14 Kim Horne CLA 2007-04-26 14:15:42 EDT
*** Bug 129765 has been marked as a duplicate of this bug. ***
Comment 15 Kim Horne CLA 2007-04-26 18:39:53 EDT
*** Bug 20845 has been marked as a duplicate of this bug. ***
Comment 16 Nitin Dahyabhai CLA 2007-07-16 09:05:19 EDT
3.4 candidate?
Comment 17 Remy Suen CLA 2007-07-16 09:12:05 EDT
Created attachment 73841 [details]
Patch to set the 'icon' attribute as 'required'.

One-line patch for the exsd file.
Comment 18 Kim Sullivan CLA 2007-07-16 09:22:17 EDT
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?
Comment 19 Boris Bokowski CLA 2007-07-16 10:10:10 EDT
Created attachment 73848 [details]
patch

Who would like to test this before I release it?
Comment 20 Boris Bokowski CLA 2007-07-16 10:26:35 EDT
(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.
Comment 21 Boris Bokowski CLA 2007-07-16 12:00:42 EDT
3.4 M1 pending verification by the community.
Comment 22 Willian Mitsuda CLA 2007-07-16 12:54:56 EDT
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.
Comment 23 Remy Suen CLA 2007-07-16 18:59:11 EDT
(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 24 Dani Megert CLA 2007-08-30 03:15:38 EDT
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.
Comment 25 Dani Megert CLA 2007-08-30 03:17:04 EDT
Moving target milestone as M1 is already out the door.
Comment 26 Remy Suen CLA 2007-08-30 07:00:09 EDT
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.
Comment 27 Boris Bokowski CLA 2007-08-30 08:30:33 EDT
(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?
Comment 28 Dani Megert CLA 2007-08-30 09:35:09 EDT
> 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.
Comment 29 Boris Bokowski CLA 2007-09-18 13:19:18 EDT
Moving to M3.
Comment 30 Boris Bokowski CLA 2007-10-29 15:09:51 EDT
Released latest patch, and updated the schema definition file.
Comment 31 Dani Megert CLA 2007-10-30 05:33:39 EDT
Verified in I20071030-0010.