@Override protected void createDefaultEditPolicies() { super.createDefaultEditPolicies(); installEditPolicy(EditPolicy.COMPONENT_ROLE, new TransitionExpressionComponentEditPolicy()); installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new ContextSensitiveHelpPolicy( HelpContextIds.SC_PROPERTIES_TRANSITION_EXPRESSION)); // BUGFIX: // https://code.google.com/a/eclipselabs.org/p/yakindu/issues/detail?id=26 installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableLabelEditPolicy() { @Override protected void replaceHandleDragEditPartsTracker(Handle handle) { if (handle instanceof AbstractHandle) { AbstractHandle h = (AbstractHandle) handle; h.setDragTracker(new DragEditPartsTrackerEx(getHost()) { protected boolean isMove() { return true; }; }); } } }); }
/** * @see org.eclipse.core.runtime.IAdaptable#getAdapter(Class) */ public Object getAdapter(Class key) { if (key == AccessibleHandleProvider.class) return new AccessibleHandleProvider() { public List getAccessibleHandleLocations() { List result = new ArrayList(); if (handles != null) { for (int i = 0; i < handles.size(); i++) { Point p = ((Handle) handles.get(i)) .getAccessibleLocation(); if (p != null) result.add(p); } } return result; } }; return null; }
/** * @see GraphicalViewer#findHandleAt(org.eclipse.draw2d.geometry.Point) */ public Handle findHandleAt(Point p) { LayerManager layermanager = (LayerManager) getEditPartRegistry().get( LayerManager.ID); if (layermanager == null) return null; List list = new ArrayList(3); list.add(layermanager.getLayer(LayerConstants.PRIMARY_LAYER)); list.add(layermanager.getLayer(LayerConstants.CONNECTION_LAYER)); list.add(layermanager.getLayer(LayerConstants.FEEDBACK_LAYER)); IFigure handle = getLightweightSystem().getRootFigure() .findFigureAtExcluding(p.x, p.y, list); if (handle instanceof Handle) return (Handle) handle; return null; }
/** * @see org.eclipse.gef.GraphicalViewer#findHandleAt(org.eclipse.draw2d.geometry.Point) */ public Handle findHandleAt(org.eclipse.draw2d.geometry.Point p) { final GraphicalEditPart gep = (GraphicalEditPart) findObjectAtExcluding( p, new ArrayList()); if (gep == null || !(gep instanceof GuideEditPart)) return null; return new Handle() { public DragTracker getDragTracker() { return ((GuideEditPart) gep).getDragTracker(null); } public org.eclipse.draw2d.geometry.Point getAccessibleLocation() { return null; } }; }
/** * If in the initial state, updates the request and the mouse target and * asks to show target feedback. If in the traverse handle state, finds the * next handle, moves the mouse cursor to that handle, and gets a drag * tracker from the handle. * * @see AbstractTool#handleMove() */ protected boolean handleMove() { if (stateTransition(STATE_ACCESSIBLE_DRAG, STATE_INITIAL)) setDragTracker(null); if (isInState(STATE_INITIAL)) { updateTargetRequest(); updateTargetUnderMouse(); showTargetFeedback(); return true; } else if (isInState(STATE_TRAVERSE_HANDLE)) { EditPartViewer viewer = getCurrentViewer(); if (viewer instanceof GraphicalViewer) { Handle handle = ((GraphicalViewer) viewer) .findHandleAt(getLocation()); if (handle != null) { setState(STATE_ACCESSIBLE_DRAG); setStartLocation(getLocation()); setDragTracker(handle.getDragTracker()); return true; } else { setState(STATE_INITIAL); } } } return false; }
/** * @see GraphicalViewer#findHandleAt(org.eclipse.draw2d.geometry.Point) */ public Handle findHandleAt( Point p ) { LayerManager layermanager = (LayerManager) getEditPartRegistry( ).get( LayerManager.ID ); if ( layermanager == null ) return null; List list = new ArrayList( 3 ); // list.add(layermanager.getLayer(LayerConstants.PRIMARY_LAYER)); list.add( layermanager.getLayer( LayerConstants.CONNECTION_LAYER ) ); list.add( layermanager.getLayer( LayerConstants.FEEDBACK_LAYER ) ); IFigure handle = getLightweightSystem( ).getRootFigure( ) .findFigureAtExcluding( p.x, p.y, list ); if ( handle instanceof Handle ) return (Handle) handle; return null; }
/** * Updates the target editpart and returns <code>true</code> if the target changes. The * target is updated by using the target conditional and the target request. If the * target has been locked, this method does nothing and returns <code>false</code>. * @return <code>true</code> if the target was changed */ // protected EditPart getEditPartUnderMouse() { // // Collection exclude = getExclusionSet(); // EditPart editPart = getCurrentViewer().findObjectAtExcluding( // getLocation(), // exclude, // getTargetingConditional()); // if (editPart != null) // return editPart.getTargetEditPart(getTargetRequest()); // return null; // // } protected Handle getHandleUnderMouse() { return ((DeferredGraphicalViewer)(getSourceEditPart().getViewer())).findHandleAt(getLocation()); }
@Override protected List<Handle> createSelectionHandles() { List<Handle> list = new ArrayList<Handle>(); GraphicalEditPart geditPart = getHost(); list.add(new CellResizeHandle2(geditPart, PositionConstants.SOUTH)); list.add(new CellResizeHandle2(geditPart, PositionConstants.NORTH)); list.add(new CellResizeHandle2(geditPart, PositionConstants.EAST)); list.add(new CellResizeHandle2(geditPart, PositionConstants.WEST)); MoveHandle hand = new CellMoveHandle(geditPart, true, true); list.add(hand); return list; }
@Override protected List<Handle> createSelectionHandles() { List<Handle> list = new ArrayList<Handle>(); GraphicalEditPart geditPart = getHost(); list.add(new CellResizeHandle2(geditPart, PositionConstants.SOUTH)); list.add(new CellResizeHandle2(geditPart, PositionConstants.NORTH)); list.add(new CellResizeHandle2(geditPart, PositionConstants.EAST)); list.add(new CellResizeHandle2(geditPart, PositionConstants.WEST)); MoveHandle hand = new CellMoveHandle(geditPart, true, false, -3); list.add(hand); return list; }
@Override protected List<Handle> createSelectionHandles() { List<Handle> list = new ArrayList<Handle>(); GraphicalEditPart geditPart = getHost(); list.add(new CellResizeHandle(geditPart, PositionConstants.SOUTH)); list.add(new CellResizeHandle(geditPart, PositionConstants.EAST)); return list; }
/** * @see org.eclipse.gef.GraphicalViewer#findHandleAt(org.eclipse.draw2d.geometry.Point) */ public Handle findHandleAt(org.eclipse.draw2d.geometry.Point p) { final GraphicalEditPart gep = (GraphicalEditPart) findObjectAtExcluding(p, new ArrayList<Object>()); if (gep == null || !(gep instanceof GuideEditPart)) return null; return new Handle() { public DragTracker getDragTracker() { return ((GuideEditPart) gep).getDragTracker(null); } public org.eclipse.draw2d.geometry.Point getAccessibleLocation() { return null; } }; }
static Handle createHandle(GraphicalEditPart owner, int direction, DragTracker tracker, Cursor cursor) { ResizeHandle handle = new ResizeHandle(owner, direction); handle.setCursor(cursor); handle.setDragTracker(tracker); return handle; }
static Handle createHandle(GraphicalEditPart owner, int direction, DragTracker tracker, Cursor cursor) { ResizeHandle handle = new ResizeHandle(owner, direction); handle.setDragTracker(tracker); handle.setCursor(cursor); return handle; }
/** * If there is a {@link Handle} under the mouse, this method sets the drag * tracker returned from the handle. If there's an {@link EditPart} under * the mouse, this method sets the drag tracker returned from the edit part. * * @see AbstractTool#handleButtonDown(int) */ protected boolean handleButtonDown(int button) { if (!stateTransition(STATE_INITIAL, STATE_DRAG)) { resetHover(); return true; } resetHover(); EditPartViewer viewer = getCurrentViewer(); Point p = getLocation(); if (getDragTracker() != null) getDragTracker().deactivate(); if (viewer instanceof GraphicalViewer) { Handle handle = ((GraphicalViewer) viewer).findHandleAt(p); if (handle != null) { setDragTracker(handle.getDragTracker()); return true; } } updateTargetRequest(); ((SelectionRequest) getTargetRequest()).setLastButtonPressed(button); updateTargetUnderMouse(); EditPart editpart = getTargetEditPart(); if (editpart != null) { setDragTracker(editpart.getDragTracker(getTargetRequest())); lockTargetEditPart(editpart); return true; } return false; }
/** * @param owner * @return */ static Handle createHandle( CrosstabCellEditPart owner ) { CrosstabTableEditPart part = (CrosstabTableEditPart) owner.getParent( ); Rectangle rect = part.getSelectBounds( ); TableSelectionHandle handle = new TableSelectionHandle( owner, rect ); handle.setCursor( SharedCursors.SIZEALL ); return handle; }
static Handle createHandle( TableCellEditPart owner ) { TableEditPart part = (TableEditPart) owner.getParent( ); Rectangle rect = part.getSelectBounds( ); TableSelectionHandle handle = new TableSelectionHandle( owner, rect ); handle.setCursor( SharedCursors.SIZEALL ); return handle; }
static Handle createHandle( GraphicalEditPart owner, int direction, DragTracker tracker, Cursor cursor ) { ReportResizeHandle handle = new ReportResizeHandle( owner, direction ); handle.setDragTracker( tracker ); handle.setCursor( cursor ); return handle; }
static Handle createHandle( GraphicalEditPart owner, int direction ) { ReportResizeHandle handle = new ReportResizeHandle( owner, direction ); handle.setCursor( SharedCursors.SIZEALL ); handle.setDragTracker( new DragEditPartsTracker( owner ) ); return handle; }
static Handle createHandle( GraphicalEditPart owner, int direction, DragTracker tracker, Cursor cursor ) { ReportResizeHandle handle = new ReportResizeHandle( owner, direction ); handle.setCursor( cursor ); handle.setDragTracker( tracker ); return handle; }
public boolean isDealwithDrag( ) { Handle handle = getHandleUnderMouse( ); if ( handle instanceof ColumnHandle ) { return ( (ColumnHandle) handle ).getOwner( ) == getSourceEditPart( ); } return false; // EditPart part = getEditPartUnderMouse(); // return part instanceof TableEditPart.DummyColumnEditPart || // isSameTable(); }
public boolean isDealwithDrag( ) { Handle handle = getHandleUnderMouse( ); if ( handle instanceof RowHandle ) { return ( (RowHandle) handle ).getOwner( ) == getSourceEditPart( ); } return false; // EditPart part = getEditPartUnderMouse(); // return part instanceof TableEditPart.DummyColumnEditPart || // isSameTable(); }
static Handle createHandle(final GraphicalEditPart owner, final int direction) { final ResizeHandle handle = new ERDiagramResizeHandle(owner, direction); return handle; }
static Handle createHandle(GraphicalEditPart owner, int direction) { ResizeHandle handle = new ERDiagramResizeHandle(owner, direction); return handle; }
@Override protected List<?> createSelectionHandles() { List<?> list = new ArrayList<Handle>(); createMoveHandle(list); return list; }
static Handle createHandle(GraphicalEditPart owner, int direction) { final ResizeHandle handle = new ERDiagramResizeHandle(owner, direction); return handle; }
static Handle createHandle(GraphicalEditPart owner, int direction) { ResizeHandle handle = new ResizeHandle(owner, direction); handle.setCursor(SharedCursors.SIZEALL); handle.setDragTracker(new DragEditPartsTracker(owner)); return handle; }
static Handle createHandle(GraphicalEditPart owner, int direction) { return new ResizeHandle(owner, direction); }
static Handle createColumnHandle( TableEditPart owner ) { TableColumnHandle handle = new TableColumnHandle( owner ); return handle; }
static Handle createRowHandle( TableEditPart owner ) { TableRowHandle handle = new TableRowHandle( owner ); return handle; }
static Handle createHandle( GraphicalEditPart owner, int direction ) { ReportResizeHandle handle = new ReportResizeHandle( owner, direction ); // handle.setDragTracker(new ResizeTracker(direction)); return handle; }
static Handle createHandle(GraphicalEditPart owner, int direction) { ResizeHandle handle = new NodeResizeHandle(owner, direction); return handle; }
/** * createHandle * * @param owner * @param direction * @return Handle */ static Handle createHandle(GraphicalEditPart owner, int direction) { ResizeHandle handle = new SequenceLineResizeHandle(owner, direction); handle.setCursor(SharedCursors.SIZEALL); handle.setDragTracker(new DragEditPartsTracker(owner)); return handle; }
/** * createHandle * * @param owner * @param direction * @param tracker * @param cursor * @return Handle */ static Handle createHandle(GraphicalEditPart owner, int direction, DragTracker tracker, Cursor cursor) { ResizeHandle handle = new SequenceLineResizeHandle(owner, direction); handle.setCursor(cursor); handle.setDragTracker(tracker); return handle; }
/** * createHandle * * @param owner * @param direction * @param tracker * @param cursor * @return Handle */ static Handle createHandle(GraphicalEditPart owner, int direction, DragTracker tracker, Cursor cursor) { SequenceLineResizeHandle handle = new SequenceLineResizeHandle(owner, direction); handle.setDragTracker(tracker); handle.setCursor(cursor); return handle; }
/** * Returns a new {@link MoveHandle} with the given owner. * @param owner the GraphicalEditPart that is the owner of the new MoveHandle * @return the new MoveHandle */ public static Handle moveHandle(GraphicalEditPart owner) { return new SequenceLineMoveHandle(owner); }
/** * createHandle * * @param owner * @param direction * @return Handle */ static Handle createHandle(GraphicalEditPart owner, int direction) { SequenceLineResizeHandle handle = new SequenceLineResizeHandle(owner, direction); // handle.setDragTracker(new ResizeTracker(direction)); return handle; }
/** * Returns a new {@link MoveHandle} with the given owner. * * @param owner * the GraphicalEditPart that is the owner of the new MoveHandle * @return the new MoveHandle */ public static Handle moveHandle(GraphicalEditPart owner) { return new MoveHandle(owner); }