Hello everybody,

I am very enthusiast about the framework and I already have a question.
In my application, I have a command that have a default 
org.eclipse.core.commands.Handler.
It opens a dialog like this:
  @Override
  public Object execute(final ExecutionEvent event) throws ExecutionException {
    final FooWizard wizard = new FooWizard();
    wizard.setWindowTitle(Messages.getString("Foo.title"));
    final WizardDialog dialog = new WizardDialog(
      HandlerUtil.getActiveShell(event).getShell(),
      wizard
    );
    dialog.setTitle(Messages.getString("Foo.title")); //$NON-NLS-1$
    dialog.create();
    dialog.open();
    return null;
  }

Tested with the code:
  bot.menu("File").menu("Foo...").click();
  bot.shell("Foo title").activate();
  ... (testing dialog) ...

The click method execute the command which forwards to the active handler. But 
the execution is stopped at dialog.open() since the command framework is 
synchronous.

Do you have any ideas how could I test a such synchronous dialog ?

I already tried to async the dialog but in this case, a timeout occurs and the 
dialog is displayed after the end of the test (!).
  Display.getDefault().asyncExec(new Runnable(){
    public void run() {
      final FooWizard wizard = new FooWizard();
      wizard.setWindowTitle(Messages.getString("Foo.title"));
      final WizardDialog dialog = new WizardDialog(
        HandlerUtil.getActiveShell(event).getShell(),
        wizard
      );
      dialog.setTitle(Messages.getString("Foo.title")); //$NON-NLS-1$
      dialog.create();
      dialog.open();
    }
  });

Thank you,
 - Eric.

--
Target platform: Eclipse 3.3.2
SWTBot: SWTBot eclipse 1.2.0.883-dev

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
SWTBot-users mailing list
SWTBot-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/swtbot-users
http://swtbot.org/ - a functional testing tool for SWT/Eclipse

Reply via email to