XtextEditor manipulation [message #1059996] |
Wed, 22 May 2013 13:30 |
|
Hello everyone,
could someone help me with the following problem, please:
I want to be able when I'm pressing in a view (like the outline) on a object from my model to be able to show in the editor only that element + subelements and the rest of the things in the editor I would like to have them collapsed or grayed.
Something like this:
View:
and if I click on Red in the editor should show me:
+myLanguage
Red name id
subelementOfRed name id
subelement2OfRed id
+code
Red name id
subelementOfRed name id
+code
the + is for collapse code
More info: now I have the XtextEditor and the IXtextDocument, I got also the model from : IXTextDocument.readOnly(new IUnitOfWork<Object, XtextResource>()).
But I'm a little stuck of how should I make this thing to collapse in between (I get the right elements from the model)
Thanks in advance!
Edwin W.T.
|
|
|
|
|
|
|
|
|
Re: XtextEditor manipulation [message #1063699 is a reply to message #1060264] |
Thu, 13 June 2013 18:52 |
|
Hi Alex,
Now I am doing something like
ICompositeNode node = NodeModelUtils.findActualNodeFor(findP);//NodeModelUtils.getNode(findP);
sourceViewer.setVisibleRegion(node.getOffset(), node.getLength());
works fine, but I have only one problem.
When I have something that is optional in my grammar for ex:
'car' (model=STRING (color=STRING)?)
if I'm using: car Audi works just fine, but if now I want to add the color Red to it the node will have the same length as when was only without the color.
The model is updated (saw it in debug).
Could you help me please?
Thanks in advance
Edwin W.T.
|
|
|
|
Re: XtextEditor manipulation [message #1063770 is a reply to message #1063750] |
Fri, 14 June 2013 07:57 |
|
Hi,
yes is added, as I said I check with debug and is added in findP.
When I write:
- the visible part is the whole object car Audi 4 wheels
works fine
but when I add the color to this and then I have
- the visible part is car Audi "Red" 4 - so this mean that the length of the string "Red" (+"") is 5 + 1 ws = 6 which is the length of the wheels (6) so will not show me the wheels in my code.
I think the problem of the node is that doesn't compute the length when you add the new feature.
As in my example the 'color' at start was null, but when I decided to update/add the color the length didn't add the new string.
Hope now is clear.
Thanks!
Edwin W.T.
|
|
|
|
Re: XtextEditor manipulation [message #1063855 is a reply to message #1063799] |
Fri, 14 June 2013 14:00 |
|
Hi again,
So the node.getText() shows what I need/expected the whole text
but in the editor appears:
I have the breakpoint at this line: sourceViewer.setVisibleRegion(node.getOffset(), node.getLength());
Thanks!
Cheers,
Edwin W.T.
|
|
|
|
Powered by
FUDForum. Page generated in 0.04619 seconds