public void run() { isDeactivateListenerActive = false; Tracker tracker = new Tracker(rootControl.getDisplay(), SWT.NONE); tracker.setStippled(true); Rectangle[] r = new Rectangle[] { fFilterText.getShell().getBounds() }; tracker.setRectangles(r); if (tracker.open()) { rootControl.setBounds(tracker.getRectangles()[0]); if (fBounds != null && restoresLocation()) { IPreferenceStore store = getStore(); store.setValue(ThemeConstants.PART_LIST_LOCATION_X, fBounds.x); store.setValue(ThemeConstants.PART_LIST_LOCATION_Y, fBounds.y); } } isDeactivateListenerActive = true; }
/** * Perform the requested tracker action (resize or move). * * @param style * The track style (resize or move). */ private void performTrackerAction(int style) { Shell shell = getShell(); if (shell == null || shell.isDisposed()) { return; } Tracker tracker = new Tracker(shell.getDisplay(), style); tracker.setStippled(true); Rectangle[] r = new Rectangle[] { shell.getBounds() }; tracker.setRectangles(r); // Ignore any deactivate events caused by opening the tracker. // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=120656 boolean oldListenToDeactivate = listenToDeactivate; listenToDeactivate = false; if (tracker.open()) { if (!shell.isDisposed()) { shell.setBounds(tracker.getRectangles()[0]); } } tracker.dispose(); listenToDeactivate = oldListenToDeactivate; }
private void performTrackerAction(int style) { Shell shell = getShell(); if (shell == null || shell.isDisposed()) { return; } Tracker tracker = new Tracker(shell.getDisplay(), style); tracker.setStippled(true); Rectangle[] r = new Rectangle[] { shell.getBounds() }; tracker.setRectangles(r); if (tracker.open()) { if (!shell.isDisposed()) { shell.setBounds(tracker.getRectangles()[0]); } } tracker.dispose(); }
/** * Swaps two tabs and corresponding notes when a user drags one to another. */ private void addSwapTabListener() { tabFolder.addDragDetectListener(new DragDetectListener() { @Override public void dragDetected(DragDetectEvent dragDetectedEvent) { final Rectangle viewRectangle = Geometry.toDisplay(tabFolder.getParent(), tabFolder.getBounds()); final Tracker tracker = new Tracker(tabFolder, SWT.NONE); tracker.setStippled(true); tracker.addListener(SWT.Move, new Listener() { @Override public void handleEvent(Event event) { Point location = new Point(event.x - viewRectangle.x, event.y - viewRectangle.y); CTabItem tabAtLocation = tabFolder.getItem(location); if (tabAtLocation != null) { // Move tracker to follow mouse cursor. tracker.setRectangles(new Rectangle[] { tabAtLocation.getBounds() }); } else { // Mouse cursor no longer above any tab in the action bar, hide tacker. tracker.setRectangles(new Rectangle[0]); } } }); if (tracker.open()) { Rectangle[] rectangles = tracker.getRectangles(); if (rectangles.length > 0) { CTabItem tabToSwap = tabFolder.getItem(new Point(rectangles[0].x, rectangles[0].y)); // Swap selected tab with the one situated at the mouse cursor's position. if (tabToSwap != null) { swapNoteTabs(tabFolder.indexOf(tabToSwap)); } } } tracker.close(); tracker.dispose(); } }); }
public void run() { Tracker tracker = new Tracker(rootControl.getDisplay(), SWT.RESIZE); tracker.setStippled(true); Rectangle[] r = new Rectangle[] { fFilterText.getShell().getBounds() }; tracker.setRectangles(r); isDeactivateListenerActive = false; if (tracker.open()) { Rectangle rectangle = tracker.getRectangles()[0]; rootControl.setBounds(rectangle); setInput(rectangle); } isDeactivateListenerActive = true; }
public void run() { final Tracker tracker = new Tracker(FlyoutPaletteComposite.this, SWT.RIGHT | SWT.LEFT); Rectangle[] rects = new Rectangle[1]; rects[0] = sash.getBounds(); tracker.setCursor(SharedCursors.SIZEE); tracker.setRectangles(rects); if (tracker.open()) { int deltaX = sash.getBounds().x - tracker.getRectangles()[0].x; if (dock == PositionConstants.WEST) deltaX = -deltaX; setPaletteWidth(paletteContainer.getBounds().width + deltaX); } tracker.dispose(); }