Ejemplo n.º 1
0
  /** {@inheritDoc} */
  @Override
  protected void initAction() {
    super.initAction();

    visibleRepresentations = new ArrayList<CompartmentEditPartRepresentation>();

    for (IGraphicalEditPart current : this.selectedElements) {
      if (((View) current.getModel()).getElement() != null) {
        this.representations.add(
            new RootEditPartRepresentation(current, ((View) current.getModel()).getElement()));
      }
    }
    setContentProvider(new ContentProvider());
    // setEditorLabelProvider(new EditorLabelProvider());
    // this.domain = ((IGraphicalEditPart)this.selectedElements.get(0)).getEditingDomain();
    // this.initialSelection = getInitialSelection();
  }
Ejemplo n.º 2
0
  /**
   * @see
   *     org.eclipse.papyrus.diagram.common.actions.AbstractShowHideAction#buildShowHideElementsList(java.lang.Object[])
   * @param results
   */
  @Override
  protected void buildShowHideElementsList(Object[] results) {
    super.buildShowHideElementsList(results);
    List<Object> result = new ArrayList<Object>();

    // we remove the EditPart from the result
    for (int i = 0; i < results.length; i++) {
      if (results[i] instanceof EditPart) {
        continue;
      } else {
        result.add(results[i]);
      }
    }

    // we are looking for the object to show
    for (Object node : result) {
      if (initialSelection.contains(node)) {
        // we do nothing
        continue;
      } else if (node instanceof EditPartRepresentation) {
        viewsToCreate.add((EditPartRepresentation) node);
      }
    }

    // we are looking for the view to destroy
    for (Object current : this.initialSelection) {
      if (!result.contains(current) && (current instanceof EditPartRepresentation)) {
        viewsToDestroy.add((EditPartRepresentation) current);
      }
    }

    // we are looking for visible elements, to set the shown title or hidden title
    for (Object node : result) {
      if (node instanceof CompartmentEditPartRepresentation) {
        visibleRepresentations.add((CompartmentEditPartRepresentation) node);
      }
    }
  }