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


Java CreateRequest.getNewObject方法代码示例

本文整理汇总了Java中org.eclipse.gef.requests.CreateRequest.getNewObject方法的典型用法代码示例。如果您正苦于以下问题:Java CreateRequest.getNewObject方法的具体用法?Java CreateRequest.getNewObject怎么用?Java CreateRequest.getNewObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.gef.requests.CreateRequest的用法示例。


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

示例1: getCreateCommand

import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的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

示例2: getCreateCommand

import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的package包/类
@Override
protected Command getCreateCommand(CreateRequest request) {
	Command ret = null;
	if (request.getNewObjectType().equals(ModuleOperationParameterNode.class) && (getHost().getModel() instanceof ModuleOperationNode)) {
		ModuleOperationNode par = (ModuleOperationNode) getHost().getModel();
		if (!(par.getType().equalsIgnoreCase(Enums.ModuleOperationTypes.DATA_READ.name()) || par.getType().equalsIgnoreCase(Enums.ModuleOperationTypes.DATA_WRITE.name()))) {
			ModuleOperationParameterCreateCommand cmd = new ModuleOperationParameterCreateCommand();
			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((ModuleOperationParameterNode) node);
			cmd.setParent((ModuleOperationNode) node.getParent());
			cmd.setLocation(new Rectangle(p.x, p.y, ModuleOperationParameterNode.DEF_WIDTH, ModuleOperationParameterNode.DEF_HEIGHT));
			ret = cmd;
		}
	}
	return ret;
}
 
开发者ID:dstl,项目名称:Open_Source_ECOA_Toolset_AS5,代码行数:24,代码来源:ModuleOperationLayoutPolicy.java

示例3: getCreateCommand

import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的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

示例4: getCreateCommand

import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的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

示例5: getCreateCommand

import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的package包/类
@Override
protected Command getCreateCommand(CreateRequest request) {
	Command ret = null;
	if (request.getNewObjectType().equals(LogicalProcessorsNode.class) && (getHost().getModel() instanceof LogicalComputingNode)) {
		LogicalProcessorsCreateCommand cmd = new LogicalProcessorsCreateCommand();
		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((LogicalProcessorsNode) node);
		cmd.setParent((LogicalComputingNode) node.getParent());
		cmd.setLocation(new Rectangle(p.x, p.y, LogicalProcessorsNode.DEF_WIDTH, LogicalProcessorsNode.DEF_HEIGHT));
		ret = cmd;
	}
	return ret;
}
 
开发者ID:dstl,项目名称:Open_Source_ECOA_Toolset_AS5,代码行数:21,代码来源:LogicalComputingLayoutPolicy.java

示例6: getCreateCommand

import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的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

示例7: getCreateCommand

import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的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

示例8: setGenericComponent

import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的package包/类
/**
 * 
 * set genericComponent to selected/hovered component in palette
 * 
 * @param paletteInternalController
 * @return
 */
private CreateRequest setGenericComponent(EditPart paletteInternalController) {
	CombinedTemplateCreationEntry addedPaletteTool = (CombinedTemplateCreationEntry) paletteInternalController
			.getModel();

		CreateRequest componentRequest = new CreateRequest();
		componentRequest.setFactory(new SimpleFactory((Class) addedPaletteTool
				.getTemplate()));

	genericComponent = (Component) componentRequest
			.getNewObject();
	
	logger.debug("genericComponent - " + genericComponent.toString());
	
	return componentRequest;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:23,代码来源:PaletteContainerListener.java

示例9: getCreateCommand

import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的package包/类
@Override
protected Command getCreateCommand(CreateRequest request) {
	// And then passed those to the validate facility.
	Object newObject = request.getNewObject();
	Object container = getHost().getModel();
	if (!GUIEditorPlugin.getComponentValidator().validate(newObject, container))
		return null;
	
	if (request.getNewObject() instanceof TitleBar
			&& getHost().getModel() instanceof Window) {
		TitleBar titleBar = (TitleBar) request.getNewObject();
		Window window = (Window)getHost().getModel();
		if (window.getTitleBar() == null){
			return new AddTitleBarCommand(window,
					titleBar, 
					new Rectangle(0, 0, window.getDimension().width, -1));
		}
	} else if (request.getNewObject() instanceof TitaniumUIBaseElement
			&& getHost().getModel() instanceof TitaniumUIContainer) {
		return super.getCreateCommand(request);
	}
	return null;
}
 
开发者ID:ShoukriKattan,项目名称:ForgedUI-Eclipse,代码行数:24,代码来源:WindowAddElementEditPolicy.java

示例10: getCreateCommand

import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的package包/类
/**
 * @see org.eclipse.gef.editpolicies.LayoutEditPolicy#getCreateCommand(org.eclipse.gef.requests.CreateRequest)
 */
@Override
protected Command getCreateCommand(CreateRequest request) {
    diagramEditDomain = (DiagramEditDomain) getHost().getViewer().getEditDomain();
    Point location = new Point(request.getLocation());
    getHostFigure().translateToRelative(location);

    // 파티션안에 파티션 생성. 계층 구조 생성.
    // if (request.getNewObject() instanceof ContainerNode) {
    // return new ActivityCreateContainerNodeCommand(diagramEditDomain,
    // getHost().getModel(), request, location);
    // }
    if (request.getNewObject() instanceof NotationNode) {
        return new ActivityCreateNotationNodeCommand(diagramEditDomain, getHost(), request, location);
    } else {
        return null;
    }

}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:22,代码来源:ActivityPartitionLayoutPolicy.java

示例11: getCreateCommand

import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的package包/类
/**
 * @see org.eclipse.gef.editpolicies.LayoutEditPolicy#getCreateCommand(org.eclipse.gef.requests.CreateRequest)
 */
@Override
protected Command getCreateCommand(CreateRequest request) {
    diagramEditDomain = (DiagramEditDomain) getHost().getViewer().getEditDomain();
    Point location = new Point(request.getLocation());
    getHostFigure().translateToRelative(location);

    if (request.getNewObject() instanceof ContainerNode) {
        return new ActivityCreateContainerNodeCommand(diagramEditDomain, getHost(), request, location);
    } else if (request.getNewObject() instanceof NotationNode) {
        return new ActivityCreateNotationNodeCommand(diagramEditDomain, getHost(), request, location);
    } else {
        return null;
    }

}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:19,代码来源:ActivityDiagramLayoutEditPolicy.java

示例12: getCreateCommand

import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的package包/类
@Override
protected Command getCreateCommand(CreateRequest request) {
	int index = -1;
	if (((TreeEditPart) getHost()).getWidget() != null)
		index = findIndexOfTreeItemAt(request.getLocation());
	if (index < 0)
		index = CreateRequestUtil.getNewIndex(request);

	if (request.getNewObject() instanceof ANode) {
		return createCreateCommand((ANode) request.getNewObject(), index);
	} else if (request.getNewObject() instanceof CreateElementAction) {
		CreateElementAction action = (CreateElementAction) request.getNewObject();
		action.dropInto(getHost().getModel(), new Rectangle(), index);
		action.run();
		return action.getCommand();
	}
	return null;
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:19,代码来源:JDTreeContainerEditPolicy.java

示例13: getCreateCommand

import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的package包/类
/**
 * Returns a command to be executed when the palette tries to create something
 * 
 * @see org.eclipse.gef.editpolicies.LayoutEditPolicy#getCreateCommand(org.eclipse.gef.requests.CreateRequest)
 */
protected Command getCreateCommand(CreateRequest request) {
    Object newObjectType = null;
    if (request.getNewObject() != null)
        newObjectType = request.getNewObjectType();

    // converts relative to absolute positions (so that zooms work properly)
    Rectangle constraint = (Rectangle) getConstraintFor(request);
    Command createCommand = null;

    if ((newObjectType == IntentionalElementRef.class) || (newObjectType == Belief.class) || (newObjectType == KPIInformationElementRef.class)) {
        createCommand = handleCreateGrlNode(request, constraint);
    } else if (newObjectType == ActorRef.class) {
        createCommand = handleCreateActorRef(request, constraint);
    } else if (newObjectType == Comment.class) {
        createCommand = handleCreateComment(request, constraint);
    }
    return createCommand;
}
 
开发者ID:McGill-DP-Group,项目名称:seg.jUCMNav,代码行数:24,代码来源:GrlGraphXYLayoutEditPolicy.java

示例14: handleCreateGrlNode

import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的package包/类
/**
 * @param request
 *            the CreateRequest containing the new ComponentRef
 * @param constraint
 *            where the new object should be created
 * @return a command that adds a new IntentionalElementRef or KPIInformationElementRef on the Graph and moves/resizes it into place.
 */
private Command handleCreateGrlNode(CreateRequest request, Rectangle constraint) {
    Command createCommand = null;
    Command create = null;
    GRLNode node = null;
    if (request.getNewObject() instanceof IntentionalElementRef) {
        node = (IntentionalElementRef) request.getNewObject();
        create = buildCreateGrlNodeCommand(getGraph(), (IntentionalElementRef) node);
    } else if (request.getNewObject() instanceof KPIInformationElementRef) {
        node = (KPIInformationElementRef) request.getNewObject();
        KPIInformationElementRef info = (KPIInformationElementRef) node;
        create = buildCreateKPIInformationElementCommand(getGraph(), info);
    } else if (request.getNewObject() instanceof Belief) {
        node = (Belief) request.getNewObject();
        create = new AddBeliefCommand(getGraph(), (Belief) node);
    }
    SetConstraintGrlNodeCommand move = new SetConstraintGrlNodeCommand(node, constraint.x, constraint.y, constraint.width, constraint.height, false);

    // after creation, move and resize the node;
    if (create != null)
        createCommand = create.chain(move);

    return createCommand;
}
 
开发者ID:McGill-DP-Group,项目名称:seg.jUCMNav,代码行数:31,代码来源:GrlGraphXYLayoutEditPolicy.java

示例15: getCreateCommand

import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的package包/类
/**
 * Returns a command to be executed when the palette tries to create something on the MapAndPathGraphEditPart.
 * 
 * Extends path for PathTool and creates ComponentRefs. PathNodes are created on NodeConnections so are not handled here.
 * 
 * @see org.eclipse.gef.editpolicies.LayoutEditPolicy#getCreateCommand(org.eclipse.gef.requests.CreateRequest)
 */
protected Command getCreateCommand(CreateRequest request) {
    Object newObjectType = null;
    if (request.getNewObject() != null)
        newObjectType = request.getNewObjectType();

    // converts relative to absolute positions (so that zooms work properly)
    Rectangle constraint = (Rectangle) getConstraintFor(request);
    Command createCommand = null;

    // if PathTool
    if (newObjectType == EndPoint.class || newObjectType == StartPoint.class) {
        createCommand = handleCreateOrExtendPath(request, constraint);
    } else if (newObjectType == ComponentRef.class) {
        createCommand = handleCreateComponentRef(request, constraint);
    } else if (newObjectType == Comment.class) {
        createCommand = handleCreateComment(request, constraint);
    }

    return createCommand;
}
 
开发者ID:McGill-DP-Group,项目名称:seg.jUCMNav,代码行数:28,代码来源:MapXYLayoutEditPolicy.java


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