| Summary: | Dot Editor: Double clicking on an element in a DOT attribute value selects the entire value | ||
|---|---|---|---|
| Product: | [Tools] GEF | Reporter: | Zoey Gerrit Prigge <eclipse> |
| Component: | GEF DOT | Assignee: | gef-inbox <gef-inbox> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | enhancement | ||
| Priority: | P3 | CC: | miklossy |
| Version: | unspecified | ||
| Target Milestone: | 5.0.100 (Photon) RC1 | ||
| Hardware: | PC | ||
| OS: | Windows 10 | ||
| See Also: |
https://github.com/eclipse/gef/pull/15 https://github.com/eclipse/gef/pull/16 https://github.com/eclipse/gef/pull/17 |
||
| Whiteboard: | |||
|
Description
Zoey Gerrit Prigge
Xtext determines the selected text based on the lexer tokens: https://www.eclipse.org/forums/index.php/t/373244/ From the DOT host grammar point of view, the entire text belonging to the HTML-Like Label is one lexer token. The problem could be addressed by customizing the org.eclipse.xtext.ui.editor.doubleClicking.LexerTokenAndCharacterPairAwareStrategy to delegate the double click calculation to the DOT HTML-Like Label sub-grammar. The double click calcutor should be improved by providing a general solution for all dot attribute values following a sub-grammar (html-like labels, record-based labels, style...). I pushed the following changes to origin/master: [532244] Implement DotEditorDoubleClickingTests test cases. - Ensure the correct behaviour of element selection when the user double clicks on an element in the DOT Editor. - Some of these test cases are ignored, they should be activated as soon as the DOT Editor double click calculation has been improved. Hi Tamás, Thank you for the help regarding this issue. I have noticed that not all double click events are handled by the LexerTokenAndCharacterPairAwareStrategy, but that some are handled by FixedCharCountPartitionDoubleClickSelector. The selection of the IDoubleClickStrategy happens in org.eclipse.xtext.ui.editor.doubleClicking.DoubleClickStrategyProvider. This seems to be problematic because the selections provided by FixedCharCountPartitionDoubleClickSelector are not as they would be expected We should hence provide a custom implementation of DoubleClickStrategyProvider, I believe. I will prepare a pull request in due course. Hello Zoey, Thanks for the info! I analyzed the problem and found a bug by mapping the DOT grammar token types to the DOT Editor partitions: the wrong editor partition was assigned to the STRING and QUOTED_STRING token types, that's why the not the proper ITextDoubleclickStrategy was executed and that's why the double clicking text selection cut off elements where it should not and did not cut off the elements where it should. I fixed that mapping in the master branch with the following commit: [532244] Improve Dot Editor text double clicking behaviour. - Add a custom ITokenTypeToPartitionTypeMapper implementation with the corresponding binding in the DotUiModule to ensure that the right ITextDoubleClickStrategy is selected by the DoubleClickStrategyProvider. - Implement corresponding DotEditorDoubleClickingTests, DotTokenTypeToPartitionMapperTests and DotHtmlLabelTokenTypeToPartitionMapperTests test cases. Now the double click selection should work properly everywhere except the HTML-like label texts. That use case still needs to be adjusted. GitHub Pull Request 15 created by [prggz] https://github.com/eclipse/gef/pull/15 Hi Tamás, Thanks for the help with finding the bug. I provided a push request (#15) implementing further test cases. I removed the HTML like label test cases which will still need to be looked into. Thanks for your contribution, Zoey! I merged your Pull Request into GEF master. GitHub Pull Request 16 created by [prggz] https://github.com/eclipse/gef/pull/16 I have provided a pull request (#16) dealing with double clicking support for HTML labels. The corresponding test cases are reintegrated and expanded to a comprehensive covering. Imho, once the request is merged, this bug can be closed. GitHub Pull Request 17 created by [prggz] https://github.com/eclipse/gef/pull/17 Thanks for your contribution, Zoey! I merged all your Pull Requests into GEF master. Resolving as fixed in 5.0.100 (Photon) RC1. |