Java Code Examples for org.eclipse.gef.commands.Command#chain()

The following examples show how to use org.eclipse.gef.commands.Command#chain() . 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: ProcessPart.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public Command getCommand(Request request) {
	if (!(request instanceof ChangeBoundsRequest))
		return null;
	ChangeBoundsRequest req = (ChangeBoundsRequest) request;
	Dimension sizeDelta = req.getSizeDelta();
	if (sizeDelta.height != 0 || sizeDelta.width != 0)
		return null;
	Command commandChain = null;
	for (Object o : req.getEditParts()) {
		if (!(o instanceof ProcessPart))
			continue;
		ProcessPart part = (ProcessPart) o;
		XYLayoutCommand command = new XYLayoutCommand();
		command.setProcessNode(part.getModel());
		Rectangle bounds = (part.getModel()).figure.getBounds().getCopy();
		part.getModel().figure.translateToAbsolute(bounds);
		Rectangle moveResize = new Rectangle(req.getMoveDelta(), sizeDelta);
		bounds.resize(moveResize.getSize());
		bounds.translate(moveResize.getLocation());
		part.getModel().figure.translateToRelative(bounds);
		command.setConstraint(bounds);
		if (commandChain == null) {
			commandChain = command;
		} else {
			commandChain = commandChain.chain(command);
		}
	}
	return commandChain;
}
 
Example 2
Source File: CrossflowBaseItemSemanticEditPolicy.java    From scava with Eclipse Public License 2.0 4 votes vote down vote up
/**
* @generated
*/
protected Command addDeleteViewCommand(Command mainCommand, DestroyRequest completedRequest) {
	Command deleteViewCommand = getGEFWrapper(new DeleteCommand(getEditingDomain(), (View) getHost().getModel()));
	return mainCommand == null ? deleteViewCommand : mainCommand.chain(deleteViewCommand);
}
 
Example 3
Source File: ProcessBaseItemSemanticEditPolicy.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
/**
* @generated
*/
protected Command addDeleteViewCommand(Command mainCommand, DestroyRequest completedRequest) {
	Command deleteViewCommand = getGEFWrapper(new DeleteCommand(getEditingDomain(), (View) getHost().getModel()));
	return mainCommand == null ? deleteViewCommand : mainCommand.chain(deleteViewCommand);
}
 
Example 4
Source File: CommandUtil.java    From olca-app with Mozilla Public License 2.0 4 votes vote down vote up
public static Command chain(Command command, Command toChain) {
	if (command == null)
		return toChain;
	return command.chain(toChain);
}