org.eclipse.swt.widgets.Shell.getShells()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(9.8k)|赞(0)|评价(0)|浏览(97)

本文整理了Java中org.eclipse.swt.widgets.Shell.getShells()方法的一些代码示例,展示了Shell.getShells()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Shell.getShells()方法的具体详情如下:
包路径:org.eclipse.swt.widgets.Shell
类名称:Shell
方法名:getShells

Shell.getShells介绍

[英]Returns an array containing all shells which are descendents of the receiver.
[中]返回一个数组,其中包含接收器的所有外壳。

代码示例

代码示例来源:origin: org.eclipse.platform/org.eclipse.debug.ui

/**
 * Returns a modal dialog currently open on the given shell or <code>null</code> if none.
 *
 * @param shell shell to check
 * @return a modal dialog currently open on the given shell or <code>null</code> if none
 */
private Shell getModalDialogOpen(Shell shell) {
  Shell[] shells = shell.getShells();
  for (int i = 0; i < shells.length; i++) {
    Shell dialog = shells[i];
    if ((dialog.getStyle() & (SWT.APPLICATION_MODAL | SWT.PRIMARY_MODAL | SWT.SYSTEM_MODAL)) > 0) {
      return dialog;
    }
  }
  return null;
}

代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64

void releaseChildren (boolean destroy) {
  Shell [] shells = getShells ();
  for (int i=0; i<shells.length; i++) {
    Shell shell = shells [i];
    if (shell != null && !shell.isDisposed ()) {
      shell.dispose ();
    }
  }
  super.releaseChildren (destroy);
}

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt

@Override
 void reskinChildren( int flags ) {
  Shell[] shells = getShells();
  for( int i = 0; i < shells.length; i++ ) {
   Shell shell = shells[ i ];
   if( shell != null ) {
    shell.reskin( flags );
   }
  }
  super.reskinChildren( flags );
 }
}

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.jface

public void handleEvent(Event event) {
    /*
     * Close if we are deactivating and have no child shells. If we
     * have child shells, we are deactivating due to their opening.
     * On X, we receive this when a menu child (such as the system
     * menu) of the shell opens, but I have not found a way to
     * distinguish that case here. Hence bug #113577 still exists.
     */
    if (listenToDeactivate && event.widget == getShell()
        && getShell().getShells().length == 0) {
      asyncClose();
    } else {
      /*
       * We typically ignore deactivates to work around
       * platform-specific event ordering. Now that we've ignored
       * whatever we were supposed to, start listening to
       * deactivates. Example issues can be found in
       * https://bugs.eclipse.org/bugs/show_bug.cgi?id=123392
       */
      listenToDeactivate = true;
    }
  }
});

代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64

void reskinChildren (int flags) {
  if (toolBar != null) toolBar.reskin(flags);
  Shell [] shells = getShells ();
  for (int i=0; i<shells.length; i++) {
    Shell shell = shells [i];
    if (shell != null) shell.reskin (flags);
  }
  super.reskinChildren (flags);
}

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.jface

public void handleEvent(Event event) {
    // ignore this event if we have launched a child
    if (event.widget == getShell()
        && getShell().getShells().length == 0) {
      listenToDeactivate = true;
      // Typically we start listening for parent deactivate after
      // we are activated, except on the Mac, where the deactivate
      // is received after activate.
      // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=100668
      listenToParentDeactivate = !Util.isMac();
    }
  }
});

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc

@Override
void reskinChildren (int flags) {
  Shell [] shells = getShells ();
  for (int i=0; i<shells.length; i++) {
    Shell shell = shells [i];
    if (shell != null) shell.reskin (flags);
  }
  if (toolTips != null) {
    for (int i=0; i<toolTips.length; i++) {
      ToolTip toolTip = toolTips [i];
      if (toolTip != null) toolTip.reskin (flags);
    }
  }
  super.reskinChildren (flags);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc

@Override
void reskinChildren (int flags) {
  Shell [] shells = getShells ();
  for (int i=0; i<shells.length; i++) {
    Shell shell = shells [i];
    if (shell != null) shell.reskin (flags);
  }
  if (toolTips != null) {
    for (int i=0; i<toolTips.length; i++) {
      ToolTip toolTip = toolTips [i];
      if (toolTip != null) toolTip.reskin (flags);
    }
  }
  super.reskinChildren (flags);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x

@Override
void reskinChildren (int flags) {
  Shell [] shells = getShells ();
  for (int i=0; i<shells.length; i++) {
    Shell shell = shells [i];
    if (shell != null) shell.reskin (flags);
  }
  if (toolTips != null) {
    for (int i=0; i<toolTips.length; i++) {
      ToolTip toolTip = toolTips [i];
      if (toolTip != null) toolTip.reskin (flags);
    }
  }
  super.reskinChildren (flags);
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86

@Override
void reskinChildren (int flags) {
  Shell [] shells = getShells ();
  for (int i=0; i<shells.length; i++) {
    Shell shell = shells [i];
    if (shell != null) shell.reskin (flags);
  }
  if (toolTips != null) {
    for (int i=0; i<toolTips.length; i++) {
      ToolTip toolTip = toolTips [i];
      if (toolTip != null) toolTip.reskin (flags);
    }
  }
  super.reskinChildren (flags);
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86

@Override
void releaseChildren (boolean destroy) {
  Shell [] shells = getShells ();
  for (int i=0; i<shells.length; i++) {
    Shell shell = shells [i];
    if (shell != null && !shell.isDisposed ()) {
      shell.release (false);
    }
  }
  if (toolTips != null) {
    for (int i=0; i<toolTips.length; i++) {
      ToolTip toolTip = toolTips [i];
      if (toolTip != null && !toolTip.isDisposed ()) {
        toolTip.release (false);
      }
    }
  }
  toolTips = null;
  super.releaseChildren (destroy);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc

@Override
void releaseChildren (boolean destroy) {
  Shell [] shells = getShells ();
  for (int i=0; i<shells.length; i++) {
    Shell shell = shells [i];
    if (shell != null && !shell.isDisposed ()) {
      shell.release (false);
    }
  }
  if (toolTips != null) {
    for (int i=0; i<toolTips.length; i++) {
      ToolTip toolTip = toolTips [i];
      if (toolTip != null && !toolTip.isDisposed ()) {
        toolTip.dispose ();
      }
    }
    toolTips = null;
  }
  super.releaseChildren (destroy);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc

@Override
void releaseChildren (boolean destroy) {
  Shell [] shells = getShells ();
  for (int i=0; i<shells.length; i++) {
    Shell shell = shells [i];
    if (shell != null && !shell.isDisposed ()) {
      shell.release (false);
    }
  }
  if (toolTips != null) {
    for (int i=0; i<toolTips.length; i++) {
      ToolTip toolTip = toolTips [i];
      if (toolTip != null && !toolTip.isDisposed ()) {
        toolTip.dispose ();
      }
    }
    toolTips = null;
  }
  super.releaseChildren (destroy);
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.ide

/**
 * Checks whether the current active shell has at least one visible sub
 * shell. This is especially the case when the content assist popup is
 * visible or the javadoc on mouse hover is enabled.
 *
 * @param display
 *            the display from which the active shell should be retrieved
 * @return true if the active shell has at least one sub shell visible,
 *         false otherwise.
 */
private static boolean hasVisibleSubShell(final Display display) {
  if (display != null && !display.isDisposed()) {
    Shell shell = display.getActiveShell();
    if (shell != null) {
      for (Shell subShell : shell.getShells()) {
        if (subShell.isVisible()) {
          return true;
        }
      }
    }
  }
  return false;
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x

@Override
void releaseChildren (boolean destroy) {
  Shell [] shells = getShells ();
  for (int i=0; i<shells.length; i++) {
    Shell shell = shells [i];
    if (shell != null && !shell.isDisposed ()) {
      shell.release (false);
    }
  }
  if (toolTips != null) {
    for (int i=0; i<toolTips.length; i++) {
      ToolTip toolTip = toolTips [i];
      if (toolTip != null && !toolTip.isDisposed ()) {
        toolTip.dispose ();
      }
    }
    toolTips = null;
  }
  super.releaseChildren (destroy);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.jface

/**
 * Returns the most specific modal child from the given list of Shells.
 *
 * @param toSearch shells to search for modal children
 * @return the most specific modal child, or null if none
 *
 * @since 3.1
 */
private static Shell getModalChild(Shell[] toSearch) {
  int modal = SWT.APPLICATION_MODAL | SWT.SYSTEM_MODAL | SWT.PRIMARY_MODAL;
  for (int i = toSearch.length - 1; i >= 0; i--) {
    Shell shell = toSearch[i];
    // Check if this shell has a modal child
    Shell[] children = shell.getShells();
    Shell modalChild = getModalChild(children);
    if (modalChild != null) {
      return modalChild;
    }
    // If not, check if this shell is modal itself
    if (shell.isVisible() && (shell.getStyle() & modal) != 0) {
      return shell;
    }
  }
  return null;
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.workbench

/**
 * Return the modal shell that is currently open. If there isn't one then
 * return null. If there are stacked modal shells, return the top one.
 *
 * @param shell
 *            A shell to exclude from the search. May be <code>null</code>.
 *
 * @return Shell or <code>null</code>.
 */
public static Shell getModalShellExcluding(Shell shell) {
  // If shell is null or disposed, then look through all shells
  if (shell == null || shell.isDisposed()) {
    return getModalChildExcluding(PlatformUI.getWorkbench()
        .getDisplay().getShells(), shell);
  }
  // Start with the shell to exclude and check it's shells
  return getModalChildExcluding(shell.getShells(), shell);
}

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.jface

public Shell getShell() {
    Display d = Display.getCurrent();
    
    if (d == null) {
      return null;
    }
    Shell parent = d.getActiveShell();
    
    // Make sure we don't pick a parent that has a modal child (this can lock the app)
    if (parent == null) {
      // If this is a top-level window, then there must not be any open modal windows.
      parent = getModalChild(Display.getCurrent().getShells());
    } else {
      // If we picked a parent with a modal child, use the modal child instead
      Shell modalChild = getModalChild(parent.getShells());
      if (modalChild != null) {
        parent = modalChild;
      }
    }
    
    return parent;
  }
};

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x

void updateMinimized (boolean minimized) {
  Shell[] shells = getShells ();
  for (int i = 0; i < shells.length; i++) {
    boolean update = false;
    Shell shell = shells[i];
    while (shell != null && shell != this && !shell.isUndecorated ()) {
      shell = (Shell) shell.getParent ();
    }
    if (shell != null && shell != this) update = true;
    if (update) {
      if (minimized) {
        if (shells[i].isVisible ()) {
          shells[i].showWithParent = true;
          OS.gtk_widget_hide(shells[i].shellHandle);
        }
      } else {
        if (shells[i].showWithParent) {
          shells[i].showWithParent = false;
          OS.gtk_widget_show(shells[i].shellHandle);
        }
      }
    }
  }
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc

void updateMinimized (boolean minimized) {
  Shell[] shells = getShells ();
  for (int i = 0; i < shells.length; i++) {
    boolean update = false;
    Shell shell = shells[i];
    while (shell != null && shell != this && !shell.isUndecorated ()) {
      shell = (Shell) shell.getParent ();
    }
    if (shell != null && shell != this) update = true;
    if (update) {
      if (minimized) {
        if (shells[i].isVisible ()) {
          shells[i].showWithParent = true;
          OS.gtk_widget_hide(shells[i].shellHandle);
        }
      } else {
        if (shells[i].showWithParent) {
          shells[i].showWithParent = false;
          OS.gtk_widget_show(shells[i].shellHandle);
        }
      }
    }
  }
}

相关文章

微信公众号

最新文章

更多

Shell类方法