/** * 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()); } }
private void uninitializeImages() { WorkbenchImages.dispose(); Image[] images = Window.getDefaultImages(); Window.setDefaultImage(null); for (Image image : images) { image.dispose(); } }
/** * 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(); }
@Override public void shellClosed(ShellEvent event) { event.doit = false; // don't close now if (canHandleShellCloseEvent()) { handleShellCloseEvent(); } } };
/** * 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(); }
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);
@Override public int getOrientation(){ //By default use the orientation in Window return Window.getDefaultOrientation(); }
shell = null; create(); constrainShellSize(); runEventLoop(shell);
/** * 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; }
Image[] defaultImages = getDefaultImages(); if (defaultImages != null && defaultImages.length > 0) { ArrayList nonDisposedImages = new ArrayList(defaultImages.length); Layout layout = getLayout(); if (layout != null) { newShell.setLayout(layout);
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 ); } } } );
shell.setImages(Window.getDefaultImages());
preferredSize.width, preferredSize.height); Monitor mon = getClosestMonitor(getShell().getDisplay(), Geometry .centerPoint(result));
preferredSize.width, preferredSize.height); Monitor mon = Util.getClosestMonitor(getShell().getDisplay(), Geometry .centerPoint(result));
/** * Extends the super implementation by creating the trim widgets using <code>createTrimWidgets</code>. */ @Override protected void configureShell(Shell shell) { super.configureShell(shell); createTrimWidgets(shell); }
@Override public void create() { super.create(); applyDialogFont(buttonBar); }
@Override protected boolean canHandleShellCloseEvent() { return super.canHandleShellCloseEvent() && !operationInProgress; }
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);
public int getOrientation() { return Window.getDefaultOrientation(); } }