本文整理汇总了Java中org.eclipse.graphiti.mm.pictograms.Connection类的典型用法代码示例。如果您正苦于以下问题:Java Connection类的具体用法?Java Connection怎么用?Java Connection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Connection类属于org.eclipse.graphiti.mm.pictograms包,在下文中一共展示了Connection类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: add
import org.eclipse.graphiti.mm.pictograms.Connection; //导入依赖的package包/类
@Override
public PictogramElement add(IAddContext context) {
IAddConnectionContext addConContext = (IAddConnectionContext) context;
Relation addedRelation = (Relation) context.getNewObject();
IPeCreateService peCreateService = Graphiti.getPeCreateService();
// CONNECTION WITH POLYLINE
Connection connection = peCreateService.createFreeFormConnection(getDiagram());
connection.setStart(addConContext.getSourceAnchor());
connection.setEnd(addConContext.getTargetAnchor());
IGaService gaService = Graphiti.getGaService();
Polyline polyline = gaService.createPolyline(connection);
polyline.setLineWidth(2);
polyline.setForeground(manageColor(CONNECTION_FOREGROUND));
// create link and wire it
link(connection, addedRelation);
return connection;
}
开发者ID:eclipse,项目名称:triquetrum,代码行数:22,代码来源:ConnectionAddFeature.java
示例2: create
import org.eclipse.graphiti.mm.pictograms.Connection; //导入依赖的package包/类
@Override
public Connection create(final ICreateConnectionContext context) {
Anchor _sourceAnchor = context.getSourceAnchor();
AnchorContainer _parent = _sourceAnchor.getParent();
Object _businessObjectForPictogramElement = this.getBusinessObjectForPictogramElement(_parent);
final State source = ((State) _businessObjectForPictogramElement);
Anchor _targetAnchor = context.getTargetAnchor();
AnchorContainer _parent_1 = _targetAnchor.getParent();
Object _businessObjectForPictogramElement_1 = this.getBusinessObjectForPictogramElement(_parent_1);
final State target = ((State) _businessObjectForPictogramElement_1);
final Transition transition = StatemachineFactory.eINSTANCE.createTransition();
transition.setSourceState(source);
transition.setTargetState(target);
EObject _eContainer = source.eContainer();
final Statemachine statemachine = ((Statemachine) _eContainer);
EList<Transition> _transitions = statemachine.getTransitions();
_transitions.add(transition);
Anchor _sourceAnchor_1 = context.getSourceAnchor();
Anchor _targetAnchor_1 = context.getTargetAnchor();
final AddConnectionContext addContext = new AddConnectionContext(_sourceAnchor_1, _targetAnchor_1);
addContext.setNewObject(transition);
IFeatureProvider _featureProvider = this.getFeatureProvider();
PictogramElement _addIfPossible = _featureProvider.addIfPossible(addContext);
return ((Connection) _addIfPossible);
}
开发者ID:spoenemann,项目名称:xtext-gef,代码行数:26,代码来源:CreateTransitionFeature.java
示例3: createConnectionText
import org.eclipse.graphiti.mm.pictograms.Connection; //导入依赖的package包/类
private String createConnectionText (org.scaledl.overview.architecture.Connection c)
{
String format = "%s \n Latency: %s \n Bandwidth: %s";
String t = String.format(format, c.getName(), "?", "?");
if (c instanceof ExternalConnection)
{
ExternalConnection ec = (ExternalConnection)c;
t = String.format(format, c.getName(), ec.getLatency(), ec.getBandwidth());
}
else{
return "";
}
return t;
}
开发者ID:CloudScale-Project,项目名称:Environment,代码行数:17,代码来源:UpdateConnectionService.java
示例4: canExecute
import org.eclipse.graphiti.mm.pictograms.Connection; //导入依赖的package包/类
@Override
public boolean canExecute(final ICustomContext context) {
for (PictogramElement pe : context.getPictogramElements()) {
if (pe instanceof Connection) {
Connection connection = (Connection) pe;
return getBusinessObjectForPictogramElement(connection.getStart()) instanceof OutputModel
&& getBusinessObjectForPictogramElement(connection.getEnd()) instanceof InputModel;
} else {
Object bo = getBusinessObjectForPictogramElement(pe);
if (bo instanceof FunctionBlockModel || bo instanceof OutputModel || bo instanceof InputModel) {
return true;
}
}
}
return false;
}
开发者ID:DesignAndDeploy,项目名称:dnd,代码行数:17,代码来源:DebugFeature.java
示例5: execute
import org.eclipse.graphiti.mm.pictograms.Connection; //导入依赖的package包/类
@Override
public void execute(final ICustomContext context) {
if (!LOGGER.isDebugEnabled()) {
LOGGER.warn("debuging is not enabled"); //$NON-NLS-1$
return;
}
for (PictogramElement pe : context.getPictogramElements()) {
if (pe instanceof Connection) {
logConnection((Connection) pe);
} else {
Object bo = getBusinessObjectForPictogramElement(pe);
if (bo instanceof FunctionBlockModel) {
logFunctionBlock((FunctionBlockModel) bo);
} else if (bo instanceof OutputModel) {
logOutput((OutputModel) bo);
} else if (bo instanceof InputModel) {
logInput((InputModel) bo);
}
}
}
}
开发者ID:DesignAndDeploy,项目名称:dnd,代码行数:22,代码来源:DebugFeature.java
示例6: canRemove
import org.eclipse.graphiti.mm.pictograms.Connection; //导入依赖的package包/类
@Override
public boolean canRemove(final IRemoveContext context) {
LOGGER.entry(context);
if (!(context.getPictogramElement() instanceof Connection)) {
LOGGER.debug("not a Connection");
return false;
}
Connection connection = (Connection) context.getPictogramElement();
if (!(getBusinessObjectForPictogramElement(connection.getStart()) instanceof OutputModel)) {
LOGGER.debug("begin is not a OutputModel");
return false;
}
if (!(getBusinessObjectForPictogramElement(connection.getEnd()) instanceof InputModel)) {
LOGGER.debug("end is not a InputModel");
return false;
}
return true;
}
开发者ID:DesignAndDeploy,项目名称:dnd,代码行数:19,代码来源:RemoveDataConnectionFeature.java
示例7: create
import org.eclipse.graphiti.mm.pictograms.Connection; //导入依赖的package包/类
@Override
public Connection create(final ICreateConnectionContext context) {
Anchor sourceAnchor = context.getSourceAnchor();
Anchor targetAnchor = context.getTargetAnchor();
if (getBusinessObjectForPictogramElement(sourceAnchor) instanceof InputModel) {
Anchor temp = sourceAnchor;
sourceAnchor = targetAnchor;
targetAnchor = temp;
}
OutputModel output = (OutputModel) getBusinessObjectForPictogramElement(sourceAnchor);
InputModel input = (InputModel) getBusinessObjectForPictogramElement(targetAnchor);
if (input.getOutput() != null) {
LOGGER.info("Removing old connection"); //$NON-NLS-1$
IRemoveContext removeContext = new RemoveContext(targetAnchor.getIncomingConnections().get(0));
IRemoveFeature removeFeature = new RemoveDataConnectionFeature(getFeatureProvider());
if (removeFeature.canExecute(removeContext)) {
removeFeature.execute(removeContext);
} else {
LOGGER.warn("could not remove"); //$NON-NLS-1$
}
}
input.setOutput(output);
AddConnectionContext addContext = new AddConnectionContext(sourceAnchor, targetAnchor);
return (Connection) getFeatureProvider().addIfPossible(addContext);
}
开发者ID:DesignAndDeploy,项目名称:dnd,代码行数:26,代码来源:CreateDataConnectionFeature.java
示例8: execute
import org.eclipse.graphiti.mm.pictograms.Connection; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public void execute(ICustomContext context) {
Diagram diagram = getDiagram();
CompoundDirectedGraph draw2dGrap = new CompoundDirectedGraph();
BiMap<PictogramElement, Node> draw2dGraphMap = HashBiMap.create();
for (Shape shape : diagram.getChildren()) {
final EObject eObject = Graphiti.getLinkService().getBusinessObjectForLinkedPictogramElement(shape);
if (eObject instanceof ProcessingUnit || eObject instanceof Medium) {
Node node = new Node();
draw2dGrap.nodes.add(node);
node.setSize(new Dimension(SHAPE_WIDTH, SHAPE_HEIGHT));
draw2dGraphMap.put(shape, node);
}
}
for (Connection connection : diagram.getConnections()) {
Node start = draw2dGraphMap.get(connection.getEnd().getParent());
Node end = draw2dGraphMap.get(connection.getStart().getParent());
Edge edge = new Edge(start, end);
draw2dGrap.edges.add(edge);
}
new CompoundDirectedGraphLayout().visit(draw2dGrap);
for (Entry<PictogramElement, Node> e : draw2dGraphMap.entrySet()) {
PictogramElement pe = e.getKey();
Node n = e.getValue();
Graphiti.getGaService().setLocation(pe.getGraphicsAlgorithm(), n.x, n.y);
}
hasDoneChanges = true;
}
开发者ID:turnus,项目名称:turnus,代码行数:36,代码来源:AutoLayoutFeauture.java
示例9: deleteLinks
import org.eclipse.graphiti.mm.pictograms.Connection; //导入依赖的package包/类
public static boolean deleteLinks(IFeatureProvider fp, AnchorContainer ac) {
boolean deleted = true;
List<Connection> connections = Graphiti.getPeService().getAllConnections(ac);
for (Connection connection : connections) {
deleted &= deleteLink(fp, connection);
}
return deleted;
}
开发者ID:turnus,项目名称:turnus,代码行数:10,代码来源:ArchitectureUtils.java
示例10: deleteLink
import org.eclipse.graphiti.mm.pictograms.Connection; //导入依赖的package包/类
public static boolean deleteLink(IFeatureProvider fp, Connection connection) {
// Initialize the delete context
final DeleteContext delCtxt = new DeleteContext(connection);
delCtxt.setMultiDeleteInfo(new MultiDeleteInfo(false, false, 1));
// Silently execute deletion (user will not be asked before deletion)
final IDeleteFeature delFeature = fp.getDeleteFeature(delCtxt);
if (delFeature.canDelete(delCtxt)) {
delFeature.delete(delCtxt);
return true;
}
return false;
}
开发者ID:turnus,项目名称:turnus,代码行数:15,代码来源:ArchitectureUtils.java
示例11: canDelete
import org.eclipse.graphiti.mm.pictograms.Connection; //导入依赖的package包/类
@Override
public boolean canDelete(IDeleteContext context) {
PictogramElement connectionPE = context.getPictogramElement();
if (connectionPE instanceof Connection) {
Object bo = getBusinessObjectForPictogramElement(context.getPictogramElement());
return (bo instanceof Relation);
} else {
return false;
}
}
开发者ID:eclipse,项目名称:triquetrum,代码行数:11,代码来源:ConnectionDeleteFeature.java
示例12: canRemove
import org.eclipse.graphiti.mm.pictograms.Connection; //导入依赖的package包/类
@Override
public boolean canRemove(IRemoveContext context) {
PictogramElement connectionPE = context.getPictogramElement();
if (connectionPE instanceof Connection) {
Object bo = getBusinessObjectForPictogramElement(context.getPictogramElement());
return (bo instanceof Relation);
} else {
return false;
}
}
开发者ID:eclipse,项目名称:triquetrum,代码行数:11,代码来源:ConnectionRemoveFeature.java
示例13: remove
import org.eclipse.graphiti.mm.pictograms.Connection; //导入依赖的package包/类
@Override
public void remove(IRemoveContext context) {
Connection connectionPE = (Connection) context.getPictogramElement();
Relation relation = (Relation) getBusinessObjectForPictogramElement(connectionPE);
if (relation != null) {
Linkable startBO = (Linkable) getBusinessObjectForPictogramElement(connectionPE.getStart());
Linkable endBO = (Linkable) getBusinessObjectForPictogramElement(connectionPE.getEnd());
startBO.unlink(relation);
endBO.unlink(relation);
}
super.remove(context);
}
开发者ID:eclipse,项目名称:triquetrum,代码行数:13,代码来源:ConnectionRemoveFeature.java
示例14: getDeleteFeature
import org.eclipse.graphiti.mm.pictograms.Connection; //导入依赖的package包/类
@Override
public IDeleteFeature getDeleteFeature(IDeleteContext context) {
PictogramElement pe = context.getPictogramElement();
Object bo = getBusinessObjectForPictogramElement(pe);
if (bo instanceof Actor) {
return new ActorDeleteFeature(this);
} else if (pe instanceof Connection) {
return new ConnectionDeleteFeature(this);
}
return new TriqDefaultDeleteFeature(this);
}
开发者ID:eclipse,项目名称:triquetrum,代码行数:12,代码来源:TriqFeatureProvider.java
示例15: setup
import org.eclipse.graphiti.mm.pictograms.Connection; //导入依赖的package包/类
private void setup() {
final PictogramElement pictogramElement = context.getPictogramElement();
final Object bo = getBusinessObjectForPictogramElement(pictogramElement);
if (pictogramElement instanceof Connection) {
final Connection anchor = (Connection) pictogramElement;
final Object startPE = getBusinessObjectForPictogramElement(anchor.getStart().getParent().getLink()
.getPictogramElement());
if (startPE instanceof FlowElement) {
targetStartObject = (FlowElement) startPE;
graphicalStartId = targetStartObject.getId();
}
final Object endPE = getBusinessObjectForPictogramElement(anchor.getEnd().getParent().getLink()
.getPictogramElement());
if (endPE instanceof FlowElement) {
targetEndObject = (FlowElement) endPE;
graphicalEndId = targetEndObject.getId();
}
businessModelObjectToUpdate = ((SequenceFlow) bo);
businessStartId = businessModelObjectToUpdate.getSourceRef().getId();
businessEndId = businessModelObjectToUpdate.getTargetRef().getId();
}
}
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:33,代码来源:UpdateConnectionFlowElementFeature.java
示例16: canAdd
import org.eclipse.graphiti.mm.pictograms.Connection; //导入依赖的package包/类
public boolean canAdd(IAddContext context) {
// return true if given business object is an EReference
// note, that the context must be an instance of IAddConnectionContext
if (context instanceof IAddConnectionContext && context.getNewObject() instanceof org.scaledl.overview.architecture.Connection)
{
return true;
}
return false;
}
开发者ID:CloudScale-Project,项目名称:Environment,代码行数:10,代码来源:AddConnectionFeature.java
示例17: add
import org.eclipse.graphiti.mm.pictograms.Connection; //导入依赖的package包/类
@Override
public PictogramElement add(IAddContext context) {
IAddConnectionContext addConContext = (IAddConnectionContext) context;
IPeCreateService peCreateService = Graphiti.getPeCreateService();
Link connector = (Link) context.getNewObject();
// CONNECTION WITH POLYLINE
Connection connection = peCreateService.createFreeFormConnection(getDiagram());
connection.setStart(addConContext.getSourceAnchor());
connection.setEnd(addConContext.getTargetAnchor());
IGaService gaService = Graphiti.getGaService();
Polyline line = gaService.createPolyline(connection);
line.setLineWidth(2);
if(connector.isRequired()){
line.setLineStyle(LineStyle.SOLID);
}
else{
line.setLineStyle(LineStyle.DASH);
};
ConnectionDecorator cd;
cd = peCreateService.createConnectionDecorator(connection, false, 1.0, true);
createArrow(cd);
link(connection, connector);
return connection;
}
开发者ID:CloudScale-Project,项目名称:Environment,代码行数:32,代码来源:ConnectorPattern.java
示例18: getRemoveFeature
import org.eclipse.graphiti.mm.pictograms.Connection; //导入依赖的package包/类
@Override
public final IRemoveFeature getRemoveFeature(final IRemoveContext context) {
if (context.getPictogramElement() instanceof Connection) {
return new RemoveDataConnectionFeature(this);
}
return super.getRemoveFeature(context);
}
开发者ID:DesignAndDeploy,项目名称:dnd,代码行数:8,代码来源:FeatureProvider.java
示例19: add
import org.eclipse.graphiti.mm.pictograms.Connection; //导入依赖的package包/类
@Override
public PictogramElement add(final IAddContext context) {
LOGGER.entry(context);
IAddConnectionContext addConContext = (IAddConnectionContext) context;
IPeCreateService peCreateService = Graphiti.getPeCreateService();
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Connecting {} and {}", getBusinessObjectForPictogramElement(addConContext.getSourceAnchor()),
getBusinessObjectForPictogramElement(addConContext.getTargetAnchor()));
}
// CONNECTION WITH POLYLINE
LOGGER.debug("creating polyline");
Connection connection = peCreateService.createFreeFormConnection(getDiagram());
connection.setStart(addConContext.getSourceAnchor());
connection.setEnd(addConContext.getTargetAnchor());
LOGGER.debug("Connection is {}", connection);
IGaService gaService = Graphiti.getGaService();
Polyline polyline = gaService.createPolyline(connection);
polyline.setLineWidth(2);
polyline.setForeground(manageColor(IColorConstant.RED));
LOGGER.debug("Polyline is {}", polyline);
LOGGER.exit(connection);
return connection;
}
开发者ID:DesignAndDeploy,项目名称:dnd,代码行数:28,代码来源:AddDataConnectionFeature.java
示例20: logConnection
import org.eclipse.graphiti.mm.pictograms.Connection; //导入依赖的package包/类
/**
* Logs information about a connection.
*
* @param connection
* the connection to inspect
*/
private void logConnection(final Connection connection) {
OutputModel output = (OutputModel) getBusinessObjectForPictogramElement(connection.getStart());
InputModel input = (InputModel) getBusinessObjectForPictogramElement(connection.getEnd());
LOGGER.debug("Connecting {}({}):{} to {}({}):{}", output.getFunctionBlock().getID(), output.getFunctionBlock() //$NON-NLS-1$
.getType(), output.getName(), input.getFunctionBlock().getID(), input.getFunctionBlock().getType(),
input.getName());
}
开发者ID:DesignAndDeploy,项目名称:dnd,代码行数:14,代码来源:DebugFeature.java
注:本文中的org.eclipse.graphiti.mm.pictograms.Connection类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论