On 08-Oct-08, at 1:11 PM, Veneet wrote:

>
> Hi guys ,
>
>    Has anyone found a work around  for a File Open Dialog...
>    if yes alittle desc. plz

We've created another FileDialog class that we use instead of the SWT  
FileDialog class.

This class decides at runtime whether it should call the SWT's file  
dialog or create a simple shell with a textbox where swtbot types in  
the file name and clicks OK. It's quite elegant and we're using  
something similar for DirectoryDialog, ColorDialog, and FontDialogs as  
well.

something like this:

public class FileDialog {

   public FileDialog(Shell shell, int style){
     this.shell = shell;
     this.style = style;
   }
...
...

   public String open(){
     if (isInTestMode())
       return new CustomFileDialog(shell, style).open();
     else
      return new org.eclipse.swt.widgets.FileDialog(shell,  
style).open();
   }

   private boolean isInTestMode(){
     return System.getProperty("isTest", "false").equals("true");
   }

}

-- Ketan


-------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/swtbot-users
http://swtbot.org/ - a functional testing tool for SWT/Eclipse

Reply via email to