本文整理汇总了Java中org.eclipse.gef.requests.CreateConnectionRequest类的典型用法代码示例。如果您正苦于以下问题:Java CreateConnectionRequest类的具体用法?Java CreateConnectionRequest怎么用?Java CreateConnectionRequest使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CreateConnectionRequest类属于org.eclipse.gef.requests包,在下文中一共展示了CreateConnectionRequest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getConnectionCreateCommand
import org.eclipse.gef.requests.CreateConnectionRequest; //导入依赖的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;
}
示例2: getConnectionCompleteCommand
import org.eclipse.gef.requests.CreateConnectionRequest; //导入依赖的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;
}
示例3: getConnectionCreateCommand
import org.eclipse.gef.requests.CreateConnectionRequest; //导入依赖的package包/类
@Override
protected Command getConnectionCreateCommand(final CreateConnectionRequest request) {
final Object object = request.getNewObject();
if (object instanceof CommentConnection) {
final CommentConnection connection = (CommentConnection) object;
final CreateConnectionCommand command = new CreateCommentConnectionCommand(connection);
command.setSource(request.getTargetEditPart());
request.setStartCommand(command);
return command;
}
return null;
}
示例4: getConnectionCreateCommand
import org.eclipse.gef.requests.CreateConnectionRequest; //导入依赖的package包/类
@Override
protected Command getConnectionCreateCommand(CreateConnectionRequest request) {
Object object = request.getNewObject();
if (object instanceof CommentConnection) {
CommentConnection connection = (CommentConnection) object;
CreateConnectionCommand command = new CreateCommentConnectionCommand(
this.diagram, connection);
command.setSource(request.getTargetEditPart());
request.setStartCommand(command);
return command;
}
return null;
}
示例5: getConnectionCompleteCommand
import org.eclipse.gef.requests.CreateConnectionRequest; //导入依赖的package包/类
@Override
protected Command getConnectionCompleteCommand(CreateConnectionRequest request) {
final AbstractCreateConnectionCommand command = (AbstractCreateConnectionCommand) request.getStartCommand();
final DiagramWalkerEditPart targetEditPart = (DiagramWalkerEditPart) request.getTargetEditPart();
if (command instanceof AbstractCreateRelationshipCommand) {
if (!(targetEditPart instanceof TableViewEditPart)) {
return null;
}
}
final String validatedMessage = command.validate();
if (validatedMessage != null) {
Activator.showErrorDialog(validatedMessage);
return null;
}
command.setTarget(targetEditPart);
if (!command.canExecute()) {
return null;
}
return command;
}
示例6: getConnectionCreateCommand
import org.eclipse.gef.requests.CreateConnectionRequest; //导入依赖的package包/类
@Override
protected Command getConnectionCreateCommand(CreateConnectionRequest request) {
Object object = request.getNewObject();
if (object instanceof CommentConnection) {
CommentConnection connection = (CommentConnection) object;
CreateConnectionCommand command = new CreateCommentConnectionCommand(
connection);
command.setSource(request.getTargetEditPart());
request.setStartCommand(command);
return command;
}
return null;
}
示例7: getFeedbackHelper
import org.eclipse.gef.requests.CreateConnectionRequest; //导入依赖的package包/类
/**
* Returns the FeedbackHelper that is ready to use. The feedback helper must
* be configured with the connection that will be used to display feedback,
* and that connection must be added to the appropriate layer in the
* diagram.
*
* @param request
* the CreateConnectionRequest
* @return a FeedbackHelper
*/
protected FeedbackHelper getFeedbackHelper(CreateConnectionRequest request) {
if (feedbackHelper == null) {
feedbackHelper = new FeedbackHelper();
Point p = request.getLocation();
connectionFeedback = createDummyConnection(request);
connectionFeedback
.setConnectionRouter(getDummyConnectionRouter(request));
connectionFeedback
.setSourceAnchor(getSourceConnectionAnchor(request));
feedbackHelper.setConnection(connectionFeedback);
addFeedback(connectionFeedback);
feedbackHelper.update(null, p);
}
return feedbackHelper;
}
示例8: handleButtonDown
import org.eclipse.gef.requests.CreateConnectionRequest; //导入依赖的package包/类
/**
* When the button is first pressed, the source node and its command
* contribution are determined and locked in. After that time, the tool will
* be looking for the target node to complete the connection
*
* @see org.eclipse.gef.tools.AbstractTool#handleButtonDown(int)
* @param button
* which button is pressed
* @return <code>true</code> if the button down was processed
*/
protected boolean handleButtonDown(int button) {
if (isInState(STATE_INITIAL) && button == 1) {
updateTargetRequest();
updateTargetUnderMouse();
setConnectionSource(getTargetEditPart());
Command command = getCommand();
((CreateConnectionRequest) getTargetRequest())
.setSourceEditPart(getTargetEditPart());
if (command != null) {
setState(STATE_CONNECTION_STARTED);
setCurrentCommand(command);
viewer = getCurrentViewer();
}
}
if (isInState(STATE_INITIAL) && button != 1) {
setState(STATE_INVALID);
handleInvalidInput();
}
return true;
}
示例9: setupConnectionStartCommand
import org.eclipse.gef.requests.CreateConnectionRequest; //导入依赖的package包/类
/**
* This method creates and return the creation command for all {@link Relation}s except the
* relations from type cyclic, total, acyclic, reflexive and irrflexive.
*
* @return {@link ORMRelationCreateCommand}
* */
private ORMRelationCreateCommand setupConnectionStartCommand(
final CreateConnectionRequest request, final Model container) {
final ORMRelationCreateCommand result = new ORMRelationCreateCommand();
result.setSource((Shape) getHost().getModel());
result.setRelation((Relation) request.getNewObject());
result.setRelationContainer(container);
if (request.getNewObjectType().equals(Type.RELATIONSHIP)) {
NamedElement ele = OrmFactory.eINSTANCE.createNamedElement();
ele.setName("*");
result.setSourceLabel(ele);
NamedElement ele2 = OrmFactory.eINSTANCE.createNamedElement();
ele2.setName("*");
result.setTargetLabel(ele2);
((Relation) request.getNewObject()).getConnectionAnchor().setContainer(container);
}
request.setStartCommand(result);
return result;
}
示例10: isStartOK
import org.eclipse.gef.requests.CreateConnectionRequest; //导入依赖的package包/类
/**
* This method tests if the conditions for the creation start of a {@link Relation} kind(except
* {@link Relation}s from type total, cyclic, acyclic, reflexive and irreflexive) are fulfilled.
*
* @return boolean
* */
public boolean isStartOK(final CreateConnectionRequest request) {
// Fufillment start
return oTCheck(request, Type.FULFILLMENT, Type.NATURAL_TYPE)
|| oTCheck(request, Type.FULFILLMENT, Type.DATA_TYPE)
|| oTCheck(request, Type.FULFILLMENT, Type.COMPARTMENT_TYPE)
// Role Implication start
|| oTCheck(request, Type.ROLE_IMPLICATION, Type.ROLE_TYPE)
|| oTCheck(request, Type.ROLE_IMPLICATION, Type.ROLE_GROUP)
// Role Equivalence start
|| oTCheck(request, Type.ROLE_EQUIVALENCE, Type.ROLE_TYPE)
|| oTCheck(request, Type.ROLE_EQUIVALENCE, Type.ROLE_GROUP)
// Role Prohibition start
|| oTCheck(request, Type.ROLE_PROHIBITION, Type.ROLE_TYPE)
|| oTCheck(request, Type.ROLE_PROHIBITION, Type.ROLE_GROUP)
// Inheritance start
|| oTCheck(request, Type.INHERITANCE, Type.NATURAL_TYPE)
|| oTCheck(request, Type.INHERITANCE, Type.DATA_TYPE)
|| oTCheck(request, Type.INHERITANCE, Type.ROLE_TYPE)
|| oTCheck(request, Type.INHERITANCE, Type.COMPARTMENT_TYPE)
// Relationship start
|| oTCheck(request, Type.RELATIONSHIP, Type.ROLE_TYPE);
}
示例11: hasConstraintsKind
import org.eclipse.gef.requests.CreateConnectionRequest; //导入依赖的package包/类
/**
* This method tests if between source edit part and traget edit part already exist a
* relationshipConstraint(total,irrflexive,cyclic, acyclic, reflexive) kind of the requested relationshipConstraint
* kind.
*
* @return boolean
* */
private boolean hasConstraintsKind(final CreateConnectionRequest request) {
if (testedRelationship != null) {
for (Relation rel : testedRelationship.getReferencedRelation()) {
if (request.getNewObjectType().equals(Type.IRREFLEXIVE)
&& rel.getType().equals(Type.IRREFLEXIVE))
return true;
if (request.getNewObjectType().equals(Type.TOTAL) && rel.getType().equals(Type.TOTAL))
return true;
if (request.getNewObjectType().equals(Type.CYCLIC) && rel.getType().equals(Type.CYCLIC))
return true;
if (request.getNewObjectType().equals(Type.ACYCLIC) && rel.getType().equals(Type.ACYCLIC))
return true;
if (request.getNewObjectType().equals(Type.REFLEXIVE) && rel.getType().equals(Type.REFLEXIVE))
return true;
}
}
return false;
}
示例12: getConnectionCompleteCommand
import org.eclipse.gef.requests.CreateConnectionRequest; //导入依赖的package包/类
protected org.eclipse.gef.commands.Command getConnectionCompleteCommand(
CreateConnectionRequest request )
{
ConnectionCommand command = (ConnectionCommand) request.getStartCommand( );
if ( command == null )
return null;
EditPart sourcePart = command.getSource( );
if ( !( getHost( ) instanceof ColumnEditPart )
|| getHost( ) == sourcePart
|| getHost( ).getParent( ) == sourcePart.getParent( ) )
{
return null;
}
ColumnEditPart targetPart = (ColumnEditPart) getHost( );
command.setTarget( targetPart );
AddJoinConditionCommand addJoinConditionCommand = new AddJoinConditionCommand( sourcePart,
targetPart );
return addJoinConditionCommand;
}
示例13: getConnectionCompleteCommand
import org.eclipse.gef.requests.CreateConnectionRequest; //导入依赖的package包/类
@Override
protected Command getConnectionCompleteCommand(CreateConnectionRequest req) {
CreateLinkCommand cmd = (CreateLinkCommand) req.getStartCommand();
if (cmd == null)
return null;
ExchangeNode toConnect = (ExchangeNode) req.getTargetEditPart().getModel();
ExchangeNode other = cmd.startedFromOutput ? cmd.output : cmd.input;
if (!toConnect.matches(other) || toConnect.parent().isConnected(toConnect.exchange.getId())) {
cmd.completeWith(null);
req.setStartCommand(cmd);
return null;
}
cmd.completeWith(toConnect);
req.setStartCommand(cmd);
if (cmd.output == null || cmd.input == null)
return null;
return cmd;
}
示例14: getConnectionCreateCommand
import org.eclipse.gef.requests.CreateConnectionRequest; //导入依赖的package包/类
@Override
protected Command getConnectionCreateCommand(CreateConnectionRequest request) {
Node start = (Node) getHost().getModel();
if (start instanceof ServiceOperationNode || start instanceof TriggerInstanceTerminalNode || start instanceof DynamicTriggerInstanceTerminalNode || start instanceof ModuleOperationNode) {
LinkCreateCommand cmd = new LinkCreateCommand();
cmd.setSource(start);
cmd.setLink((Link) request.getNewObject());
request.setStartCommand(cmd);
return cmd;
}
return null;
}
示例15: getConnectionCompleteCommand
import org.eclipse.gef.requests.CreateConnectionRequest; //导入依赖的package包/类
@Override
protected Command getConnectionCompleteCommand(CreateConnectionRequest request) {
LinkCreateCommand cmd = (LinkCreateCommand) request.getStartCommand();
Node end = (Node) getHost().getModel();
Node start = cmd.getSource();
if (end instanceof ReferenceNode && (!(start.getParent().getId().equalsIgnoreCase(end.getParent().getId())))) {
ReferenceNode nd = (ReferenceNode) end;
ServiceNode st = (ServiceNode) start;
if (nd.getIntf().equalsIgnoreCase(st.getIntf())) {
cmd.setTarget(end);
return cmd;
}
}
return null;
}