コード例 #1
0
ファイル: ShellIsActive.java プロジェクト: jpeterka/reddeer
 @Override
 public boolean test() {
   if (shell == null) {
     return ShellLookup.getInstance().getCurrentActiveShell() != null;
   } else {
     org.eclipse.swt.widgets.Shell currentActiveShell =
         ShellLookup.getInstance().getCurrentActiveShell();
     if (currentActiveShell == null) {
       log.debug("Current active shell is null");
       return false;
     }
     return currentActiveShell.equals(shell.getSWTWidget());
   }
 }
コード例 #2
0
ファイル: DefaultShell.java プロジェクト: ibuziuk/reddeer
 public DefaultShell() {
   super(ShellLookup.getInstance().getActiveShell());
   try {
     setFocus();
     log.debug("Active shell with title '" + getText() + "' found");
   } catch (Exception e) {
     throw new SWTLayerException("No active shell is available at the moment", e);
   }
 }
コード例 #3
0
ファイル: DefaultShell.java プロジェクト: ibuziuk/reddeer
 public DefaultShell(String title) {
   super(ShellLookup.getInstance().getShell(title));
   try {
     setFocus();
     log.debug("Shell with title '" + title + "' found");
   } catch (Exception e) {
     throw new SWTLayerException("No shell with title '" + title + "' is available", e);
   }
 }
コード例 #4
0
ファイル: DefaultShell.java プロジェクト: ibuziuk/reddeer
 /**
  * Creates a new DefaultShell matching specified matcher. First found shell with specified matcher
  * is created. Beware, there is no strict (deterministic) order of shells.
  *
  * @param matcher matcher to match title of a shell
  */
 public DefaultShell(Matcher<String> matcher) {
   super(ShellLookup.getInstance().getShell(matcher));
   try {
     setFocus();
     log.debug("Shell matching specified matcher is found and focused");
   } catch (Exception e) {
     throw new SWTLayerException(
         "Shell matching specified matcher was not focused successfully.", e);
   }
 }
コード例 #5
0
 protected static void disableSourceLookup() {
   // wait for some shell to get activated
   ShellLookup.getInstance().getActiveShell();
   String originalShellText = new DefaultShell().getText();
   WorkbenchPreferenceDialog preferenceDialog = new WorkbenchPreferenceDialog();
   preferenceDialog.open();
   SourceLookupPreferencePage sourceLookupPreferencePage = new SourceLookupPreferencePage();
   preferenceDialog.select(sourceLookupPreferencePage);
   sourceLookupPreferencePage.setSourceAttachment(
       SourceLookupPreferencePage.SourceAttachmentEnum.NEVER);
   preferenceDialog.ok();
   new WaitUntil(new ShellWithTextIsActive(originalShellText));
 }