当前位置: 首页>>代码示例>>Java>>正文


Java Command类代码示例

本文整理汇总了Java中org.eclipse.gef.commands.Command的典型用法代码示例。如果您正苦于以下问题:Java Command类的具体用法?Java Command怎么用?Java Command使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Command类属于org.eclipse.gef.commands包,在下文中一共展示了Command类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getConnectionCreateCommand

import org.eclipse.gef.commands.Command; //导入依赖的package包/类
@Override
protected Command getConnectionCreateCommand(
		CreateConnectionRequest request) {

	LinkCommand command = new LinkCommand();
	command.setConnection(new Link());
	command.setSource(getComponentEditPart().getCastedModel());
	ConnectionAnchor ctor = getComponentEditPart().getSourceConnectionAnchor(
			request);
	if (ctor == null)
		return null;

	command.setSourceTerminal(getComponentEditPart()
			.mapConnectionAnchorToTerminal(ctor));

	request.setStartCommand(command);
	return command;

}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:20,代码来源:NodeConnectionEditPolicy.java

示例2: getCreateCommand

import org.eclipse.gef.commands.Command; //导入依赖的package包/类
@Override
protected Command getCreateCommand(CreateRequest request) {
	Command ret = null;
	if (request.getNewObjectType().equals(ModuleInstancePropertyNode.class) && getHost().getModel() instanceof ModuleInstanceNode) {
		ModuleInstancePropertyCreateCommand cmd = new ModuleInstancePropertyCreateCommand();
		Node node = (Node) request.getNewObject();
		node.setParent((Node) getHost().getModel());
		Viewport vp = ((FigureCanvas) getHost().getViewer().getControl()).getViewport();
		Point viewSize = vp.getViewLocation();
		Point p = request.getLocation();
		p.setX(p.x + viewSize.x);
		p.setY(p.y + viewSize.y);
		p = node.getAnchor(p, 2);
		cmd.setNode((ModuleInstancePropertyNode) node);
		cmd.setParent((ModuleInstanceNode) node.getParent());
		cmd.setLocation(new Rectangle(p.x, p.y, ModuleInstancePropertyNode.DEF_WIDTH, ModuleInstancePropertyNode.DEF_HEIGHT));
		ret = cmd;
	}
	return ret;
}
 
开发者ID:dstl,项目名称:Open_Source_ECOA_Toolset_AS5,代码行数:21,代码来源:ModuleInstanceLayoutPolicy.java

示例3: getMoveBendpointCommand

import org.eclipse.gef.commands.Command; //导入依赖的package包/类
@Override
protected Command getMoveBendpointCommand(BendpointRequest request) {
	Viewport vp = ((FigureCanvas) getHost().getViewer().getControl()).getViewport();
	Point viewSize = vp.getViewLocation();
	Point p = request.getLocation();
	p.setX(p.x + viewSize.x);
	p.setY(p.y + viewSize.y);
	BendpointMoveCommand cmd = new BendpointMoveCommand();
	cmd.setLink((Link) request.getSource().getModel());
	cmd.setIndex(request.getIndex());
	cmd.setNewLocation(p);
	return cmd;
}
 
开发者ID:dstl,项目名称:Open_Source_ECOA_Toolset_AS5,代码行数:14,代码来源:BendpointPolicy.java

示例4: getReconnectSourceCommand

import org.eclipse.gef.commands.Command; //导入依赖的package包/类
@Override
protected Command getReconnectSourceCommand(
		ReconnectRequest request) {
	
	Link link=(Link)request.getConnectionEditPart().getModel();
	Component comp=getComponentEditPart().getCastedModel();
	
	LinkReconnectSourceCommand cmd=new LinkReconnectSourceCommand(link);
	cmd.setOldSource(link);
	cmd.setNewSource(comp);
	ConnectionAnchor anchor=getComponentEditPart().getSourceConnectionAnchor(request);
	if(anchor==null){
		return null;
	}
	cmd.setNewSourceTerminal(getComponentEditPart().mapConnectionAnchorToTerminal(anchor));
	

	return cmd;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:20,代码来源:NodeConnectionEditPolicy.java

示例5: getCreateCommand

import org.eclipse.gef.commands.Command; //导入依赖的package包/类
@Override
protected Command getCreateCommand(CreateRequest request) {
	Command ret = null;
	if (request.getNewObjectType().equals(ComputingNodeConfigurationNode.class) && (getHost().getModel() instanceof PlatformConfigurationNode)) {
		ComputingNodeConfigurationCreateCommand cmd = new ComputingNodeConfigurationCreateCommand();
		Node node = (Node) request.getNewObject();
		node.setParent((Node) getHost().getModel());
		Viewport vp = ((FigureCanvas) getHost().getViewer().getControl()).getViewport();
		Point viewSize = vp.getViewLocation();
		Point p = request.getLocation();
		p.setX(p.x + viewSize.x);
		p.setY(p.y + viewSize.y);
		p = node.getAnchor(p, 1);
		cmd.setNode((ComputingNodeConfigurationNode) node);
		cmd.setParent((PlatformConfigurationNode) node.getParent());
		cmd.setLocation(new Rectangle(p.x, p.y, ComputingNodeConfigurationNode.DEF_WIDTH, ComputingNodeConfigurationNode.DEF_HEIGHT));
		ret = cmd;
	}
	return ret;
}
 
开发者ID:dstl,项目名称:Open_Source_ECOA_Toolset_AS5,代码行数:21,代码来源:PlatformConfigurationLayoutPolicy.java

示例6: getCreateCommand

import org.eclipse.gef.commands.Command; //导入依赖的package包/类
@Override
protected Command getCreateCommand(CreateRequest request) {
	Command ret = null;
	if (request.getNewObjectType().equals(LogicalComputingPlatformNode.class) && (getHost().getModel() instanceof LogicalSystemNode)) {
		LogicalComputingPlatformCreateCommand cmd = new LogicalComputingPlatformCreateCommand();
		Node node = (Node) request.getNewObject();
		node.setParent((Node) getHost().getModel());
		Viewport vp = ((FigureCanvas) getHost().getViewer().getControl()).getViewport();
		Point viewSize = vp.getViewLocation();
		Point p = request.getLocation();
		p.setX(p.x + viewSize.x);
		p.setY(p.y + viewSize.y);
		cmd.setNode((LogicalComputingPlatformNode) node);
		cmd.setParent((LogicalSystemNode) node.getParent());
		cmd.setLocation(new Rectangle(p.x, p.y, LogicalComputingPlatformNode.DEF_WIDTH, LogicalComputingPlatformNode.DEF_HEIGHT));
		ret = cmd;
	}
	return ret;
}
 
开发者ID:dstl,项目名称:Open_Source_ECOA_Toolset_AS5,代码行数:20,代码来源:LogicalSystemLayoutPolicy.java

示例7: getCreateCommand

import org.eclipse.gef.commands.Command; //导入依赖的package包/类
@Override
protected Command getCreateCommand(CreateRequest request) {
	Command ret = null;
	if (request.getNewObjectType().equals(LogicalComputingNode.class) && (getHost().getModel() instanceof LogicalComputingPlatformNode)) {
		LogicalComputingCreateCommand cmd = new LogicalComputingCreateCommand();
		Node node = (Node) request.getNewObject();
		node.setParent((Node) getHost().getModel());
		Viewport vp = ((FigureCanvas) getHost().getViewer().getControl()).getViewport();
		Point viewSize = vp.getViewLocation();
		Point p = request.getLocation();
		p.setX(p.x + viewSize.x);
		p.setY(p.y + viewSize.y);
		p = node.getAnchor(p, 1);
		cmd.setNode((LogicalComputingNode) node);
		cmd.setParent((LogicalComputingPlatformNode) node.getParent());
		cmd.setLocation(new Rectangle(p.x, p.y, LogicalComputingNode.DEF_WIDTH, LogicalComputingNode.DEF_HEIGHT));
		ret = cmd;
	}
	return ret;
}
 
开发者ID:dstl,项目名称:Open_Source_ECOA_Toolset_AS5,代码行数:21,代码来源:LogicalComputingPlatformLayoutPolicy.java

示例8: getCreateBendpointCommand

import org.eclipse.gef.commands.Command; //导入依赖的package包/类
protected Command getCreateBendpointCommand(BendpointRequest request) {
	CreateBendpointCommand com = new CreateBendpointCommand();
	Point p = request.getLocation();
	conn = getConnection();
	conn.translateToRelative(p);
	com.setLocation(p);
	Point ref1 = conn.getSourceAnchor().getReferencePoint();
	Point ref2 = conn.getTargetAnchor().getReferencePoint();

	conn.translateToRelative(ref1);
	conn.translateToRelative(ref2);

	com.setRelativeDimensions(p.getDifference(ref1), p.getDifference(ref2));
	com.setConn((Connection) request.getSource().getModel());
	com.setIndex(request.getIndex());
	return com;
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:18,代码来源:ConnectionBendpointEditPolicy.java

示例9: createMoveChildCommand

import org.eclipse.gef.commands.Command; //导入依赖的package包/类
@Override
protected Command createMoveChildCommand(EditPart child, EditPart after) {
	if (child == after || getHost().getChildren().size() == 1) {
		return null;
	}
	int index = getHost().getChildren().indexOf(child);
	if (index == 0) {
		if (after == null)
			return null;
	} else {
		if (after == getHost().getChildren().get(index - 1))
			return null;
	}
	ColumnReorderCommand cmd = new ColumnReorderCommand((Table) getHost().getModel(), (Column) child.getModel());
	if (after != null) {
		cmd.setAfterColumn((Column) after.getModel());
	}
	return cmd;
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:20,代码来源:ColumnOrderedLayoutEditPolicy.java

示例10: getCreateCommand

import org.eclipse.gef.commands.Command; //导入依赖的package包/类
@Override
protected Command getCreateCommand(CreateRequest request) {
	Command ret = null;
	if (request.getNewObjectType().equals(ComponentPropertyNode.class) && (getHost().getModel() instanceof ComponentNode)) {
		ComponentPropertyNodeCreateCommand cmd = new ComponentPropertyNodeCreateCommand();
		Node node = (Node) request.getNewObject();
		node.setParent((Node) getHost().getModel());
		Viewport vp = ((FigureCanvas) getHost().getViewer().getControl()).getViewport();
		Point viewSize = vp.getViewLocation();
		Point p = request.getLocation();
		p.setX(p.x + viewSize.x);
		p.setY(p.y + viewSize.y);
		p = node.getAnchor(p, 1);
		cmd.setNode((ComponentPropertyNode) node);
		cmd.setParent((ComponentNode) node.getParent());
		cmd.setLocation(new Rectangle(p.x, p.y, ComponentPropertyNode.DEF_WIDTH, ComponentPropertyNode.DEF_HEIGHT));
		ret = cmd;
	}
	return ret;
}
 
开发者ID:dstl,项目名称:Open_Source_ECOA_Toolset_AS5,代码行数:21,代码来源:ComponentNodeLayoutPolicy.java

示例11: getConnectionCompleteCommand

import org.eclipse.gef.commands.Command; //导入依赖的package包/类
@Override
protected Command getConnectionCompleteCommand(
		CreateConnectionRequest request) {

	LinkCommand command = (LinkCommand) request
			.getStartCommand();
	command.setTarget(getComponentEditPart().getCastedModel());
	ConnectionAnchor ctor = getComponentEditPart().getTargetConnectionAnchor(
			request);
	if (ctor == null)
		return null;


	command.setTargetTerminal(getComponentEditPart()
			.mapConnectionAnchorToTerminal(ctor));

	return command;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:19,代码来源:NodeConnectionEditPolicy.java

示例12: getMoveBendpointCommand

import org.eclipse.gef.commands.Command; //导入依赖的package包/类
protected Command getMoveBendpointCommand(BendpointRequest request) {
	MoveBendpointCommand com = new MoveBendpointCommand();
	Point p = request.getLocation();
	conn = getConnection();
	conn.translateToRelative(p);

	com.setLocation(p);

	Point ref1 = getConnection().getSourceAnchor().getReferencePoint();
	Point ref2 = getConnection().getTargetAnchor().getReferencePoint();

	conn.translateToRelative(ref1);
	conn.translateToRelative(ref2);

	com.setRelativeDimensions(p.getDifference(ref1), p.getDifference(ref2));
	com.setConn((Connection) request.getSource().getModel());
	com.setIndex(request.getIndex());
	return com;
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:20,代码来源:ConnectionBendpointEditPolicy.java

示例13: getReconnectTargetCommand

import org.eclipse.gef.commands.Command; //导入依赖的package包/类
@Override
protected Command getReconnectTargetCommand(
		ReconnectRequest request) {
	Link link=(Link)request.getConnectionEditPart().getModel();
	Component component=getComponentEditPart().getCastedModel();
	ConnectionAnchor anchor=getComponentEditPart().getTargetConnectionAnchor(request);
	if(anchor==null){
		return null;
	}
	LinkReconnectTargetCommand command=new LinkReconnectTargetCommand(link);
	command.setOldTarget(link);
	command.setNewTarget(component);
	command.setNewTargetTerminal(getComponentEditPart().mapConnectionAnchorToTerminal(anchor));
	
	return command;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:17,代码来源:NodeConnectionEditPolicy.java

示例14: createCopyCommand

import org.eclipse.gef.commands.Command; //导入依赖的package包/类
private Command createCopyCommand(List<Object> selectedObjects) {
	if (selectedObjects == null || selectedObjects.isEmpty()) {
		return null;
	}

	CopyNodeCommand cmd = new CopyNodeCommand();
	Iterator<Object> it = selectedObjects.iterator();
	while (it.hasNext()) {
		Object obj =  it.next();
		if (!(obj instanceof EditPart)) continue;
		EditPart ep = (EditPart) obj;
		if (!(ep.getModel() instanceof GWNode)) continue;
		GWNode gWNode = (GWNode) ep.getModel();
		if (!cmd.isCopyableNode(gWNode))
			return null;
		cmd.addElement(ep);
	}
	return cmd;
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:20,代码来源:CopyNodeAction.java

示例15: createChangeConstraintCommand

import org.eclipse.gef.commands.Command; //导入依赖的package包/类
@Override
protected Command createChangeConstraintCommand(EditPart child, Object constraint) {
	ChangeConstraintCommand ret = new ChangeConstraintCommand();
	ret.setModel((Node) child.getModel());
	ret.setNewConstraint((Rectangle) constraint);
	return ret;
}
 
开发者ID:dstl,项目名称:Open_Source_ECOA_Toolset_AS5,代码行数:8,代码来源:ModuleInstanceLayoutPolicy.java


注:本文中的org.eclipse.gef.commands.Command类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。