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

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

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

Shell.getShell介绍

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

代码示例

代码示例来源:origin: pentaho/pentaho-kettle

@Override
 public void widgetSelected( SelectionEvent evt ) {
  HelpUtils.openHelpDialog( parent.getShell(), docTitle, docUrl, docHeader );
 }
} );

代码示例来源:origin: pentaho/pentaho-kettle

@Override protected Shell createDialog() {
 Shell dialog = super.createDialog();
 if ( icon == null ) {
  return dialog;
 }
 Image[] images = KettleImageUtil.loadImages( container, dialog.getShell(), icon );
 if ( images != null ) {
  dialog.getShell().setImages( images );
 }
 return dialog;
}

代码示例来源:origin: pentaho/pentaho-kettle

@Override
 public void widgetSelected( SelectionEvent evt ) {
  String docUrl = Const.getDocUrl( BaseMessages.getString( Spoon.class, "Spoon.ArgumentsDialog.Help" ) );
  String docTitle = BaseMessages.getString( PKG, "ArgumentsDialog.docTitle" );
  String docHeader = BaseMessages.getString( PKG, "ArgumentsDialog.docHeader" );
  HelpUtils.openHelpDialog( parent.getShell(), docTitle, docUrl, docHeader );
 }
} );

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

Shell getModalShell () {
  Shell shell = null;
  Shell [] modalShells = display.modalShells;
  if (modalShells != null) {
    int bits = SWT.APPLICATION_MODAL | SWT.SYSTEM_MODAL;
    int index = modalShells.length;
    while (--index >= 0) {
      Shell modal = modalShells [index];
      if (modal != null) {
        if ((modal.style & bits) != 0) {
          Control control = this;
          while (control != null) {
            if (control == modal) break;
            control = control.parent;
          }
          if (control != modal) return modal;
          break;
        }
        if ((modal.style & SWT.PRIMARY_MODAL) != 0) {
          if (shell == null) shell = getShell ();
          if (modal.parent == shell) return modal;
        }
      }
    }
  }
  return null;
}

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

Shell getModalShell () {
  Shell shell = null;
  Shell [] modalShells = display.modalShells;
  if (modalShells != null) {
    int bits = SWT.APPLICATION_MODAL | SWT.SYSTEM_MODAL;
    int index = modalShells.length;
    while (--index >= 0) {
      Shell modal = modalShells [index];
      if (modal != null) {
        if ((modal.style & bits) != 0) {
          Control control = this;
          while (control != null) {
            if (control == modal) break;
            control = control.parent;
          }
          if (control != modal) return modal;
          break;
        }
        if ((modal.style & SWT.PRIMARY_MODAL) != 0) {
          if (shell == null) shell = getShell ();
          if (modal.parent == shell) return modal;
        }
      }
    }
  }
  return null;
}

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

Shell getModalShell () {
  Shell shell = null;
  Shell [] modalShells = display.modalShells;
  if (modalShells != null) {
    int bits = SWT.APPLICATION_MODAL | SWT.SYSTEM_MODAL;
    int index = modalShells.length;
    while (--index >= 0) {
      Shell modal = modalShells [index];
      if (modal != null) {
        if ((modal.style & bits) != 0) {
          Control control = this;
          while (control != null) {
            if (control == modal) break;
            control = control.parent;
          }
          if (control != modal) return modal;
          break;
        }
        if ((modal.style & SWT.PRIMARY_MODAL) != 0) {
          if (shell == null) shell = getShell ();
          if (modal.parent == shell) return modal;
        }
      }
    }
  }
  return null;
}

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

Shell getModalShell () {
  Shell shell = null;
  Shell [] modalShells = display.modalShells;
  if (modalShells != null) {
    int bits = SWT.APPLICATION_MODAL | SWT.SYSTEM_MODAL;
    int index = modalShells.length;
    while (--index >= 0) {
      Shell modal = modalShells [index];
      if (modal != null) {
        if ((modal.style & bits) != 0) {
          Control control = this;
          while (control != null) {
            if (control == modal) break;
            control = control.parent;
          }
          if (control != modal) return modal;
          break;
        }
        if ((modal.style & SWT.PRIMARY_MODAL) != 0) {
          if (shell == null) shell = getShell ();
          if (modal.parent == shell) return modal;
        }
      }
    }
  }
  return null;
}

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

/**
 * Set the foreground text color. This method has no effect after
 * {@link #getBundleProgressMonitor()} has been invoked.
 *
 * @param foregroundRGB
 *            the color
 */
protected void setForeground(RGB foregroundRGB) {
  if (monitor != null)
    return;
  if (this.foreground != null)
    this.foreground.dispose();
  this.foreground = new Color(getSplash().getShell().getDisplay(),
      foregroundRGB);
}

代码示例来源:origin: inspectIT/inspectIT

MessageDialog.openError(Display.getDefault().getActiveShell().getShell(), "Error", e.getCause().toString());
} catch (InterruptedException e) {
  MessageDialog.openInformation(Display.getDefault().getActiveShell().getShell(), "Cancelled", e.getCause().toString());

代码示例来源:origin: inspectIT/inspectIT

MessageDialog.openError(Display.getDefault().getActiveShell().getShell(), "Error", e.getCause().toString());
} catch (InterruptedException e) {
  MessageDialog.openInformation(Display.getDefault().getActiveShell().getShell(), "Cancelled", e.getCause().toString());

代码示例来源:origin: inspectIT/inspectIT

MessageDialog.openError(Display.getDefault().getActiveShell().getShell(), "Error", e.getCause().toString());
} catch (InterruptedException e) {
  MessageDialog.openInformation(Display.getDefault().getActiveShell().getShell(), "Cancelled", e.getCause().toString());

代码示例来源:origin: anb0s/LogViewer

public void showErrorMessage(String message) {
  IWorkbenchWindow window = getDefault().getWorkbench().getActiveWorkbenchWindow();
  if(window != null) {
    MessageDialog.openError(window.getShell().getShell(),getResourceString("error.fatal.title"),message); //$NON-NLS-1$
    }
 }

代码示例来源:origin: anb0s/LogViewer

public void showInfoMessage(String message) {
  IWorkbenchWindow window = getDefault().getWorkbench().getActiveWorkbenchWindow();
   if(window != null) {
     MessageDialog.openInformation(window.getShell().getShell(),getResourceString("error.info.title"),message); //$NON-NLS-1$
   }
}

代码示例来源:origin: anb0s/LogViewer

public void showWarningMessage(String message) {
  IWorkbenchWindow window = getDefault().getWorkbench().getActiveWorkbenchWindow();
   if(window != null) {
     MessageDialog.openWarning(window.getShell().getShell(),getResourceString("error.warning.title"),message); //$NON-NLS-1$
   }
}

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

private boolean validChanges(CompositeChange change) {
  RefactoringStatus result= new RefactoringStatus();
  List files= new ArrayList();
  try {
    findFilesToBeModified(change, files);
  } catch (JavaModelException e) {
    JavaPlugin.log(e);
    return false;
  }
  result.merge(Checks.validateModifiesFiles((IFile[])files.toArray(new IFile[files.size()]), JavaPlugin.getActiveWorkbenchShell().getShell()));
  if (result.hasFatalError()) {
    RefactoringStatusEntry[] entries= result.getEntries();
    IStatus status;
    if (entries.length > 1) {
      status= new MultiStatus(JavaUI.ID_PLUGIN, 0, result.getMessageMatchingSeverity(RefactoringStatus.ERROR), null);
      for (int i= 0; i < entries.length; i++) {
        ((MultiStatus)status).add(new Status(entries[i].getSeverity(), JavaUI.ID_PLUGIN, 0, entries[i].getMessage(), null));
      }
    } else {
      RefactoringStatusEntry entry= entries[0];
      status= new Status(entry.getSeverity(), JavaUI.ID_PLUGIN, 0, entry.getMessage(), null);
    }
    ErrorDialog.openError(JavaPlugin.getActiveWorkbenchShell().getShell(), CorrectionMessages.CorrectionMarkerResolutionGenerator__multiFixErrorDialog_Titel, CorrectionMessages.CorrectionMarkerResolutionGenerator_multiFixErrorDialog_description, status);
    return false;
  }
  return true;
}

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

private void launch(IPluginModelBase model, String mode) {
  fModel = model;
  fApplicationName = null;
  if (fModel != null) {
    String[] applicationNames = getAvailableApplications();
    if (applicationNames.length == 1) {
      fApplicationName = applicationNames[0];
    } else if (applicationNames.length > 1) {
      ApplicationSelectionDialog dialog = new ApplicationSelectionDialog(PDEPlugin.getActiveWorkbenchShell().getShell(), applicationNames, mode);
      if (dialog.open() == Window.OK) {
        fApplicationName = dialog.getSelectedApplication();
      }
    }
  }
  launch(mode);
}

代码示例来源:origin: infinitest/infinitest

private void sizeDialog(final Shell dialog) {
  dialog.pack();
  Monitor monitor = dialog.getShell().getMonitor();
  if (monitor != null) {
    if (dialog.getSize().x > monitor.getClientArea().width) {
      dialog.setSize(monitor.getClientArea().width, dialog.getSize().y);
    }
    if (dialog.getSize().y > monitor.getClientArea().height) {
      dialog.setSize(dialog.getSize().x, monitor.getClientArea().height);
    }
  }
  dialog.layout();
}

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

shell.setSize(cSize);
Display display = shell.getShell().getDisplay();

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

@Override
public IProgressMonitor getBundleProgressMonitor() {
  if (monitor == null) {
    Composite parent = new Composite(getSplash(), Window.getDefaultOrientation());
    Point size = getSplash().getSize();
    parent.setBounds(new Rectangle(0,0,size.x,size.y));
    monitor = new AbsolutePositionProgressMonitorPart(parent);
    monitor.setSize(size);
    if (progressRect != null)
      monitor.getProgressIndicator().setBounds(progressRect);
    else
      monitor.getProgressIndicator().setVisible(false);
    if (messageRect != null)
      monitor.getProgressText().setBounds(messageRect);
    else
      monitor.getProgressText().setVisible(false);
    if (foreground != null)
      monitor.getProgressText().setForeground(foreground);
    monitor.setBackgroundMode(SWT.INHERIT_FORCE);
    monitor.setBackgroundImage(getSplash().getShell()
        .getBackgroundImage());
  }
  return monitor;
}

代码示例来源:origin: org.xworker/xworker_swt

public static Object openSwtEditor(ActionContext actionContext){        
    World world = World.getInstance();
    //Thing currentThing = (Thing) actionContext.get("currentThing");
    Control parent = (Control) actionContext.get("parent");
    
    //创建编辑窗体
    ActionContext ac = new ActionContext();
    ac.put("parent", parent);
    Thing editorThing = world.getThing("xworker.app.view.swt.widgets.form.DataObjectEditDialog/@shell");
    editorThing.doAction("create", ac);
    ((Thing) ac.get("form")).doAction("setDataObject", ac, UtilMap.toMap(new Object[]{"dataObject", actionContext.get("dataObject"), "formType", actionContext.get("type")}));
    Shell shell = (Shell) ac.get("shell");
    ((Shell) ac.get("shell")).pack();
    SwtUtils.centerShell((Shell) ac.get("shell"));
    
    SwtDialog dialog = new SwtDialog(shell.getShell(),shell, ac);
    return dialog.open();
  }
}

相关文章

微信公众号

最新文章

更多

Shell类方法