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 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; } } });
window.setY(bounds.y); window.setWidth(bounds.width); window.setHeight(bounds.height);
private void attach() { dragElement.getParent().getChildren().remove(dragElement); ((Shell) baseWindow.getWidget()).getDisplay().update(); dragWindow = MBasicFactory.INSTANCE.createWindow(); dragWindow.getTags().add(DragHostId); // define the initial location and size for the window Point cp = ((Shell) baseWindow.getWidget()).getDisplay() .getCursorLocation(); Point size = new Point(200, 200); if (dragElement.getWidget() instanceof Control) { Control ctrl = (Control) dragElement.getWidget(); size = ctrl.getSize(); } else if (dragElement.getWidget() instanceof ToolItem) { ToolItem ti = (ToolItem) dragElement.getWidget(); Rectangle bounds = ti.getBounds(); size = new Point(bounds.width + 3, bounds.height + 3); } dragWindow.setX(cp.x + xOffset); dragWindow.setY(cp.y + yOffset); dragWindow.setWidth(size.x); dragWindow.setHeight(size.y); // add the window as a child of the base window baseWindow.getWindows().add(dragWindow); getShell().layout(getShell().getChildren(), SWT.CHANGED | SWT.DEFER); getShell().setVisible(true); }
private void attach() { dragElement.getParent().getChildren().remove(dragElement); ((Shell) baseWindow.getWidget()).getDisplay().update(); dragWindow = MBasicFactory.INSTANCE.createWindow(); dragWindow.getTags().add(DragHostId); formatModel(dragWindow); // define the initial location and size for the window Point cp = ((Shell) baseWindow.getWidget()).getDisplay() .getCursorLocation(); Point size = new Point(200, 200); if (dragElement.getWidget() instanceof Control) { Control ctrl = (Control) dragElement.getWidget(); size = ctrl.getSize(); } else if (dragElement.getWidget() instanceof ToolItem) { ToolItem ti = (ToolItem) dragElement.getWidget(); Rectangle bounds = ti.getBounds(); size = new Point(bounds.width + 3, bounds.height + 3); } dragWindow.setX(cp.x + xOffset); dragWindow.setY(cp.y + yOffset); dragWindow.setWidth(size.x); dragWindow.setHeight(size.y); // add the window as a child of the base window baseWindow.getWindows().add(dragWindow); getShell().layout(getShell().getChildren(), SWT.CHANGED | SWT.DEFER); getShell().setVisible(true); }