Java Code Examples for org.eclipse.gef.commands.UnexecutableCommand#INSTANCE
The following examples show how to use
org.eclipse.gef.commands.UnexecutableCommand#INSTANCE .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StateCompartmentCreationEditPolicy.java From statecharts with Eclipse Public License 1.0 | 6 votes |
@Override protected Command getCreateCommand(CreateViewRequest request) { StateEditPart parent = (StateEditPart) getHost().getParent(); BooleanValueStyle isInline = GMFNotationUtil.getBooleanValueStyle(parent.getNotationView(), DiagramPartitioningUtil.INLINE_STYLE); if (isInline != null && !isInline.isBooleanValue()) return UnexecutableCommand.INSTANCE; List<? extends ViewDescriptor> viewDescriptors = request.getViewDescriptors(); for (ViewDescriptor viewDescriptor : viewDescriptors) { String semanticHint = viewDescriptor.getSemanticHint(); if (ViewType.NOTE.equals(semanticHint) || ViewType.NOTEATTACHMENT.equals(semanticHint) || ViewType.TEXT.equals(semanticHint)) { return UnexecutableCommand.INSTANCE; } } return super.getCreateCommand(request); }
Example 2
Source File: TreeLayoutEditPolicy.java From statecharts with Eclipse Public License 1.0 | 6 votes |
@Override protected Command createChangeConstraintCommand(EditPart child, Object constraint) { if (constraint instanceof TreeLayoutConstraint) { if (((TreeLayoutConstraint) constraint).isRoot()) { return UnexecutableCommand.INSTANCE; } else { return new ICommandProxy(new UpdateAnnotationsOnMoveCommand( getHost().getEditingDomain(), (IGraphicalEditPart) child, (TreeLayoutConstraint) constraint)); } } return super.createChangeConstraintCommand(child, constraint); }
Example 3
Source File: ReportFlowLayoutEditPolicy.java From birt with Eclipse Public License 1.0 | 6 votes |
protected Command createMoveChildCommand( EditPart child, EditPart after ) { Object afterModel = null; if ( after != null ) { afterModel = after.getModel( ); } if(child.getParent( ).getModel( ) instanceof ReportItemHandle) { ReportItemHandle reportHandle = (ReportItemHandle)child.getParent( ).getModel( ); if(reportHandle.getViews( ).contains( child.getModel( ) )) { return UnexecutableCommand.INSTANCE; } } FlowMoveChildCommand command = new FlowMoveChildCommand( child.getModel( ), afterModel, child.getParent( ).getModel( ) ); return command; }
Example 4
Source File: CompartmentCreationEditPolicy.java From statecharts with Eclipse Public License 1.0 | 5 votes |
@Override protected Command getReparentCommand(ChangeBoundsRequest request) { if (!isValidSelection(request.getEditParts())) { return UnexecutableCommand.INSTANCE; } return super.getReparentCommand(request); }
Example 5
Source File: CrosstavCellDragHandle.java From birt with Eclipse Public License 1.0 | 5 votes |
protected DragTracker createDragTracker( ) { CrosstabHandleAdapter adapter = ((CrosstabTableEditPart)getOwner( ).getParent( )).getCrosstabHandleAdapter( ); if (cursorDirection == PositionConstants.EAST && (adapter.getColumnOprationCell( start )!=null||adapter.getColumnOprationCell( end )!=null)) { return new CrosstabColumnDragTracker(getOwner( ), start, end); } if (cursorDirection == PositionConstants.SOUTH && adapter.getRowOprationCell( start ) != null) { return new CrosstabRowDragTracker(getOwner( ), start, end); } //return null; return new ResizeTracker( getOwner( ), cursorDirection ) { protected void showTargetFeedback() { } protected void eraseTargetFeedback() { } protected void showSourceFeedback( ) { } protected void eraseSourceFeedback( ) { } protected Command getCommand( ) { return UnexecutableCommand.INSTANCE; } }; }
Example 6
Source File: VirtualCrosstabCellFlowLayoutEditPolicy.java From birt with Eclipse Public License 1.0 | 5 votes |
protected Command createAddCommand( EditPart parent, EditPart child, EditPart after ) { Object parentObj = parent.getModel( ); // Object source = child.getModel( ); Object afterObj = after == null ? null : after.getModel( ); Object childParent = getOperator( child ).getModel( ); if ( parentObj instanceof VirtualCrosstabCellAdapter && childParent instanceof CrosstabCellAdapter ) { CrosstabCellAdapter childAdapter = (CrosstabCellAdapter) childParent; VirtualCrosstabCellAdapter parentAdapter = (VirtualCrosstabCellAdapter) parentObj; if ( parentAdapter.getType( ) == VirtualCrosstabCellAdapter.IMMACULATE_TYPE || parentAdapter.getType( ) == VirtualCrosstabCellAdapter.MEASURE_TYPE ) { return UnexecutableCommand.INSTANCE; } if ( ICrosstabCellAdapterFactory.CELL_FIRST_LEVEL_HANDLE.equals( childAdapter.getPositionType( ) ) ) { if ( !( after instanceof FirstLevelHandleDataItemEditPart ) ) { afterObj = null; } if ( parent.getParent( ) == getOperator( child ).getParent( ) ) { ChangeAreaCommand command = new ChangeAreaCommand( parentAdapter.getDesignElementHandle( ), childAdapter.getDesignElementHandle( ), DNDUtil.unwrapToModel( afterObj ) ); command.setType( parentAdapter.getType( ) ); return command; } else { return UnexecutableCommand.INSTANCE; } } } return UnexecutableCommand.INSTANCE; }
Example 7
Source File: EditorDragGuidePolicy.java From birt with Eclipse Public License 1.0 | 5 votes |
public Command getCommand( Request request ) { Command cmd; final ChangeBoundsRequest req = (ChangeBoundsRequest) request; if ( isDeleteRequest( req ) ) { cmd = getGuideEditPart( ).getRulerProvider( ) .getDeleteGuideCommand( getHost( ).getModel( ) ); } else { int pDelta; if ( getGuideEditPart( ).isHorizontal( ) ) { pDelta = req.getMoveDelta( ).y; } else { pDelta = req.getMoveDelta( ).x; } if ( isMoveValid( getGuideEditPart( ).getZoomedPosition( ) + pDelta ) ) { ZoomManager zoomManager = getGuideEditPart( ).getZoomManager( ); if ( zoomManager != null ) { pDelta = (int) Math.round( pDelta / zoomManager.getZoom( ) ); } cmd = getGuideEditPart( ).getRulerProvider( ) .getMoveGuideCommand( getHost( ).getModel( ), pDelta ); } else { cmd = UnexecutableCommand.INSTANCE; } } return cmd; }
Example 8
Source File: TableCellDragHandle.java From birt with Eclipse Public License 1.0 | 5 votes |
protected DragTracker createDragTracker( ) { if (cursorDirection == PositionConstants.EAST ) { return new ColumnDragTracker(getOwner( ).getParent( ), start, end); } if (cursorDirection == PositionConstants.SOUTH) { return new RowDragTracker(getOwner( ).getParent( ), start, end); } //return null; return new ResizeTracker( getOwner( ), cursorDirection ) { protected void showTargetFeedback() { } protected void eraseTargetFeedback() { } protected void showSourceFeedback( ) { } protected void eraseSourceFeedback( ) { } protected Command getCommand( ) { return UnexecutableCommand.INSTANCE; } }; }
Example 9
Source File: ReportFlowLayoutEditPolicy.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * @param parent * @param child * @param insertionReference * @return command */ protected Command createAddCommand( EditPart parent, EditPart child, EditPart insertionReference ) { Object parentModel = null; if ( parent.getModel( ) instanceof ListBandProxy ) { parentModel = ( (ListBandProxy) parent.getModel( ) ).getSlotHandle( ); } else { parentModel = parent.getModel( ); } if ( !( child.getModel( ) instanceof DesignElementHandle ) ) { return UnexecutableCommand.INSTANCE; } if (insertionReference != null && !(insertionReference.getModel( ) instanceof DesignElementHandle)) { return UnexecutableCommand.INSTANCE; } return new PasteCommand( (DesignElementHandle) child.getModel( ), parentModel, insertionReference == null ? null : (DesignElementHandle) insertionReference.getModel( ), false ); }
Example 10
Source File: CustomNonResizableLabelEditPolicy.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Override protected Command getMoveCommand(final ChangeBoundsRequest request) { if (moveNotAllowed(request)) { return UnexecutableCommand.INSTANCE; } return super.getMoveCommand(request); }
Example 11
Source File: CustomMainProcessItemSemanticEditPolicy.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Override protected Command getCreateCommand(CreateElementRequest req) { /* * Allow to create only Pool and EventSubProcessPool on the "background" * */ IElementType elementType = req.getElementType(); if (ProcessElementTypes.Pool_2007 == elementType) { return getGEFWrapper(new PoolCreateCommand(req)); } return UnexecutableCommand.INSTANCE; }
Example 12
Source File: CustomDragDropEditPolicy.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Override protected Command getDropCommand(final ChangeBoundsRequest request) { if(dropNotAllowed(request)){ return UnexecutableCommand.INSTANCE; } return super.getDropCommand(request); }
Example 13
Source File: ColorAndFontPropertySection.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
protected Command getCommand(Request request) { List operationSet = getInput(); Iterator editParts = operationSet.iterator(); CompoundCommand command = new CompoundCommand("Change Font"); while (editParts.hasNext()) { EditPart editPart = (EditPart) editParts.next(); Command curCommand = editPart.getCommand(request); if (curCommand != null) { command.add(curCommand); } } return command.isEmpty() || command.size() != operationSet.size() ? UnexecutableCommand.INSTANCE : (Command) command; }
Example 14
Source File: ProcessBaseItemSemanticEditPolicy.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
/** * @generated */ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) { return UnexecutableCommand.INSTANCE; }
Example 15
Source File: CrossflowBaseItemSemanticEditPolicy.java From scava with Eclipse Public License 2.0 | 4 votes |
/** * @generated */ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) { return UnexecutableCommand.INSTANCE; }
Example 16
Source File: ProcessBaseItemSemanticEditPolicy.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
/** * @generated */ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) { return UnexecutableCommand.INSTANCE; }
Example 17
Source File: CustomCreationEditPolicy.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
@Override protected Command getReparentCommand(final ChangeBoundsRequest request) { final CompoundCommand cc = new CompoundCommand(); if(getHost() instanceof ITextAwareEditPart){ return UnexecutableCommand.INSTANCE; } if(request.getExtendedData().get("DELETE_FROM_LANE") != null){ return super.getReparentCommand(request); } if(getHost() instanceof CustomPoolCompartmentEditPart && request.getEditParts().get(0) != null && ((EditPart) request.getEditParts().get(0)).getParent() instanceof CustomLaneCompartmentEditPart){ return UnexecutableCommand.INSTANCE; } if(getHost() instanceof CustomSubprocessEventCompartmentEditPart && request.getEditParts().get(0) != null){ for(final Object child : request.getEditParts()){ if(child instanceof IGraphicalEditPart){ if(!((IGraphicalEditPart) child).getTargetConnections().isEmpty() || !((IGraphicalEditPart) child).getSourceConnections().isEmpty()){ return UnexecutableCommand.INSTANCE; } else { if (child instanceof StartTimerEvent2EditPart && !(((IGraphicalEditPart) child).getParent() instanceof CustomSubprocessEventCompartmentEditPart) && !((IGraphicalEditPart)child).getParent().equals(getHost())){ final Command editCommand = editTimerEventValue((IGraphicalEditPart)child); if (editCommand.canExecute()){ cc.add(editCommand); } } } } } } if(getHost() instanceof CustomSubProcessEvent2EditPart){ return UnexecutableCommand.INSTANCE; } if(getHost() instanceof CustomLaneEditPart){ if( request.getLocation() != null){ return UnexecutableCommand.INSTANCE; } } cc.add(super.getReparentCommand(request)); return cc; }
Example 18
Source File: CrossflowBaseItemSemanticEditPolicy.java From scava with Eclipse Public License 2.0 | 4 votes |
/** * @generated */ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) { return UnexecutableCommand.INSTANCE; }