Listado de archivos del plugin Hello World modificado para agregarle mayor funcionalidad

Archivo HelloWorld.java

import org.gjt.sp.jedit.*;

public class HelloWorld
{
  public HelloWorld(View view)  {
    WizardManager wizardManager = new WizardManager(view);
  }
}

Archivo WizardManager.java

import javax.swing.*;
import org.gjt.sp.jedit.*;

public class WizardManager extends JDialog  {

  private View view;
  private int panelNumber = 0;
  private static WizardManager instance = null;

  public WizardManager(View view) {
    super(view,jEdit.getProperty("HelloWorld.title"),false);
    this.view = view;
    this.instance = this;
    GUIUtilities.loadGeometry(this, "HelloWorld");
    setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    next();
  }

  public static  WizardManager getInstance () {
    return instance;
  }

  public void dispose() {
    view = null;
    GUIUtilities.saveGeometry(this, "HelloWorld");
    super.dispose();
  }

  public void back()  {
    panelNumber--;
    showPanel();
  }

  public void next() {
    panelNumber++;
    showPanel();
  }

  public void showPanel()  {
    JPanel content=null;

    if(panelNumber==1)
      content = (JPanel) new HelloWorldPanel1();
    if(panelNumber==2)
      content = (JPanel) new HelloWorldPanel2();
    if(panelNumber==3)
      content = (JPanel) new HelloWorldPanel3();

    setContentPane(content);
    this.pack();
    this.repaint();
    this.show();
  }

}

Archivo HelloWorldPanel1.java

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class HelloWorldPanel1 extends JPanel {
  BorderLayout borderLayout1 = new BorderLayout();
  JPanel jPanel1 = new JPanel();
  JPanel jPanel2 = new JPanel();
  JButton jButton1 = new JButton();
  JButton jButton2 = new JButton();
  JButton jButton3 = new JButton();
  GridLayout gridLayout1 = new GridLayout();
  JLabel jLabel1 = new JLabel();
  JLabel jLabel2 = new JLabel();
  JLabel jLabel3 = new JLabel();
  JLabel jLabel4 = new JLabel();

  public HelloWorldPanel1() {
    try {
      jbInit();
    }
    catch(Exception ex) {
      ex.printStackTrace();
    }
  }

  void jbInit() throws Exception {
    this.setLayout(borderLayout1);
    jButton1.setEnabled(false);
    jButton1.setText("< Anterior");
    jButton1.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(ActionEvent e) {
        jButton1_actionPerformed(e);
      }
    });
    jButton2.setText("Siguiente >");
    jButton2.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(ActionEvent e) {
        jButton2_actionPerformed(e);
      }
    });
    jButton3.setText("Cancelar");
    jButton3.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(ActionEvent e) {
        jButton3_actionPerformed(e);
      }
    });
    jPanel1.setLayout(gridLayout1);
    jLabel1.setFont(new java.awt.Font("Dialog", 1, 16));
    jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
    jLabel1.setText("Bienvenido al plugin Hello World !");
    jLabel2.setHorizontalAlignment(SwingConstants.CENTER);
    jLabel2.setText("Este plugin le permitira escribir en un archivo");
    gridLayout1.setRows(4);
    gridLayout1.setColumns(1);
    jLabel3.setHorizontalAlignment(SwingConstants.CENTER);
    jLabel3.setText("escogido la frase \"Hello World !\"");
    jLabel4.setHorizontalAlignment(SwingConstants.CENTER);
    jLabel4.setText("Presione el boton \"Siguiente >\" para continuar");
    this.add(jPanel1,  BorderLayout.CENTER);
    jPanel1.add(jLabel1, null);
    jPanel1.add(jLabel2, null);
    jPanel1.add(jLabel3, null);
    jPanel1.add(jLabel4, null);
    this.add(jPanel2, BorderLayout.SOUTH);
    jPanel2.add(jButton1, null);
    jPanel2.add(jButton2, null);
    jPanel2.add(jButton3, null);

  }

  void jButton1_actionPerformed(ActionEvent e) {
    WizardManager.getInstance().back();
  }

  void jButton2_actionPerformed(ActionEvent e) {
    WizardManager.getInstance().next();
  }

  void jButton3_actionPerformed(ActionEvent e) {
     WizardManager.getInstance().dispose();
  }
}s.CENTER);
    jLabel3.setText("escogido la frase \"Hello World !\"");
    jLabel4.setHorizontalAlignment(SwingConstants.CENTER);
    jLabel4.setText("Presione el boton \"Siguiente >\" para continuar");
    this.add(jPanel1,  BorderLayout.CENTER);
    jPanel1.add(jLabel1, null);
    jPanel1.add(jLabel2, null);
    jPanel1.add(jLabel3, null);
    jPanel1.add(jLabel4, null);
    this.add(jPanel2, BorderLayout.SOUTH);
    jPanel2.add(jButton1, null);
    jPanel2.add(jButton2, null);
    jPanel2.add(jButton3, null);

  }

  void jButton1_actionPerformed(ActionEvent e) {
    WizardManager.getInstance().back();
  }

  void jButton2_actionPerformed(ActionEvent e) {
    WizardManager.getInstance().next();
  }

  void jButton3_actionPerformed(ActionEvent e) {
     WizardManager.getInstance().dispose();
  }
}

Archivo HelloWorldPane2.java

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;

public class HelloWorldPanel2 extends JPanel {
  File resultFile;
  BorderLayout borderLayout1 = new BorderLayout();
  JPanel jPanel1 = new JPanel();
  JPanel jPanel2 = new JPanel();
  JButton jButton1 = new JButton();
  JButton jButton2 = new JButton();
  JButton jButton3 = new JButton();
  GridLayout gridLayout1 = new GridLayout();
  JLabel jLabel1 = new JLabel();
  JLabel jLabel2 = new JLabel();
  JPanel jPanel3 = new JPanel();
  JButton jButton4 = new JButton();
  JLabel jLabel3 = new JLabel();
  JTextField jTextField1 = new JTextField();
  JLabel jLabel4 = new JLabel();

  public HelloWorldPanel2() {
    try {
      jbInit();
    }
    catch(Exception ex) {
      ex.printStackTrace();
    }
  }

  void jbInit() throws Exception {
    this.setLayout(borderLayout1);
    jButton1.setText("< Anterior");
    jButton1.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(ActionEvent e) {
        jButton1_actionPerformed(e);
      }
    });
    jButton2.setText("Siguiente >");
    jButton2.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(ActionEvent e) {
        jButton2_actionPerformed(e);
      }
    });
    jButton3.setText("Cancelar");
    jButton3.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(ActionEvent e) {
        jButton3_actionPerformed(e);
      }
    });
    jPanel1.setLayout(gridLayout1);
    jLabel1.setFont(new java.awt.Font("Dialog", 1, 16));
    jLabel1.setToolTipText("");
    jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
    jLabel1.setText("Escoja el archivo");
    jLabel2.setHorizontalAlignment(SwingConstants.CENTER);
    jLabel2.setText("Presione el boton \"Examinar...\" para escoger");
    gridLayout1.setRows(3);
    gridLayout1.setColumns(1);
    jButton4.setText("Examinar...");
    jButton4.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(ActionEvent e) {
        jButton4_actionPerformed(e);
      }
    });
    jLabel3.setToolTipText("");
    jLabel3.setHorizontalAlignment(SwingConstants.CENTER);
    jLabel3.setText("el nombre y ubicación del archivo");
    jTextField1.setColumns(15);
    jLabel4.setText("Ubicación");
    this.add(jPanel1, BorderLayout.NORTH);
    jPanel1.add(jLabel1, null);
    jPanel1.add(jLabel2, null);
    jPanel1.add(jLabel3, null);
    this.add(jPanel2,  BorderLayout.SOUTH);
    jPanel2.add(jButton1, null);
    jPanel2.add(jButton2, null);
    jPanel2.add(jButton3, null);
    this.add(jPanel3,  BorderLayout.CENTER);
    jPanel3.add(jLabel4, null);
    jPanel3.add(jTextField1, null);
    jPanel3.add(jButton4, null);

  }

  void jButton1_actionPerformed(ActionEvent e) {
    WizardManager.getInstance().back();
  }

  void jButton2_actionPerformed(ActionEvent e) {
    printContentInFile();
    WizardManager.getInstance().next();
  }

  void jButton3_actionPerformed(ActionEvent e) {
     WizardManager.getInstance().dispose();
  }

  void jButton4_actionPerformed(ActionEvent e) {
    JFileChooser jFileChooser1 = new JFileChooser();
    jFileChooser1.setDialogTitle("Ubicación del archivo resultante");
    int returnVal = jFileChooser1.showSaveDialog(WizardManager.getInstance());
    if (returnVal == JFileChooser.APPROVE_OPTION) {
      resultFile = jFileChooser1.getSelectedFile();
      String path = new String (resultFile.getPath().toString());
      this.jTextField1.setText(path);
    } else {
        jFileChooser1.setVisible(false);
    }
  }

  public void printContentInFile(){
    String path = resultFile.getPath();
    FileWriter fw = null;
    PrintWriter pw = null;

    try {
      File out = new File(path);
      fw = new FileWriter(out);
      pw = new PrintWriter(fw);
    }
    catch(Exception e){
      JOptionPane.showMessageDialog(WizardManager.getInstance(), e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
    }

    pw.print("Hello World !");

    try {
          pw.close();
          fw.close();
    }
    catch(Exception e){
      JOptionPane.showMessageDialog(WizardManager.getInstance(), e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
    }
  }
}

Archivo HelloWorldPane3.java

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class HelloWorldPanel3 extends JPanel {
  BorderLayout borderLayout1 = new BorderLayout();
  JPanel jPanel1 = new JPanel();
  JPanel jPanel2 = new JPanel();
  JButton jButton1 = new JButton();
  JButton jButton2 = new JButton();
  JButton jButton3 = new JButton();
  GridLayout gridLayout1 = new GridLayout();
  JLabel jLabel1 = new JLabel();
  JLabel jLabel2 = new JLabel();
  JLabel jLabel3 = new JLabel();
  JLabel jLabel4 = new JLabel();

  public HelloWorldPanel3() {
    try {
      jbInit();
    }
    catch(Exception ex) {
      ex.printStackTrace();
    }
  }

  void jbInit() throws Exception {
    this.setLayout(borderLayout1);
    jButton1.setText("< Anterior");
    jButton1.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(ActionEvent e) {
        jButton1_actionPerformed(e);
      }
    });
    jButton2.setText("Terminar");
    jButton2.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(ActionEvent e) {
        jButton2_actionPerformed(e);
      }
    });
    jButton3.setText("Cancelar");
    jButton3.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(ActionEvent e) {
        jButton3_actionPerformed(e);
      }
    });
    jPanel1.setLayout(gridLayout1);
    jLabel1.setFont(new java.awt.Font("Dialog", 1, 16));
    jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
    jLabel1.setText("Gracias por utilizar el plugin Hello World !");
    jLabel2.setHorizontalAlignment(SwingConstants.CENTER);
    jLabel2.setText("La frase \"Hello World !\" ha quedado escrita");
    gridLayout1.setRows(4);
    gridLayout1.setColumns(1);
    jLabel3.setHorizontalAlignment(SwingConstants.CENTER);
    jLabel3.setText("en el archivo que usted ha escogido. ");
    jLabel4.setToolTipText("");
    jLabel4.setHorizontalAlignment(SwingConstants.CENTER);
    this.add(jPanel1,  BorderLayout.CENTER);
    jPanel1.add(jLabel1, null);
    jPanel1.add(jLabel2, null);
    jPanel1.add(jLabel3, null);
    jPanel1.add(jLabel4, null);
    this.add(jPanel2, BorderLayout.SOUTH);
    jPanel2.add(jButton1, null);
    jPanel2.add(jButton2, null);
    jPanel2.add(jButton3, null);

  }

  void jButton1_actionPerformed(ActionEvent e) {
    WizardManager.getInstance().back();
  }

  void jButton2_actionPerformed(ActionEvent e) {
    WizardManager.getInstance().dispose();
  }

  void jButton3_actionPerformed(ActionEvent e) {
     WizardManager.getInstance().dispose();
  }
}