|
Re: activateDirectEdit idiom question [message #637723 is a reply to message #637632] |
Mon, 08 November 2010 14:12 |
Pascal G Messages: 157 Registered: July 2009 |
Senior Member |
|
|
On 10-11-08 02:12 AM, Hugo A. Garcia wrote:
> Hi
>
> Just want to confirm that the following idiom is the only way to edit a
> part in an EditPart?
>
> List<SWTBotGefEditPart> parts =
> editor.editParts(instanceOf(XXX_EditPart.class));
> SWTBotGefEditPart part = parts.get(0);
> List<SWTBotGefEditPart> children = part.children();
> children.get(0).activateDirectEdit();
> editor.directEditType("Something");
>
> Is there another idiom for editing the children of an EditPart?
For me, I can't use GefEditor#directEditType() because it sends a
default selection event. I need to do some validation before the default
selection is sent, so here's what I do instead:
editPart.select();
editPart.activateDirectEdit();
SWTBotText textControl = gefEditor.bot().text();
textControl.typeText(newExpression);
Helper.validateEdit(textControl);
Of course, I have this wrapped in an helper method.
Now, if you want to edit a child of an edit part, then you would have to do:
SWTBotGefEditPart child = editPart.children().get(0);
Helper.edit(child, gefEditor, newExpression);
> Haven't tried this yet but will soon: How would I edit a non visual
> property of the parent EditPart, one that is shown in the properties
> view but not in the diagram?
>
> -H
For this you won't need the gef component. It is simple SWTWorkbenchBot
work: get the view (Properties), activate/show it, search for widgets
inside it, do some edition.
Hope this helps.
--
Pascal Gélinas | Software Developer
*Nu Echo Inc.*
http://www.nuecho.com/ | http://blog.nuecho.com/
*Because performance matters.*
|
|
|
|
Powered by
FUDForum. Page generated in 0.03185 seconds