/**
   * Sets the focus into the editor file determined by the selected node given as a parameter.
   *
   * @param currentSelection Selected node in the explorer tree.
   */
  private void setFocusEditorFile(TreePath currentSelection) {

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

      // Gets the file path from the selected node in the explorer tree
      String filePath = currentSelection.getLastPathComponent().toString();

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

      // Builds the project file from the explorer tree node
      DefaultMutableTreeNode currentNode =
          (DefaultMutableTreeNode) currentSelection.getLastPathComponent();

      // Gets the project file from the selected node in the explorer tree
      AcideProjectFile currentProjectFile = (AcideProjectFile) currentNode.getUserObject();

      // Selects the file editor
      for (int index = 0;
          index
              < AcideMainWindow.getInstance().getFileEditorManager().getNumberOfFileEditorPanels();
          index++) {

        // If it is the file editor panel
        if (AcideMainWindow.getInstance()
            .getFileEditorManager()
            .getFileEditorPanelAt(index)
            .getAbsolutePath()
            .equals(currentProjectFile.getAbsolutePath())) {

          // Sets the selected file editor panel on it
          AcideMainWindow.getInstance().getFileEditorManager().setSelectedFileEditorPanelAt(index);
        }
      }
    }
  }
  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);
      }
    }
  }