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

LocationMap is empty before selecting elements in the editor but populated afterwards #6

Open
jreimone opened this issue Jul 12, 2013 · 5 comments

Comments

@jreimone
Copy link
Contributor

It's hard to describe it as JaMoPP-specific as possible.
Refactory hooks in when some one right-clicks in an open editor. The current selection is determined with the EMFTextEditorConnector. The connector calls locationMap.getElementsAt(..). The problem for JaMoPP is that this map is empty while right-clicking in the editor (selecting some elements). But the map is populated after the call to locationMap.getElementsAt(..). It seems that the workflow is a little bit distinct to other EMFText-generated languages. @jjohannes, can something be done here?

@mirkoseifert
Copy link
Member

The LocationMap is populated during parsing. If you find it empty, you might be requesting information from the LocationMap in an invalid state (e.g., between two parse runs). Do you think that could be the case?

@jreimone
Copy link
Contributor Author

Well, I have the editor open, putting the cursor to arbitrary position reveals the outline to the right node. Thus, the locationmap must be valid somehow. But when I right-click and call getElementsAt it's empty for some reason. In other EMFText-generated editors the same scenario works as expected.
With "between two parse runs" you mean just right before another parse run? I assume a parse run is only initiated as a consequence of ocurred changes, isn't it? In this case I must answer with no because I'm just selecting some text without changing something.

@mirkoseifert
Copy link
Member

Parse runs are initiated when a document is changed and when the editor receives focus. The latter is required to make sure that changes made in other editors are reflected when the editor is changed (e.g., error markers must be removed if references to external resource can be suddenly resolved).

Maybe you can add some debug output to the respective methods (e.g., reload()) to figure out when the resource content is actually parsed and when the location map is reset?

@jreimone
Copy link
Contributor Author

which reload() method do you mean?

@mirkoseifert
Copy link
Member

I meant JavaResource.reload(InputStream inputStream, Map options)

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

No branches or pull requests

2 participants