本文整理汇总了Java中org.eclipse.gef.requests.CreateRequest.getLocation方法的典型用法代码示例。如果您正苦于以下问题:Java CreateRequest.getLocation方法的具体用法?Java CreateRequest.getLocation怎么用?Java CreateRequest.getLocation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.gef.requests.CreateRequest
的用法示例。
在下文中一共展示了CreateRequest.getLocation方法的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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例8: 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;
}
}
示例9: 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;
}
}
示例10: enforceConstraintsForSizeOnDropCreate
import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的package包/类
/**
* Ensures size constraints (by default minimum and maximum) are respected
* by the given request. May be overwritten by clients to enforce additional
* constraints.
*
* @since 3.7
*/
protected void enforceConstraintsForSizeOnDropCreate(CreateRequest request) {
CreateRequest createRequest = (CreateRequest) getTargetRequest();
if (createRequest.getSize() != null) {
// ensure create request respects minimum and maximum size
// constraints
PrecisionRectangle constraint = new PrecisionRectangle(
createRequest.getLocation(), createRequest.getSize());
((GraphicalEditPart) getTargetEditPart()).getContentPane()
.translateToRelative(constraint);
constraint.setSize(Dimension.max(constraint.getSize(),
getMinimumSizeFor(createRequest)));
constraint.setSize(Dimension.min(constraint.getSize(),
getMaximumSizeFor(createRequest)));
((GraphicalEditPart) getTargetEditPart()).getContentPane()
.translateToAbsolute(constraint);
createRequest.setSize(constraint.getSize());
}
}
示例11: placeComponentOnCanvasByDoubleClickOnPalette
import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的package包/类
private void placeComponentOnCanvasByDoubleClickOnPalette(
CreateRequest componentRequest) {
GraphicalViewer graphViewer = graphicalViewer;
ComponentCreateCommand createComponent = new ComponentCreateCommand(
(hydrograph.ui.graph.model.Component) componentRequest
.getNewObject(),
(Container) graphViewer.getContents().getModel(),
new Rectangle(componentRequest.getLocation(), componentRequest
.getSize()));
graphViewer.getEditDomain().getCommandStack().execute(createComponent);
}
示例12: getCreateCommand
import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的package包/类
@Override
protected Command getCreateCommand(CreateRequest request) {
if (request.getNewObjectType() == Table.class && getHost().getModel() instanceof Schema) {
return new TableCreateCommand((Table) request.getNewObject(), (Schema) getHost().getModel(), request.getLocation());
}
return null;
}
示例13: getCreateCommand
import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected Command getCreateCommand(final CreateRequest request) {
final ERDiagramEditPart editPart = (ERDiagramEditPart) getHost();
final Point point = request.getLocation();
editPart.getFigure().translateToRelative(point);
final NodeElement element = (NodeElement) request.getNewObject();
final ERDiagram diagram = (ERDiagram) editPart.getModel();
Dimension size = request.getSize();
final List<NodeElement> enclosedElementList = new ArrayList<NodeElement>();
if (size != null) {
final ZoomManager zoomManager = ((ScalableFreeformRootEditPart) getHost().getRoot()).getZoomManager();
final double zoom = zoomManager.getZoom();
size = new Dimension((int) (size.width / zoom), (int) (size.height / zoom));
for (final Object child : editPart.getChildren()) {
if (child instanceof NodeElementEditPart) {
final NodeElementEditPart nodeElementEditPart = (NodeElementEditPart) child;
final Rectangle bounds = nodeElementEditPart.getFigure().getBounds();
if (bounds.x > point.x && bounds.x + bounds.width < point.x + size.width && bounds.y > point.y && bounds.y + bounds.height < point.y + size.height) {
enclosedElementList.add((NodeElement) nodeElementEditPart.getModel());
}
}
}
}
return new CreateElementCommand(diagram, element, point.x, point.y, size, enclosedElementList);
}
示例14: 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( DiagramType.SEQUENCE_DIAGRAM.equals(diagramEditDomain.getDiagram().getType()) && getHost().getModel() instanceof ContainerNode ) {
UiUtil.eraseFeedback(getHost());
return null;
}
return new CreateNotationNodeCommand(diagramEditDomain, getHost(), request, location);
}
示例15: getCreateCommand
import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的package包/类
/**
* @see ContainerEditPolicy#getCreateCommand(org.eclipse.gef.requests.CreateRequest)
*/
protected Command getCreateCommand(CreateRequest request) {
Object newObject = request.getNewObject();
MFrom parent = null;
if (getHost() instanceof QueryEditPart) {
MSQLRoot mroot = ((QueryEditPart) getHost()).getModel();
parent = Util.getKeyword(mroot, MFrom.class);
}
if (getHost().getModel() instanceof MFrom)
parent = (MFrom) getHost().getModel();
if (parent != null)
if (newObject instanceof Collection<?>) {
Rectangle r = new Rectangle(10, 10, 100, 100);
if (request.getLocation() != null) {
r.setLocation(request.getLocation().getCopy());
GraphicalEditPart ep = (GraphicalEditPart) getHost();
if (getHost() instanceof QueryEditPart) {
r.translate(-20, -20);
} else {
Rectangle ca = ep.getFigure().getClientArea();
r.translate(-ca.x, -ca.y);
}
}
if (request.getSize() != null) {
r.width = request.getSize().width;
r.height = request.getSize().height;
}
return new AddTableCommand(parent, (Collection<MSqlTable>) newObject, r);
}
return null;
}