Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » Importing "File System"
Importing "File System" [message #695506] Mon, 11 July 2011 22:08 Go to next message
David  is currently offline David Friend
Messages: 3
Registered: July 2011
Junior Member
Anyone know how to get SWTBot to import a "File System" into an existing project?

I can use SWTBot to create a new project, but when I try to import some existing files into the project using the "File -> Import -> General -> File System". there seems to be an issue with the "tree" widget in the "Import" dialog that does not allow it to get populated with the directory contents.

I use something like the following code (many variations of it as well, but nothing seems to work.)

bot.menu("File").menu("Import...").click();
bot.shell("Import").setFocus();
bot.tree().select("General").expandNode("General").select("File System");
bot.button("Next >").click();

SWTBotShell botShell = bot.shell("Import");
botShell.activate();

bot.comboBox().setFocus();
bot.comboBox().setText(path);

// At this point I have the "path" in the "From Directory" filled in, but after that point nothing I do will cause the tree item to be populated with the files in that path. I;ve tried selecting other widgets in the dialog, tabbing around, chaning the path and trying again to select other widgets or tab, but nothing seems to work.

Any ideas?
Re: Importing "File System" [message #695636 is a reply to message #695506] Tue, 12 July 2011 08:07 Go to previous messageGo to next message
Benjamin Ratiarisolo is currently offline Benjamin RatiarisoloFriend
Messages: 16
Registered: January 2010
Location: Paris, France
Junior Member
Hi David,

I think this is more a design issue related to the eclipse Import wizards, than an actual SWTBot problem.

On my helios version (3.6.2 64 bits, on windows 7), The path set by typing new text in the 'From directory' combo-box in the 'File System' Import wizard page is not taken into account when the combo-box loses focus. You have to:
* Either press the 'Return/Enter' key.
* Or push the 'Browse...' button (which will pop-up the 'Import from directory').

Note that, you have a very similar behavior in the 'Import Projects' Import wizard page: text typed in the 'Select root directory' text box is not taken into account until press the 'Return/Enter' key or push the 'Browse...' button right next to it. The slight difference being that if you push the 'Browse...' button and the path is correct and projects are found in the directory, then the 'Browse for Folder dialog' will not pop-up .

Hope this helps,



--
Benjamin Ratiarisolo
IBM ODM Decision Server Rules - Software Developer
IBM Software - France Lab
Re: Importing "File System" [message #696189 is a reply to message #695636] Wed, 13 July 2011 12:56 Go to previous messageGo to next message
David  is currently offline David Friend
Messages: 3
Registered: July 2011
Junior Member
Thanks Benjamin,

Can you provide some example code? I've tried both your suggestions and it doesn't work for me.

doing an "Return/Enter" does nothing, and clicking on the "Browse" button opens the browse dialog, but that is a system dialog and SWTBot can't do anything with it, so SWTBot just sits there doing nothing.

Thanks
Re: Importing "File System" [message #696856 is a reply to message #696189] Fri, 15 July 2011 00:54 Go to previous message
Joanna  is currently offline Joanna Friend
Messages: 12
Registered: May 2011
Junior Member
Hi, David:
I got this problem before, then i tried lots of ways, and finally, the following one works well for me, maybe you can have a try:

bot.text(0).setText(PROJECT_PATH);
bot.sleep(500);
Keyboard key = KeyboardFactory.getSWTKeyboard();
key.pressShortcut(Keystrokes.CR);

The text editor in this wizard page is not combobox. sometimes it's hard to locate this kind of widget especially when we are not familiar with related code. Hope it can help.
Previous Topic:Custom Context Menus and Dialogs
Next Topic:How to find the selected row in the NatTable Grid ?
Goto Forum:
  


Current Time: Thu Dec 18 21:11:24 GMT 2014

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

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