org.eclipse.jface.window.Window类的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(7.6k)|赞(0)|评价(0)|浏览(100)

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

Window介绍

[英]A JFace window is an object that has no visual representation (no widgets) until it is told to open.

Creating a window involves the following steps:

  • creating an instance of a concrete subclass of Window
  • creating the window's shell and widget tree by calling create (optional)
  • assigning the window to a window manager using WindowManager.add (optional)
  • opening the window by calling open
    Opening the window will create its shell and widget tree if they have not already been created. When the window is closed, the shell and widget tree are disposed of and are no longer referenced, and the window is automatically removed from its window manager. A window may be reopened.

The JFace window framework (this package) consists of this class, Window, the abstract base of all windows, and one concrete window classes (ApplicationWindow) which may also be subclassed. Clients may define additional window subclasses as required.

The Window class provides methods that subclasses may override to configure the window, including:

  • close- extend to free other SWT resources
  • configureShell- extend or reimplement to set shell properties before window opens
  • createContents- extend or reimplement to create controls before window opens
  • getInitialSize- reimplement to give the initial size for the shell
  • getInitialLocation- reimplement to give the initial location for the shell
  • getShellListener- extend or reimplement to receive shell events
  • handleFontChange- reimplement to respond to font changes
  • handleShellCloseEvent- extend or reimplement to handle shell closings
    [中]JFace窗口是一个在被告知打开之前没有视觉表现(没有小部件)的对象。
    创建窗口包括以下步骤:
    *创建Window的具体子类的实例
    *通过调用create创建窗口的外壳和小部件树(可选)
    *使用WindowManager.add将窗口分配给窗口管理器(可选)
    *通过调用open打开窗口
    打开窗口将创建其外壳和小部件树(如果尚未创建)。当窗口关闭时,shell和小部件树将被丢弃,不再被引用,窗口将自动从其窗口管理器中删除。可能会重新打开一扇窗户。
    JFace窗口框架(这个包)由这个类Window组成,它是所有窗口的抽象基础,还有一个具体的窗口类(ApplicationWindow),也可以是子类。客户端可以根据需要定义其他窗口子类。
    Window类提供了子类可以重写以配置窗口的方法,包括:
    *[$7$]-扩展到免费的其他SWT资源
    *[$8$]-扩展或重新实现以在窗口打开之前设置外壳属性
    *[$9$]-在窗口打开之前扩展或重新实现以创建控件
    *[$10$]-重新实现以给出外壳的初始大小
    *[$11$]-重新实现以给出外壳的初始位置
    *[$12$]-扩展或重新实现以接收shell事件
    *[$13$]-重新实现以响应字体更改
    *[$14$]-扩展或重新实现以处理外壳关闭

代码示例

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

/**
 * Creates a window instance, whose shell will be created under the given
 * parent shell. Note that the window will have no visual representation
 * until it is told to open. By default, <code>open</code> does not block.
 *
 * @param parentShell
 *            the parent shell, or <code>null</code> to create a top-level
 *            shell. Try passing "(Shell)null" to this method instead of "null"
 *            if your compiler complains about an ambiguity error.
 * @see #setBlockOnOpen
 * @see #getDefaultOrientation()
 */
protected Window(Shell parentShell) {
  this(new SameShellProvider(parentShell));
  if(parentShell == null) {
    setShellStyle(getShellStyle() | getDefaultOrientation());
  }
}

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

private void uninitializeImages() {
  WorkbenchImages.dispose();
  Image[] images = Window.getDefaultImages();
  Window.setDefaultImage(null);
  for (Image image : images) {
    image.dispose();
  }
}

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

/**
 * Notifies that the window's close button was pressed, the close menu was
 * selected, or the ESCAPE key pressed.
 * <p>
 * The default implementation of this framework method sets the window's
 * return code to <code>CANCEL</code> and closes the window using
 * <code>close</code>. Subclasses may extend or reimplement.
 * </p>
 */
protected void handleShellCloseEvent() {
  setReturnCode(CANCEL);
  close();
}

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

@Override
  public void shellClosed(ShellEvent event) {
    event.doit = false; // don't close now
    if (canHandleShellCloseEvent()) {
      handleShellCloseEvent();
    }
  }
};

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

/**
 * Creates this window's widgetry in a new top-level shell.
 * <p>
 * The default implementation of this framework method creates this window's
 * shell (by calling <code>createShell</code>), and its controls (by
 * calling <code>createContents</code>), then initializes this window's
 * shell bounds (by calling <code>initializeBounds</code>).
 * </p>
 */
public void create() {
  shell = createShell();
  contents = createContents(shell);
  //initialize the bounds of the shell to that appropriate for the
  // contents
  initializeBounds();
}

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

Shell newParent = getParentShell();
if(newParent != null &&  newParent.isDisposed()){
  parentShell = new SameShellProvider(null);
  newParent = getParentShell();//Find a better parent
Shell newShell = new Shell(newParent, getShellStyle());
newShell.addShellListener(getShellListener());
configureShell(newShell);

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

@Override
public int getOrientation(){
  //By default use the orientation in Window
  return Window.getDefaultOrientation();
}

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

shell = null;
  create();
constrainShellSize();
  runEventLoop(shell);

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

/**
 * Attempts to close all windows managed by this window manager,
 * as well as windows managed by any descendent window managers.
 *
 * @return <code>true</code> if all windows were sucessfully closed,
 * and <code>false</code> if any window refused to close
 */
public boolean close() {
  List<Window> t = new ArrayList<>(windows); // make iteration robust
  Iterator<Window> e = t.iterator();
  while (e.hasNext()) {
    Window window = e.next();
    boolean closed = window.close();
    if (!closed) {
      return false;
    }
  }
  if (subManagers != null) {
    Iterator<WindowManager> i = subManagers.iterator();
    while (i.hasNext()) {
      WindowManager wm = i.next();
      boolean closed = wm.close();
      if (!closed) {
        return false;
      }
    }
  }
  return true;
}

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

Image[] defaultImages = getDefaultImages();
if (defaultImages != null && defaultImages.length > 0) {
  ArrayList nonDisposedImages = new ArrayList(defaultImages.length);
Layout layout = getLayout();
if (layout != null) {
  newShell.setLayout(layout);

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

public void handleEvent( Event event ) {
  if( TextSizeUtil.isTemporaryResize() ) {
   temporaryResize = true;
  } else if( temporaryResize ) {
   shell.removeListener( SWT.Resize, this );
   initializeBounds();
  } else {
   shell.removeListener( SWT.Resize, this );
  }
 }
} );

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

shell.setImages(Window.getDefaultImages());

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

preferredSize.width, preferredSize.height);
Monitor mon = getClosestMonitor(getShell().getDisplay(), Geometry
    .centerPoint(result));

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

preferredSize.width, preferredSize.height);
Monitor mon = Util.getClosestMonitor(getShell().getDisplay(), Geometry
    .centerPoint(result));

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

dialog.close();
  dialog = null;
      list, getTitle());
dialog.open();

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

/**
 * Extends the super implementation by creating the trim widgets using <code>createTrimWidgets</code>.
 */
@Override
protected void configureShell(Shell shell) {
  super.configureShell(shell);
  createTrimWidgets(shell);
}

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

@Override
public void create() {
  super.create();
  applyDialogFont(buttonBar);
}

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

@Override
protected boolean canHandleShellCloseEvent() {
  return super.canHandleShellCloseEvent() && !operationInProgress;
}

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

Shell newParent = getParentShell();
if(newParent != null &&  newParent.isDisposed()){
  parentShell = new SameShellProvider(null);
  newParent = getParentShell();//Find a better parent
Shell newShell = new Shell(newParent, getShellStyle());
newShell.addShellListener(getShellListener());
configureShell(newShell);

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

public int getOrientation() {
    return Window.getDefaultOrientation();
  }
}

相关文章