Exemple #1
0
 /**
  * @param title
  * @param type
  * @return
  */
 public LayerStorageNode getLayerStorageNode(String title, String type) {
   for (int i = 0; i < root.getChildCount(); i++) {
     LayerStorageNode child = (LayerStorageNode) root.getChildAt(i);
     if (child.getTitle().equals(title) && child.getType().equals(type)) {
       return child;
     }
   }
   return null;
 }
Exemple #2
0
 @Override
 @Test
 public void testTextOffsetLength() {
   RootNode rootNode = createCompositeNode();
   String completeContent = "completeContent";
   rootNode.basicSetCompleteContent(completeContent);
   assertEquals(completeContent, rootNode.getText());
   assertEquals(0, rootNode.getTotalOffset());
   assertEquals(completeContent.length(), rootNode.getTotalLength());
 }
Exemple #3
0
  @Test
  public void testIteratorForEmptyNode() {
    RootNode rootNode = createCompositeNode();
    BidiTreeIterator<AbstractNode> forwardIterator = rootNode.basicIterator();
    assertTrue(forwardIterator.hasNext());
    assertSame(rootNode, forwardIterator.next());
    assertFalse(forwardIterator.hasNext());

    BidiTreeIterator<AbstractNode> backwardsIterator = rootNode.basicIterator();
    assertTrue(backwardsIterator.hasPrevious());
    assertSame(rootNode, backwardsIterator.next());
    assertFalse(backwardsIterator.hasPrevious());
  }
Exemple #4
0
  public void addLayerStorageNode(LayerStorageNode layerStorageNode) {
    treeModel.insertNodeInto(layerStorageNode, root, root.getChildCount());

    TreeNode[] path = treeModel.getPathToRoot(root);
    expandPath(new TreePath(path));
    setSelectionPath(new TreePath(path));
  }
Exemple #5
0
  /**
   * Returns the position of the specified LayerNode or -1 if it is not contained in the ContentTree.<br>
   * In the following example this method will return 4 for the 'X'-LayerNode.
   *
   * <pre>
   *   -O
   *    |-O
   *    |-O
   *    |-O
   *   -O
   *    |-O
   *    |-X
   *    |-O
   *
   * &#064;param layerNode
   * @return
   *
   */
  public int positionOf(LayerNode layerNode) {
    int position = 0;
    for (int i = 0; i < root.getChildCount(); i++) {
      TreeNode storageNode = root.getChildAt(i);

      for (int j = 0; j < storageNode.getChildCount(); j++) {

        if (storageNode.getChildAt(j) != layerNode) {
          position++;
        } else {
          return position;
        }
      }
    }

    return -1;
  }
 @Override
 public void render(@NotNull ShaderProgram program) {
   super.render(program);
   if (!isVisible()) return;
   program.setUniformMatrix(MODEL_VIEW, getCombinedTransoformation());
   //        program.setUniformMatrix(NORMAL, getCombinedTransoformation().toNormalMatrix());
   material.apply(program);
   model.render(program);
 }
  @Override
  public boolean hasChildren(Object element) {
    if (element instanceof TreeNode) {
      return ((TreeNode) element).hasChildren();
    } else if (element == null) {
      return root.hasChildren();
    }

    return false;
  }
  @Override
  public Object[] getChildren(Object parent) {
    if (parent instanceof TreeNode) {
      return ((TreeNode) parent).getChildren();
    } else if (parent == null) {
      return root.getChildren();
    }

    return new Object[0];
  }
 /* (non-Javadoc)
  * @see java.lang.Object#hashCode()
  */
 @Override
 public int hashCode() {
   final int prime = 31;
   int result = 1;
   result = prime * result + getOuterType().hashCode();
   result = prime * result + ((cls == null) ? 0 : cls.hashCode());
   result = prime * result + ((level == null) ? 0 : level.hashCode());
   result = prime * result + ((rootNode == null) ? 0 : rootNode.hashCode());
   result = prime * result + ((spell == null) ? 0 : spell.hashCode());
   return result;
 }
 @Override
 public String toString() {
   String countStr = "";
   if (count != 1) {
     countStr = " (x" + count + ")"; // $NON-NLS-1$ //$NON-NLS-2$
   }
   if (spell != null) {
     return spell.toString() + countStr;
   } else if (cls != null) {
     return cls.toString() + countStr;
   } else if (rootNode != null) {
     return rootNode.toString() + countStr;
   }
   return LanguageBundle.getFormattedString("in_spellEmptyNode", countStr); // $NON-NLS-1$
 }
  public void inputChanged(Viewer v, Object oldInput, Object newInput) {
    if (oldInput != newInput) {
      if (newInput instanceof MethodResult) {
        consume((MethodResult) newInput);
      } else {
        root.clear();
        final IJavaProject jp = view.getCurrentProject();
        CheckFlowMarkerAndImageManager.getInstance().clearAll(jp != null ? jp.getProject() : null);
      }

      //			System.out.println("Content changed: " + (oldInput == null ? "null" :
      // oldInput.hashCode())
      //					+ " -> " + (newInput == null ? "null" : newInput.hashCode()));
    }
  }
 /* (non-Javadoc)
  * @see java.lang.Object#equals(java.lang.Object)
  */
 @Override
 public boolean equals(Object obj) {
   if (this == obj) {
     return true;
   }
   if (obj == null) {
     return false;
   }
   if (getClass() != obj.getClass()) {
     return false;
   }
   SpellNodeImpl other = (SpellNodeImpl) obj;
   if (!getOuterType().equals(other.getOuterType())) {
     return false;
   }
   if (level == null) {
     if (other.level != null) {
       return false;
     }
   } else if (!level.equals(other.level)) {
     return false;
   }
   if (spell == null) {
     if (other.spell != null) {
       return false;
     }
   } else if (!spell.equals(other.spell)) {
     return false;
   }
   if (cls == null) {
     if (other.cls != null) {
       return false;
     }
   } else if (!cls.equals(other.cls)) {
     return false;
   }
   if (rootNode == null) {
     if (other.rootNode != null) {
       return false;
     }
   } else if (!rootNode.equals(other.rootNode)) {
     return false;
   }
   return true;
 }
 public int getNShapeNodes() {
   return mRootNode.getNChildNodes();
 }
Exemple #14
0
 public void clearTree() {
   while (root.getChildCount() > 0) {
     removeNode(root.getFirstLeaf());
   }
 }
 public void addShapeNode(ShapeNode node) {
   mRootNode.addChildNode(node);
 }
 public ShapeNode getShapeNodes() {
   return mRootNode.getShapeNodes();
 }
 public void dispose() {
   root.clear();
 }
 public Object[] getElements(Object parent) {
   return root.getChildren();
 }
 @Override
 public void visit(@NotNull RootNode node) {
   node.getReferences().forEach(this::visitChildren);
   node.getAbbreviations().forEach(this::visitChildren);
   visitChildren(node);
 }
 public void onJstdConfigRunningStarted(@NotNull File jstdConfigFile) {
   String jstdConfigNodeDisplayName = buildJstdConfigDisplayName(jstdConfigFile);
   myCurrentJstdConfigNode = new ConfigNode(jstdConfigNodeDisplayName, jstdConfigFile, myRootNode);
   myRootNode.addChild(myCurrentJstdConfigNode);
 }