/**
   * Test the ODBC driver
   *
   * @return String
   */
  public String test() {

    String shellPath = AcideProjectConfiguration.getInstance().getShellPath();

    // LinkedList<String> lines = null;
    LinkedList<String> lines = executeCommand("/tapi /test_tapi");
    /*
     * if (shellPath != null && (shellPath.endsWith("\\des.exe") ||
     * shellPath .endsWith("/des"))) { lines =
     * executeCommand("/tapi /test_tapi"); }
     */

    if (lines.equals("$success") || lines == null || lines.size() == 0) return "$success";

    return "$error";
  }
  public static void action(ActionEvent actionEvent) {
    // Are you sure?
    int returnValue =
        JOptionPane.showConfirmDialog(
            null, AcideLanguageManager.getInstance().getLabels().getString("s951"));

    // If yes
    if (returnValue == JOptionPane.OK_OPTION) {

      // Gets the selection in the explorer tree
      TreePath currentSelection =
          AcideMainWindow.getInstance().getExplorerPanel().getTree().getSelectionPath();

      // If there is something selected
      if (currentSelection != null) {

        // Gets the selected node in the explorer tree
        DefaultMutableTreeNode currentNode =
            (DefaultMutableTreeNode) (currentSelection.getLastPathComponent());

        // Transforms it into a project file
        AcideProjectFile currentProjectFile = (AcideProjectFile) currentNode.getUserObject();

        // If it is a file
        if (!currentProjectFile.isDirectory()) {

          // Gets the parent
          MutableTreeNode parentNode = (MutableTreeNode) (currentNode.getParent());

          // If it has parent
          if (parentNode != null) {

            // Removes it the node from its parent
            AcideMainWindow.getInstance()
                .getExplorerPanel()
                .getTreeModel()
                .removeNodeFromParent(currentNode);

            // Searches for the file into the project configuration
            int fileIndex = -1;
            for (int index = 0;
                index < AcideProjectConfiguration.getInstance().getNumberOfFilesFromList();
                index++) {

              if (AcideProjectConfiguration.getInstance()
                  .getFileAt(index)
                  .getAbsolutePath()
                  .equals(currentProjectFile.getAbsolutePath())) {

                // Found it
                fileIndex = index;
              }
            }

            // Gets the file from the project configuration file
            // list
            AcideProjectFile configurationFile =
                AcideProjectConfiguration.getInstance().getFileAt(fileIndex);

            // Gets its absolute path
            String absolutePath = configurationFile.getAbsolutePath();

            // Removes the file from the project configuration
            AcideProjectConfiguration.getInstance().removeFileAt(fileIndex);

            // Deletes this file
            File physicalFile = new File(absolutePath);
            physicalFile.delete();

            // Updates the status message in the status bar
            AcideMainWindow.getInstance().getStatusBar().setStatusMessage(" ");

            // The project has been modified
            AcideProjectConfiguration.getInstance().setIsModified(true);

            return;
          }
        }
      }

      // If there are more files in the project
      if (AcideProjectConfiguration.getInstance().getNumberOfFilesFromList() > 0) {

        // Updates the selected file editor index
        AcideMainWindow.getInstance()
            .getFileEditorManager()
            .updateRelatedComponentsAt(
                AcideMainWindow.getInstance()
                    .getFileEditorManager()
                    .getSelectedFileEditorPanelIndex());

        // Enables the remove file menu item in the explorer panel popup
        // menu
        AcideMainWindow.getInstance()
            .getExplorerPanel()
            .getPopupMenu()
            .getRemoveFileMenuItem()
            .setEnabled(true);

        // Enables the delete file menu item in the explorer panel popup
        // menu
        AcideMainWindow.getInstance()
            .getExplorerPanel()
            .getPopupMenu()
            .getDeleteFileMenuItem()
            .setEnabled(true);
      } else {

        // Disables the remove file menu item in the explorer panel
        // popup menu
        AcideMainWindow.getInstance()
            .getExplorerPanel()
            .getPopupMenu()
            .getRemoveFileMenuItem()
            .setEnabled(false);

        // Disables the delete file menu item in the explorer panel
        // popup menu
        AcideMainWindow.getInstance()
            .getExplorerPanel()
            .getPopupMenu()
            .getDeleteFileMenuItem()
            .setEnabled(false);
      }
    }
  }
  /*
   * (non-Javadoc)
   *
   * @see java.lang.Runnable#run()
   */
  @Override
  public void run() {
    InputStream in = new ByteArrayInputStream(_input.getBytes());
    if (!AcideProjectConfiguration.getInstance().isDebugPanelShowed()) {
      AcideMainWindow.getInstance().getDebugPanel().showDebugPanel();
      AcideProjectConfiguration.getInstance().setIsDebugPanelShowed(true);
      // Updates the show debug panel check box menu item state
      AcideMainWindow.getInstance()
          .getMenu()
          .getViewMenu()
          .getShowDebugPanelCheckBoxMenuItem()
          .setSelected(AcideProjectConfiguration.getInstance().isDebugPanelShowed());

      // If it is not the default project
      if (!AcideProjectConfiguration.getInstance().isDefaultProject())

        // The project has been modified
        AcideProjectConfiguration.getInstance().setIsModified(true);
    }
    // // parses the result and generates the graph
    if (_method.equals(PARSE_TAPI_PDG)) {
      if (_destiny.equals(DESTINY_PATH))
        try {
          // parses the input to obtain the graph
          ArrayList<Node> g = AcideDebugCanvas.parsePathGraphTapi(in);
          // sets the path graph
          _canvas.setPathGraph(g);
          // updates the success flag
          _success = true;
        } catch (AcideDebugCanvasParseInputEqualsErrorException e) {
          // sets empty graphs on the path and the main graph of the canvas
          _canvas.set_graph(new DirectedWeightedGraph());
          _canvas.setPathGraph(new ArrayList<Node>());
          _canvas.repaint();
          if (_showErrorMessage) {
            // shows the error message
            new AcideDebugPanelErrorMessageDialog(
                AcideLanguageManager.getInstance().getLabels().getString("s157"), e.getMessage());
          }
          // updates the succes flag
          _success = false;
        }
      if (_destiny.equals(DESTINY_MAIN)) {
        // parses the input to obtain the graph
        _canvas.set_graph(AcideDebugCanvas.parseGraphTapi(in));
        // sets the main graph
        _success = true;
      }
    }
    // // parses the result and generates the graph
    if (_method.equals(PARSE_TAPI_RDG)) {
      if (_destiny.equals(DESTINY_PATH))
        try {
          // parses the input to obtain the graph
          ArrayList<Node> g = AcideDebugCanvas.parsePathGraphTapi(in);
          // sets the path graph
          _canvas.setPathGraph(g);
          // updates the success flag
          _success = true;
        } catch (AcideDebugCanvasParseInputEqualsErrorException e) {
          // sets empty graphs on the path and the main graph of the canvas
          _canvas.set_graph(new DirectedWeightedGraph());
          _canvas.setPathGraph(new ArrayList<Node>());
          _canvas.repaint();
          if (_showErrorMessage) {
            // shows the error message
            new AcideDebugPanelErrorMessageDialog(
                AcideLanguageManager.getInstance().getLabels().getString("s157"), e.getMessage());
          }
          // updates the succes flag
          _success = false;
        }
      if (_destiny.equals(DESTINY_MAIN)) {
        // parses the input to obtain the graph
        _canvas.set_graph(AcideDebugCanvas.parseGraphTapi(in));
        // sets the main graph
        _success = true;
      }
    }
    _canvas.repaint();
  }