org.eclipse.gmf.runtime.notation.Edge Java Examples
The following examples show how to use
org.eclipse.gmf.runtime.notation.Edge.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CrossflowViewProvider.java From scava with Eclipse Public License 2.0 | 6 votes |
/** * @generated */ public Edge createEdge(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) { IElementType elementType = getSemanticElementType(semanticAdapter); String elementTypeHint = ((IHintedType) elementType).getSemanticHint(); switch (CrossflowVisualIDRegistry.getVisualID(elementTypeHint)) { case StreamTypeEditPart.VISUAL_ID: return createStreamType_4001(containerView, index, persisted, preferencesHint); case StreamInputOfEditPart.VISUAL_ID: return createStreamInputOf_4005(containerView, index, persisted, preferencesHint); case TaskOutputEditPart.VISUAL_ID: return createTaskOutput_4003(containerView, index, persisted, preferencesHint); case TypeExtendingEditPart.VISUAL_ID: return createTypeExtending_4004(containerView, index, persisted, preferencesHint); } // can never happen, provided #provides(CreateEdgeViewOperation) is correct return null; }
Example #2
Source File: ProcessViewProvider.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
/** * @generated */ public Edge createEdge(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) { IElementType elementType = getSemanticElementType(semanticAdapter); String elementTypeHint = ((IHintedType) elementType).getSemanticHint(); switch (ProcessVisualIDRegistry.getVisualID(elementTypeHint)) { case SequenceFlowEditPart.VISUAL_ID: return createSequenceFlow_4001(getSemanticElement(semanticAdapter), containerView, index, persisted, preferencesHint); case MessageFlowEditPart.VISUAL_ID: return createMessageFlow_4002(getSemanticElement(semanticAdapter), containerView, index, persisted, preferencesHint); case TextAnnotationAttachmentEditPart.VISUAL_ID: return createTextAnnotationAttachment_4003(getSemanticElement(semanticAdapter), containerView, index, persisted, preferencesHint); } // can never happen, provided #provides(CreateEdgeViewOperation) is correct return null; }
Example #3
Source File: ProcessValidationDecoratorProvider.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
/** * @generated */ public void createDecorators(IDecoratorTarget decoratorTarget) { EditPart editPart = (EditPart) decoratorTarget.getAdapter(EditPart.class); if (editPart instanceof GraphicalEditPart || editPart instanceof AbstractConnectionEditPart) { Object model = editPart.getModel(); if ((model instanceof View)) { View view = (View) model; if (!(view instanceof Edge) && !view.isSetElement()) { return; } } EditDomain ed = editPart.getViewer().getEditDomain(); if (!(ed instanceof DiagramEditDomain)) { return; } if (((DiagramEditDomain) ed).getEditorPart() instanceof ProcessDiagramEditor) { decoratorTarget.installDecorator(KEY, new StatusDecorator(decoratorTarget)); } } }
Example #4
Source File: RemoveDanglingReferences.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
private void removeSequenceFlowWithoutSourceAndTarget(EObject element) { if (element.eResource() != null && element.eResource().getResourceSet() != null) { final List<EObject> toRemove = new ArrayList<>(); element.eAllContents().forEachRemaining(eObject -> { if (eObject instanceof Connection && (((Connection) eObject).getTarget() == null || ((Connection) eObject).getSource() == null)) { toRemove.add(eObject); } if (eObject instanceof MessageFlow && (((MessageFlow) eObject).getTarget() == null || ((MessageFlow) eObject).getSource() == null)) { toRemove.add(eObject); } if (eObject instanceof Edge && (((Edge) eObject).getTarget() == null || ((Edge) eObject).getSource() == null)) { toRemove.add(eObject); } }); toRemove.forEach(EcoreUtil::remove); } }
Example #5
Source File: InlineSubdiagramRefactoring.java From statecharts with Eclipse Public License 1.0 | 6 votes |
@SuppressWarnings("unchecked") @Override protected void internalExecute() { BooleanValueStyle inlineStyle = getInlineStyle(getContextObject()); if (inlineStyle == null) { inlineStyle = createInlineStyle(); getContextObject().getStyles().add(inlineStyle); } inlineStyle.setBooleanValue(true); View contextView = getContextObject(); State contextElement = (State) contextView.getElement(); Diagram diagramToInline = DiagramPartitioningUtil.getSubDiagram(contextElement); View containerView = ViewUtil.getChildBySemanticHint(contextView, SemanticHints.STATE_FIGURE_COMPARTMENT); while (diagramToInline.getChildren().size() > 0) { containerView.insertChild((View) diagramToInline.getChildren().get(0)); } while (diagramToInline.getEdges().size() > 0) { containerView.getDiagram().insertEdge((Edge) diagramToInline.getEdges().get(0)); } getResource().getContents().remove(diagramToInline); }
Example #6
Source File: ExtractSubdiagramRefactoring.java From statecharts with Eclipse Public License 1.0 | 6 votes |
protected void createEntryPoint(Edge edge, Diagram subdiagram) { Transition transition = (Transition) edge.getElement(); Region entryPointContainer = getEntryPointContainer(transition); Entry entryPoint = createSemanticEntryPoint(transition); // re-wire old transition to targeting the selected state transition.setTarget((State) subdiagram.getElement()); View oldTarget = edge.getTarget(); edge.setTarget(getContextObject()); // create node for entry point View entryPointContainerView = helper.getViewForSemanticElement(entryPointContainer, subdiagram); View entryPointRegionCompartment = ViewUtil.getChildBySemanticHint(entryPointContainerView, SemanticHints.REGION_COMPARTMENT); Node entryNode = ViewService.createNode(entryPointRegionCompartment, entryPoint, SemanticHints.ENTRY, preferencesHint); ViewService.createEdge(entryNode, oldTarget, entryPoint.getOutgoingTransitions().get(0), SemanticHints.TRANSITION, preferencesHint); addEntryPointSpec(transition, entryPoint); }
Example #7
Source File: InitialPointsConnectionBendpointEditPolicy.java From statecharts with Eclipse Public License 1.0 | 6 votes |
@Override protected Command getBendpointsChangedCommand(Connection connection, Edge edge) { Point ptRef1 = connection.getSourceAnchor().getReferencePoint(); getConnection().translateToRelative(ptRef1); Point ptRef2 = connection.getTargetAnchor().getReferencePoint(); getConnection().translateToRelative(ptRef2); TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain(); SetConnectionBendpointsAndLabelCommmand sbbCommand = new SetConnectionBendpointsAndLabelCommmand(editingDomain); sbbCommand.setEdgeAdapter(new EObjectAdapter(edge)); sbbCommand.setNewPointList(connection.getPoints(), ptRef1, ptRef2); return new ICommandProxy(sbbCommand); }
Example #8
Source File: NotationClipboardOperationHelper.java From statecharts with Eclipse Public License 1.0 | 6 votes |
/** * By default, don't provide any child paste override behaviour. * * @return <code>null</code>, always */ public OverridePasteChildOperation getOverrideChildPasteOperation( PasteChildOperation overriddenChildPasteOperation) { if (shouldAllowPaste(overriddenChildPasteOperation)) { EObject eObject = overriddenChildPasteOperation.getEObject(); if (eObject instanceof org.eclipse.gmf.runtime.notation.Node) { org.eclipse.gmf.runtime.notation.Node node = (org.eclipse.gmf.runtime.notation.Node) eObject; EObject element = node.getElement(); if ((element != null)) { return new PositionalGeneralViewPasteOperation(overriddenChildPasteOperation, true); } else { return new PositionalGeneralViewPasteOperation(overriddenChildPasteOperation, false); } } else if (eObject instanceof Edge) { return new ConnectorViewPasteOperation(overriddenChildPasteOperation); } else if (eObject instanceof Diagram) { return new DiagramPasteOperation(overriddenChildPasteOperation); } } return null; }
Example #9
Source File: ConnectorViewPasteOperation.java From statecharts with Eclipse Public License 1.0 | 6 votes |
public void paste() throws Exception { //basically delay... connectorView = (Edge) getEObject(); sourceView = connectorView.getSource(); targetView = connectorView.getTarget(); EObject element = connectorView.getElement(); if (element != null) { if (element.eIsProxy()) { element = ClipboardSupportUtil.resolve(element, getParentPasteProcess().getLoadedIDToEObjectMapCopy()); } if (element.eIsProxy() == false) { pasteSemanticElement = true; } } }
Example #10
Source File: CrossflowValidationDecoratorProvider.java From scava with Eclipse Public License 2.0 | 6 votes |
/** * @generated */ public void createDecorators(IDecoratorTarget decoratorTarget) { EditPart editPart = (EditPart) decoratorTarget.getAdapter(EditPart.class); if (editPart instanceof GraphicalEditPart || editPart instanceof AbstractConnectionEditPart) { Object model = editPart.getModel(); if ((model instanceof View)) { View view = (View) model; if (!(view instanceof Edge) && !view.isSetElement()) { return; } } EditDomain ed = editPart.getViewer().getEditDomain(); if (!(ed instanceof DiagramEditDomain)) { return; } if (((DiagramEditDomain) ed).getEditorPart() instanceof CrossflowDiagramEditor) { decoratorTarget.installDecorator(KEY, new StatusDecorator(decoratorTarget)); } } }
Example #11
Source File: SetLabelsOffsetOperation.java From statecharts with Eclipse Public License 1.0 | 5 votes |
/** * Update {@link Bounds} of a label {@link Node}. * * @param labelEdgeEditPart the editPart of the edge label to be updated * @param connectionEditPart The connection having these labels */ private void computeGMFLabelOffset(LabelEditPart labelEditPartToUpdate, ConnectionEditPart connectionEditPart) { Point newLabelOffset = null; Node labelNodeToUpdate = (Node) labelEditPartToUpdate.getModel(); if (connectionEditPart.getModel() instanceof Edge) { PointList oldBendpoints = oldBendPointsList; if (oldBendpoints == null) { // System.out.println("read current points"); oldBendpoints = connectionEditPart.getConnectionFigure().getPoints(); } boolean isEdgeWithObliqueRoutingStyle = isEdgeWithObliqueRoutingStyle(connectionEditPart); LayoutConstraint layoutConstraint = labelNodeToUpdate.getLayoutConstraint(); if (layoutConstraint instanceof Location) { Location point = (Location) layoutConstraint; newLabelOffset = new EdgeLabelQuery(oldBendpoints, newPointList, isEdgeWithObliqueRoutingStyle, new Point(point.getX(), point.getY()), labelEditPartToUpdate.getFigure().getSize(), labelEditPartToUpdate.getKeyPoint(), false).calculateGMFLabelOffset(); // System.out.println("queried label offset = " + newLabelOffset); if ((newLabelOffset.x == 0) && (newLabelOffset.y == 0)) { newLabelOffset = null; } } } if (newLabelOffset != null) { // System.out.println("store label offset"); labelsWithNewOffset.put(labelNodeToUpdate, newLabelOffset); } }
Example #12
Source File: SubProcessEvent2ItemSemanticEditPolicy.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** * @generated */ protected Command getDestroyElementCommand(DestroyElementRequest req) { View view = (View) getHost().getModel(); CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(getEditingDomain(), null); cmd.setTransactionNestingEnabled(false); for (Iterator<?> it = view.getTargetEdges().iterator(); it.hasNext();) { Edge incomingLink = (Edge) it.next(); if (ProcessVisualIDRegistry.getVisualID(incomingLink) == TextAnnotationAttachmentEditPart.VISUAL_ID) { DestroyElementRequest r = new DestroyElementRequest(incomingLink.getElement(), false); cmd.add(new DestroyElementCommand(r)); cmd.add(new DeleteCommand(getEditingDomain(), incomingLink)); continue; } } EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$ if (annotation == null) { // there are indirectly referenced children, need extra commands: false addDestroyChildNodesCommand(cmd); addDestroyShortcutsCommand(cmd, view); // delete host element cmd.add(new DestroyElementCommand(req)); } else { cmd.add(new DeleteCommand(getEditingDomain(), view)); } final EObject pool = req.getElementToDestroy(); if (pool instanceof Pool) { for (MessageFlow f : ModelHelper.getMainProcess(pool).getMessageConnections()) { if (pool.equals(ModelHelper.getParentProcess(f.getSource()))) { cmd.add(new DestroyElementCommand(new DestroyElementRequest(f, false))); } } } return getGEFWrapper(cmd.reduce()); }
Example #13
Source File: PoolItemSemanticEditPolicy.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** * @generated */ protected Command getDestroyElementCommand(DestroyElementRequest req) { View view = (View) getHost().getModel(); CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(getEditingDomain(), null); cmd.setTransactionNestingEnabled(false); for (Iterator<?> it = view.getTargetEdges().iterator(); it.hasNext();) { Edge incomingLink = (Edge) it.next(); if (ProcessVisualIDRegistry.getVisualID(incomingLink) == TextAnnotationAttachmentEditPart.VISUAL_ID) { DestroyElementRequest r = new DestroyElementRequest(incomingLink.getElement(), false); cmd.add(new DestroyElementCommand(r)); cmd.add(new DeleteCommand(getEditingDomain(), incomingLink)); continue; } } EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$ if (annotation == null) { // there are indirectly referenced children, need extra commands: false addDestroyChildNodesCommand(cmd); addDestroyShortcutsCommand(cmd, view); // delete host element cmd.add(new DestroyElementCommand(req)); } else { cmd.add(new DeleteCommand(getEditingDomain(), view)); } final EObject pool = req.getElementToDestroy(); if (pool instanceof Pool) { for (MessageFlow f : ModelHelper.getMainProcess(pool).getMessageConnections()) { if (pool.equals(ModelHelper.getParentProcess(f.getSource()))) { cmd.add(new DestroyElementCommand(new DestroyElementRequest(f, false))); } } } return getGEFWrapper(cmd.reduce()); }
Example #14
Source File: LaneItemSemanticEditPolicy.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** * @generated */ protected Command getDestroyElementCommand(DestroyElementRequest req) { View view = (View) getHost().getModel(); CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(getEditingDomain(), null); cmd.setTransactionNestingEnabled(false); for (Iterator<?> it = view.getTargetEdges().iterator(); it.hasNext();) { Edge incomingLink = (Edge) it.next(); if (ProcessVisualIDRegistry.getVisualID(incomingLink) == TextAnnotationAttachmentEditPart.VISUAL_ID) { DestroyElementRequest r = new DestroyElementRequest(incomingLink.getElement(), false); cmd.add(new DestroyElementCommand(r)); cmd.add(new DeleteCommand(getEditingDomain(), incomingLink)); continue; } } EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$ if (annotation == null) { // there are indirectly referenced children, need extra commands: false addDestroyChildNodesCommand(cmd); addDestroyShortcutsCommand(cmd, view); // delete host element cmd.add(new DestroyElementCommand(req)); } else { cmd.add(new DeleteCommand(getEditingDomain(), view)); } final EObject pool = req.getElementToDestroy(); if (pool instanceof Pool) { for (MessageFlow f : ModelHelper.getMainProcess(pool).getMessageConnections()) { if (pool.equals(ModelHelper.getParentProcess(f.getSource()))) { cmd.add(new DestroyElementCommand(new DestroyElementRequest(f, false))); } } } return getGEFWrapper(cmd.reduce()); }
Example #15
Source File: BPMNShapeFactory.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("unchecked") private PolylineConnection createConnectorFigure(Edge bonitaEdge) { Bounds sourceLocation = getBPMNShapeBounds(modelExporter.getEObjectID(bonitaEdge.getSource())); Bounds targetLocation = getBPMNShapeBounds(modelExporter.getEObjectID(bonitaEdge.getTarget())); PolylineConnection conn = new PolylineConnection(); AbstractRouter router = new CustomRectilinearRouter(); conn.setConnectionRouter(router); final List<RelativeBendpoint> pointList = ((RelativeBendpoints) bonitaEdge.getBendpoints()).getPoints(); List<org.eclipse.draw2d.RelativeBendpoint> figureConstraint = new ArrayList<>(); for (int i = 0; i < pointList.size(); i++) { RelativeBendpoint relativeBendpoint = (RelativeBendpoint) pointList.get(i); IFigure sourceFigure = new Figure(); sourceFigure.setBounds(toRectangle(sourceLocation)); IFigure targetFigure = new Figure(); targetFigure.setBounds(toRectangle(targetLocation)); conn.setSourceAnchor(new CustomAnchor(sourceFigure)); conn.setTargetAnchor(new CustomAnchor(targetFigure)); org.eclipse.draw2d.RelativeBendpoint rbp = new org.eclipse.draw2d.RelativeBendpoint(conn); rbp.setRelativeDimensions( new Dimension(relativeBendpoint.getSourceX(), relativeBendpoint.getSourceY()), new Dimension(relativeBendpoint.getTargetX(), relativeBendpoint.getTargetY())); if (pointList.size() == 1) { rbp.setWeight(0.5f); } else { rbp.setWeight(i / ((float) pointList.size() - 1)); } figureConstraint.add(rbp); } conn.setRoutingConstraint(figureConstraint); router.route(conn); return conn; }
Example #16
Source File: BPMNShapeFactory.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
private void attachEdgeLabel(final DecorationNode decorationNode, final BPMNEdge edge, String labelText, Edge bonitaEdge) { Font font = createFont(bonitaEdge); if (font != null) { final BPMNLabel label = DiFactory.eINSTANCE.createBPMNLabel(); Location relativeLocation = (Location) decorationNode.getLayoutConstraint(); Point offSet = new Point(relativeLocation.getX(), relativeLocation.getY()); org.eclipse.gmf.runtime.notation.Bounds absoluteBounds = NotationFactory.eINSTANCE.createBounds(); PointList pList = new PointList(); edge.getWaypoint().stream().map(wayPoint -> new PrecisionPoint(wayPoint.getX(), wayPoint.getY())) .forEach(pList::addPoint); Point referencePoint = PointListUtilities.calculatePointRelativeToLine(pList, 0, LabelViewConstants.MIDDLE_LOCATION, true); Point location = LabelHelper.calculatePointRelativeToPointOnLine(pList, referencePoint, offSet); //Here we use some default constant values to avoid a dependency on a set Display //The output diemension values are sligthly the same between windows and linux Dimension dimension = new Dimension((int) (labelText.length() * 7.42), (int) (11 * 1.6)); absoluteBounds.setWidth(dimension.width); absoluteBounds.setHeight(dimension.height); location.translate(-1 * dimension.width / 2, -1 * dimension.height / 2); absoluteBounds.setWidth(dimension.width); absoluteBounds.setHeight(dimension.height); absoluteBounds.setX(location.x); absoluteBounds.setY(location.y); final Bounds elementBounds = DcFactory.eINSTANCE.createBounds(); elementBounds.setX(absoluteBounds.getX()); elementBounds.setY(absoluteBounds.getY()); elementBounds.setHeight(absoluteBounds.getHeight()); elementBounds.setWidth(absoluteBounds.getWidth()); edge.setBPMNLabel(label); } }
Example #17
Source File: BPMNShapeFactory.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("unchecked") public BPMNEdge createBPMNEdge(final String bpmnFlowId, EObject bonitaElement) { Edge bonitaEdge = modelExporter.getElementNotationEdge(bonitaElement); if (bonitaEdge != null) { final BPMNEdge edge = DiFactory.eINSTANCE.createBPMNEdge(); edge.setBpmnElement(QName.valueOf(bpmnFlowId)); edge.setId(modelExporter.getEObjectID(bonitaEdge)); PolylineConnection conn = createConnectorFigure(bonitaEdge); PointList points = conn.getPoints(); for (int i = 0; i < points.size(); i++) { final org.omg.spec.dd.dc.Point sourcePoint = DcFactory.eINSTANCE.createPoint(); Point point = points.getPoint(i); sourcePoint.setX(point.x); sourcePoint.setY(point.y); edge.getWaypoint().add(sourcePoint); } if (bonitaElement instanceof SequenceFlow) { bonitaEdge.getPersistedChildren().stream() .filter(DecorationNode.class::isInstance) .findFirst() .ifPresent(decorationNode -> attachEdgeLabel((DecorationNode) decorationNode, edge, ((SequenceFlow) bonitaElement).getName(), bonitaEdge)); } return edge; } return null; }
Example #18
Source File: BonitaModelExporterImpl.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Override public Edge getElementNotationEdge(EObject connection) { return (Edge) getDiagram().getPersistedEdges().stream() .filter(edge -> Objects.equals(((Edge) edge).getElement(), connection)) .findFirst() .orElse(null); }
Example #19
Source File: SubProcessEventItemSemanticEditPolicy.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** * @generated */ protected Command getDestroyElementCommand(DestroyElementRequest req) { View view = (View) getHost().getModel(); CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(getEditingDomain(), null); cmd.setTransactionNestingEnabled(false); for (Iterator<?> it = view.getTargetEdges().iterator(); it.hasNext();) { Edge incomingLink = (Edge) it.next(); if (ProcessVisualIDRegistry.getVisualID(incomingLink) == TextAnnotationAttachmentEditPart.VISUAL_ID) { DestroyElementRequest r = new DestroyElementRequest(incomingLink.getElement(), false); cmd.add(new DestroyElementCommand(r)); cmd.add(new DeleteCommand(getEditingDomain(), incomingLink)); continue; } } EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$ if (annotation == null) { // there are indirectly referenced children, need extra commands: false addDestroyChildNodesCommand(cmd); addDestroyShortcutsCommand(cmd, view); // delete host element cmd.add(new DestroyElementCommand(req)); } else { cmd.add(new DeleteCommand(getEditingDomain(), view)); } final EObject pool = req.getElementToDestroy(); if (pool instanceof Pool) { for (MessageFlow f : ModelHelper.getMainProcess(pool).getMessageConnections()) { if (pool.equals(ModelHelper.getParentProcess(f.getSource()))) { cmd.add(new DestroyElementCommand(new DestroyElementRequest(f, false))); } } } return getGEFWrapper(cmd.reduce()); }
Example #20
Source File: MainProcessCanonicalEditPolicy.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** * @generated */ private Collection<IAdaptable> refreshConnections() { Domain2Notation domain2NotationMap = new Domain2Notation(); Collection<ProcessLinkDescriptor> linkDescriptors = collectAllLinks(getDiagram(), domain2NotationMap); Collection existingLinks = new LinkedList(getDiagram().getEdges()); for (Iterator linksIterator = existingLinks.iterator(); linksIterator.hasNext();) { Edge nextDiagramLink = (Edge) linksIterator.next(); int diagramLinkVisualID = ProcessVisualIDRegistry.getVisualID(nextDiagramLink); if (diagramLinkVisualID == -1) { if (nextDiagramLink.getSource() != null && nextDiagramLink.getTarget() != null) { linksIterator.remove(); } continue; } EObject diagramLinkObject = nextDiagramLink.getElement(); EObject diagramLinkSrc = nextDiagramLink.getSource().getElement(); EObject diagramLinkDst = nextDiagramLink.getTarget().getElement(); for (Iterator<ProcessLinkDescriptor> linkDescriptorsIterator = linkDescriptors .iterator(); linkDescriptorsIterator.hasNext();) { ProcessLinkDescriptor nextLinkDescriptor = linkDescriptorsIterator.next(); if (diagramLinkObject == nextLinkDescriptor.getModelElement() && diagramLinkSrc == nextLinkDescriptor.getSource() && diagramLinkDst == nextLinkDescriptor.getDestination() && diagramLinkVisualID == nextLinkDescriptor.getVisualID()) { linksIterator.remove(); linkDescriptorsIterator.remove(); break; } } } deleteViews(existingLinks.iterator()); return createConnections(linkDescriptors, domain2NotationMap); }
Example #21
Source File: WorkflowCanonicalEditPolicy.java From scava with Eclipse Public License 2.0 | 5 votes |
/** * @generated */ private Collection<IAdaptable> refreshConnections() { Domain2Notation domain2NotationMap = new Domain2Notation(); Collection<CrossflowLinkDescriptor> linkDescriptors = collectAllLinks(getDiagram(), domain2NotationMap); Collection existingLinks = new LinkedList(getDiagram().getEdges()); for (Iterator linksIterator = existingLinks.iterator(); linksIterator.hasNext();) { Edge nextDiagramLink = (Edge) linksIterator.next(); int diagramLinkVisualID = CrossflowVisualIDRegistry.getVisualID(nextDiagramLink); if (diagramLinkVisualID == -1) { if (nextDiagramLink.getSource() != null && nextDiagramLink.getTarget() != null) { linksIterator.remove(); } continue; } EObject diagramLinkObject = nextDiagramLink.getElement(); EObject diagramLinkSrc = nextDiagramLink.getSource().getElement(); EObject diagramLinkDst = nextDiagramLink.getTarget().getElement(); for (Iterator<CrossflowLinkDescriptor> linkDescriptorsIterator = linkDescriptors .iterator(); linkDescriptorsIterator.hasNext();) { CrossflowLinkDescriptor nextLinkDescriptor = linkDescriptorsIterator.next(); if (diagramLinkObject == nextLinkDescriptor.getModelElement() && diagramLinkSrc == nextLinkDescriptor.getSource() && diagramLinkDst == nextLinkDescriptor.getDestination() && diagramLinkVisualID == nextLinkDescriptor.getVisualID()) { linksIterator.remove(); linkDescriptorsIterator.remove(); break; } } } deleteViews(existingLinks.iterator()); return createConnections(linkDescriptors, domain2NotationMap); }
Example #22
Source File: ExtractSubdiagramRefactoring.java From statecharts with Eclipse Public License 1.0 | 5 votes |
protected void createExitPoint(Edge edge, Diagram subdiagram) { Transition transition = (Transition) edge.getElement(); // create semantic exit point Region exitPointContainer = getExitPointContainer(transition); Exit exitPoint = createSemanticExitPoint(transition); // create node for exit point View exitPointContainerView = helper.getViewForSemanticElement(exitPointContainer, subdiagram); View exitPointRegionCompartment = ViewUtil.getChildBySemanticHint(exitPointContainerView, SemanticHints.REGION_COMPARTMENT); Node exitNode = ViewService.createNode(exitPointRegionCompartment, exitPoint, SemanticHints.EXIT, preferencesHint); // re-wire existing transition to new exit point Vertex oldTransitionTarget = transition.getTarget(); transition.setTarget(exitPoint); View oldEdgeTarget = edge.getTarget(); edge.setTarget(exitNode); // create transition from selected state to former transition target Transition exitPointTransition = SGraphFactory.eINSTANCE.createTransition(); exitPointTransition.setSource((State) subdiagram.getElement()); exitPointTransition.setTarget(oldTransitionTarget); ViewService.createEdge(getContextObject(), oldEdgeTarget, exitPointTransition, SemanticHints.TRANSITION, preferencesHint); addExitPointSpec(exitPointTransition, exitPoint); }
Example #23
Source File: ProcessViewProvider.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** * @generated */ public Edge createTextAnnotationAttachment_4003(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { Connector edge = NotationFactory.eINSTANCE.createConnector(); edge.getStyles().add(NotationFactory.eINSTANCE.createFontStyle()); RelativeBendpoints bendpoints = NotationFactory.eINSTANCE.createRelativeBendpoints(); ArrayList<RelativeBendpoint> points = new ArrayList<RelativeBendpoint>(2); points.add(new RelativeBendpoint()); points.add(new RelativeBendpoint()); bendpoints.setPoints(points); edge.setBendpoints(bendpoints); ViewUtil.insertChildView(containerView, edge, index, persisted); edge.setType(ProcessVisualIDRegistry.getType(TextAnnotationAttachmentEditPart.VISUAL_ID)); edge.setElement(domainElement); // initializePreferences final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); org.eclipse.swt.graphics.RGB lineRGB = PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_LINE_COLOR); ViewUtil.setStructuralFeatureValue(edge, NotationPackage.eINSTANCE.getLineStyle_LineColor(), FigureUtilities.RGBToInteger(lineRGB)); FontStyle edgeFontStyle = (FontStyle) edge.getStyle(NotationPackage.Literals.FONT_STYLE); if (edgeFontStyle != null) { FontData fontData = PreferenceConverter.getFontData(prefStore, IPreferenceConstants.PREF_DEFAULT_FONT); edgeFontStyle.setFontName(fontData.getName()); edgeFontStyle.setFontHeight(fontData.getHeight()); edgeFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0); edgeFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0); org.eclipse.swt.graphics.RGB fontRGB = PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_FONT_COLOR); edgeFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB).intValue()); } Routing routing = Routing.get(prefStore.getInt(IPreferenceConstants.PREF_LINE_STYLE)); if (routing != null) { ViewUtil.setStructuralFeatureValue(edge, NotationPackage.eINSTANCE.getRoutingStyle_Routing(), routing); } return edge; }
Example #24
Source File: RegionCompartmentCanonicalEditPolicy.java From statecharts with Eclipse Public License 1.0 | 5 votes |
protected boolean shouldIncludeConnection(Edge connection, Collection<View> children) { // Connections should only be included, when the source vertex is // contained in the region this edit policy belongs to EObject element = (EObject) connection.getElement(); if (element instanceof Transition) { Vertex source = ((Transition) element).getSource(); if (!getSemanticHost().getVertices().contains(source)) { return false; } } return super.shouldIncludeConnection(connection, children); }
Example #25
Source File: CrossflowNavigatorContentProvider.java From scava with Eclipse Public License 2.0 | 5 votes |
/** * @generated */ private Collection<View> getLinksSourceByType(Collection<Edge> edges, String type) { LinkedList<View> result = new LinkedList<View>(); for (Edge nextEdge : edges) { View nextEdgeSource = nextEdge.getSource(); if (type.equals(nextEdgeSource.getType()) && isOwnView(nextEdgeSource)) { result.add(nextEdgeSource); } } return result; }
Example #26
Source File: CrossflowNavigatorContentProvider.java From scava with Eclipse Public License 2.0 | 5 votes |
/** * @generated */ private Collection<View> getLinksTargetByType(Collection<Edge> edges, String type) { LinkedList<View> result = new LinkedList<View>(); for (Edge nextEdge : edges) { View nextEdgeTarget = nextEdge.getTarget(); if (type.equals(nextEdgeTarget.getType()) && isOwnView(nextEdgeTarget)) { result.add(nextEdgeTarget); } } return result; }
Example #27
Source File: SetLabelsOffsetOperation.java From statecharts with Eclipse Public License 1.0 | 5 votes |
public static boolean isEdgeWithObliqueRoutingStyle(org.eclipse.gef.ConnectionEditPart part) { Edge edge = (Edge) part.getModel(); ConnectorStyle style = (ConnectorStyle) edge.getStyle(NotationPackage.Literals.CONNECTOR_STYLE); if (style != null) { return Routing.MANUAL_LITERAL == style.getRouting(); } return false; }
Example #28
Source File: SubdiagramAwareCopyCommand.java From statecharts with Eclipse Public License 1.0 | 5 votes |
protected List<Edge> getInnerEdges(List views) { List<Edge> innerEdges = new LinkedList<Edge>(); for (Iterator itr = views.iterator(); itr.hasNext();) { View view = (View) itr.next(); if (!(view instanceof Diagram)) { innerEdges.addAll(ViewUtil.getAllInnerEdges(view)); } } return innerEdges; }
Example #29
Source File: AdjustIdentityAnchorCommand.java From statecharts with Eclipse Public License 1.0 | 5 votes |
private void handleEdge(Edge edge, EditPart editPart, boolean sourceAnchor) { Anchor anchorToModify; if (sourceAnchor) { anchorToModify = edge.getSourceAnchor(); } else { anchorToModify = edge.getTargetAnchor(); } String terminalString = composeTerminalString(DEFAULT_POINT); if (anchorToModify instanceof IdentityAnchor) { terminalString = ((IdentityAnchor) anchorToModify).getId(); } PrecisionPoint anchorPoint = BaseSlidableAnchor.parseTerminalString(terminalString); PrecisionPoint newPoint = computeNewAnchor(anchorPoint, editPart); String newTerminalString = new SlidableAnchor(null, newPoint).getTerminal(); if (anchorToModify instanceof IdentityAnchor) { ((IdentityAnchor) anchorToModify).setId(newTerminalString); } else if (anchorToModify == null) { // Create a new one IdentityAnchor newAnchor = NotationFactory.eINSTANCE.createIdentityAnchor(); newAnchor.setId(newTerminalString); if (sourceAnchor) { edge.setSourceAnchor(newAnchor); } else { edge.setTargetAnchor(newAnchor); } } }
Example #30
Source File: ProcessViewProvider.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
/** * @generated */ public Edge createMessageFlow_4002(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { Connector edge = NotationFactory.eINSTANCE.createConnector(); edge.getStyles().add(NotationFactory.eINSTANCE.createFontStyle()); RelativeBendpoints bendpoints = NotationFactory.eINSTANCE.createRelativeBendpoints(); ArrayList<RelativeBendpoint> points = new ArrayList<RelativeBendpoint>(2); points.add(new RelativeBendpoint()); points.add(new RelativeBendpoint()); bendpoints.setPoints(points); edge.setBendpoints(bendpoints); ViewUtil.insertChildView(containerView, edge, index, persisted); edge.setType(ProcessVisualIDRegistry.getType(MessageFlowEditPart.VISUAL_ID)); edge.setElement(domainElement); // initializePreferences final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); org.eclipse.swt.graphics.RGB lineRGB = PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_LINE_COLOR); ViewUtil.setStructuralFeatureValue(edge, NotationPackage.eINSTANCE.getLineStyle_LineColor(), FigureUtilities.RGBToInteger(lineRGB)); FontStyle edgeFontStyle = (FontStyle) edge.getStyle(NotationPackage.Literals.FONT_STYLE); if (edgeFontStyle != null) { FontData fontData = PreferenceConverter.getFontData(prefStore, IPreferenceConstants.PREF_DEFAULT_FONT); edgeFontStyle.setFontName(fontData.getName()); edgeFontStyle.setFontHeight(fontData.getHeight()); edgeFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0); edgeFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0); org.eclipse.swt.graphics.RGB fontRGB = PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_FONT_COLOR); edgeFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB).intValue()); } Routing routing = Routing.get(prefStore.getInt(IPreferenceConstants.PREF_LINE_STYLE)); if (routing != null) { ViewUtil.setStructuralFeatureValue(edge, NotationPackage.eINSTANCE.getRoutingStyle_Routing(), routing); } Node label6003 = createLabel(edge, ProcessVisualIDRegistry.getType(MessageFlowLabelEditPart.VISUAL_ID)); label6003.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); Location location6003 = (Location) label6003.getLayoutConstraint(); location6003.setX(0); location6003.setY(-10); return edge; }