Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Classifier Info View Leaves stray "goto" marker #2496

Closed
AaronGreenhouse opened this issue Nov 3, 2020 · 8 comments · Fixed by #2506
Closed

Classifier Info View Leaves stray "goto" marker #2496

AaronGreenhouse opened this issue Nov 3, 2020 · 8 comments · Fixed by #2506
Assignees
Milestone

Comments

@AaronGreenhouse
Copy link
Contributor

AaronGreenhouse commented Nov 3, 2020

From @lwrage :

I found a minor issue with the classifier info view:

  1. open a classifier C in the info view
  2. enable link with editor
  3. close the text file
  4. click on C in the info view.

The text file opens and the classifier is highlighted as expected.

However, there is now an info marker on the classifier and the whole classifier is underlined, I assume it's the goto marker that isn't cleaned up in this scenario. This marker doesn't show in the problems view and cannot be deleted manually.

@AaronGreenhouse AaronGreenhouse self-assigned this Nov 3, 2020
@AaronGreenhouse
Copy link
Contributor Author

This is very strange because the marker is being removed. If you change UiUtil.openDeclarativeModelElement() to not remove the marker, then you can see it in the Problems view (provided you enable the showing of "info" markers in the view). If you then put UiUtil.openDeclarativeModelElement() back the way it was (removing the marker), you can see that the marker does not appear in the view. Something is confusing the text editor, I think.

@AaronGreenhouse
Copy link
Contributor Author

This is horrible. This must be caused by some kind of data race because when I start pausing things in the debugger the problem goes away.

@AaronGreenhouse
Copy link
Contributor Author

Here's a theory:
The problem may be with the resource change listener used by the editor to receive changes to the markers. It's possible that in the case when the editor is already open, the listener is already registered. So when the markers are deleted and the marker changed events are sent, the editors receives them no problem. But when the editor needs to be opened first, there is a race between the editor registering the listener and the marker change events being sent.

Not really sure how to test for this problem or how it would be fixed.

@lwrage
Copy link
Contributor

lwrage commented Nov 4, 2020

This doesn't happen when we open an editor from the navigator. Is the code different?

@AaronGreenhouse
Copy link
Contributor Author

See AadlNavigatorActionProvider

@AaronGreenhouse
Copy link
Contributor Author

I think we need to open the editor using the URI (as in AadlNavigatorActionProvider) and then use the selectAndReveal() method directly.

@AaronGreenhouse
Copy link
Contributor Author

AaronGreenhouse commented Nov 6, 2020

Deprecated

  • UiUtil.openDeclarativeModelElementAsJob
  • UiUtil.openDeclarativeModelElement(IWorkbenchPage, Element)

Replaced them with openDeclarativeModelElement(URI), which is much simpler:

	public void openDeclarativeModelElement(final URI gotoURI) {
		final EObject eObject = (new ResourceSetImpl()).getEObject(gotoURI, true);
		final ITextRegion where = locationProvider.getFullTextRegion(eObject);
		final IEditorPart editorPart = editorOpener.open(gotoURI, false);
		((ITextEditor) editorPart).selectAndReveal(where.getOffset(), where.getLength());
	}

Changed ClassifierInfoView to use it. Also updated AadlUiBridge.

@AaronGreenhouse
Copy link
Contributor Author

Updated Aadl2ActionBarContributor to use new versions of UiUtil.gotoInstanceObjectSource() that do not use markers.

UiUtil.gotoDeclarativeModelElement() is now @deprecated -- this version was even more poorly behaved than the old openDeclarativeModelElement(). It didn't highlight the correct things all the time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants