org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart Java Examples
The following examples show how to use
org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart.
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: AbstractDiagramElementsTxtUmlArranger.java From txtUML with Eclipse Public License 1.0 | 6 votes |
private void modifyConnectionEditParts( Map<ConnectionNodeEditPart, List<hu.elte.txtuml.utils.diagrams.Point>> linksTransform, Map<GraphicalEditPart, hu.elte.txtuml.utils.diagrams.Rectangle> objectTransform) { linksTransform.forEach((ConnectionNodeEditPart connection, List<hu.elte.txtuml.utils.diagrams.Point> route) ->{ if(connection != null && route.size() >= 2){ hu.elte.txtuml.utils.diagrams.Rectangle source = objectTransform.get(connection.getSource()); hu.elte.txtuml.utils.diagrams.Rectangle target = objectTransform.get(connection.getTarget()); String anchor_start = getAnchor(source.getTopLeft(), route.get(0), source.width(), source.height()); String anchor_end = getAnchor(target.getTopLeft(), route.get(route.size()-1), target.width(), target.height()); DiagramElementsModifier.setConnectionAnchors(connection, anchor_start, anchor_end); List<Point> gmfRoute = route.stream().map(p -> new Point(p.x(), p.y())).collect(Collectors.toList()); DiagramElementsModifier.setConnectionPoints(connection, gmfRoute); } }); }
Example #2
Source File: StateMachineDiagramElementsTxtUmlArranger.java From txtUML with Eclipse Public License 1.0 | 6 votes |
@Override protected void arrangeChildren(GraphicalEditPart state, IProgressMonitor monitor) throws ArrangeException{ assert state instanceof RoundedCompartmentEditPart; boolean isCompositeState = false; RegionCompartmentEditPart regionCompartement = getRegionCompatementEditPart((RoundedCompartmentEditPart)state); if(regionCompartement != null){ @SuppressWarnings("unchecked") List<GraphicalEditPart> editparts = regionCompartement.getChildren(); for(GraphicalEditPart ep : editparts){ if(isValidStateClass(ep)){ isCompositeState = true; this.arrangeChildren(ep, monitor); } } if(isCompositeState){ super.arrangeChildren(regionCompartement, monitor); Dimension d = calculatePreferredSize(editparts); DiagramElementsModifier.resizeGraphicalEditPart(state, d.width, d.height); } } }
Example #3
Source File: StateMachineDiagramElementsGmfArranger.java From txtUML with Eclipse Public License 1.0 | 6 votes |
/** * Calls an {@link AbstractDiagramElementsGmfArranger#arrangeChildren(EditPart) arrangeChildren} * and a hideConnectionLabels on the children of the given GraphicalEditPart * @param stateEP - The GraphicalEditPart */ private void arrange_recurively(GraphicalEditPart stateEP) { @SuppressWarnings("unchecked") List<GraphicalEditPart> stateCompartements = stateEP.getChildren(); @SuppressWarnings("unchecked") List<GraphicalEditPart> regions = ((EditPart) stateCompartements.get(1)).getChildren(); for(GraphicalEditPart region: regions){ GraphicalEditPart regioncompartement = (GraphicalEditPart) region.getChildren().get(0); @SuppressWarnings("unchecked") List<GraphicalEditPart> listEp = regioncompartement.getChildren(); for(GraphicalEditPart Ep : listEp){ if(Ep instanceof StateEditPart){ arrange_recurively(Ep); } } super.arrangeChildren(regioncompartement); DiagramElementsModifier.hideConnectionLabelsForEditParts(listEp, Arrays.asList(CustomTransitionGuardEditPart.class)); } }
Example #4
Source File: StateMachineDiagramElementsGmfArranger.java From txtUML with Eclipse Public License 1.0 | 6 votes |
/** * Calls an {@link AbstractDiagramElementsGmfArranger#autoresizeGraphicalEditPart(GraphicalEditPart) autosize} * and {@link AbstractDiagramElementsGmfArranger#arrangeChildren(EditPart) arrangeChildren} * on the given statemachine. * The method is called recursively for all children which are {@link StateEditPart}s * @param stateEP - The StateEditPart */ private void arrange_and_resize_recursively(GraphicalEditPart stateEP) { @SuppressWarnings("unchecked") List<GraphicalEditPart> stateCompartements = stateEP.getChildren(); @SuppressWarnings("unchecked") List<GraphicalEditPart> regions = ((EditPart) stateCompartements.get(1)).getChildren(); for(GraphicalEditPart region: regions){ GraphicalEditPart regioncompartement = (GraphicalEditPart) region.getChildren().get(0); @SuppressWarnings("unchecked") List<EditPart> listEp = regioncompartement.getChildren(); for(EditPart Ep : listEp){ if(Ep instanceof StateEditPart){ arrange_and_resize_recursively((StateEditPart) Ep); } } super.autoresizeGraphicalEditPart(stateEP); super.arrangeChildren(regioncompartement); } }
Example #5
Source File: AbstractDiagramElementsTxtUmlArranger.java From txtUML with Eclipse Public License 1.0 | 6 votes |
private Map<GraphicalEditPart, hu.elte.txtuml.utils.diagrams.Rectangle> createObjectRectangleMappingFromObjectsAndEditParts(Set<RectangleObject> objects, List<GraphicalEditPart> editParts) { Map<GraphicalEditPart, hu.elte.txtuml.utils.diagrams.Rectangle> result = new HashMap<>(); for(RectangleObject obj : objects){ Optional<Element> e = txtUmlRegistry.findElement(obj.getName()); if(e.isPresent()){ GraphicalEditPart ep = (GraphicalEditPart) getEditPartOfModelElement(editParts, e.get()); if(ep != null){ hu.elte.txtuml.utils.diagrams.Rectangle rect = new hu.elte.txtuml.utils.diagrams.Rectangle(obj.getPosition().getX(), obj.getPosition().getY(), obj.getPixelWidth(), obj.getPixelHeight()); result.put(ep, rect); } } } return result; }
Example #6
Source File: CompositeDiagramElementsTxtUmlArranger.java From txtUML with Eclipse Public License 1.0 | 6 votes |
private Dimension calculatePreferredSize(List<? extends GraphicalEditPart> editparts){ FreeFormLayoutEx manager = (FreeFormLayoutEx) editparts.get(0).getFigure().getParent().getLayoutManager(); Point topLeft = new Point(Integer.MAX_VALUE, Integer.MAX_VALUE); Point bottomRight = new Point(Integer.MIN_VALUE, Integer.MIN_VALUE); for(GraphicalEditPart ep : editparts){ Rectangle constraint = (Rectangle) manager.getConstraint(ep.getFigure()); Dimension preferredSize = ep.getFigure().getPreferredSize(); constraint.width = constraint.width < preferredSize.width ? preferredSize.width : constraint.width; constraint.height = constraint.height < preferredSize.height ? preferredSize.height : constraint.height; topLeft.x = constraint.x < topLeft.x ? constraint.x : topLeft.x; topLeft.y = constraint.y < topLeft.y ? constraint.y : topLeft.y; bottomRight.x = constraint.getBottomRight().x > bottomRight.x ? constraint.getBottomRight().x : bottomRight.x; bottomRight.y = constraint.getBottomRight().y > bottomRight.y ? constraint.getBottomRight().y : bottomRight.y; } return new Dimension(bottomRight.x, bottomRight.y); }
Example #7
Source File: DiagramElementsModifier.java From txtUML with Eclipse Public License 1.0 | 6 votes |
/** * Hides the labels on the connections of the given elements * * @param elements * - The EditParts which's connection labels is to be hidden * @param excluding * - The types of connection labels which are not wanted to be * hidden */ public static void hideConnectionLabelsForEditParts(List<GraphicalEditPart> elements, List<java.lang.Class<?>> excluding) { for (EditPart editpart : elements) { GraphicalEditPart ep = ((GraphicalEditPart) editpart); @SuppressWarnings("unchecked") List<ConnectionNodeEditPart> connections = ep.getSourceConnections(); for (ConnectionNodeEditPart connection : connections) { @SuppressWarnings("unchecked") List<ConnectionNodeEditPart> labels = connection.getChildren(); for (EditPart label : labels) { if (!isInstanceOfAny(label, excluding)) { ShowHideLabelsRequest request = new ShowHideLabelsRequest(false, ((View) label.getModel())); Command com = connection.getCommand(request); if (com != null && com.canExecute()) com.execute(); } } } } }
Example #8
Source File: GroupStatesIntoCompositeRefactoring.java From statecharts with Eclipse Public License 1.0 | 6 votes |
/** * Iterates through all {@link StateEditPart}s of the current selection and * computes layout constraints for the composite node. * * @param compositeStateNode * node of the composite state */ protected void setCompositeStateLayoutConstraint(Node compositeStateNode) { Rectangle newbounds = null; for (GraphicalEditPart editPart : getContextObjects()) { Rectangle childBounds = editPart.getFigure().getBounds(); if (newbounds == null) newbounds = childBounds.getCopy(); newbounds.union(childBounds); } newbounds.expand(new Insets(PADDING, PADDING, PADDING, PADDING)); Bounds bounds = NotationFactory.eINSTANCE.createBounds(); bounds.setX(newbounds.x); bounds.setY(newbounds.y); bounds.setWidth(newbounds.width); bounds.setHeight(newbounds.height); compositeStateNode.setLayoutConstraint(bounds); }
Example #9
Source File: BoundaryElementTypeResolver.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
public IElementType getElementType(GraphicalEditPart parentEditPart, EClass targetEClass) { List<IElementType> allowedChildren = new ArrayList<IElementType>(); if (parentEditPart instanceof Task2EditPart || parentEditPart instanceof TaskEditPart) { allowedChildren.add(ProcessElementTypes.IntermediateErrorCatchEvent_3029); allowedChildren.add(ProcessElementTypes.BoundaryMessageEvent_3035); allowedChildren.add(ProcessElementTypes.BoundaryTimerEvent_3043); allowedChildren.add(ProcessElementTypes.NonInterruptingBoundaryTimerEvent_3064); allowedChildren.add(ProcessElementTypes.BoundarySignalEvent_3052); } else if (parentEditPart instanceof CallActivity2EditPart || parentEditPart instanceof CallActivityEditPart) { allowedChildren.add(ProcessElementTypes.IntermediateErrorCatchEvent_3030); allowedChildren.add(ProcessElementTypes.BoundaryMessageEvent_3036); allowedChildren.add(ProcessElementTypes.BoundaryTimerEvent_3044); allowedChildren.add(ProcessElementTypes.NonInterruptingBoundaryTimerEvent_3065); allowedChildren.add(ProcessElementTypes.BoundarySignalEvent_3053); } else if (parentEditPart instanceof ScriptTask2EditPart || parentEditPart instanceof ScriptTaskEditPart) { allowedChildren.add(ProcessElementTypes.IntermediateErrorCatchEvent_3033); } else if (parentEditPart instanceof ServiceTask2EditPart || parentEditPart instanceof ServiceTaskEditPart) { allowedChildren.add(ProcessElementTypes.IntermediateErrorCatchEvent_3032); } else if (parentEditPart instanceof ReceiveTask2EditPart || parentEditPart instanceof ReceiveTaskEditPart) { allowedChildren.add(ProcessElementTypes.IntermediateErrorCatchEvent_3031); } else if (parentEditPart instanceof Activity2EditPart || parentEditPart instanceof ActivityEditPart) { allowedChildren.add(ProcessElementTypes.IntermediateErrorCatchEvent_3034); } for (IElementType child : allowedChildren) { if (child.getEClass().equals(targetEClass)) { return child; } } return null; }
Example #10
Source File: EventEditPart.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** * @Generated BonitaSoft */ @Override public Object getAdapter(Class key) { if (key == SnapToHelper.class) { EditPart parent = getParent(); while (!(parent instanceof DiagramEditPart)) { parent = parent.getParent(); } return GMFTools.getSnapHelper((GraphicalEditPart) parent); } return super.getAdapter(key); }
Example #11
Source File: BoundaryMessageEvent2EditPart.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** * @Generated BonitaSoft */ @Override public java.lang.Object getAdapter(Class key) { if (key == SnapToHelper.class) { EditPart parent = getParent(); while (!(parent instanceof DiagramEditPart)) { parent = parent.getParent(); } return GMFTools.getSnapHelper((GraphicalEditPart) parent); } return super.getAdapter(key); }
Example #12
Source File: ThrowLinkEventEditPart.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** * @Generated BonitaSoft */ @Override public Object getAdapter(Class key) { if (key == SnapToHelper.class) { EditPart parent = getParent(); while (!(parent instanceof DiagramEditPart)) { parent = parent.getParent(); } return GMFTools.getSnapHelper((GraphicalEditPart) parent); } return super.getAdapter(key); }
Example #13
Source File: CustomLaneCompartmentEditPart.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Override public void showTargetFeedback(Request request) { if(request instanceof ChangeBoundsRequest){ if(!(((GraphicalEditPart)((ChangeBoundsRequest)request).getEditParts().get(0)).resolveSemanticElement() instanceof Container)){ super.showTargetFeedback(request); } }else{ super.showTargetFeedback(request); } }
Example #14
Source File: EndTerminatedEventEditPart.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** * @Generated BonitaSoft */ @Override public Object getAdapter(Class key) { if (key == SnapToHelper.class) { EditPart parent = getParent(); while (!(parent instanceof DiagramEditPart)) { parent = parent.getParent(); } return GMFTools.getSnapHelper((GraphicalEditPart) parent); } return super.getAdapter(key); }
Example #15
Source File: TextAnnotation2EditPart.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** * @Generated BonitaSoft */ @Override public Object getAdapter(Class key) { if (key == SnapToHelper.class) { EditPart parent = getParent(); while (!(parent instanceof DiagramEditPart)) { parent = parent.getParent(); } return GMFTools.getSnapHelper((GraphicalEditPart) parent); } return super.getAdapter(key); }
Example #16
Source File: SubProcessEventEditPart.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** * @Generated BonitaSoft */ @Override public Object getAdapter(Class key) { if (key == SnapToHelper.class) { EditPart parent = getParent(); while (!(parent instanceof DiagramEditPart)) { parent = parent.getParent(); } return GMFTools.getSnapHelper((GraphicalEditPart) parent); } return super.getAdapter(key); }
Example #17
Source File: BoundarySignalEventEditPart.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** * @Generated BonitaSoft */ @Override public java.lang.Object getAdapter(Class key) { if (key == SnapToHelper.class) { EditPart parent = getParent(); while (!(parent instanceof DiagramEditPart)) { parent = parent.getParent(); } return GMFTools.getSnapHelper((GraphicalEditPart) parent); } return super.getAdapter(key); }
Example #18
Source File: StartEventEditPart.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** * @Generated BonitaSoft */ @Override public Object getAdapter(Class key) { if (key == SnapToHelper.class) { EditPart parent = getParent(); while (!(parent instanceof DiagramEditPart)) { parent = parent.getParent(); } return GMFTools.getSnapHelper((GraphicalEditPart) parent); } return super.getAdapter(key); }
Example #19
Source File: StartMessageEvent2EditPart.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** * @Generated BonitaSoft */ @Override public Object getAdapter(Class key) { if (key == SnapToHelper.class) { EditPart parent = getParent(); while (!(parent instanceof DiagramEditPart)) { parent = parent.getParent(); } return GMFTools.getSnapHelper((GraphicalEditPart) parent); } return super.getAdapter(key); }
Example #20
Source File: CustomLaneCompartmentEditPart.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** * @Generated BonitaSoft */ @Override public Object getAdapter(Class key) { if (key == SnapToHelper.class) { EditPart parent = getParent(); while (!(parent instanceof DiagramEditPart)) { parent = parent.getParent(); } return GMFTools.getSnapHelper((GraphicalEditPart) parent); } return super.getAdapter(key); }
Example #21
Source File: EndErrorEvent2EditPart.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** * @Generated BonitaSoft */ @Override public Object getAdapter(Class key) { if (key == SnapToHelper.class) { EditPart parent = getParent(); while (!(parent instanceof DiagramEditPart)) { parent = parent.getParent(); } return GMFTools.getSnapHelper((GraphicalEditPart) parent); } return super.getAdapter(key); }
Example #22
Source File: StartSignalEventEditPart.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** * @Generated BonitaSoft */ @Override public Object getAdapter(Class key) { if (key == SnapToHelper.class) { EditPart parent = getParent(); while (!(parent instanceof DiagramEditPart)) { parent = parent.getParent(); } return GMFTools.getSnapHelper((GraphicalEditPart) parent); } return super.getAdapter(key); }
Example #23
Source File: IntermediateErrorCatchEvent5EditPart.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** * @Generated BonitaSoft */ @Override public java.lang.Object getAdapter(Class key) { if (key == SnapToHelper.class) { EditPart parent = getParent(); while (!(parent instanceof DiagramEditPart)) { parent = parent.getParent(); } return GMFTools.getSnapHelper((GraphicalEditPart) parent); } return super.getAdapter(key); }
Example #24
Source File: TextAnnotationEditPart.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** * @Generated BonitaSoft */ @Override public Object getAdapter(Class key) { if (key == SnapToHelper.class) { EditPart parent = getParent(); while (!(parent instanceof DiagramEditPart)) { parent = parent.getParent(); } return GMFTools.getSnapHelper((GraphicalEditPart) parent); } return super.getAdapter(key); }
Example #25
Source File: TargetFixedConnectionAnchor.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
public TargetFixedConnectionAnchor(GraphicalEditPart ep, IFigure sourceFigure){ super(ep.getFigure()); this.owner = ep.getFigure() ; this.sourceFig = sourceFigure ; this.targetFig = ep.getFigure(); this.ep = ep ; }
Example #26
Source File: EndTerminatedEvent2EditPart.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** * @Generated BonitaSoft */ @Override public Object getAdapter(Class key) { if (key == SnapToHelper.class) { EditPart parent = getParent(); while (!(parent instanceof DiagramEditPart)) { parent = parent.getParent(); } return GMFTools.getSnapHelper((GraphicalEditPart) parent); } return super.getAdapter(key); }
Example #27
Source File: IntermediateThrowMessageEventEditPart.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** * @Generated BonitaSoft */ @Override public Object getAdapter(Class key) { if (key == SnapToHelper.class) { EditPart parent = getParent(); while (!(parent instanceof DiagramEditPart)) { parent = parent.getParent(); } return GMFTools.getSnapHelper((GraphicalEditPart) parent); } return super.getAdapter(key); }
Example #28
Source File: GMFTools.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** * @param node * @param type * @return */ public static Node createNode(final GraphicalEditPart node, IElementType type) { CreateViewRequest boundaryRequest = CreateViewRequestFactory.getCreateShapeRequest(type, node.getDiagramPreferencesHint()); Command command = node.getCommand(boundaryRequest); final IDiagramEditDomain diagramEditDomain = node.getDiagramEditDomain(); diagramEditDomain.getDiagramCommandStack().execute(command); IAdaptable targetAdapter = (IAdaptable) ((List<?>) boundaryRequest.getNewObject()).get(0); Node newNode = (Node) targetAdapter.getAdapter(EObject.class); return newNode; }
Example #29
Source File: EndSignalEvent2EditPart.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** * @Generated BonitaSoft */ @Override public Object getAdapter(Class key) { if (key == SnapToHelper.class) { EditPart parent = getParent(); while (!(parent instanceof DiagramEditPart)) { parent = parent.getParent(); } return GMFTools.getSnapHelper((GraphicalEditPart) parent); } return super.getAdapter(key); }
Example #30
Source File: InclusiveGateway2EditPart.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** * @Generated BonitaSoft */ @Override public Object getAdapter(Class key) { if (key == SnapToHelper.class) { EditPart parent = getParent(); while (!(parent instanceof DiagramEditPart)) { parent = parent.getParent(); } return GMFTools.getSnapHelper((GraphicalEditPart) parent); } return super.getAdapter(key); }