Bug 116544 - [EditorMgmt] [Doc] Clarify documentation of IEditorMatchingStrategy
Summary: [EditorMgmt] [Doc] Clarify documentation of IEditorMatchingStrategy
Status: RESOLVED INVALID
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.1.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Nick Edgar CLA
QA Contact:
URL:
Whiteboard:
Keywords: Documentation
Depends on:
Blocks:
 
Reported: 2005-11-15 20:41 EST by benson margulies CLA
Modified: 2006-02-16 12:06 EST (History)
1 user (show)

See Also:


Attachments
Plugin with unit test that fails (16.73 KB, application/octet-stream)
2005-12-08 11:50 EST, benson margulies CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description benson margulies CLA 2005-11-15 20:41:17 EST
This report may amount to a request for clarification of IEditorMatchingStrategy.

I have an editor extension registered for XML extensions that has a matching
strategy.

If I click right on an XML file and select OpenWith..., my editor is still offered.

If I select it, my matching strategy API is indeed called. In the case that is
troubling me, it returns false -- and the platform proceeds to fire up my editor
against the file anyway.

Now, what my matching strategy is trying to do is to select amongst XML files by
their root elements (some day, perhaps DTD ID's would be better). I suspect that
things are working as intended. I think the documentation really needs some help
in explaining what the exact behavior is supposed to be.
Comment 1 Kim Horne CLA 2005-11-16 11:26:44 EST
Passing to Nick to clarify.
Comment 2 Nick Edgar CLA 2005-11-17 10:17:05 EST
Can you clarify your scenario and what the desired behaviour is (independent of
which mechanisms are used)?

IEditorMatchingStrategy is used for matching an editor input against existing
editors.  The default behaviour uses equals on the input, but
IEditorMatchingStrategy lets you override that.  It's not intended to veto the
opening of an editor.  This is generally used when the editor represents
multiple files, and wants to match a file input matching any of them (e.g. the
plugin manifest editor).

For choosing different editors based on XML root element type, the mechanism to
use is content types, not IEditorMatchingStrategy.
See the section on Content Types in Help > Help Contents > Platform Plug-in
Developer Guide > Runtime Overview >.
See also the <contentBinding> element in the schema for the editors extension
point (in the Reference section of the Developer Guide).

Comment 3 benson margulies CLA 2005-11-17 10:21:20 EST
OK, I get it. Thanks. This was not clear from the documentation, at least to me.
The doc left me thinking that the matching strategy was a refinement for the
suffix matching properties in the extension point.
Comment 4 Nick Edgar CLA 2005-11-17 10:24:08 EST
Changing the title accordingly.  Please try the content types mechanism, and if
there are still issues, please open separate reports.
Comment 5 benson margulies CLA 2005-11-17 10:25:49 EST
I'm confident that the use of the correct mechanism will yield the desired
results  :-). As soon as I sort our my disagreement with the runtime/PDE on
java.nio.charset.spi, I'll go try the content type.
Comment 6 benson margulies CLA 2005-12-08 11:50:28 EST
Created attachment 31384 [details]
Plugin with unit test that fails

The unit test in here works 'outside' Eclipse and fails when run with the 'plugin junit'.
Comment 7 benson margulies CLA 2005-12-30 21:57:37 EST
The attachment here was supposed to go with a different bug. Ignore it, please.
Comment 8 benson margulies CLA 2006-01-05 08:29:25 EST
All's well.
Comment 9 Boris Bokowski CLA 2006-02-16 12:05:48 EST
Cleaning up bugs
Comment 10 Boris Bokowski CLA 2006-02-16 12:06:14 EST
Marking as INVALID since no fix was made.