本文整理汇总了Java中org.eclipse.gef.requests.BendpointRequest.getLocation方法的典型用法代码示例。如果您正苦于以下问题:Java BendpointRequest.getLocation方法的具体用法?Java BendpointRequest.getLocation怎么用?Java BendpointRequest.getLocation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.gef.requests.BendpointRequest
的用法示例。
在下文中一共展示了BendpointRequest.getLocation方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getMoveBendpointCommand
import org.eclipse.gef.requests.BendpointRequest; //导入方法依赖的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;
}
示例2: getCreateBendpointCommand
import org.eclipse.gef.requests.BendpointRequest; //导入方法依赖的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;
}
示例3: getMoveBendpointCommand
import org.eclipse.gef.requests.BendpointRequest; //导入方法依赖的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;
}
示例4: getCreateBendpointCommand
import org.eclipse.gef.requests.BendpointRequest; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected Command getCreateBendpointCommand(final BendpointRequest bendpointrequest) {
final AbstractConnectionEditPart connectionEditPart = (AbstractConnectionEditPart) getHost();
final ConnectionElement connection = (ConnectionElement) connectionEditPart.getModel();
if (connection.getSource() == connection.getTarget()) {
return null;
}
final Point point = bendpointrequest.getLocation();
getConnection().translateToRelative(point);
final CreateBendpointCommand createBendpointCommand = new CreateBendpointCommand(connection, point.x, point.y, bendpointrequest.getIndex());
return createBendpointCommand;
}
示例5: getCreateBendpointCommand
import org.eclipse.gef.requests.BendpointRequest; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected Command getCreateBendpointCommand(
BendpointRequest bendpointrequest) {
AbstractConnectionEditPart connectionEditPart = (AbstractConnectionEditPart) this
.getHost();
ConnectionElement connection = (ConnectionElement) connectionEditPart
.getModel();
if (connection.getSource() == connection.getTarget()) {
return null;
}
Point point = bendpointrequest.getLocation();
this.getConnection().translateToRelative(point);
CreateBendpointCommand createBendpointCommand = new CreateBendpointCommand(
this.diagram.getCurrentCategory(),
connection, point.x, point.y, bendpointrequest.getIndex());
return createBendpointCommand;
}
示例6: showCreateBendpointFeedback
import org.eclipse.gef.requests.BendpointRequest; //导入方法依赖的package包/类
/**
* Shows feedback when a bendpoint is being created. The original figure is used for
* feedback and the original constraint is saved, so that it can be restored when feedback
* is erased.
* @param request the BendpointRequest
*/
protected void showCreateBendpointFeedback(BendpointRequest request) {
Point p = new Point(request.getLocation());
List constraint;
getConnection().translateToRelative(p);
Bendpoint bp = new AbsoluteBendpoint(p);
if (originalConstraint == null) {
saveOriginalConstraint();
constraint = (List)getConnection().getRoutingConstraint();
constraint.add(request.getIndex(), bp);
} else {
constraint = (List)getConnection().getRoutingConstraint();
}
constraint.set(request.getIndex(), bp);
getConnection().setRoutingConstraint(constraint);
}
示例7: showMoveBendpointFeedback
import org.eclipse.gef.requests.BendpointRequest; //导入方法依赖的package包/类
/**
* Shows feedback when a bendpoint is being moved. Also checks to see if the bendpoint
* should be deleted and then calls {@link #showDeleteBendpointFeedback(BendpointRequest)}
* if needed. The original figure is used for feedback and the original constraint is
* saved, so that it can be restored when feedback is erased.
* @param request the BendpointRequest
*/
protected void showMoveBendpointFeedback(BendpointRequest request) {
Point p = new Point(request.getLocation());
if (!isDeleting)
setReferencePoints(request);
if (lineContainsPoint(ref1, ref2, p)) {
if (!isDeleting) {
isDeleting = true;
eraseSourceFeedback(request);
showDeleteBendpointFeedback(request);
}
return;
}
if (isDeleting) {
isDeleting = false;
eraseSourceFeedback(request);
}
if (originalConstraint == null)
saveOriginalConstraint();
List constraint = (List)getConnection().getRoutingConstraint();
getConnection().translateToRelative(p);
Bendpoint bp = new AbsoluteBendpoint(p);
constraint.set(request.getIndex(), bp);
getConnection().setRoutingConstraint(constraint);
}
示例8: showCreateBendpointFeedback
import org.eclipse.gef.requests.BendpointRequest; //导入方法依赖的package包/类
/**
* @see org.eclipse.gef.editpolicies.BendpointEditPolicy#showCreateBendpointFeedback(org.eclipse.gef.requests.BendpointRequest)
*/
@Override
protected void showCreateBendpointFeedback(BendpointRequest request) {
IFigure feedback = getDragSourceFeedbackFigure();
Rectangle bounds = new Rectangle(getInitialFeedbackBounds().getCopy());
PrecisionRectangle rect = new PrecisionRectangle(bounds);
getHostFigure().translateToAbsolute(rect);
Point movePoint = request.getLocation();
movePoint.x = ((GraphicalEditPart) getHost()).getFigure().getBounds().x;//movePoint.x - rect.getSize().width / 2;
rect.setLocation(movePoint);
feedback.translateToRelative(rect);
feedback.setBounds(rect);
}
示例9: getCreateBendpointCommand
import org.eclipse.gef.requests.BendpointRequest; //导入方法依赖的package包/类
@Override
protected Command getCreateBendpointCommand(BendpointRequest bendpointrequest) {
final AbstractConnectionEditPart connectionEditPart = (AbstractConnectionEditPart) getHost();
final WalkerConnection connection = (WalkerConnection) connectionEditPart.getModel();
if (connection.getSourceWalker() == connection.getTargetWalker()) {
return null;
}
final Point point = bendpointrequest.getLocation();
getConnection().translateToRelative(point);
final CreateBendpointCommand createBendpointCommand =
new CreateBendpointCommand(connection, point.x, point.y, bendpointrequest.getIndex());
return createBendpointCommand;
}
示例10: getCreateBendpointCommand
import org.eclipse.gef.requests.BendpointRequest; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected Command getCreateBendpointCommand(
BendpointRequest bendpointrequest) {
AbstractConnectionEditPart connectionEditPart = (AbstractConnectionEditPart) this
.getHost();
ConnectionElement connection = (ConnectionElement) connectionEditPart
.getModel();
if (connection.getSource() == connection.getTarget()) {
return null;
}
Point point = bendpointrequest.getLocation();
this.getConnection().translateToRelative(point);
CreateBendpointCommand createBendpointCommand = new CreateBendpointCommand(
connection, point.x, point.y, bendpointrequest.getIndex());
return createBendpointCommand;
}
示例11: showCreateBendpointFeedback
import org.eclipse.gef.requests.BendpointRequest; //导入方法依赖的package包/类
/**
* Shows feedback when a bendpoint is being created. The original figure is
* used for feedback and the original constraint is saved, so that it can be
* restored when feedback is erased.
*
* @param request
* the BendpointRequest
*/
protected void showCreateBendpointFeedback(BendpointRequest request) {
Point p = new Point(request.getLocation());
List constraint;
getConnection().translateToRelative(p);
Bendpoint bp = new AbsoluteBendpoint(p);
if (originalConstraint == null) {
saveOriginalConstraint();
constraint = (List) getConnection().getRoutingConstraint();
constraint.add(request.getIndex(), bp);
} else {
constraint = (List) getConnection().getRoutingConstraint();
}
constraint.set(request.getIndex(), bp);
getConnection().setRoutingConstraint(constraint);
}
示例12: showMoveBendpointFeedback
import org.eclipse.gef.requests.BendpointRequest; //导入方法依赖的package包/类
/**
* Shows feedback when a bendpoint is being moved. Also checks to see if the
* bendpoint should be deleted and then calls
* {@link #showDeleteBendpointFeedback(BendpointRequest)} if needed. The
* original figure is used for feedback and the original constraint is
* saved, so that it can be restored when feedback is erased.
*
* @param request
* the BendpointRequest
*/
protected void showMoveBendpointFeedback(BendpointRequest request) {
Point p = new Point(request.getLocation());
if (!isDeleting)
setReferencePoints(request);
if (lineContainsPoint(ref1, ref2, p)) {
if (!isDeleting) {
isDeleting = true;
eraseSourceFeedback(request);
showDeleteBendpointFeedback(request);
}
return;
}
if (isDeleting) {
isDeleting = false;
eraseSourceFeedback(request);
}
if (originalConstraint == null)
saveOriginalConstraint();
List constraint = (List) getConnection().getRoutingConstraint();
getConnection().translateToRelative(p);
Bendpoint bp = new AbsoluteBendpoint(p);
constraint.set(request.getIndex(), bp);
getConnection().setRoutingConstraint(constraint);
}
示例13: getMoveBendpointCommand
import org.eclipse.gef.requests.BendpointRequest; //导入方法依赖的package包/类
/**
* This method creats and returns a command for changing the position of a {@link Bendpoint}.
*
* @return {@link ORMRelationMoveBendpointCommand}
*/
@Override
protected Command getMoveBendpointCommand(final BendpointRequest request) {
final ORMRelationMoveBendpointCommand command = new ORMRelationMoveBendpointCommand();
Point p = request.getLocation();
Connection conn = getConnection();
conn.translateToRelative(p);
Point sourceP = conn.getSourceAnchor().getReferencePoint();
Point targetP = conn.getTargetAnchor().getReferencePoint();
conn.translateToRelative(sourceP);
conn.translateToRelative(targetP);
command.setRelation((Relation) request.getSource().getModel());
command.setNewDimension(p.getDifference(sourceP), p.getDifference(targetP));
command.setIndex(request.getIndex());
return command;
}
示例14: getCreateBendpointCommand
import org.eclipse.gef.requests.BendpointRequest; //导入方法依赖的package包/类
protected Command getCreateBendpointCommand(BendpointRequest request) {
CreateBendpointCommand cmd = new CreateBendpointCommand();
Point p = request.getLocation();
Connection conn = (Connection) getConnection();
conn.translateToRelative(p);
Point ref1 = getConnection().getSourceAnchor().getReferencePoint();
Point ref2 = getConnection().getTargetAnchor().getReferencePoint();
conn.translateToRelative(ref1);
conn.translateToRelative(ref2);
cmd.setRelativeDimensions(p.getDifference(ref1), p.getDifference(ref2));
cmd.setConnection((com.wt.studio.plugin.modeldesigner.editor.model.NodeConnection) request.getSource()
.getModel());
cmd.setIndex(request.getIndex());
return cmd;
}
示例15: getMoveBendpointCommand
import org.eclipse.gef.requests.BendpointRequest; //导入方法依赖的package包/类
protected Command getMoveBendpointCommand(BendpointRequest request) {
MoveBendpointCommand cmd = new MoveBendpointCommand();
Point p = request.getLocation();
Connection conn = getConnection();
conn.translateToRelative(p);
Point ref1 = getConnection().getSourceAnchor().getReferencePoint();
Point ref2 = getConnection().getTargetAnchor().getReferencePoint();
conn.translateToRelative(ref1);
conn.translateToRelative(ref2);
cmd.setRelativeDimensions(p.getDifference(ref1), p.getDifference(ref2));
cmd.setConnection((com.wt.studio.plugin.modeldesigner.editor.model.NodeConnection) request.getSource()
.getModel());
cmd.setIndex(request.getIndex());
return cmd;
}