コード例 #1
0
  /** Collapse edit part */
  private void collapseEditPart() {
    final Set<ConnectionEditPart> childrenConnections = getChildrenConnections();
    final Set<ConnectionEditPart> outsideConnections =
        excludeInternConnections(childrenConnections);
    final Set<ConnectionEditPart> edges = filterForDependencyConstraints(outsideConnections);

    for (final ConnectionEditPart outConnection : edges) {
      final EdgeImpl edge = (EdgeImpl) outConnection.getModel();

      // it's for undo/redo operations
      if (outConnection.getSource().getModel() != edge.getSource()
          || outConnection.getTarget().getModel() != edge.getTarget()) {
        return;
      }

      if (compartmentChildren.contains(outConnection.getSource())) {
        // readjust connection and update original source history
        // readjust at source
        edge.setSource((ShapeImpl) editPartOfCompartment.getModel());
        final Connection con = (Connection) edge.getElement();
        con.setTemp(true);
        final EList<Shape> oSources = con.getOriginalSource();
        oSources.add(con.getSource());
        con.setSource((Shape) ((ShapeImpl) editPartOfCompartment.getModel()).getElement());
      } else {
        // readjust at target
        edge.setTarget((ShapeImpl) editPartOfCompartment.getModel());
        final Connection con = (Connection) edge.getElement();
        con.setTemp(true);
        final EList<Shape> oTargets = con.getOriginalTarget();
        oTargets.add(con.getTarget());
        con.setTarget((Shape) ((ShapeImpl) editPartOfCompartment.getModel()).getElement());
      }
    }
  }
コード例 #2
0
 /**
  * Constructor. It needs the shape being resized, it's re-size delta and the axis where the
  * position should be preserved. The different preserveAxis values are the following:
  *
  * <ul>
  *   <li>ModifyAnchorsToPreservePosition.PRESERVE_Y
  *   <li>ModifyAnchorsToPreservePosition.PRESERVE_X
  *   <li>ModifyAnchorsToPreservePosition.PRESERVE_XY
  * </ul>
  *
  * @param shapeEP the ShapeNodeEditPart that is being resized
  * @param sizeDelta the re-size delta
  * @param preserveAxis the axis where the position should be preserved. If the given value is not
  *     valid, then PRESERVE_Y will be taken as default
  */
 public PreserveAnchorsPositionCommand(
     ShapeNodeEditPart shapeEP, Dimension sizeDelta, int preserveAxis) {
   super(shapeEP.getEditingDomain(), COMMAND_LABEL, null);
   setShapeEP(shapeEP);
   setSizeDelta(sizeDelta);
   setPreserveAxis(preserveAxis);
 }
コード例 #3
0
  /**
   * Permet de créer la région en 0,0 pour le diagramme
   *
   * @generated NOT
   */
  @Override
  public void activate() {
    super.activate();

    AbstractEMFOperation emfOp =
        new AbstractEMFOperation(getEditingDomain(), "Location setting") {

          @Override
          protected IStatus doExecute(IProgressMonitor monitor, IAdaptable info)
              throws ExecutionException {
            // TODO Auto-generated method stub
            // Recupération du layout et mis a jour en (0,0)
            Location lc = (Location) ((Node) getModel()).getLayoutConstraint();
            lc.setX(0);
            lc.setY(0);

            return Status.OK_STATUS;
          }
        };

    IStatus status;

    try {
      status = OperationHistoryFactory.getOperationHistory().execute(emfOp, null, null);
    } catch (ExecutionException e) {
      status =
          new Status(IStatus.ERROR, ImaginDataDiagramEditorPlugin.ID, "Setting location failed", e);
    }

    if (status.getCode() == IStatus.WARNING || status.getCode() == IStatus.ERROR) {
      ImaginDataDiagramEditorPlugin.getInstance().getLog().log(status);
    }
  }
コード例 #4
0
  @Override
  protected void handleNotificationEvent(Notification notification) {
    super.handleNotificationEvent(notification);
    if ((notification.getEventType() == Notification.SET)
        && (notification.getNotifier() instanceof org.ow2.aspirerfid.ide.bpwme.impl.EBProcImpl)) {

      EBProcImpl epi = (EBProcImpl) notification.getNotifier();
      EAttributeImpl ei = (EAttributeImpl) notification.getFeature();
      MainControl mc = MainControl.getMainControl();

      org.ow2.aspirerfid.commons.apdl.model.EBProc ebproc =
          (org.ow2.aspirerfid.commons.apdl.model.EBProc) mc.getMapObject(epi.hashCode());

      EPCISMasterDataDocumentType doc = MasterDataUtil.getEPCISMasterDataDocument(ebproc);
      VocabularyElementType vocabularyElement = MasterDataUtil.getEBProcVocabularyElement(doc);

      if (ei.getName().equals("id")) {
        ebproc.setId(notification.getNewStringValue());
        MasterDataUtil.setVocabularyElementID(vocabularyElement, notification.getNewStringValue());
      } else if (ei.getName().equals("name")) {
        ebproc.setName(notification.getNewStringValue());
        MasterDataUtil.setVocabularyElementAttribute(
            vocabularyElement,
            "urn:epcglobal:epcis:mda:event_name",
            notification.getNewStringValue());
      } else if (ei.getName().equals("description")) {
        ebproc.setDescription(notification.getNewStringValue());
      } else {
        return;
      }

      mc.saveObject();
    }
  }
コード例 #5
0
  /** @generated */
  @Override
  protected void handleNotificationEvent(Notification notification) {
    super.handleNotificationEvent(notification);

    if (notification.getNotifier() instanceof de.uni_mannheim.informatik.swt.models.plm.PLM.Feature
        && ((EStructuralFeature) notification.getFeature()).getName().equals("expressed")) {
      IGraphicalEditPart parent = (IGraphicalEditPart) getParent();
      de.uni_mannheim.informatik.swt.models.plm.PLM.Element self =
          (de.uni_mannheim.informatik.swt.models.plm.PLM.Element) resolveSemanticElement();

      // Check is visible
      if (parent.resolveSemanticElement()
          instanceof de.uni_mannheim.informatik.swt.models.plm.PLM.Context) {
        de.uni_mannheim.informatik.swt.models.plm.PLM.Context container =
            (de.uni_mannheim.informatik.swt.models.plm.PLM.Context) parent.resolveSemanticElement();
        if ((container.getOrigin().equalsIgnoreCase("computed") && self.isExpressed())
            || (container.getOrigin().equalsIgnoreCase("expressed") && !self.isExpressed())) {
          getNotationView().setVisible(false);
        }
      } else {
        getNotationView().setVisible(true);
      }

      de.uni_mannheim.informatik.swt.models.plm.PLM.Feature f =
          (de.uni_mannheim.informatik.swt.models.plm.PLM.Feature) resolveSemanticElement();
      if (f.isExpressed()) {
        ((org.eclipse.gmf.runtime.notation.Shape) this.getNotationView()).setItalic(false);
        ((org.eclipse.gmf.runtime.notation.Shape) this.getNotationView()).setFontColor(0);
      } else {
        ((org.eclipse.gmf.runtime.notation.Shape) this.getNotationView()).setItalic(true);
        ((org.eclipse.gmf.runtime.notation.Shape) this.getNotationView())
            .setFontColor(FigureUtilities.colorToInteger(DiagramColorConstants.diagramGray));
      }
    }
  }
コード例 #6
0
 /** @generated */
 protected void handleNotificationEvent(Notification event) {
   if (event.getNotifier() == getModel()
       && EcorePackage.eINSTANCE.getEModelElement_EAnnotations().equals(event.getFeature())) {
     handleMajorSemanticChange();
   } else {
     super.handleNotificationEvent(event);
   }
 }
コード例 #7
0
 /** @generated NOT */
 protected void createDefaultEditPolicies() {
   super.createDefaultEditPolicies();
   installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new SceneItemSemanticEditPolicy());
   installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
   // XXX need an SCR to runtime to have another abstract superclass that would let children add
   // reasonable editpolicies
   // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
 }
コード例 #8
0
  /**
   * This operation checks if, after resizing the ShapeNodeEditPart, all links anchors will fit
   * inside the figure in case their positions are preserved
   *
   * @param shapeEP That shape being resized
   * @param sizeDelta The SizeDelta for the resize
   * @param preserveAxis The axisxxx
   * @return The new SizeDelta to preserve anchors' positions
   */
  public static Dimension getSizeDeltaToFitAnchors(
      ShapeNodeEditPart shapeEP, Dimension sizeDelta, int preserveAxis) {

    Dimension newSizeDelta = new Dimension(sizeDelta);
    View view = (View) shapeEP.getModel();
    Rectangle figureBounds = shapeEP.getFigure().getBounds();

    List<Edge> sourceList = ViewUtil.getSourceConnections(view);
    List<Edge> targetList = ViewUtil.getTargetConnections(view);

    for (Edge edge : sourceList) {
      IdentityAnchor anchor = (IdentityAnchor) edge.getSourceAnchor();
      modifySizeDeltaToFitAnchor(anchor, newSizeDelta, preserveAxis, figureBounds);
    }
    for (Edge edge : targetList) {
      IdentityAnchor anchor = (IdentityAnchor) edge.getTargetAnchor();
      modifySizeDeltaToFitAnchor(anchor, newSizeDelta, preserveAxis, figureBounds);
    }

    return newSizeDelta;
  }
コード例 #9
0
  /** Opens the edit part and restores the connections. */
  private void openEditPart() {

    final Set<ConnectionEditPart> connections = getAllConnections();

    for (final ConnectionEditPart i : connections) {
      final EdgeImpl edgeToRestore = (EdgeImpl) i.getModel();
      final Connection con = (Connection) edgeToRestore.getElement();

      if (con.isTemp()) {
        if (edgeToRestore.getSource() == editPartOfCompartment.getModel()
            && (!con.getOriginalSource().isEmpty())) {
          // readjust source
          final EList<Shape> oSources = con.getOriginalSource();
          final Shape source = oSources.remove(oSources.size() - 1);

          final NodeImpl shapeImpl = getViewFromModel(compartmentToSupport, source);

          edgeToRestore.setSource(shapeImpl);

          con.setSource(source);
        } else if (edgeToRestore.getTarget() == editPartOfCompartment.getModel()
            && (!con.getOriginalTarget().isEmpty())) {
          // readjust target
          final EList<Shape> oTargets = con.getOriginalTarget();
          final Shape target = oTargets.remove(oTargets.size() - 1);

          final NodeImpl shapeImpl = getViewFromModel(compartmentToSupport, target);
          edgeToRestore.setTarget(shapeImpl);

          con.setTarget(target);
        }
        if (con.getOriginalSource().isEmpty() && con.getOriginalTarget().isEmpty()) {
          // connection is points direct from original source to original target, thus it's not
          // temporal
          // anymore.
          con.setTemp(false);
        }
      }
    }
  }
コード例 #10
0
 public void notifyChanged(Notification notification) {
   super.notifyChanged(notification);
   if (notification.getFeature() instanceof EAttributeImpl) {
     if (notification.getNotifier() instanceof BoundsImpl) {
       reposition(
           ((BoundsImpl) notification.getNotifier()).getX(),
           ((BoundsImpl) notification.getNotifier()).getY(),
           ((BoundsImpl) notification.getNotifier()).getWidth(),
           ((BoundsImpl) notification.getNotifier()).getHeight());
       FigureCanvas canvas = (FigureCanvas) getViewer().getControl();
       canvas.getViewport().repaint();
     }
   }
 }
コード例 #11
0
 /** @generated NOT */
 protected void createDefaultEditPolicies() {
   installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy());
   super.createDefaultEditPolicies();
   installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new RegionItemSemanticEditPolicy());
   installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
   installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new RegionCanonicalEditPolicy());
   installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
   // installEditPolicy(EditPolicyRoles.OPEN_ROLE,
   //	new OpenDiagramEditPolicy());
   // XXX need an SCR to runtime to have another abstract superclass that would let children add
   // reasonable editpolicies
   removeEditPolicy(
       org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
 }
コード例 #12
0
 /** @generated */
 protected void createDefaultEditPolicies() {
   installEditPolicy(
       EditPolicyRoles.CREATION_ROLE,
       new CreationEditPolicyWithCustomReparent(
           stateAnalysis.diagram.part.StateAnalysisVisualIDRegistry.TYPED_INSTANCE));
   super.createDefaultEditPolicies();
   installEditPolicy(
       EditPolicyRoles.SEMANTIC_ROLE,
       new stateAnalysis.diagram.edit.policies.StateVariable2ItemSemanticEditPolicy());
   installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
   installEditPolicy(
       EditPolicyRoles.OPEN_ROLE, new stateAnalysis.diagram.edit.policies.OpenDiagramEditPolicy());
   // XXX need an SCR to runtime to have another abstract superclass that would let children add
   // reasonable editpolicies
   // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
 }
コード例 #13
0
 /** @generated NOT */
 protected void createDefaultEditPolicies() {
   installEditPolicy(
       EditPolicyRoles.CREATION_ROLE,
       new CreationEditPolicyWithCustomReparent(
           dataMapper.diagram.part.DataMapperVisualIDRegistry.TYPED_INSTANCE));
   super.createDefaultEditPolicies();
   installEditPolicy(
       EditPolicyRoles.SEMANTIC_ROLE,
       new dataMapper.diagram.edit.policies.InputItemSemanticEditPolicy());
   installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
   installEditPolicy(
       EditPolicyRoles.CANONICAL_ROLE,
       new dataMapper.diagram.edit.policies.InputCanonicalEditPolicy());
   installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
   removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.POPUPBAR_ROLE);
 }
コード例 #14
0
  /** @generated */
  protected void createDefaultEditPolicies() {

    installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy());
    super.createDefaultEditPolicies();
    installEditPolicy(
        EditPolicyRoles.SEMANTIC_ROLE,
        new de.uni_mannheim.informatik.swt.models.plm.diagram.edit.policies
            .MethodItemSemanticEditPolicy());
    installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
    installEditPolicy(
        EditPolicyRoles.CANONICAL_ROLE,
        new de.uni_mannheim.informatik.swt.models.plm.diagram.edit.policies
            .MethodCanonicalEditPolicy());
    installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
    // XXX need an SCR to runtime to have another abstract superclass that would let children add
    // reasonable editpolicies
    // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);

  }
コード例 #15
0
ファイル: ClassEditPart.java プロジェクト: ppourali/MMINT
 /** @generated */
 protected void createDefaultEditPolicies() {
   installEditPolicy(
       EditPolicyRoles.CREATION_ROLE,
       new CreationEditPolicyWithCustomReparent(
           edu.toronto.cs.se.modelepedia.icse15_sequencediagram_mavo.diagram.part
               .ICSE15_SequenceDiagram_MAVOVisualIDRegistry.TYPED_INSTANCE));
   super.createDefaultEditPolicies();
   installEditPolicy(
       EditPolicyRoles.SEMANTIC_ROLE,
       new edu.toronto.cs.se.modelepedia.icse15_sequencediagram_mavo.diagram.edit.policies
           .ClassItemSemanticEditPolicy());
   installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
   installEditPolicy(
       EditPolicyRoles.OPEN_ROLE,
       new edu.toronto.cs.se.modelepedia.icse15_sequencediagram_mavo.diagram.edit.policies
           .OpenDiagramEditPolicy()); // XXX need an SCR to runtime to have another abstract
   // superclass that would let children add reasonable
   // editpolicies
   // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
 }
コード例 #16
0
 protected void addChildVisual(EditPart childEditPart, int index) {
   refreshOutputConnector(
       ((EntitlementMediatorEditPart)
           childEditPart.getParent().getParent().getParent().getParent()));
   super.addChildVisual(childEditPart, -1);
 }
コード例 #17
0
 /** @generated */
 protected void removeChildVisual(EditPart childEditPart) {
   if (removeFixedChild(childEditPart)) {
     return;
   }
   super.removeChildVisual(childEditPart);
 }
コード例 #18
0
 /** @generated */
 protected void addChildVisual(EditPart childEditPart, int index) {
   if (addFixedChild(childEditPart)) {
     return;
   }
   super.addChildVisual(childEditPart, -1);
 }
コード例 #19
0
 /** @generated NOT */
 public void activate() {
   super.activate();
 }