Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » activateDirectEdit idiom question
activateDirectEdit idiom question [message #637632] Mon, 08 November 2010 07:12 Go to next message
Eclipse User is currently offline Eclipse User
Messages: 257
Registered: July 2009
Senior Member
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?

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
Re: activateDirectEdit idiom question [message #637723 is a reply to message #637632] Mon, 08 November 2010 14:12 Go to previous messageGo to next message
Pascal G is currently offline 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.*
Re: activateDirectEdit idiom question [message #638187 is a reply to message #637632] Wed, 10 November 2010 09:45 Go to previous message
Udo Walker is currently offline Udo Walker
Messages: 67
Registered: July 2009
Member
Am 08.11.2010 08:12, schrieb Hugo A. Garcia:
> 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?
>
> 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?

Answer to your second question with the properties view:

Just select the properties view with swtbot and find the table in that
view and edit the line with your property.

Udo
Previous Topic:Help me With SWTGefEditor
Next Topic:SWTBot does not work properly in Linux Ubuntu 8.10
Goto Forum:
  


Current Time: Fri Oct 24 10:22:16 GMT 2014

Powered by FUDForum. Page generated in 0.03421 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software