示例#1
0
  private static void main() throws FileNotFoundException {
    // デフォルトDisplayを使用してシェルを作成
    try {
      shell.setSize(100, 100); // シェルのサイズを指定

      // 作成したシェルを使用したLightweightSystemの作成
      LightweightSystem lws = new LightweightSystem(shell);

      // ルート・フィギュアの作成
      IFigure panel = new Figure();
      panel.setLayoutManager(new ToolbarLayout());

      initialize(panel);

      // ルート・フィギュアの登録
      lws.setContents(panel);

      // 以下は、その他のSWTアプリケーションと同様
      shell.open();

      Display display = Display.getDefault();
      while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) display.sleep();
      }

    } finally {
      if (image != null) {
        image.dispose();
      }
    }
  }
示例#2
0
 /** @generated */
 protected boolean removeFixedChild(EditPart childEditPart) {
   if (childEditPart
       instanceof
       edu.toronto.cs.se.modelepedia.icse15_sequencediagram_mavo.diagram.edit.parts
           .ClassNameEditPart) {
     return true;
   }
   if (childEditPart
       instanceof
       edu.toronto.cs.se.modelepedia.icse15_sequencediagram_mavo.diagram.edit.parts
           .WrappingLabel2EditPart) {
     return true;
   }
   if (childEditPart
       instanceof
       edu.toronto.cs.se.modelepedia.icse15_sequencediagram_mavo.diagram.edit.parts
           .ClassClassOperationsCompartmentEditPart) {
     IFigure pane = getPrimaryShape().getClassOperationsCompartmentFigure();
     pane.remove(
         ((edu.toronto.cs.se.modelepedia.icse15_sequencediagram_mavo.diagram.edit.parts
                     .ClassClassOperationsCompartmentEditPart)
                 childEditPart)
             .getFigure());
     return true;
   }
   return false;
 }
 private void hookAll() {
   figuresToBounds = new HashMap<IFigure, Rectangle>();
   for (int i = 0; i < container.getChildren().size(); i++) {
     addChild((IFigure) container.getChildren().get(i));
   }
   container.addLayoutListener(listener);
 }
示例#4
0
  protected IFigure createFigure() {
    if (image == null) {
      ILabeledElement element = BPELUtil.adapt(getStartNode(), ILabeledElement.class);
      image = element.getSmallImage(getStartNode());
      Rectangle rect = image.getBounds();
      imageWidth = rect.width;
      imageHeight = rect.height;
    }
    this.hasFH = getFaultHandler() != null;
    this.hasEH = getEventHandler() != null;
    // Cause the handlerIcons don't belong to the
    // bounds of the StartNodeFigure (as a result of
    // moving them a bit to the right in vertical layout and a bit to to the bottom
    // in horizontal layout) hit testing
    // doesn't reach the Startnode. So add an invisible
    // border
    StartNodeFigure snf = new StartNodeFigure();
    if (!ModelHelper.isHorizontalLayout(getModel()))
      snf.setBorder(new MarginBorder(0, 7 + BORDER_WIDTH, 0, 7 + BORDER_WIDTH));
    else snf.setBorder(new MarginBorder(5, 0, 5, 0));

    faultImageFigure = new ImageFigure(faultImage);
    faultImageFigure.setParent(snf);

    eventImageFigure = new ImageFigure(eventImage);
    eventImageFigure.setParent(snf);

    return snf;
  }
 @Override
 protected void doExecute() {
   if (designEditor != null) {
     GraphicalViewer graphicalViewer = designEditor.getGraphicalViewer();
     if (graphicalViewer != null && graphicalViewer.getEditPartRegistry() != null) {
       ScalableFreeformRootEditPart rootEditPart =
           (ScalableFreeformRootEditPart)
               graphicalViewer.getEditPartRegistry().get(LayerManager.ID);
       IFigure gridFigure = ((LayerManager) rootEditPart).getLayer(LayerConstants.GRID_LAYER);
       IColorConstant cc =
           StyleUtil.getColorConstant(
               PreferenceManager.getInstance()
                   .loadPreferenceAsString(PreferencesConstants.EDITOR_GRID_COLOR));
       Diagram diagram = designEditor.getDiagramTypeProvider().getDiagram();
       if (cc != null && diagram != null) {
         GraphicsAlgorithm ga = diagram.getGraphicsAlgorithm();
         if (ga != null) {
           ga.setForeground(GraphitiUi.getGaService().manageColor(diagram, cc));
           gridFigure.repaint();
           gridFigure.revalidate();
           designEditor.getDiagramBehavior().refreshContent();
         }
       }
     }
   }
 }
  @Override
  protected Dimension calculatePreferredSize(IFigure container, int wHint, int hHint) {
    Insets insets = container.getInsets();
    if (isHorizontal()) {
      wHint = -1;
      if (hHint >= 0) {
        hHint = Math.max(0, hHint - insets.getHeight());
      }
    } else {
      hHint = -1;
      if (wHint >= 0) {
        wHint = Math.max(0, wHint - insets.getWidth());
      }
    }

    List children = container.getChildren();
    Dimension prefSize = calculateChildrenSize(children, wHint, hHint, true);
    // Do a second pass, if necessary
    if (wHint >= 0 && prefSize.width > wHint) {
      prefSize = calculateChildrenSize(children, prefSize.width, hHint, true);
    } else if (hHint >= 0 && prefSize.width > hHint) {
      prefSize = calculateChildrenSize(children, wHint, prefSize.width, true);
    }

    prefSize.height += Math.max(0, children.size() - 1) * spacing;
    return transposer
        .t(prefSize)
        .expand(insets.getWidth(), insets.getHeight())
        .union(getBorderPreferredSize(container));
  }
  /** Erases the guide and the feedback shown by the container of the elements. */
  protected void eraseSourceFeedback() {
    if (guideline.getParent() != null) {
      guideline.getParent().remove(guideline);
    }

    if (_container != null) {
      _container.eraseSourceFeedback(getSourceRequest());
    }

    ChangeBoundsRequest request = new ChangeBoundsRequest(RequestConstants.REQ_MOVE);
    request.setEditParts(Collections.emptyList());
    request.setSizeDelta(new Dimension(0, 0));
    request.setMoveDelta(new Point(0, 0));
    for (IGraphicalEditPart part : _movingShapes) {
      part.eraseSourceFeedback(request);
    }

    ChangeBoundsRequest spRequest = new ChangeBoundsRequest(RequestConstants.REQ_RESIZE);
    spRequest.setEditParts(Collections.emptyList());
    spRequest.setSizeDelta(new Dimension(0, 0));
    spRequest.setMoveDelta(new Point(0, 0));
    for (IGraphicalEditPart sp : _subProcesses) {
      sp.eraseSourceFeedback(spRequest);
    }
  }
示例#8
0
  @Override
  protected IFigure createFigure() {
    final IFigure figure = createBaseFigure();
    ComponentInterface ci =
        ((WorkflowNode) getModel())
            .getComponentDescription()
            .getComponentInstallation()
            .getComponentRevision()
            .getComponentInterface();

    if (ci.getShape() == ComponentShape.CIRCLE) {
      final int size = 16;
      final int newOffset = 3;
      errorFigure.setBounds(new Rectangle(newOffset, newOffset, size, size));
      warningFigure.setBounds(new Rectangle(newOffset, newOffset, size, size));
      final int localX = 22;
      final int localY = 20;
      localFigure.setBounds(new Rectangle(localX, localY, size, size));
    } else if (ci.getSize() == ComponentSize.SMALL) {
      final int size = 16;
      final int newOffsetX = 22;
      final int newOffsetY = 1;
      warningFigure.setBounds(new Rectangle(newOffsetX, newOffsetY, size, size));
      final int localX = 22;
      final int localY = 22;
      localFigure.setBounds(new Rectangle(localX, localY, size, size));
    }
    figure.add(errorFigure);
    figure.add(warningFigure);
    figure.add(localFigure);
    figure.add(deprecatedFigure);
    return figure;
  }
  /**
   * Given a label figure object, this will calculate the correct Font needed to display into screen
   * coordinates, taking into account the current mapmode. This will typically be used by direct
   * edit cell editors that need to display independent of the zoom or any coordinate mapping that
   * is taking place on the drawing surface.
   *
   * @param label the label to use for the font calculation
   * @return the <code>Font</code> that is scaled to the screen coordinates. Note: the returned
   *     <code>Font</code> should not be disposed since it is cached by a common resource manager.
   */
  protected Font getScaledFont(IFigure label) {
    Font scaledFont = label.getFont();
    FontData data = scaledFont.getFontData()[0];
    Dimension fontSize = new Dimension(0, MapModeUtil.getMapMode(label).DPtoLP(data.getHeight()));
    label.translateToAbsolute(fontSize);

    if (Math.abs(data.getHeight() - fontSize.height) < 2) fontSize.height = data.getHeight();

    try {
      FontDescriptor fontDescriptor = FontDescriptor.createFrom(data);
      cachedFontDescriptors.add(fontDescriptor);
      return getResourceManager().createFont(fontDescriptor);
    } catch (DeviceResourceException e) {
      Trace.catching(
          DiagramUIPlugin.getInstance(),
          DiagramUIDebugOptions.EXCEPTIONS_CATCHING,
          getClass(),
          "getScaledFont",
          e); //$NON-NLS-1$
      Log.error(
          DiagramUIPlugin.getInstance(),
          DiagramUIStatusCodes.IGNORED_EXCEPTION_WARNING,
          "getScaledFont",
          e); //$NON-NLS-1$
    }
    return JFaceResources.getDefaultFont();
  }
 /**
  * @see
  *     org.eclipse.papyrus.uml.diagram.communication.edit.parts.MessageEditPart#addFixedChild(org.eclipse.gef.EditPart)
  * @param childEditPart
  * @return
  */
 @Override
 protected boolean addFixedChild(EditPart childEditPart) {
   if (childEditPart instanceof MessageNameEditPart) {
     CustomWrappingLabel fFigureMessageCreateLabelFigure = new CustomWrappingLabel();
     fFigureMessageCreateLabelFigure.setText("Message"); // $NON-NLS-1$
     // fFigureMessageCreateLabelFigure.setTextWrap(true);
     fFigureMessageCreateLabelFigure.setTextJustification(PositionConstants.CENTER);
     fFigureMessageCreateLabelFigure.setAlignment(PositionConstants.CENTER);
     fFigureMessageCreateLabelFigure.setIconAlignment(PositionConstants.CENTER);
     IFigure childFigureBefore = ((GraphicalEditPart) childEditPart).getFigure();
     IFigure fig = getFigure();
     if ((childFigureBefore
         == null)) { // First time the label is added to the figure of the message connector
       fig.add(fFigureMessageCreateLabelFigure);
       // getFigure().add(fFigureMessageCreateLabelFigure);
       // setFigure(getFigure());
       ((MessageNameEditPart) childEditPart).setLabel(fFigureMessageCreateLabelFigure);
     } else { // The figure has been already removed and now we re-add it to the Message Connector
       // Figure (getFigure())
       fig.add(childFigureBefore);
     }
     return true;
   }
   if (childEditPart instanceof AppliedStereotypeMessageEditPart) {
     ((AppliedStereotypeMessageEditPart) childEditPart)
         .setLabel(getPrimaryShape().getAppliedStereotypeLabel());
     return true;
   }
   return false;
 }
示例#11
0
 {
   final int offsetX = 62;
   final int offsetY = 2;
   final int size = 16;
   warningFigure.setBounds(new Rectangle(offsetX, offsetY, size, size));
   warningFigure.setVisible(false);
 }
示例#12
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);
 }
示例#13
0
 /** @generated */
 protected boolean addFixedChild(EditPart childEditPart) {
   if (childEditPart instanceof PackageNameEditPart) {
     ((PackageNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel());
     return true;
   }
   if (childEditPart instanceof PackagePackageableElementCompartmentEditPart) {
     IFigure pane = getPrimaryShape().getPackageableElementFigure();
     setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
     pane.add(((PackagePackageableElementCompartmentEditPart) childEditPart).getFigure());
     return true;
   }
   // Papyrus Gencode :precise the locator for a template signature
   if (childEditPart instanceof RedefinableTemplateSignatureEditPart) {
     IBorderItemLocator locator =
         new TemplateBorderItemLocator(getMainFigure(), PositionConstants.EAST);
     getBorderedFigure()
         .getBorderItemContainer()
         .add(((RedefinableTemplateSignatureEditPart) childEditPart).getFigure(), locator);
     return true;
   }
   // Papyrus Gencode :precise the locator for a template signature
   if (childEditPart instanceof TemplateSignatureEditPart) {
     IBorderItemLocator locator =
         new TemplateBorderItemLocator(getMainFigure(), PositionConstants.EAST);
     getBorderedFigure()
         .getBorderItemContainer()
         .add(((TemplateSignatureEditPart) childEditPart).getFigure(), locator);
     return true;
   }
   return false;
 }
  /**
   * Given an absolute point (pStart) and a list of EditParts, this method finds the closest
   * EditPart (except for the one to be excluded) in the given direction.
   *
   * @param siblings List of sibling EditParts
   * @param pStart The starting point (must be in absolute coordinates) from which the next sibling
   *     is to be found.
   * @param direction PositionConstants
   * @param exclude The EditPart to be excluded from the search
   */
  public IGraphicalEntityPart findSibling(
      List<?> siblings, Point pStart, int direction, EditPart exclude) {
    IGraphicalEntityPart epCurrent;
    IGraphicalEntityPart epFinal = null;
    IFigure figure;
    Point pCurrent;
    int distance = Integer.MAX_VALUE;

    Iterator<?> iter = siblings.iterator();
    while (iter.hasNext()) {
      epCurrent = (IGraphicalEntityPart) iter.next();
      if (epCurrent == exclude || !epCurrent.isSelectable()) continue;
      figure = epCurrent.getFigure();
      pCurrent = getNavigationPoint(figure);
      figure.translateToAbsolute(pCurrent);
      if (pStart.getPosition(pCurrent) != direction) continue;

      Dimension difference = pCurrent.getDifference(pStart);
      int d = Math.abs(difference.width()) + Math.abs(difference.height());
      if (d < distance) {
        distance = d;
        epFinal = epCurrent;
      }
    }
    return epFinal;
  }
    @Override
    public void relocate(IFigure target) {
      Rectangle bounds;
      if (reference instanceof HandleBounds) {
        bounds = new PrecisionRectangle(((HandleBounds) reference).getHandleBounds());
      } else {
        bounds = new PrecisionRectangle(reference.getBounds());
        // authorized rectangle without handle bounds is smaller: if the icon would be exactly on
        // one of the corners,
        // it would trigger an enlargement of the figure, followed by a reposition, i.e. an endless
        // loop.
        bounds.x++;
        bounds.y++;
        bounds.width -= 2;
        bounds.height -= 2;
      }

      reference.translateToAbsolute(bounds);
      target.translateToRelative(bounds);

      Point pTR = bounds.getTopRight();
      Point pTL = bounds.getTopLeft();
      Point pDecoration = new Point(pTR);

      int decorationX = pTR.x - target.getSize().width - rightMargin;
      if (decorationX > pTL.x) {
        // only set position, if it is inside the figure, i.e. bigger than left margin
        pDecoration.setX(decorationX);
      } else {
        pDecoration.setX(pTL.x);
      }
      target.setLocation(pDecoration);
    }
  public void figureMoved(IFigure figure) {
    Rectangle bounds = figure.getBounds();

    if (relativeToParent) {
      bounds = Rectangle.SINGLETON.setBounds(bounds); // copy
      Rectangle parentBounds = figure.getParent().getBounds();
      bounds.translate(-parentBounds.x, -parentBounds.y);
    }

    Point loc = element.getLocation();
    if (loc == null || loc.x != bounds.x || loc.y != bounds.y) {
      Point newLocation = new Point(bounds.x, bounds.y);
      if (element instanceof FormElementGroup) {
        FormElementGroupPropertySource formElementGroupPropertySource =
            new FormElementGroupPropertySource((FormElementGroup) element, form);
        formElementGroupPropertySource.setLocation(newLocation);
      } else {
        element.setLocation(newLocation);
      }
    }
    Dimension dim = element.getSize();
    if (dim == null || dim.width != bounds.width || dim.height != bounds.height) {
      Dimension newSize = new Dimension(bounds.width, bounds.height);
      if (element instanceof FormElementGroup) {
        FormElementGroupPropertySource formElementGroupPropertySource =
            new FormElementGroupPropertySource((FormElementGroup) element, null);
        formElementGroupPropertySource.setSize(newSize);
      } else {
        element.setSize(newSize);
      }
    }
  }
示例#17
0
  public static void movepositions(
      final SWTGefBot bot,
      SWTBotGefEditor gmfEditor,
      final String sourcelane,
      final String destlane,
      final String element,
      final int j,
      final int i) {

    final SWTBotEditor botEditor = bot.activeEditor();
    gmfEditor = bot.gefEditor(botEditor.getTitle());

    final SWTBotGefEditPart lane2 = gmfEditor.getEditPart(sourcelane);
    lane2.parent().select().resize(PositionConstants.NORTH, 100, 150);

    // compute target destination
    final SWTBotGefEditPart lane3 = gmfEditor.getEditPart(destlane);

    // move step2 to lane2

    final SWTBotGefEditPart ele = gmfEditor.getEditPart(element).parent();
    ele.select();

    // move step2 to lane2

    SWTBotGefEditPart step = gmfEditor.getEditPart(element).parent();
    step.select();

    IFigure figure = ((GraphicalEditPart) step.part()).getFigure();
    final Rectangle dest = figure.getBounds().getCopy();
    figure.translateToAbsolute(dest);

    gmfEditor.drag(step, dest.x + j, dest.y + i);

    step = gmfEditor.getEditPart(element).parent();
    step.select();
    figure = ((GraphicalEditPart) step.part()).getFigure();
    final Rectangle targetdest = figure.getBounds().getCopy();
    figure.translateToAbsolute(targetdest);

    Assert.assertTrue("Move has failed", !targetdest.equals(dest));

    bot.waitUntil(
        new ICondition() {
          @Override
          public boolean test() throws Exception {
            return getPartRecursively(lane3.parent(), element) != null;
          }

          @Override
          public void init(final SWTBot bot) {}

          @Override
          public String getFailureMessage() {
            System.out.println(element + "is not in sourcelane");
            return "element is not in sourcelane (unable to move the step)";
          }
        });
  }
 /*
  * (non-Javadoc)
  *
  * @see org.xmind.gef.part.GraphicalEditPart#createFigure()
  */
 @Override
 protected IFigure createFigure() {
   IFigure figure = new Layer();
   figure.setOpaque(true);
   figure.setBackgroundColor(ColorConstants.black);
   figure.setLayoutManager(new NavigationItemLayout());
   return figure;
 }
 /** @generated */
 public IBorderItemLocator getBorderItemLocator() {
   IFigure parentFigure = getFigure().getParent();
   if (parentFigure != null && parentFigure.getLayoutManager() != null) {
     Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
     return (IBorderItemLocator) constraint;
   }
   return null;
 }
 @Override
 public void showSizeOnDropFeedback(CreateRequest request, IFigure feedback, Insets insets) {
   Point p = new Point(request.getLocation().getCopy());
   feedback.translateToRelative(p);
   Dimension size = request.getSize().getCopy();
   feedback.translateToRelative(size);
   feedback.setBounds(new Rectangle(p, size).expand(insets));
 }
 /**
  * Default implementation treats passed figure as content pane. Respects layout one may have set
  * for generated figure.
  *
  * @param nodeShape instance of generated figure class
  * @generated
  */
 protected IFigure setupContentPane(IFigure nodeShape) {
   if (nodeShape.getLayoutManager() == null) {
     ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
     layout.setSpacing(5);
     nodeShape.setLayoutManager(layout);
   }
   return nodeShape; // use nodeShape itself as contentPane
 }
 public boolean didClickTextControl(Point requestLoc) {
   IFigure figure = getTextControl();
   if (figure != null) {
     figure.translateToRelative(requestLoc);
     return figure.containsPoint(requestLoc);
   }
   return false;
 }
示例#23
0
 {
   final int offsetX = 23;
   final int offsetY = 17;
   final int size = 32;
   deprecatedFigure.setBounds(new Rectangle(offsetX, offsetY, size, size));
   deprecatedFigure.setToolTip(new Label(Messages.deprecated));
   deprecatedFigure.setVisible(false);
 }
示例#24
0
 {
   final int offsetX = 62;
   final int offsetY = 62;
   final int size = 16;
   localFigure.setBounds(new Rectangle(offsetX, offsetY, size, size));
   localFigure.setToolTip(new Label(Messages.localExecutionOnly));
   localFigure.setVisible(false);
 }
示例#25
0
  @Override
  protected IFigure createFigure() {
    // TODO: Shouldn't have to initialize labels in each subclass.
    initializeLabels();
    if (collapsedImage == null) {
      // Create the actual figure for the collapsed edit part
      ILabeledElement element = BPELUtil.adapt(getActivity(), ILabeledElement.class);
      collapsedImage = element.getSmallImage(getActivity());
    }
    this.collapsedImageLabel = new Label(collapsedImage);
    this.collapsedNameLabel = new Label(getLabel());

    // TODO: Shouldn't have to set the decorator in each subclass.
    editPartMarkerDecorator =
        new BPELEditPartMarkerDecorator(
            (EObject) getModel(),
            new CollapsableDecorationLayout(/*collapsedImage.getBounds().width*/ 0));
    editPartMarkerDecorator.addMarkerMotionListener(getMarkerMotionListener());

    this.parentFigure = new Figure();
    AlignedFlowLayout layout = new AlignedFlowLayout();
    layout.setHorizontal(true);
    layout.setHorizontalSpacing(0);
    layout.setVerticalSpacing(0);
    parentFigure.setLayoutManager(layout);

    this.contentFigure = new CollapsableScopeContainerFigure(getModel(), getImage(), getLabel());
    contentFigure.addMouseMotionListener(getMouseMotionListener());
    contentFigure.setEditPart(this);
    contentFigure.setForegroundColor(
        BPELUIPlugin.INSTANCE.getColorRegistry().get(IBPELUIConstants.COLOR_BLACK));
    parentFigure.add(contentFigure);

    // Configure the border and contents based on collapsed state
    if (isCollapsed()) {
      configureCollapsedFigure(contentFigure);
    } else {
      configureExpandedFigure(contentFigure);
    }

    boolean isHorizontal = ModelHelper.isHorizontalLayout(getModel());

    this.auxilaryFigure = new AuxiliaryFigure();
    layout = new AlignedFlowLayout();
    layout.setHorizontal(!isHorizontal);
    auxilaryFigure.setLayoutManager(layout);
    contentFigure.addFigureListener(auxilaryFigure);

    parentFigure.add(auxilaryFigure);

    ScopeBorder border = getScopeBorder();
    border.setShowFault(getFaultHandler() != null);
    border.setShowCompensation(getCompensationHandler() != null);
    border.setShowTermination(getTerminationHandler() != null);
    border.setShowEvent(getEventHandler() != null);

    return editPartMarkerDecorator.createFigure(parentFigure);
  }
    /*
     * (non-Javadoc)
     *
     * @see org.eclipse.draw2d.ToolbarLayout#calculatePreferredSize(org.eclipse.draw2d.IFigure, int, int)
     */
    @Override
    protected Dimension calculatePreferredSize(IFigure container, int wHint, int hHint) {
      Insets insets = container.getInsets();
      Dimension prefSize = calculateChildrenSize(container.getChildren(), wHint, hHint);

      return prefSize
          .expand(insets.getWidth(), insets.getHeight())
          .union(getBorderPreferredSize(container));
    }
 public Point getChildLocation(GraphicalEditPart parentEditPart) {
   IFigure f =
       ((LifelineEditPart) parentEditPart)
           .getPrimaryShape()
           .getFigureLifelineDotLineFigure();
   Rectangle b = f.getBounds().getCopy();
   f.translateToAbsolute(b);
   return b.getCenter().getCopy().translate(0, 50);
 }
示例#28
0
  // We override reveal to show the Handles of the selected EditPart when
  // scrolling
  public void reveal(EditPart part) {
    // In some case, the editor control is not created, but get the sync selection event.
    // Fix this problem temporary.
    if (getFigureCanvas() == null || getFigureCanvas().isDisposed()) {
      return;
    }

    Viewport port = getFigureCanvas().getViewport();
    IFigure target = ((GraphicalEditPart) part).getFigure();

    Rectangle exposeRegion = target.getBounds().getCopy();

    // Get the primary editpolicy
    EditPolicy policy = part.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);

    // If the policy let us access the handles, proceed, otherwise
    // default to original behaviour
    if (!(policy instanceof ISelectionHandlesEditPolicy)) {
      super.reveal(part);
      return;
    }

    // First translate exposeRegion to the root level
    target = target.getParent();
    while (target != null && target != port) {
      target.translateToParent(exposeRegion);
      target = target.getParent();
    }

    // Merge selection handles if any to the exposeRegion
    List handles = ((ISelectionHandlesEditPolicy) policy).getHandles();
    for (Iterator iter = handles.iterator(); iter.hasNext(); ) {
      AbstractHandle handle = (AbstractHandle) iter.next();

      Locator locator = handle.getLocator();
      locator.relocate(handle);
      exposeRegion.union(handle.getBounds().getCopy());
    }

    exposeRegion.getExpanded(5, 5);

    Dimension viewportSize = port.getClientArea().getSize();

    Point topLeft = exposeRegion.getTopLeft();
    Point bottomRight = exposeRegion.getBottomRight().translate(viewportSize.getNegated());
    Point finalLocation = new Point();
    if (viewportSize.width < exposeRegion.width)
      finalLocation.x = Math.min(bottomRight.x, Math.max(topLeft.x, port.getViewLocation().x));
    else finalLocation.x = Math.min(topLeft.x, Math.max(bottomRight.x, port.getViewLocation().x));

    if (viewportSize.height < exposeRegion.height)
      finalLocation.y = Math.min(bottomRight.y, Math.max(topLeft.y, port.getViewLocation().y));
    else finalLocation.y = Math.min(topLeft.y, Math.max(bottomRight.y, port.getViewLocation().y));

    getFigureCanvas().scrollSmoothTo(finalLocation.x, finalLocation.y);
  }
 /** @generated */
 protected void refreshSelectionFeedback() {
   if (selectionFeedbackFigure != null) {
     if (selectionFeedbackFigure instanceof Label) {
       updateLabel((Label) selectionFeedbackFigure);
       selectionFeedbackFigure.setBounds(getFeedbackBounds());
     } else {
       selectionFeedbackFigure.setBounds(getFeedbackBounds().expand(5, 5));
     }
   }
 }
  @Override
  public void showChangeBoundsFeedback(
      AbstractWidgetModel widgetModel,
      PrecisionRectangle bounds,
      IFigure feedbackFigure,
      ChangeBoundsRequest request) {

    feedbackFigure.translateToRelative(bounds);
    feedbackFigure.setBounds(bounds);
  }