/**
   * Override to return the <code>Command</code> to perform an {@link RequestConstants#REQ_CLONE
   * CLONE}. By default, <code>null</code> is returned.
   *
   * @param request the Clone Request
   * @return A command to perform the Clone.
   */
  protected Command getCloneCommand(ChangeBoundsRequest request) {
    CloneCommand clone = new CloneCommand();

    clone.setParent((LogicDiagram) getHost().getModel());

    Iterator i = request.getEditParts().iterator();
    GraphicalEditPart currPart = null;

    while (i.hasNext()) {
      currPart = (GraphicalEditPart) i.next();
      clone.addPart(
          (LogicSubpart) currPart.getModel(), (Rectangle) getConstraintFor(request, currPart));
    }

    // Attach to horizontal guide, if one is given
    Integer guidePos = (Integer) request.getExtendedData().get(SnapToGuides.KEY_HORIZONTAL_GUIDE);
    if (guidePos != null) {
      int hAlignment =
          ((Integer) request.getExtendedData().get(SnapToGuides.KEY_HORIZONTAL_ANCHOR)).intValue();
      clone.setGuide(findGuideAt(guidePos.intValue(), true), hAlignment, true);
    }

    // Attach to vertical guide, if one is given
    guidePos = (Integer) request.getExtendedData().get(SnapToGuides.KEY_VERTICAL_GUIDE);
    if (guidePos != null) {
      int vAlignment =
          ((Integer) request.getExtendedData().get(SnapToGuides.KEY_VERTICAL_ANCHOR)).intValue();
      clone.setGuide(findGuideAt(guidePos.intValue(), false), vAlignment, false);
    }

    return clone;
  }
  @Override
  protected IFigure createNodeShape() {
    CustomStyle imageStyle = (CustomStyle) resolveSemanticElement();

    NodeImageExtension imageExtension =
        ExtensionActivator.getDefault().getBestImageExtension(imageStyle.getId());

    primaryShape =
        new RotatableSVGWorkspaceImageFigure(
            imageExtension.getMode(),
            imageExtension.getTopImage(),
            imageExtension.getLeftImage(),
            imageExtension.getBottomImage(),
            imageExtension.getRightImage());

    listener = new RotatableImageListener(this);
    primaryShape.addFigureListener(listener);

    EditPart parentEditPart = getParent();
    if (parentEditPart instanceof GraphicalEditPart) {
      GraphicalEditPart parentGraphicalEditPart = (GraphicalEditPart) parentEditPart;
      NodeListener dEdgeEditPartListener = new PropagateFigureListenerAtConnectionFigure(listener);
      parentGraphicalEditPart.addNodeListener(dEdgeEditPartListener);
    }

    return primaryShape;
  }
 /**
  * Refreshes the label of the figure associated to the specified edit part
  *
  * @param editPart the edit part managing the refreshed figure
  */
 public void refreshEditPartDisplay(GraphicalEditPart editPart) {
   IFigure figure = editPart.getFigure();
   // computes the icon to be displayed
   final Collection<Image> imageToDisplay = stereotypeIconsToDisplay(editPart);
   // should check if edit part has to display the element icon or not
   if (AppearanceHelper.showElementIcon((View) editPart.getModel())) {
     imageToDisplay.add(getImage(editPart));
   }
   // for each element in the list of stereotype icon, adds it to the icons
   // list of the
   // wrapping label
   // problem (RS - CEA LIST): more icons were displayed before refresh:
   // has to clean
   // problem 2 (RS - CEA LIST): no method to know how many icons were
   // displayed => should fix
   // a max number ?!
   // solution: set all images to null, and then add the correct icons
   int i = 0;
   if (figure instanceof WrappingLabel) {
     while (((WrappingLabel) figure).getIcon(i) != null) {
       ((WrappingLabel) figure).setIcon(null, i);
       i++;
     }
     i = 0;
     for (Image image : imageToDisplay) {
       ((WrappingLabel) figure).setIcon(image, i);
       i++;
     }
     ((WrappingLabel) figure).setText(labelToDisplay(editPart));
   }
 }
  public void execute(ICustomContext context) {
    PictogramElement[] pes = context.getPictogramElements();
    if (pes != null && pes.length > 0 && pes[0] != null) {
      PictogramElement pe = pes[0];
      DiagramEditorInternal diagramEditor = (DiagramEditorInternal) getDiagramEditor();
      GraphicalEditPart ep = diagramEditor.getEditPartForPictogramElement(pe);
      IFigure figure = diagramEditor.getFigureForPictogramElement(pe);

      switch (getType()) {
        case TYPE_DUMP_PICTOGRAM_DATA:
          GraphitiUiInternal.getTraceService().dumpPictogramModelTree(pe);
          break;
        case TYPE_DUMP_EDIT_PART_DATA:
          GraphitiUiInternal.getTraceService().dumpEditPartTree(ep);
          break;
        case TYPE_DUMP_FIGURE_DATA:
          GraphitiUiInternal.getTraceService().dumpFigureTree(figure);
          break;
        case TYPE_DUMP_ALL:
          GraphitiUiInternal.getTraceService().dumpPictogramModelTree(pe);
          GraphitiUiInternal.getTraceService().dumpEditPartTree(ep);
          GraphitiUiInternal.getTraceService().dumpFigureTree(figure);
          break;
        case TYPE_REFRESH:
          ep.refresh();
          break;
      }
    }
  }
 /**
  * Computes actual grid specification (origin + single cell width and height) in the absolute
  * coordinate system. Note, in contrast to {@link #getRelativeGridSpec(EditPartViewer)} this
  * specification depends on the active zoom or scroll and can't be cached by clients.
  *
  * @param viewer
  * @return absolute grid specification, or <code>null</code> if grid is not enabled
  */
 public static PrecisionRectangle getAbsoluteGridSpec(EditPartViewer viewer) {
   PrecisionRectangle spec = getRelativeGridSpec(viewer);
   if (spec != null) {
     GraphicalEditPart diagramEP = (GraphicalEditPart) viewer.getContents();
     diagramEP.getContentPane().translateToAbsolute(spec);
   }
   return spec;
 }
 /**
  * Resizes the figure. Use {@link AbstractBaseEditPart} to implement more complex refreshing
  * behavior.
  *
  * @param refreshableFigure the figure
  */
 protected synchronized void doRefreshVisuals(final IFigure refreshableFigure) {
   super.refreshVisuals();
   AbstractWidgetModel model = getWidgetModel();
   GraphicalEditPart parent = (GraphicalEditPart) getParent();
   if (parent != null) {
     parent.setLayoutConstraint(
         this, refreshableFigure, new Rectangle(model.getLocation(), model.getSize()));
   }
 }
Exemple #7
0
 /**
  * Get the static minimum size from child edit part rather than imposing a constant one.
  *
  * <p>Bug #422827 is about this method called for reflowable comments, so the new version of this
  * class should call {@link #getMinimumSizeForHint(GraphicalEditPart, Dimension)} instead.
  *
  * @see
  *     org.eclipse.gef.editpolicies.XYLayoutEditPolicy#getMinimumSizeFor(org.eclipse.gef.GraphicalEditPart)
  * @param child the child
  * @return the minumum size
  */
 @Override
 protected Dimension getMinimumSizeFor(GraphicalEditPart child) {
   if (isReflowable(child)) {
     // call from super class, we need to return something very small
     // because this class will call getMinimumSizeForHint() anyway
     return new Dimension(5, 5);
   }
   if (child.getFigure() != null) {
     return child.getFigure().getMinimumSize();
   }
   return super.getMinimumSizeFor(child);
 }
 @SuppressWarnings("unchecked")
 ConnectionEditPart findConnection(
     GraphicalEditPart node, ConnectionEditPart current, boolean forward) {
   List<ConnectionEditPart> connections =
       new ArrayList<ConnectionEditPart>(node.getSourceConnections());
   connections.addAll(node.getTargetConnections());
   if (connections.isEmpty()) return null;
   if (forward) counter++;
   else counter--;
   while (counter < 0) counter += connections.size();
   counter %= connections.size();
   return connections.get(counter % connections.size());
 }
  @Override
  public void setSelected(int value) {
    final EditPart parent = this.getParent();

    final NormalColumnFigure figure = (NormalColumnFigure) this.getFigure();

    Color backgroundColor = null;
    Color foregroundColor = null;
    boolean isSelected = false;

    if (value != 0 && parent != null && parent.getParent() != null) {
      List selectedEditParts = this.getViewer().getSelectedEditParts();

      if (selectedEditParts == null || selectedEditParts.size() != 1) {
        return;
      }

      backgroundColor = ColorConstants.titleBackground;
      foregroundColor = ColorConstants.titleForeground;
      isSelected = true;
    }

    final NormalColumn normalColumn = (NormalColumn) this.getModel();
    final ColumnHolder columnHolder = normalColumn.getColumnHolder();

    if (columnHolder instanceof ColumnGroup) {
      if (parent != null) {
        for (Object child : parent.getChildren()) {
          final GraphicalEditPart childEditPart = (GraphicalEditPart) child;

          if (childEditPart.getModel() instanceof NormalColumn) {
            final NormalColumn column = (NormalColumn) childEditPart.getModel();
            if (column.getColumnHolder() == columnHolder) {
              setGroupColumnFigureColor(
                  (TableViewEditPart) parent, (ColumnGroup) columnHolder, isSelected);
            }
          }
        }
      }

    } else {
      figure.setBackgroundColor(backgroundColor);
      figure.setForegroundColor(foregroundColor);
      selected = isSelected;
    }

    super.setSelected(value);
  }
  /**
   * Always returns the same instance to avoid endless creation
   *
   * @return active grid specification in absolute coordinates or <code>null</code> if not enabled
   */
  public PrecisionRectangle getAbsoluteGridSpec() {
    PrecisionRectangle result = getRelativeGridSpec();
    if (result == null) {
      return null;
    }

    if (myAbsoluteGridSpec == null) {
      myAbsoluteGridSpec = new PrecisionRectangle();
    }
    myAbsoluteGridSpec.setPreciseBounds(
        result.preciseX(), result.preciseY(), result.preciseWidth(), result.preciseHeight());
    GraphicalEditPart diagramEP = (GraphicalEditPart) myViewer.getContents();
    diagramEP.getContentPane().translateToAbsolute(myAbsoluteGridSpec);

    return myAbsoluteGridSpec;
  }
Exemple #11
0
 /**
  * Called for reflowable editpart and allows them to compute minimum height based on suggested
  * width.
  *
  * @return minimum size computed by using the given width as a hint.
  */
 protected Dimension getMinimumSizeForHint(GraphicalEditPart child, Dimension hint) {
   IFigure figure = child.getFigure();
   if (figure == null) {
     return super.getMinimumSizeFor(child);
   }
   return figure.getMinimumSize(hint.width, -1);
 }
 @Override
 protected Object getConstraintFor(ChangeBoundsRequest request, GraphicalEditPart child) {
   Rectangle rect = (Rectangle) super.getConstraintFor(request, child);
   if (child instanceof LifelineEditPart) {
     child.getFigure().translateToRelative(rect);
   }
   return rect;
 }
  /**
   * Removes a decoration.
   *
   * @param decoratorTarget the decorator target
   * @param Decoration the decoration
   */
  public final void removeDecoration(IDecoration decoration) {
    if ((decoration == null) || (decoratorTarget == null)) {
      return;
    }

    if (decoration instanceof IFigure) {
      IFigure parent = ((IFigure) decoration).getParent();
      if (parent != null) {
        parent.remove((IFigure) decoration);
      }
    }
    // decorations.remove(decoration);
    GraphicalEditPart ownerEditPart =
        (GraphicalEditPart) decoratorTarget.getAdapter(GraphicalEditPart.class);
    if (ownerEditPart.getViewer() != null) {
      ownerEditPart.getViewer().getVisualPartMap().remove(decoration);
    }
  }
  @SuppressWarnings("unchecked")
  public void setVisibility(int visibility) {
    if (this.visibility == visibility || (visibility < INVISIBLE || visibility > FADED)) return;

    this.visibility = visibility;
    _setVisibilityProperty(visibility);
    updateFigureVisibility(getFigure(), visibility);

    // Connections have to be grayed out too.
    Collection<Object> connections =
        new ArrayList<Object>(getSourceConnections().size() + getTargetConnections().size());
    connections.addAll(getSourceConnections());
    connections.addAll(getTargetConnections());
    for (Object obj : connections) {
      GraphicalEditPart part = (GraphicalEditPart) obj;
      part.getFigure().setVisible(visibility != INVISIBLE);
      part.refresh();
    }
    getParent().refresh();
  }
 /**
  * get the list of stereotype to display from the eannotation
  *
  * @return the list of stereotypes to display
  */
 public String stereotypesToDisplay(GraphicalEditPart editPart) {
   View view = (View) editPart.getModel();
   // retrieve all stereotypes to be displayed
   // try to display stereotype properties
   String stereotypesPropertiesToDisplay =
       AppliedStereotypeHelper.getAppliedStereotypesPropertiesToDisplay(view);
   String stereotypesToDisplay = AppliedStereotypeHelper.getStereotypesToDisplay(view);
   String stereotypespresentationKind =
       AppliedStereotypeHelper.getAppliedStereotypePresentationKind(view);
   // now check presentation.
   // if horizontal => equivalent to the inBrace visualization in nodes
   // (i.e. only name =
   // value, separator = comma, delimited with brace
   // if vertical => equivalent to compartment visualization name of
   // stereotype, NL, property =
   // value, NL, etC.
   // check the presentation kind. if only icon => do not display
   // stereotype, only values
   if (UMLVisualInformationPapyrusConstant.ICON_STEREOTYPE_PRESENTATION.equals(
       stereotypespresentationKind)) {
     return StereotypeUtil.getPropertiesValuesInBrace(
         stereotypesPropertiesToDisplay, getUMLElement(editPart));
   }
   String stereotypesToDisplayWithQN = AppliedStereotypeHelper.getStereotypesQNToDisplay(view);
   String display = "";
   if (UMLVisualInformationPapyrusConstant.STEREOTYPE_TEXT_VERTICAL_PRESENTATION.equals(
       stereotypespresentationKind)) {
     display +=
         stereotypesAndPropertiesToDisplay(
             editPart,
             "\n",
             stereotypesToDisplay,
             stereotypesToDisplayWithQN,
             stereotypesPropertiesToDisplay);
   } else {
     final String st =
         stereotypesToDisplay(editPart, ", ", stereotypesToDisplay, stereotypesToDisplayWithQN);
     if (st != null && !st.equals("")) {
       display += Activator.ST_LEFT + st + Activator.ST_RIGHT + " ";
     }
     final String propSt =
         StereotypeUtil.getPropertiesValuesInBrace(
             stereotypesPropertiesToDisplay, getUMLElement(editPart));
     if (propSt != null && !propSt.equals("")) {
       if (st != null && !st.equals("")) {
         // display += "\n";
       }
       display += "{" + propSt + "} ";
     }
   }
   return display;
 }
 /**
  * Returns the image to be displayed for the applied stereotypes.
  *
  * @return the image that represents the first applied stereotype or <code>null</code> if no image
  *     has to be displayed
  */
 public Collection<Image> stereotypeIconsToDisplay(GraphicalEditPart editPart) {
   String stereotypespresentationKind =
       AppliedStereotypeHelper.getAppliedStereotypePresentationKind((View) editPart.getModel());
   if (stereotypespresentationKind == null) {
     return null;
   }
   if (stereotypespresentationKind.equals(
           UMLVisualInformationPapyrusConstant.ICON_STEREOTYPE_PRESENTATION)
       || stereotypespresentationKind.equals(
           UMLVisualInformationPapyrusConstant.TEXT_ICON_STEREOTYPE_PRESENTATION)) {
     // retrieve the first stereotype in the list of displayed stereotype
     String stereotypesToDisplay =
         AppliedStereotypeHelper.getStereotypesToDisplay((View) editPart.getModel());
     Collection<Stereotype> stereotypes = new ArrayList<Stereotype>();
     StringTokenizer tokenizer = new StringTokenizer(stereotypesToDisplay, ",");
     while (tokenizer.hasMoreTokens()) {
       String firstStereotypeName = tokenizer.nextToken();
       stereotypes.add(getUMLElement(editPart).getAppliedStereotype(firstStereotypeName));
     }
     return Activator.getIconElements(getUMLElement(editPart), stereotypes, false);
   }
   return new ArrayList<Image>();
 }
 @Override
 public void relocate(IFigure target) {
   Rectangle bounds = target.getBounds().getCopy();
   Point location = null;
   if (parent instanceof ConnectorEditPart) {
     ConnectorEditPart connectorPart = (ConnectorEditPart) parent;
     PointList points = getPoints(connectorPart.getConnectionFigure());
     location = getPointForEnd(points);
   } else {
     // if the parent is any other edit part
     // use the bounds center
     location = parent.getFigure().getBounds().getCenter();
   }
   if (lastLocation == null) {
     lastLocation = location;
   }
   Dimension delta = location.getDifference(lastLocation);
   bounds.translate(delta.width, delta.height);
   lastLocation = location.getCopy();
   // if the current width is 0 then the
   // user has never set the width, calculate it
   // here using a maximum number of 400
   boolean cropWidth = false;
   if (bounds.width == 0) {
     Dimension preferred = target.getPreferredSize();
     bounds.width = preferred.width;
     bounds.width = Math.min(400, bounds.width);
     cropWidth = true;
   }
   if (bounds.width < target.getBorder().getInsets(target).getWidth()) {
     // do not allow resizing to zero
     bounds.width = target.getBorder().getInsets(target).getWidth();
   }
   // we must set the bounds to allow recalculation
   // of text height (wrapping)
   target.setBounds(bounds);
   target.validate();
   // adjust height to account for word wrapping
   bounds.height = getMinimumHeight(target);
   if (cropWidth) {
     // crop the width here, as this is not a user set
     // width and otherwise if near 400 may leave extra
     // slack
     bounds.width = getMinimumWidth(target);
   }
   target.setBounds(bounds);
 }
 /*
  * (non-Javadoc)
  * @see
  * org.eclipse.gef.editpolicies.XYLayoutEditPolicy#getMinimumSizeFor(org
  * .eclipse.gef.GraphicalEditPart)
  */
 @Override
 protected Dimension getMinimumSizeFor(final GraphicalEditPart child) {
   return child.getContentPane().getMinimumSize();
 }
  @Override
  public void fill(Menu menu, int index) {

    // this is a hack to prevent this menu from being created twice
    if (menu.getItemCount() > MIDContextMenu.INVALID_MENU_ITEM_LIMIT) {
      return;
    }

    // check selection
    ISelection selection =
        PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getSelection();
    if (selection == null || selection.isEmpty() || !(selection instanceof StructuredSelection)) {
      return;
    }
    Object[] objects = ((StructuredSelection) selection).toArray();
    boolean doDerivation = true;
    if (objects.length > 1) {
      doDerivation = false;
    }

    // get selection
    ModelElementReference modelElemRef = null;
    for (Object object : objects) {
      if (object instanceof ModelElementReferenceEditPart
          || object instanceof ModelElementReference2EditPart) {
        GraphicalEditPart editPart = (GraphicalEditPart) object;
        modelElemRef = (ModelElementReference) ((View) editPart.getModel()).getElement();
        // TODO MMINT[KLEISLI] replace with KleisliModelElement
        EMFInfo eInfo = modelElemRef.getObject().getEInfo();
        if (!(((ModelEndpointReference) modelElemRef.eContainer()).getObject()
                instanceof KleisliModelEndpoint)
            || MultiModelConstraintChecker.isInstancesLevel(modelElemRef)
            || ( // only types
            !eInfo.getClassName().startsWith("_")
                && ( // only derived classes
                eInfo.getFeatureName() == null || !eInfo.getFeatureName().startsWith("_")))
            || (eInfo.getClassName().startsWith("_")
                && // only derived features
                eInfo.getFeatureName() != null
                && !eInfo.getFeatureName().startsWith("_"))) {
          doDerivation = false;
        }
      }
      if (!doDerivation) {
        return;
      }
    }
    if (modelElemRef == null) { // no relevant edit parts selected
      return;
    }

    // create dynamic menus
    MenuItem mmintItem = new MenuItem(menu, SWT.CASCADE, index);
    mmintItem.setText(MIDContextMenu.MMINT_MENU_LABEL);
    Menu mmintMenu = new Menu(menu);
    mmintItem.setMenu(mmintMenu);
    // derivation
    if (doDerivation) {
      MenuItem derivationItem = new MenuItem(mmintMenu, SWT.NONE);
      derivationItem.setText(MMINT_MENU_KLEISLI_LABEL);
      derivationItem.addSelectionListener(
          new KleisliAddModifyQueryListener(MMINT_MENU_KLEISLI_LABEL, modelElemRef.getObject()));
    }
  }
 @Override
 public void execute() {
   // configure the request
   EditPart source = request.getSourceEditPart();
   EditPart target = request.getTargetEditPart();
   PointList list = feedback.getPoints();
   DiagramEditPart diagramEditPart = null;
   if (source.getParent() instanceof DiagramEditPart) {
     diagramEditPart = (DiagramEditPart) source.getParent();
   } else if (source instanceof DiagramEditPart) {
     diagramEditPart = (DiagramEditPart) source;
   } else {
     if (source.getParent().getParent() instanceof DiagramEditPart) {
       diagramEditPart = (DiagramEditPart) source.getParent().getParent();
     }
   }
   if (diagramEditPart == null) {
     return;
   }
   if (!(source instanceof DiagramEditPart || target instanceof DiagramEditPart)) {
     // one must be whitespace, we make it the target
     request.setTargetEditPart(diagramEditPart);
     // additionally we must cut the drawn connection
     // in half to share room with the element that will
     // be auto-created
     PointList newList = new PointList();
     newList.addPoint(list.getFirstPoint());
     if (list.size() == 4) {
       // rectilinear routing will have a three points
       newList.addPoint(list.getPoint(1));
     }
     newList.addPoint(list.getMidpoint());
     feedback.setPoints(newList);
   }
   // create the active tool's element first
   CreateConnectionCommand command = new CreateConnectionCommand(request, feedback);
   command.execute();
   Connector_c newConnector = command.result;
   if (newConnector == null) {
     return;
   }
   // we need to now refresh the diagram to get the new edit part
   source.refresh();
   source.getParent().refresh();
   GraphicalEditPart newPart =
       (GraphicalEditPart) source.getViewer().getEditPartRegistry().get(newConnector);
   // transfer the feedback connection points to the newly created
   // edit part
   ((Connection) newPart.getFigure()).setPoints(feedback.getPoints().getCopy());
   // now adjust the request for the new element to be created for each
   // terminal specification that requires auto-creation
   createElementForTerminalSpec(
       autoStartSpec,
       ((NonRootModelElement) diagramEditPart.getModel()).getModelRoot(),
       list,
       newPart,
       target,
       diagramEditPart);
   createElementForTerminalSpec(
       autoEndSpec,
       ((NonRootModelElement) diagramEditPart.getModel()).getModelRoot(),
       list,
       newPart,
       target,
       diagramEditPart);
 }
 private void describeGraphicalPartTo(GraphicalEditPart part, StringBuffer buffer) {
   separate(buffer);
   describeFigureTo(part.getFigure(), buffer);
 }
 /** {@inheritDoc} */
 @Override
 public Property getUMLElement(GraphicalEditPart editPart) {
   if ((View) editPart.getModel() != null && ((View) editPart.getModel()).eContainer() != null) {
     EObject container = ((View) editPart.getModel()).eContainer();
     if (!(container instanceof Edge)) {
       return null; // Happens e.g. when redoing the suppression of an association's end. The
                    // association is contained in a ChangeDescription
     }
     if (((Edge) ((View) editPart.getModel()).eContainer()).getTarget() == null) {
       return null;
     }
     Classifier target =
         (Classifier) ((Edge) ((View) editPart.getModel()).eContainer()).getTarget().getElement();
     Property propertyToDisplay = null;
     if (((View) editPart.getModel()) != null
         && (((View) editPart.getModel()).getElement() instanceof Association)) {
       // look for the property that is typed by the classifier
       Iterator<Property> propertiesIterator =
           ((Association) ((View) editPart.getModel()).getElement()).getMemberEnds().iterator();
       // find the last
       while (propertiesIterator.hasNext()) {
         Property currentProperty = propertiesIterator.next();
         if (EcoreUtil.equals(currentProperty.getType(), target)) {
           propertyToDisplay = currentProperty;
         }
       }
     }
     if (propertyToDisplay != null) {
       return propertyToDisplay;
     }
     // /in the case of reorient the property must be not found,
     // so we have to find the property that is different from the source.
     Classifier source =
         (Classifier) ((Edge) ((View) editPart.getModel()).eContainer()).getSource().getElement();
     if (((View) editPart.getModel()) != null
         && (((View) editPart.getModel()).getElement() instanceof Association)) {
       // look for the property that is typed by the classifier
       Iterator<Property> propertiesIterator =
           ((Association) ((View) editPart.getModel()).getElement()).getMemberEnds().iterator();
       // find the last
       while (propertiesIterator.hasNext()) {
         Property currentProperty = propertiesIterator.next();
         if (!EcoreUtil.equals(currentProperty.getType(), source)) {
           propertyToDisplay = currentProperty;
         }
       }
     }
     return propertyToDisplay;
   }
   return null;
 }
 /**
  * Creates a MoveHandle for the given <code>GraphicalEditPart</code> using a default {@link
  * Locator}.
  *
  * @param owner The GraphicalEditPart to be moved by this handle.
  */
 public MoveHandle(GraphicalEditPart owner) {
   this(owner, new MoveHandleLocator(owner.getFigure()));
 }
 private Rectangle getAbsoluteBounds(GraphicalEditPart ep) {
   Rectangle bounds = ep.getFigure().getBounds().getCopy();
   ep.getFigure().translateToAbsolute(bounds);
   return bounds;
 }