コード例 #1
0
 public SimpleNode[] getChildren() {
   final List<SimpleNode> nodes = new ArrayList<SimpleNode>(myBuffer.size());
   for (final OfbizFileSet entry : myBuffer) {
     if (!entry.isRemoved()) {
       final FileSetNode setNode = new FileSetNode(entry);
       nodes.add(setNode);
     }
   }
   return ArrayUtil.toObjectArray(nodes, SimpleNode.class);
 }
コード例 #2
0
    FileSetNode(final OfbizFileSet fileSet) {
      mySet = fileSet;

      final PresentationData presentationData = getPresentation();
      final String name = mySet.getName();

      if (fileSet.getFiles().isEmpty()) {
        presentationData.addText(name, getErrorAttributes());
        presentationData.setTooltip("No files attached");
      } else {
        presentationData.addText(name, getPlainAttributes());
        presentationData.setLocationString("" + fileSet.getFiles().size());
      }
    }
コード例 #3
0
    public SimpleNode[] getChildren() {
      final List<SimpleNode> nodes = new ArrayList<SimpleNode>();

      for (final VirtualFilePointer file : mySet.getFiles()) {
        nodes.add(new ConfigFileNode(file, this));
      }
      return ArrayUtil.toObjectArray(nodes, SimpleNode.class);
    }
コード例 #4
0
  private void remove() {
    final SimpleNode[] nodes = myTree.getSelectedNodesIfUniform();
    for (final SimpleNode node : nodes) {

      if (node instanceof FileSetNode) {
        final OfbizFileSet fileSet = ((FileSetNode) node).mySet;
        if (fileSet.getFiles().isEmpty()) {
          myBuffer.remove(fileSet);
          return;
        }

        final int result =
            Messages.showYesNoDialog(
                myPanel,
                String.format("Remove File Set '%s' ?", fileSet.getName()),
                "Confirm removal",
                Messages.getQuestionIcon());
        if (result == DialogWrapper.OK_EXIT_CODE) {
          if (fileSet.isAutodetected()) {
            fileSet.setRemoved(true);
            myBuffer.add(fileSet);
          } else {
            myBuffer.remove(fileSet);
          }
        }
      } else if (node instanceof ConfigFileNode) {
        final VirtualFilePointer filePointer = ((ConfigFileNode) node).myFilePointer;
        final OfbizFileSet fileSet = ((FileSetNode) node.getParent()).mySet;
        fileSet.removeFile(filePointer);
      }
    }
  }
コード例 #5
0
 public Object[] getEqualityObjects() {
   return new Object[] {mySet, mySet.getName(), mySet.getFiles()};
 }