コード例 #1
0
 /**
  * Get all the hidden diagram element in the hierarchy of a given diagram element.
  *
  * @param diagramElement Diagram element
  * @return List of all the hidden parent container element
  */
 private List<DDiagramElement> getHiddenParentContainerViews(DDiagramElement diagramElement) {
   final List<DDiagramElement> containerViews = Lists.newArrayList();
   EObject containerView = diagramElement.eContainer();
   while (!(containerView instanceof DDiagram) && containerView instanceof DDiagramElement) {
     final DDiagramElementQuery query = new DDiagramElementQuery((DDiagramElement) containerView);
     if (query.isHidden()) {
       containerViews.add((DDiagramElement) containerView);
     }
     containerView = containerView.eContainer();
   }
   return containerViews;
 }
コード例 #2
0
 /**
  * Get all the hidden existing diagram elements related to a semantic element.
  *
  * @param semanticElement Semantic element
  * @param containerView Container view
  * @return List of all existing diagram elements for the given semantic element which are
  *     currently hidden in the diagram
  */
 private List<DDiagramElement> getHiddenExistingDiagramElements(
     EObject semanticElement, DSemanticDecorator containerView) {
   final List<DDiagramElement> existingDiagramElements = Lists.newArrayList();
   if (containerView instanceof DSemanticDiagram) {
     for (final DDiagramElement element :
         ((DSemanticDiagram) containerView).getDiagramElements()) {
       if (semanticElement.equals(element.getTarget())) {
         final DDiagramElementQuery query = new DDiagramElementQuery(element);
         if (query.isHidden()) {
           existingDiagramElements.add(element);
         }
         // Get the hidden parent container of the element to reveal,
         // in order to reveal all the
         // hierarchy
         existingDiagramElements.addAll(getHiddenParentContainerViews(element));
       }
     }
   }
   return existingDiagramElements;
 }