本文整理汇总了Java中org.eclipse.gef.requests.ReconnectRequest.getConnectionEditPart方法的典型用法代码示例。如果您正苦于以下问题:Java ReconnectRequest.getConnectionEditPart方法的具体用法?Java ReconnectRequest.getConnectionEditPart怎么用?Java ReconnectRequest.getConnectionEditPart使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.gef.requests.ReconnectRequest
的用法示例。
在下文中一共展示了ReconnectRequest.getConnectionEditPart方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSourceConnectionAnchor
import org.eclipse.gef.requests.ReconnectRequest; //导入方法依赖的package包/类
public ConnectionAnchor getSourceConnectionAnchor(Request request) {
//return new ChopboxAnchor(getFigure());
if(request instanceof ReconnectRequest) {
ReconnectRequest r = (ReconnectRequest)request;
NodeConnectionEditPart con =(NodeConnectionEditPart) r.getConnectionEditPart();
NodeConnection conModel = (NodeConnection)con.getModel();
BorderAnchor anchor = con.getSourceAnchor();
GraphicalEditPart part = (GraphicalEditPart)r.getTarget();
if(anchor == null || anchor.getOwner() != part.getFigure()) {
anchor = new RectangleBorderAnchor(getFigure());
anchor.setAngle(conModel.getSourceAngle());
con.setSourceAnchor(anchor);
}
Point loc = r.getLocation();
Rectangle rect = Rectangle.SINGLETON;
rect.setBounds(getFigure().getBounds());
getFigure().translateToAbsolute(rect);
Point ref = rect.getCenter();
double dx = loc.x - ref.x;
double dy = loc.y - ref.y;
anchor.setAngle(Math.atan2(dy, dx));
con.setSourceAnchor(anchor);
conModel.setSourceAngle(anchor.getAngle());
return anchor;
} else {
return new RectangleBorderAnchor(getFigure());
}
}
示例2: getTargetConnectionAnchor
import org.eclipse.gef.requests.ReconnectRequest; //导入方法依赖的package包/类
public ConnectionAnchor getTargetConnectionAnchor(Request request) {
//return new ChopboxAnchor(getFigure());
//return new ChopboxAnchor(getFigure());
if(request instanceof ReconnectRequest) {
ReconnectRequest r = (ReconnectRequest)request;
NodeConnectionEditPart con =(NodeConnectionEditPart) r.getConnectionEditPart();
NodeConnection conModel = (NodeConnection)con.getModel();
BorderAnchor anchor = con.getTargetAnchor();
GraphicalEditPart part = (GraphicalEditPart)r.getTarget();
if(anchor == null || anchor.getOwner() != part.getFigure()) {
anchor = new RectangleBorderAnchor(getFigure());
anchor.setAngle(conModel.getTargetAngle());
con.setTargetAnchor(anchor);
}
Point loc = r.getLocation();
Rectangle rect = Rectangle.SINGLETON;
rect.setBounds(getFigure().getBounds());
getFigure().translateToAbsolute(rect);
Point ref = rect.getCenter();
double dx = loc.x - ref.x;
double dy = loc.y - ref.y;
anchor.setAngle(Math.atan2(dy, dx));
con.setTargetAnchor(anchor);
conModel.setTargetAngle(anchor.getAngle());
return anchor;
} else {
return new RectangleBorderAnchor(getFigure());
}
}
示例3: getSourceConnectionAnchor
import org.eclipse.gef.requests.ReconnectRequest; //导入方法依赖的package包/类
public ConnectionAnchor getSourceConnectionAnchor(Request request) {
if(request instanceof ReconnectRequest) {
ReconnectRequest r = (ReconnectRequest)request;
ColumnConnectionEditPart con =(ColumnConnectionEditPart) r.getConnectionEditPart();
ColumnConnection conModel = (ColumnConnection)con.getModel();
BorderAnchor anchor = con.getSourceAnchor();
GraphicalEditPart part = (GraphicalEditPart)r.getTarget();
if(anchor == null || anchor.getOwner() != part.getFigure()) {
anchor = new RectangleBorderAnchor(getFigure());
anchor.setAngle(conModel.getSourceAngle());
con.setSourceAnchor(anchor);
}
Point loc = r.getLocation();
Rectangle rect = Rectangle.SINGLETON;
rect.setBounds(getFigure().getBounds());
getFigure().translateToAbsolute(rect);
Point ref = rect.getCenter();
double dx = loc.x - ref.x;
double dy = loc.y - ref.y;
anchor.setAngle(Math.atan2(dy, dx));
con.setSourceAnchor(anchor);
conModel.setSourceAngle(anchor.getAngle());
return anchor;
} else {
return new RectangleBorderAnchor(getFigure());
}
}
示例4: getTargetConnectionAnchor
import org.eclipse.gef.requests.ReconnectRequest; //导入方法依赖的package包/类
public ConnectionAnchor getTargetConnectionAnchor(Request request) {
if(request instanceof ReconnectRequest) {
ReconnectRequest r = (ReconnectRequest)request;
ColumnConnectionEditPart con =(ColumnConnectionEditPart) r.getConnectionEditPart();
ColumnConnection conModel = (ColumnConnection)con.getModel();
BorderAnchor anchor = con.getTargetAnchor();
GraphicalEditPart part = (GraphicalEditPart)r.getTarget();
if(anchor == null || anchor.getOwner() != part.getFigure()) {
anchor = new RectangleBorderAnchor(getFigure());
anchor.setAngle(conModel.getTargetAngle());
con.setTargetAnchor(anchor);
}
Point loc = r.getLocation();
Rectangle rect = Rectangle.SINGLETON;
rect.setBounds(getFigure().getBounds());
getFigure().translateToAbsolute(rect);
Point ref = rect.getCenter();
double dx = loc.x - ref.x;
double dy = loc.y - ref.y;
anchor.setAngle(Math.atan2(dy, dx));
con.setTargetAnchor(anchor);
conModel.setTargetAngle(anchor.getAngle());
return anchor;
} else {
return new RectangleBorderAnchor(getFigure());
}
}
示例5: getSourceConnectionAnchor
import org.eclipse.gef.requests.ReconnectRequest; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public ConnectionAnchor getSourceConnectionAnchor(final Request request) {
if (request instanceof ReconnectRequest) {
final ReconnectRequest reconnectRequest = (ReconnectRequest) request;
final ConnectionEditPart connectionEditPart = reconnectRequest.getConnectionEditPart();
// if (!(connectionEditPart instanceof RelationEditPart)) {
// return super.getSourceConnectionAnchor(request);
// }
final ConnectionElement connection = (ConnectionElement) connectionEditPart.getModel();
if (connection.getSource() == connection.getTarget()) {
return new XYChopboxAnchor(getFigure());
}
final EditPart editPart = reconnectRequest.getTarget();
if (editPart == null || !editPart.getModel().equals(connection.getSource())) {
return new XYChopboxAnchor(getFigure());
}
final Point location = new Point(reconnectRequest.getLocation());
getFigure().translateToRelative(location);
final IFigure sourceFigure = ((TableViewEditPart) connectionEditPart.getSource()).getFigure();
final XYChopboxAnchor anchor = new XYChopboxAnchor(getFigure());
final Rectangle bounds = sourceFigure.getBounds();
final Rectangle centerRectangle = new Rectangle(bounds.x + (bounds.width / 4), bounds.y + (bounds.height / 4), bounds.width / 2, bounds.height / 2);
if (!centerRectangle.contains(location)) {
final Point point = getIntersectionPoint(location, sourceFigure);
anchor.setLocation(point);
}
return anchor;
} else if (request instanceof CreateConnectionRequest) {
final CreateConnectionRequest connectionRequest = (CreateConnectionRequest) request;
final Command command = connectionRequest.getStartCommand();
if (command instanceof CreateCommentConnectionCommand) {
return new ChopboxAnchor(getFigure());
}
}
return new XYChopboxAnchor(getFigure());
}
示例6: getTargetConnectionAnchor
import org.eclipse.gef.requests.ReconnectRequest; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public ConnectionAnchor getTargetConnectionAnchor(final Request request) {
if (request instanceof ReconnectRequest) {
final ReconnectRequest reconnectRequest = (ReconnectRequest) request;
final ConnectionEditPart connectionEditPart = reconnectRequest.getConnectionEditPart();
// if (!(connectionEditPart instanceof RelationEditPart)) {
// return super.getTargetConnectionAnchor(request);
// }
final ConnectionElement connection = (ConnectionElement) connectionEditPart.getModel();
if (connection.getSource() == connection.getTarget()) {
return new XYChopboxAnchor(getFigure());
}
final EditPart editPart = reconnectRequest.getTarget();
if (editPart == null || !editPart.getModel().equals(connection.getTarget())) {
return new XYChopboxAnchor(getFigure());
}
final Point location = new Point(reconnectRequest.getLocation());
getFigure().translateToRelative(location);
final IFigure targetFigure = ((AbstractModelEditPart) connectionEditPart.getTarget()).getFigure();
final XYChopboxAnchor anchor = new XYChopboxAnchor(getFigure());
final Rectangle bounds = targetFigure.getBounds();
final Rectangle centerRectangle = new Rectangle(bounds.x + (bounds.width / 4), bounds.y + (bounds.height / 4), bounds.width / 2, bounds.height / 2);
if (!centerRectangle.contains(location)) {
final Point point = getIntersectionPoint(location, targetFigure);
anchor.setLocation(point);
}
return anchor;
} else if (request instanceof CreateConnectionRequest) {
final CreateConnectionRequest connectionRequest = (CreateConnectionRequest) request;
final Command command = connectionRequest.getStartCommand();
if (command instanceof CreateCommentConnectionCommand) {
return new ChopboxAnchor(getFigure());
}
}
return new XYChopboxAnchor(getFigure());
}
示例7: getSourceConnectionAnchor
import org.eclipse.gef.requests.ReconnectRequest; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
public ConnectionAnchor getSourceConnectionAnchor(Request request) {
if (request instanceof ReconnectRequest) {
ReconnectRequest reconnectRequest = (ReconnectRequest) request;
ConnectionEditPart connectionEditPart = reconnectRequest
.getConnectionEditPart();
// if (!(connectionEditPart instanceof RelationEditPart)) {
// return super.getSourceConnectionAnchor(request);
// }
ConnectionElement connection = (ConnectionElement) connectionEditPart
.getModel();
if (connection.getSource() == connection.getTarget()) {
return new XYChopboxAnchor(this.getFigure());
}
EditPart editPart = reconnectRequest.getTarget();
if (editPart == null
|| !editPart.getModel().equals(connection.getSource())) {
return new XYChopboxAnchor(this.getFigure());
}
Point location = new Point(reconnectRequest.getLocation());
this.getFigure().translateToRelative(location);
IFigure sourceFigure = ((TableViewEditPart) connectionEditPart
.getSource()).getFigure();
XYChopboxAnchor anchor = new XYChopboxAnchor(this.getFigure());
Rectangle bounds = sourceFigure.getBounds();
Rectangle centerRectangle = new Rectangle(bounds.x
+ (bounds.width / 4), bounds.y + (bounds.height / 4),
bounds.width / 2, bounds.height / 2);
if (!centerRectangle.contains(location)) {
Point point = getIntersectionPoint(location, sourceFigure);
anchor.setLocation(point);
}
return anchor;
} else if (request instanceof CreateConnectionRequest) {
CreateConnectionRequest connectionRequest = (CreateConnectionRequest) request;
Command command = connectionRequest.getStartCommand();
if (command instanceof CreateCommentConnectionCommand) {
return new ChopboxAnchor(this.getFigure());
}
}
return new XYChopboxAnchor(this.getFigure());
}
示例8: getTargetConnectionAnchor
import org.eclipse.gef.requests.ReconnectRequest; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
public ConnectionAnchor getTargetConnectionAnchor(Request request) {
if (request instanceof ReconnectRequest) {
ReconnectRequest reconnectRequest = (ReconnectRequest) request;
ConnectionEditPart connectionEditPart = reconnectRequest
.getConnectionEditPart();
// if (!(connectionEditPart instanceof RelationEditPart)) {
// return super.getTargetConnectionAnchor(request);
// }
ConnectionElement connection = (ConnectionElement) connectionEditPart
.getModel();
if (connection.getSource() == connection.getTarget()) {
return new XYChopboxAnchor(this.getFigure());
}
EditPart editPart = reconnectRequest.getTarget();
if (editPart == null
|| !editPart.getModel().equals(connection.getTarget())) {
return new XYChopboxAnchor(this.getFigure());
}
Point location = new Point(reconnectRequest.getLocation());
this.getFigure().translateToRelative(location);
IFigure targetFigure = ((AbstractModelEditPart) connectionEditPart
.getTarget()).getFigure();
XYChopboxAnchor anchor = new XYChopboxAnchor(this.getFigure());
Rectangle bounds = targetFigure.getBounds();
Rectangle centerRectangle = new Rectangle(bounds.x
+ (bounds.width / 4), bounds.y + (bounds.height / 4),
bounds.width / 2, bounds.height / 2);
if (!centerRectangle.contains(location)) {
Point point = getIntersectionPoint(location, targetFigure);
anchor.setLocation(point);
}
return anchor;
} else if (request instanceof CreateConnectionRequest) {
CreateConnectionRequest connectionRequest = (CreateConnectionRequest) request;
Command command = connectionRequest.getStartCommand();
if (command instanceof CreateCommentConnectionCommand) {
return new ChopboxAnchor(this.getFigure());
}
}
return new XYChopboxAnchor(this.getFigure());
}
示例9: getSourceConnectionAnchor
import org.eclipse.gef.requests.ReconnectRequest; //导入方法依赖的package包/类
@Override
public ConnectionAnchor getSourceConnectionAnchor(Request request) {
if (request instanceof ReconnectRequest) {
final ReconnectRequest reconnectRequest = (ReconnectRequest) request;
final ConnectionEditPart connectionEditPart = reconnectRequest.getConnectionEditPart();
if (!(connectionEditPart instanceof RelationEditPart)) {
return super.getSourceConnectionAnchor(request);
}
final Relationship relation = (Relationship) connectionEditPart.getModel();
if (relation.getSourceWalker() == relation.getTargetWalker()) {
return new XYChopboxAnchor(getFigure());
}
final EditPart editPart = reconnectRequest.getTarget();
if (editPart == null || !editPart.getModel().equals(relation.getSourceWalker())) {
return new XYChopboxAnchor(getFigure());
}
final Point location = new Point(reconnectRequest.getLocation());
getFigure().translateToRelative(location);
final IFigure sourceFigure = ((TableViewEditPart) connectionEditPart.getSource()).getFigure();
final Rectangle bounds = sourceFigure.getBounds();
final Rectangle centerRectangle =
new Rectangle(bounds.x + (bounds.width / 4), bounds.y + (bounds.height / 4), bounds.width / 2, bounds.height / 2);
final XYChopboxAnchor anchor = new XYChopboxAnchor(getFigure());
if (!centerRectangle.contains(location)) {
final Point point = getIntersectionPoint(location, sourceFigure);
anchor.setLocation(point);
}
return anchor;
} else if (request instanceof CreateConnectionRequest) {
final CreateConnectionRequest connectionRequest = (CreateConnectionRequest) request;
final Command command = connectionRequest.getStartCommand();
if (command instanceof CreateCommentConnectionCommand) {
return super.getTargetConnectionAnchor(request);
}
}
return new XYChopboxAnchor(getFigure());
}
示例10: getTargetConnectionAnchor
import org.eclipse.gef.requests.ReconnectRequest; //导入方法依赖的package包/类
@Override
public ConnectionAnchor getTargetConnectionAnchor(Request request) {
if (request instanceof ReconnectRequest) {
final ReconnectRequest reconnectRequest = (ReconnectRequest) request;
final ConnectionEditPart connectionEditPart = reconnectRequest.getConnectionEditPart();
if (!(connectionEditPart instanceof RelationEditPart)) {
return super.getTargetConnectionAnchor(request);
}
final Relationship relation = (Relationship) connectionEditPart.getModel();
if (relation.getSourceWalker() == relation.getTargetWalker()) {
return new XYChopboxAnchor(getFigure());
}
final EditPart editPart = reconnectRequest.getTarget();
if (editPart == null || !editPart.getModel().equals(relation.getTargetWalker())) {
return new XYChopboxAnchor(getFigure());
}
final Point location = new Point(reconnectRequest.getLocation());
getFigure().translateToRelative(location);
final IFigure targetFigure = ((TableViewEditPart) connectionEditPart.getTarget()).getFigure();
final Rectangle bounds = targetFigure.getBounds();
final Rectangle centerRectangle =
new Rectangle(bounds.x + (bounds.width / 4), bounds.y + (bounds.height / 4), bounds.width / 2, bounds.height / 2);
final XYChopboxAnchor anchor = new XYChopboxAnchor(getFigure());
if (!centerRectangle.contains(location)) {
final Point point = getIntersectionPoint(location, targetFigure);
anchor.setLocation(point);
}
return anchor;
} else if (request instanceof CreateConnectionRequest) {
final CreateConnectionRequest connectionRequest = (CreateConnectionRequest) request;
final Command command = connectionRequest.getStartCommand();
if (command instanceof CreateCommentConnectionCommand) {
return super.getTargetConnectionAnchor(request);
}
}
return new XYChopboxAnchor(getFigure());
}