/** * @param curDockLocation2 * @return */ private void showFeedback(int location) { if (location == NOWHERE) return; Rectangle feedbackBounds = null; if (!onEdge) { Rectangle bounds = new Rectangle(ctfBounds.x, ctfBounds.y, ctfBounds.width, ctfBounds.height); // bounds = Display.getCurrent().map(dropCTF.getParent(), null, bounds); feedbackBounds = bounds; } else { Rectangle bounds = new Rectangle(ocBounds.x, ocBounds.y, ocBounds.width, ocBounds.height); feedbackBounds = bounds; } if (feedback != null) feedback.dispose(); int side = 0; if (location == EModelService.ABOVE) { side = SWT.TOP; } else if (location == EModelService.BELOW) { side = SWT.BOTTOM; } else if (location == EModelService.LEFT_OF) { side = SWT.LEFT; } else if (location == EModelService.RIGHT_OF) { side = SWT.RIGHT; } float pct = (float) (onEdge ? 0.34 : 0.50); clearFeedback(); feedback = new SplitFeedbackOverlay( dropCTF.getShell(), feedbackBounds, side, pct, getEnclosed(), getModified()); feedback.setVisible(true); }
@Override public boolean track(MUIElement dragElement, DnDInfo info) { if (!clientBounds.contains(info.cursorPos)) return false; boolean wasOnEdge = onEdge; int dockLocation = getDockLocation(info); if (feedback != null) { feedback.setFeedback(getEnclosed(), getModified()); } if (dockLocation == curDockLocation && wasOnEdge == onEdge) return true; if (dropStack == dragElement && !onEdge) return false; curDockLocation = dockLocation; if (curDockLocation != NOWHERE) { showFeedback(curDockLocation); dndManager.setCursor(Display.getCurrent().getSystemCursor(SWT.CURSOR_HAND)); } else { unDock(dragElement); dndManager.setCursor(Display.getCurrent().getSystemCursor(SWT.CURSOR_NO)); } return true; }
private void clearFeedback() { if (feedback == null) return; feedback.dispose(); feedback = null; }