0

I registered a custom editor with eclipse extension point "org.eclipse.ui.editors" as follows.

<extension
     point="org.eclipse.ui.editors">
     <editor 
            class="com.xxx.designer.scxml.ui.ScxmlDiagramEditor" 
            id="com.xxx.designer.scxml.ui.ScxmlDiagramEditor"
            extensions="scdiagram"
            name="SCXML Editor">
</editor>

It works fine, this editor is associated with .scdiagram files. However, every time I click on one same .scdiagram file, it opens a new instance for me instead of highlighting the opened file. Any idea on this?

Thanks,

Jie

Jie Qin
  • 23
  • 1
  • 3

2 Answers2

3

All you need to do is make your IEditorInput return true for the same files. You could implement this by comparing the canonical names of your files. Don't forget to also override the hashCode() method. What issues should be considered when overriding equals and hashCode in Java?

See Lars Vogel's excellent tutorial Eclipse Editor Plugin Tutorial for more details on using Editors.

Community
  • 1
  • 1
Malcolm Smith
  • 3,432
  • 19
  • 28
2

Here's how my question was resolved eventually. It's related to Graphiti and solution is also tied to the framework.

Since I subclassed Graphiti's diagram editor, all I need to do is to set org.eclipse.graphiti.ui.editor.DiagramEditorMatchingStrategy as the editor's matching strategy in plugin.xml.

Jie Qin
  • 23
  • 1
  • 3