예제 #1
0
 @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
 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
 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
 /**
  * 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);
   }
 }
 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));
 }