Exemplo n.º 1
0
    @Override
    public Object[] getChildren(Object parentElement) {
      // Because of potentially large amount of children, MethodNode is special case
      // We filter out test suites with too many test cases
      if (parentElement instanceof MethodNode) {
        MethodNode method = (MethodNode) parentElement;
        ArrayList<Object> children = new ArrayList<Object>();
        children.addAll(method.getParameters());
        children.addAll(method.getConstraintNodes());
        for (String testSuite : method.getTestSuites()) {
          Collection<TestCaseNode> testCases = method.getTestCases(testSuite);
          if (testCases.size() <= Constants.MAX_DISPLAYED_TEST_CASES_PER_SUITE) {
            children.addAll(testCases);
          }
        }
        return children.toArray();
      }

      if (parentElement instanceof MethodParameterNode) {
        MethodParameterNode parameter = (MethodParameterNode) parentElement;
        if (parameter.isExpected() && AbstractParameterInterface.isPrimitive(parameter.getType())) {
          return EMPTY_ARRAY;
        }
        if (parameter.isLinked()) {
          return EMPTY_ARRAY;
        }
      }
      if (parentElement instanceof AbstractNode) {
        AbstractNode node = (AbstractNode) parentElement;
        if (node.getChildren().size() < Constants.MAX_DISPLAYED_CHILDREN_PER_NODE) {
          return node.getChildren().toArray();
        }
      }
      return EMPTY_ARRAY;
    }
Exemplo n.º 2
0
    private boolean addExportOnlineAction(MethodNode methodNode, MethodInterface methodInterface) {
      if (methodNode.getParametersCount() == 0) {
        return false;
      }

      ExportOnlineAction exportOnlineAction =
          new ExportOnlineAction(fFileInfoProvider, ModelMasterSection.this, methodInterface);
      addMenuItem(exportOnlineAction.getName(), exportOnlineAction);
      return true;
    }