Examples of FileNode


Examples of com.qspin.qtaste.ui.tools.FileNode

        public CreateTestFolder() {
            super("Create folder");
        }

        public void actionPerformed(ActionEvent e) {
            FileNode fn = getSelectedFileNode();
            String input = JOptionPane.showInputDialog(null,
                    "Give the name of the folder",
                    "folder name:",
                    JOptionPane.QUESTION_MESSAGE);
            if (input==null) return;
            File testScriptFile = fn.getFile();
            testScriptFile.renameTo(new File(input));
        }
View Full Code Here

Examples of com.qspin.qtaste.ui.tools.FileNode

        public void actionPerformed(ActionEvent e) {
            TCTreeNode tn = getSelectedTreeNode();

            String testName = tn.toString();
            FileNode fn = (FileNode) tn.getUserObject();
            String input = JOptionPane.showInputDialog(null,
                    "Give the new name of the test " + testName,
                    //"Test name:",
                    //JOptionPane.QUESTION_MESSAGE
                    testName
                    );
            if (input==null) return;

            // if doc tab is opened, ensure close it first
            testCasePane.getDocPane().setText("");
            File newFile = new File(fn.getFile().getParent() + "/" + input);
            boolean result = fn.getFile().renameTo(newFile);
            if (!result) {
              logger.error("Impossible to rename " + fn.getFile().getName() + " to " + input);
              return;
            }
            String testScriptFileName;
      try {
        // rename necessary classes
        fn.setFile(newFile);
        testScriptFileName = fn.getFile().getCanonicalPath() + "/" + StaticConfiguration.TEST_SCRIPT_FILENAME;
              fn.getPythonTestScript().setTestScriptFile(new File(testScriptFileName));
              // rename the testscript name
              NonWrappingTextPane tcPane = testCasePane.getTcSourceTextPane();
              if (tcPane!=null)
              {
                tcPane.setFileName(testScriptFileName);
              }
              // rename the testdata name
              TestDataEditor tcDataPane = testCasePane.getTestDataPane();
              if (tcDataPane!=null)
              {
                tcDataPane.setFileName(fn.getPythonTestScript().getTestcaseData().getCanonicalPath());
              }
             
              TCTreeNode parentTreeNode = (TCTreeNode)tn.getParent();
              parentTreeNode.removeAllChildren();
              FileNode parentFileNode = (FileNode)parentTreeNode.getUserObject();
              addTreeToDir(parentFileNode.getFile(), parentTreeNode);
              ((DefaultTreeModel) getModel()).reload(parentTreeNode);
              // reload the doc is selected
              setTestCaseDoc(fn.getPythonTestScript().getTestcaseDoc(), false);
              //
      } catch (IOException e1) {
View Full Code Here

Examples of com.qspin.qtaste.ui.tools.FileNode

        public void actionPerformed(ActionEvent e) {
            // confirmation dialog
            TCTreeNode tn = getSelectedTreeNode();

            String testName = tn.toString();
            FileNode fn = (FileNode) tn.getUserObject();
            if (fn.isTestcaseDir()) {
                if (JOptionPane.showConfirmDialog(null, "Are you sure to remove the script '" + testName + "'", "Confirmation", JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE) ==
                        JOptionPane.OK_OPTION)
                {
                    // remove the test script directory
                    File testScriptFile = fn.getFile();
                    boolean deleted = DeleteDirectory.deleteDirectory(testScriptFile);
                    if (deleted)
                    {
                        TCTreeNode parentTreeNode = (TCTreeNode)tn.getParent();
                        parentTreeNode.removeAllChildren();
                        FileNode parentFileNode = (FileNode)parentTreeNode.getUserObject();
                        addTreeToDir(parentFileNode.getFile(), parentTreeNode);
                        ((DefaultTreeModel) getModel()).reload(parentTreeNode);
                    }
                    else
                    {
                        JOptionPane.showConfirmDialog(null, "Impossible to delete " + testName, "Error", JOptionPane.OK_OPTION, JOptionPane.ERROR_MESSAGE);
View Full Code Here

Examples of com.qspin.qtaste.ui.tools.FileNode

                    JOptionPane.QUESTION_MESSAGE);
            if (input==null) return;
            TCTreeNode tn = getSelectedTreeNode();

      try {
              FileNode fn = (FileNode) tn.getUserObject();
              if (fn.isTestcaseDir()) {
                  // get the source Dir
                  TestScriptCreation createScriptTool = new TestScriptCreation(input, fn.getFile().getParentFile().getAbsoluteFile().getCanonicalPath());
                  createScriptTool.copyTestSuite(fn.getFile().getAbsoluteFile().getCanonicalPath());
                  tn = (TCTreeNode) tn.getParent();
                  fn = (FileNode) tn.getUserObject();
              } else {
                  TestScriptCreation createScriptTool = new TestScriptCreation(
                          input, fn.getFile().getAbsoluteFile().getCanonicalPath());
                  createScriptTool.createTestSuite();
              }
              // update the tree view
              // add the tree
 
              tn.removeAllChildren();
              addTreeToDir(fn.getFile(), tn);
              ((DefaultTreeModel) getModel()).reload(tn);
      } catch (IOException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
      }
View Full Code Here

Examples of com.qspin.qtaste.ui.tools.FileNode

        e1.printStackTrace();
      }
        }

        public boolean isEnabled() {
            FileNode fn = getSelectedFileNode();
            if (fn != null) {
                if (fn.isTestcaseDir()) {
                    this.putValue(Action.NAME, "Copy TestScript");
                    return true;
                } else {
                    this.putValue(Action.NAME, "Create new TestScript");
                    return true;
View Full Code Here

Examples of com.qspin.qtaste.ui.tools.FileNode

    }
    protected File getTestCase(Object node) {
        TCTreeNode tcNode = (TCTreeNode)node;
       
        if (tcNode.getUserObject() instanceof FileNode) {
            FileNode fileNode = ((FileNode)tcNode.getUserObject());
            return fileNode.getFile();      
        }
        else
        {
            return null;
        }
View Full Code Here

Examples of com.qspin.qtaste.ui.tools.FileNode

        // recursive through parents
        return checkIfParentAdded(parentDir);
    }
    public void removeIfChildAdded(String directory) {
        // build the childrent of this new parent
        FileNode parentNode = new FileNode(new File(directory), directory,TESTUITE_DIR);
        Object[] childNodes = parentNode.getChildren();
        for (int i=0 ; i < childNodes.length; i++) {
            JTreeNode childNode = (JTreeNode)childNodes[i];
            // now check in the already added nodes if it is already added
            //
            TCTreeNode rootNode = (TCTreeNode)this.getRoot();
View Full Code Here

Examples of com.qspin.qtaste.ui.tools.FileNode

            return null;
        }
       
        // check if child of this directory is already added, if yes, remove the previous child
        removeIfChildAdded(directory);
        FileNode childFileNode = new FileNode(testsuiteDirFile, testsuiteDirFile.getName(),TESTUITE_DIR);       
        childFileNode.setShowTestdata(true);
        TCTreeNode testsuiteNode = new TCTreeNode(childFileNode, true);
       
        // add this node to the root node
        // current list
        int currentIndex = testsuiteDir.size();
        testsuiteDir.add(testsuiteNode);
        rootNode.add(testsuiteNode);
        this.fireTreeNodesInserted(this, new Object [] {this.getRoot()}, new int[] {currentIndex}, new Object [] {testsuiteNode});

        fireAddTestSuite(testsuiteNode, childFileNode.getChildren());
       
        return childFileNode;
    }
View Full Code Here

Examples of com.qspin.qtaste.ui.tools.FileNode

                        if (testsuite.contains("/" ))
                            dirToAdd = testsuite.split("\\/")[0]+ "/" + testsuite.split("\\/")[1];
                        JTreeNode addedNode = addTestSuite(dirToAdd);
                        for (int i=0; i<this.getColumnCount(); i++) {
                            if (this.getColumnName(i).equals(testbed)) {
                                FileNode fileNode = new FileNode(new File(testsuite), testsuite,TESTUITE_DIR);
                                // check if there is testdata or not
                                NodeList childList = nodeList.item(testSuiteIndex).getChildNodes();
                                if (childList.getLength()==0) {
                                    this.setNodeState(fileNode, testbed, TristateCheckBox.SELECTED);
                                }
View Full Code Here

Examples of com.qspin.qtaste.ui.tools.FileNode

      
    }
    public void fireAddTestSuite(TCTreeNode parentNode, Object[] childNodes) {
        for (int i = 0; i < childNodes.length;i++) {
            if (childNodes[i] instanceof FileNode) {
                FileNode childFileNode = (FileNode)childNodes[i];
                childFileNode.setShowTestdata(true);
                TCTreeNode childNode = new TCTreeNode(childFileNode, true);
                parentNode.add(childNode);
                this.fireTreeNodesInserted(this, this.getPathToRoot(parentNode), new int[] {i}, new Object [] {childNode});
                if (childFileNode.getChildren()!=null) {
                    if (childFileNode.getChildren().length>0) {
                        fireAddTestSuite(childNode, childFileNode.getChildren());
                    }
                }
            }
            if (childNodes[i] instanceof TestDataNode) {
                TestDataNode childDataNode = (TestDataNode)childNodes[i];
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.