Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » Renaming a node in a tree(Is there a method for renaming a node in a tree)
Renaming a node in a tree [message #515686] Fri, 19 February 2010 18:47 Go to next message
Paul N is currently offline Paul N
Messages: 3
Registered: February 2010
Location: St. Louis, MO
Junior Member
Hi -

As the topic suggests, I have a tree node which expects the user to type in a new name, but I have not been able to find a suitable method for setting the text to a new value.

Is this possible? If so--and I hope it is--what method should I use.

The node is the child of a child, like:

Parent
|
----- Child
        |
        -----Child
               |
               -----Please Rename Me!


Any assistance is appreciated!

Cheers,
Paul
Re: Renaming a node in a tree [message #515693 is a reply to message #515686] Fri, 19 February 2010 19:23 Go to previous messageGo to next message
Pascal G is currently offline Pascal G
Messages: 157
Registered: July 2009
Senior Member
Paul N wrote:
> Hi -
>
> As the topic suggests, I have a tree node which expects the user to type
> in a new name, but I have not been able to find a suitable method for
> setting the text to a new value.
>
> Is this possible? If so--and I hope it is--what method should I use.
>
> The node is the child of a child, like:
>
>
> Parent
> |
> ----- Child
> |
> -----Child
> |
> -----Please Rename Me!
>
>
> Any assistance is appreciated!
>
> Cheers,
> Paul

Surely there should be some kind of text box active... I don't know of
any way to "rename" a tree node in SWT. My bet would be something like
bot.text().setText("text");

If there isn't any text box active because you have some funky SWT stuff
happening that I don't know of, my second bet would be
KeyboardFactory.getDefaultKeyboard(widget, description).typeText("text");

Hell, another way might even be this, but I don't think it's exactly
what you want:
asyncExec(new VoidResult()
{
public void run()
{
treeItem.widget.setText("test");
}
});

Hope this helps.
--
Pascal GĂ©linas | Software Developer
*Nu Echo Inc.*
http://www.nuecho.com/ | http://blog.nuecho.com/

*Because performance matters.*
Re: Renaming a node in a tree [message #515711 is a reply to message #515693] Fri, 19 February 2010 21:26 Go to previous messageGo to next message
Paul N is currently offline Paul N
Messages: 3
Registered: February 2010
Location: St. Louis, MO
Junior Member
Actually, it was a big help.

I'm new to SWTBot and am not a Java programmer, so I'm encountering a fairly steep learning curve. On the bright side, however, SWTBot seems to be capable of doing much of want I want to automate.

Good way to end the work week!

Thanks,
Paul
Re: Renaming a node in a tree [message #515731 is a reply to message #515686] Sat, 20 February 2010 00:07 Go to previous message
Ketan Padegaonkar is currently offline Ketan Padegaonkar
Messages: 873
Registered: July 2009
Senior Member
I suppose you'll need to doubleclick on the element and type stuff in a
textbox that pops up.

There's a similar test case for an editable table, you're probably
looking for something similar.

http://github.com/ketan/swtbot/blob/master/org.eclipse.swtbo t.swt.finder.test/src/org/eclipse/swtbot/swt/finder/widgets/ SWTBotTableDoubleClickTest.java

Cheers!

-- Ketan

On 2/20/10 12:17 AM, Paul N wrote:
> Hi -
>
> As the topic suggests, I have a tree node which expects the user to type
> in a new name, but I have not been able to find a suitable method for
> setting the text to a new value.
>
> Is this possible? If so--and I hope it is--what method should I use.
>
> The node is the child of a child, like:
>
>
> Parent
> |
> ----- Child
> |
> -----Child
> |
> -----Please Rename Me!
>
>
> Any assistance is appreciated!
>
> Cheers,
> Paul
Previous Topic:Ant: NoClassDEfFoundError while accessing another plugin
Next Topic:TreeItem.pressShortcut() stopped working
Goto Forum:
  


Current Time: Wed Sep 24 02:29:16 GMT 2014

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

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