public WindowProperty( Shell shell ) { name = shell.getText(); maximized = shell.getMaximized(); rectangle = shell.getBounds(); }
@Override public boolean matches( Widget widget ) { return ( ( Shell )widget ).getMaximized(); } } );
public void controlMoved(ControlEvent e) { if (!shell.getMaximized()) { Point location = shell.getLocation(); x = location.x; y = location.y; } } public void controlResized(ControlEvent e) {
public void controlResized(ControlEvent e) { if (!shell.getMaximized()) { Point size = shell.getSize(); w = size.x; h = size.y; } } });
public void controlResized(ControlEvent e) { if (!shell.getMaximized()) { Point size = shell.getSize(); w = size.x; h = size.y; } } });
public void controlMoved(ControlEvent e) { if (!shell.getMaximized()) { Point location = shell.getLocation(); x = location.x; y = location.y; } } public void controlResized(ControlEvent e) {
private int calcState(Shell shell) { return shell.getMinimized() ? SWT.MIN : shell.getMaximized() ? SWT.MAX : SWT.NONE; }
@Override public void handleEvent(Event event) { Shell shell = Utils.getActiveShell(); if (shell == null || shell.isDisposed()) { event.doit = false; return; } shell.setMaximized(!shell.getMaximized()); } });
public void widgetDisposed(DisposeEvent e) { // save position store.setValue(BROWSER_X, Integer.toString(x)); store.setValue(BROWSER_Y, Integer.toString(y)); store.setValue(BROWSER_WIDTH, Integer.toString(w)); store.setValue(BROWSER_HEIGTH, Integer.toString(h)); store.setValue(BROWSER_MAXIMIZED, (new Boolean(shell .getMaximized()).toString())); notifyCloseListners(); } });
private static String getMode( final Shell shell ) { String result = null; if( shell.getMinimized() ) { result = "minimized"; } else if( shell.getMaximized() || shell.getFullScreen() ) { result = "maximized"; } return result; }
private void bringToFront(final Shell shell) { showDesktop(); //minimize all the application Thread.sleep(5000); // here have to wait for some time, I am not sure why shell.getDisplay().asyncExec(new Runnable() { public void run() { if(!shell.getMaximized()){ shell.setMaximized(true); } shell.forceActive(); } }); }
private static String getMode( Shell shell ) { String result = null; if( shell.getMinimized() ) { result = "minimized"; } else if( shell.getFullScreen() ) { result = "fullscreen"; } else if( shell.getMaximized() ) { result = "maximized"; } return result; }
public void widgetDisposed(DisposeEvent e) { Shell shell = (Shell) e.widget; if (disposeME != null) { disposeME.getTags().remove(ShellMinimizedTag); disposeME.getTags().remove(ShellMaximizedTag); if (shell.getMinimized()) disposeME.getTags().add(ShellMinimizedTag); if (shell.getMaximized()) disposeME.getTags().add(ShellMaximizedTag); } } });
public void controlResized(ControlEvent e) { // Don't store the maximized size in the model if (shell.getMaximized()) return; try { ignoreSizeChanges = true; w.setWidth(shell.getSize().x); w.setHeight(shell.getSize().y); } finally { ignoreSizeChanges = false; } }
public void controlMoved(ControlEvent e) { // Don't store the maximized size in the model if (shell.getMaximized()) return; try { ignoreSizeChanges = true; w.setX(shell.getLocation().x); w.setY(shell.getLocation().y); } finally { ignoreSizeChanges = false; } } });
@Override public void controlResized(ControlEvent e) { // Don't store the maximized size in the model if (shell.getMaximized()) { return; } try { ignoreSizeChanges = true; w.setWidth(shell.getSize().x); w.setHeight(shell.getSize().y); } finally { ignoreSizeChanges = false; } }
@Override public void controlMoved(ControlEvent e) { // Don't store the maximized size in the model if (shell.getMaximized()) { return; } try { ignoreSizeChanges = true; w.setX(shell.getLocation().x); w.setY(shell.getLocation().y); } finally { ignoreSizeChanges = false; } } });
public static void main(String[] args) { final Display display = new Display(); final Shell shell = new Shell(display); shell.setLayout(new FillLayout()); shell.setText("StackOverflow"); shell.addListener(SWT.Resize, new Listener() { @Override public void handleEvent(Event arg0) { if(shell.getMaximized()) System.out.println("Maximize"); } }); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
@Override public void handleEvent(Event event) { Shell shell = Utils.getActiveShell(); if ( shell == null || shell.isDisposed() || item.isDisposed()) { return; } if (!Constants.isOSX) { if (shell.getMaximized()) { Messages.setLanguageText(item, MENU_ID_WINDOW_ZOOM_RESTORE); } else { Messages.setLanguageText(item, MENU_ID_WINDOW_ZOOM_MAXIMIZE); } } if (((shell.getStyle() & SWT.MAX) != 0)) { item.setEnabled(!shell.getMinimized()); } else { item.setEnabled(false); } } };
public void readData( Display display ) { readBounds( display ); readCursorLocation( display ); readFocusControl( display ); ActiveKeysUtil.readKeyEvents( display ); WidgetTreeVisitor visitor = new AllWidgetTreeVisitor() { public boolean doVisit( final Widget widget ) { IWidgetLifeCycleAdapter adapter = WidgetUtil.getLCA( widget ); adapter.readData( widget ); return true; } }; Shell[] shells = getShells( display ); for( int i = 0; i < shells.length; i++ ) { Composite shell = shells[ i ]; WidgetTreeVisitor.accept( shell, visitor ); } for( int i = 0; i < shells.length; i++ ) { if( shells[ i ].getMaximized() || shells[ i ].getFullScreen() ) { Object adapter = shells[ i ].getAdapter( IShellAdapter.class ); IShellAdapter shellAdapter = ( IShellAdapter )adapter; shellAdapter.setBounds( display.getBounds() ); } } DNDSupport.processEvents(); }