コード例 #1
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);
      }
    }
  }
コード例 #2
0
 @Nullable
 private FileSetNode getCurrentFileSetNode() {
   final SimpleNode selectedNode = myTree.getSelectedNode();
   if (selectedNode == null) {
     return null;
   }
   if (selectedNode instanceof FileSetNode) {
     return (FileSetNode) selectedNode;
   } else if (selectedNode.getParent() instanceof FileSetNode) {
     return (FileSetNode) selectedNode.getParent();
   } else {
     final SimpleNode parent = selectedNode.getParent();
     if (parent != null && parent.getParent() instanceof FileSetNode) {
       return (FileSetNode) selectedNode.getParent().getParent();
     }
   }
   return null;
 }