osate / osate2

Open Source AADL2 Tool Environment
http://osate.org
Eclipse Public License 2.0
36 stars 8 forks source link

AADL Navigator: Selection moves unexpectedly. #1559

Open lwrage opened 5 years ago

lwrage commented 5 years ago

I go to a classifier (in an already opened editor) by clicking on the classifier name in the navigator and then click somewhere else in the editor the selection in the navigator jumps to the file. If the current selection is below the file in the navigator tree it should stay where it is until I click elsewhere in the navigator or bring another editor to the front. Likely related to "link with editor" functionality.

lwrage commented 5 years ago

It is caused by the default implementation of "link with editor" in the common navigator. Unfortunately, this behavior is not easily customizable.

AaronGreenhouse commented 5 years ago

This happens when the "link with editor" is active. In this case, single-clicking on an AADL element, jumps inthe editor, and the navigator stays as expected. But double-clicking, which is controlled by AadlNavigatorActionProvider opens and jumps in the editor, and then the navigator selection is reset to the opened file. I can confirm for sure that the method AadlNavigatorLinkHelper.findSelection() is called when this happens. This is what causes the navigator selection to change. I assume, but have not been able to confirm that his happens as a side-effect of the call to IDE.openEditor() that is triggered inside of the editor opener used by AadlNavigatorActionProvider.

Obviously, this seems like a circular event nonsense, but I don't know how to avoid it. The JDT navigator does not suffer this problem, but I cannot figure out what it is doen't differentlhy.

lwrage commented 5 years ago

Postponing this.

AaronGreenhouse commented 5 years ago

Another quick comment: probably if we are smarter about they way we open editors this can be avoided, but not worth investigated now.

lwrage commented 5 years ago

Link wiht editor listens for opening an editor and bringing an editor to the front. Based on the new editor on top it gets the new selection from the link helper. The helper needs to find the current tree selection and return it if it is below the editor's resource in the tree.