Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » wait for the project complete
icon5.gif  wait for the project complete [message #1461162] Tue, 04 November 2014 09:14 Go to next message
Shweta Dhumal is currently offline Shweta DhumalFriend
Messages: 5
Registered: November 2014
Junior Member
Hi,

I have written test case in SWTBOT of "creating a project" for my RCP application.

But after pressing finish button to create a project, Project is taking time to create. Some times more than 5 min--> Specially project takes time to load all the modules in the project or because of imported files.

While loading modules. My RCP application is showing Progress bar. But it is not observed by the SWTBot.

My question is --> Is there any way to get project finished?

If yes please provide code snippet
Re: wait for the project complete [message #1461488 is a reply to message #1461162] Tue, 04 November 2014 16:08 Go to previous messageGo to next message
Rüdiger Herrmann is currently offline Rüdiger HerrmannFriend
Messages: 581
Registered: July 2009
Senior Member
Hi,

I'd spin a 'timed loop' that tests if the project was created (exists),
wait some time and enter the loop again until either the project was
created or the timeout was reached.

long start = System.currentTimeMillis();
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
while( root.getProject( name-of-project" ).exists() ) {
Thread.sleep( 10 );
if( System.currentTimeMillis() - start > TIMEOUT ) {
fail( "Timeout out while waiting for project to be created." );
}
}

If the project is created early but other necessary artifacts are
created later, then you will have to refine the while-condition to test
if the project was _fully_ created.

Regards,
Rüdiger

On 04.11.2014 13:12, Shweta Dhumal wrote:
> Hi,
>
> I have written test case in SWTBOT of "creating a project" for my RCP
> application.
>
> But after pressing finish button to create a project, Project is taking
> time to create. Some times more than 5 min--> Specially project takes
> time to load all the modules in the project or because of imported files.
>
> While loading modules. My RCP application is showing Progress bar. But
> it is not observed by the SWTBot.
>
> My question is --> Is there any way to get project finished?
>
> If yes please provide code snippet
--
Rüdiger Herrmann
http://codeaffine.com
Re: wait for the project complete [message #1463143 is a reply to message #1461162] Thu, 06 November 2014 08:58 Go to previous message
Aparajita K is currently offline Aparajita KFriend
Messages: 7
Registered: August 2014
Junior Member
Hi Shwetali,
You can try this to wait until project creation gets finished.
public class DynamicWait {

public void waitSometime(String ProjName, SWTWorkbenchBot swtBot) {
swtBot = new SWTWorkbenchBot();
IWorkspaceRoot wRoot = ResourcesPlugin.getWorkspace().getRoot();
IProject project = wRoot.getProject(ProjName);

boolean isSync = false;
while (isSync) {
swtBot.sleep(500);
System.out.println("_________________" + isSync);
isSync = project.isSynchronized(IResource.DEPTH_INFINITE);
}

}
Previous Topic:Display not found in framework
Next Topic:waituntil some condition
Goto Forum:
  


Current Time: Sat Oct 12 02:37:32 GMT 2024

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

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

Back to the top