@Override public void showTargetFeedback(Request request) { // Do not be fooled, the REQ_SELECTION is poorly named // nothing is actually getting selected here, maybe // TimelineTool should change this to reflect something // more accurate (inspect?) if (request.getType() == REQ_SELECTION && request instanceof LocationRequest ) { LocationRequest loc = (LocationRequest) request; Point pt = loc.getLocation().getCopy(); PlanTimelineDataRowEditPart rowData = getRowData(); if (rowData != null) { pt = pt.translate(-rowData.getFigure().getBounds().x, 0); update(pt.x); } } }
@Override public void eraseTargetFeedback(Request request) { super.eraseTargetFeedback(request); if (request instanceof LocationRequest && tooltipShell != null && !tooltipShell.isDisposed()) { Timeline activeEditPart = TimelineUtils.getTimeline(this); if (activeEditPart != null) { EditDomain editDomain = activeEditPart.getEditDomain(); Tool tool = editDomain.getActiveTool(); if(tool instanceof TimelineTool) { TimelineTool timelineTool = (TimelineTool)tool; if(timelineTool != null && timelineTool.getTargetUnderMouse() != null && !timelineTool.getTargetUnderMouse().equals(this.getHost())) { tooltipShell.dispose(); tooltipShell = null; } } } } }
/** * When asked to show target feedback, figure out where to display the tooltip. * Next, get the tooltip (maybe a new one will need to be created), and display * it at the calculated location. * * @param request the request */ @Override public void showTargetFeedback(Request request) { if (understandsRequest(request)) { if (request instanceof LocationRequest) { LocationRequest locationRequest = (LocationRequest)request; Point location = locationRequest.getLocation(); GraphicalEditPart host = (GraphicalEditPart)getHost(); TOOLTIP_SHELL_MANAGER.display(host, location); } } }
/** * Creates the hover request (a {@link LocationRequest}) and sets its type * to {@link RequestConstants#REQ_SELECTION_HOVER}. */ protected void createHoverRequest() { hoverRequest = new LocationRequest(); hoverRequest.setType(RequestConstants.REQ_SELECTION_HOVER); }
/** * Updates the location of the hover request. */ protected void updateHoverRequest() { LocationRequest request = (LocationRequest) getTargetHoverRequest(); request.setLocation(getLocation()); }