org.eclipse.gef.requests.GroupRequest Java Examples

The following examples show how to use org.eclipse.gef.requests.GroupRequest. 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: NotElementComponentEditPolicy.java    From ermaster-b with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected Command createDeleteCommand(GroupRequest request) {
	if (this.getHost() instanceof DeleteableEditPart) {
		DeleteableEditPart editPart = (DeleteableEditPart) this.getHost();

		if (!editPart.isDeleteable()) {
			return null;
		}

	} else {
		return null;
	}

	ERDiagram diagram = (ERDiagram) this.getHost().getRoot().getContents()
			.getModel();

	return this.createDeleteCommand(diagram, this.getHost().getModel());
}
 
Example #2
Source File: NotElementComponentEditPolicy.java    From ermasterr with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected Command createDeleteCommand(final GroupRequest request) {
    if (getHost() instanceof DeleteableEditPart) {
        final DeleteableEditPart editPart = (DeleteableEditPart) getHost();

        if (!editPart.isDeleteable()) {
            return null;
        }

    } else {
        return null;
    }

    final ERDiagram diagram = (ERDiagram) getHost().getRoot().getContents().getModel();

    return this.createDeleteCommand(diagram, getHost().getModel());
}
 
Example #3
Source File: CrosstabCellEditPart.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
protected void createEditPolicies( )
{
	installEditPolicy( EditPolicy.COMPONENT_ROLE,
			new ReportComponentEditPolicy( ) {

				protected org.eclipse.gef.commands.Command createDeleteCommand(
						GroupRequest deleteRequest )
				{
					return UnexecutableCommand.INSTANCE;
				}

				protected Command getOrphanCommand( )
				{
					return new Command( ) {

					};
				}
			} );
	installEditPolicy( EditPolicy.LAYOUT_ROLE,
			new CrosstabCellFlowLayoutEditPolicy( ) );
	installEditPolicy( EditPolicy.CONTAINER_ROLE,
			new CrosstabCellContainerEditPolicy( ) );

}
 
Example #4
Source File: FirstLevelHandleDataItemEditPart.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
protected void createEditPolicies( )
{
	installEditPolicy( EditPolicy.COMPONENT_ROLE,
			new ReportComponentEditPolicy( ) 
	{
		protected org.eclipse.gef.commands.Command createDeleteCommand(
				GroupRequest deleteRequest )
		{
			//Object model =  ((EditPart) parts.get( i ) ).getModel( ) ;
			Object parent = this.getHost( ).getParent( ).getModel( ) ;
			if (parent instanceof CrosstabCellAdapter)
			{
				if (ICrosstabCellAdapterFactory.CELL_FIRST_LEVEL_HANDLE.equals( 
						((CrosstabCellAdapter)parent).getPositionType( ))
						||ICrosstabCellAdapterFactory.CELL_MEASURE.equals( 
								((CrosstabCellAdapter)parent).getPositionType( )) )
				{
					return new Command(){};
				}
			}
			DeleteCommand command = new DeleteCommand( this.getHost( ).getModel( ) );
			return command;
		}
	});

	installEditPolicy( EditPolicy.DIRECT_EDIT_ROLE,
			new LabelDirectEditPolicy( ) );
}
 
Example #5
Source File: CommentConnectionEditPolicy.java    From ermaster-b with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected Command getDeleteCommand(GroupRequest grouprequest) {
	ConnectionElement connection = (ConnectionElement) this.getHost()
			.getModel();

	return new DeleteConnectionCommand(connection);
}
 
Example #6
Source File: ProcessPart.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
@Override
protected void createEditPolicies() {
	installEditPolicy(EditPolicy.LAYOUT_ROLE, new LayoutPolicy());
	installEditPolicy(EditPolicy.COMPONENT_ROLE, new ComponentEditPolicy() {
		@Override
		protected Command createDeleteCommand(GroupRequest deleteRequest) {
			return new DeleteProcessCommand(getModel());
		}
	});
}
 
Example #7
Source File: LinkPart.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
@Override
protected void createEditPolicies() {
	installEditPolicy(EditPolicy.CONNECTION_ENDPOINTS_ROLE, new ConnectionEndpointEditPolicy());
	installEditPolicy(EditPolicy.CONNECTION_ROLE, new ConnectionEditPolicy() {
		@Override
		protected Command getDeleteCommand(GroupRequest arg0) {
			return new DeleteLinkCommand(getModel());
		}
	});
}
 
Example #8
Source File: ReportContainerEditPolicy.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public Command getOrphanChildrenCommand( GroupRequest request )
{
	List parts = request.getEditParts( );
	CompoundCommand result = new CompoundCommand( "Move in layout" );//$NON-NLS-1$
	for ( int i = 0; i < parts.size( ); i++ )
	{
		DeleteCommand command = new DeleteCommand( ( (EditPart) parts.get( i ) ).getModel( ) );
		command.setClear( false );
		result.add( command );
	}
	return result.unwrap( );
}
 
Example #9
Source File: TableEditPart.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
protected void createEditPolicies( )
{
	ReportComponentEditPolicy policy = new ReportComponentEditPolicy( ) {

		protected org.eclipse.gef.commands.Command createDeleteCommand(
				GroupRequest deleteRequest )
		{
			DeleteRowCommand command = new DeleteRowCommand( getModel( ) );
			return command;
		}
	};
	installEditPolicy( EditPolicy.COMPONENT_ROLE, policy );
}
 
Example #10
Source File: TableEditPart.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
protected void createEditPolicies( )
{

	ReportComponentEditPolicy policy = new ReportComponentEditPolicy( ) {

		protected org.eclipse.gef.commands.Command createDeleteCommand(
				GroupRequest deleteRequest )
		{
			DeleteColumnCommand command = new DeleteColumnCommand( getModel( ) );
			return command;
		}
	};
	installEditPolicy( EditPolicy.COMPONENT_ROLE, policy );
}
 
Example #11
Source File: NotElementComponentEditPolicy.java    From erflute with Apache License 2.0 5 votes vote down vote up
@Override
protected Command createDeleteCommand(GroupRequest request) {
    if (getHost() instanceof DeleteableEditPart) {
        final DeleteableEditPart editPart = (DeleteableEditPart) getHost();
        if (!editPart.isDeleteable()) {
            return null;
        }
    } else {
        return null;
    }

    final ERDiagram diagram = (ERDiagram) getHost().getRoot().getContents().getModel();

    return createDeleteCommand(diagram, getHost().getModel());
}
 
Example #12
Source File: TransitionExpressionComponentEditPolicy.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected Command createDeleteSemanticCommand(GroupRequest deleteRequest) {
	SetRequest request = new SetRequest(getHost().resolveSemanticElement(),
			SGraphPackage.Literals.SPECIFICATION_ELEMENT__SPECIFICATION,
			null);
	SetValueCommand result = new SetValueCommand(request);
	return new ICommandProxy(result);
}
 
Example #13
Source File: StateEditPart.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Delegates all {@link CreateViewAndElementRequest}s to the figure compartment.
 */
@Override
public EditPart getTargetEditPart(Request request) {
	if (request instanceof CreateViewAndElementRequest) {
		return figureCompartmentEditPart;
	}
	if (request instanceof GroupRequest && request.getType() == RequestConstants.REQ_DROP) {
		GroupRequest req = (GroupRequest) request;
		if (areInsertableChildren(req.getEditParts())) {
			return figureCompartmentEditPart;
		}
	}

	return super.getTargetEditPart(request);
}
 
Example #14
Source File: CommentConnectionEditPolicy.java    From ermasterr with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected Command getDeleteCommand(final GroupRequest grouprequest) {
    final ConnectionElement connection = (ConnectionElement) getHost().getModel();

    return new DeleteConnectionCommand(connection);
}
 
Example #15
Source File: RelationEditPolicy.java    From ermasterr with Apache License 2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected Command getDeleteCommand(final GroupRequest grouprequest) {
    final Relation relation = (Relation) getHost().getModel();
    return new DeleteRelationCommand(relation, null);
}
 
Example #16
Source File: ReportComponentEditPolicy.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
protected org.eclipse.gef.commands.Command createDeleteCommand(
		GroupRequest deleteRequest )
{
	DeleteCommand command = new DeleteCommand( this.getHost( ).getModel( ) );
	return command;
}
 
Example #17
Source File: CommentConnectionEditPolicy.java    From erflute with Apache License 2.0 4 votes vote down vote up
@Override
protected Command getDeleteCommand(GroupRequest grouprequest) {
    final WalkerConnection connection = (WalkerConnection) getHost().getModel();

    return new DeleteConnectionCommand(connection);
}
 
Example #18
Source File: RelationEditPolicy.java    From erflute with Apache License 2.0 4 votes vote down vote up
@Override
protected Command getDeleteCommand(GroupRequest grouprequest) {
    final Relationship relation = (Relationship) getHost().getModel();
    return new DeleteRelationshipCommand(relation, null);
}
 
Example #19
Source File: RelationEditPolicy.java    From ermaster-b with Apache License 2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected Command getDeleteCommand(GroupRequest grouprequest) {
	Relation relation = (Relation) this.getHost().getModel();
	return new DeleteRelationCommand(relation, null);
}