/** Performs the action of loading a session from a file. */
  public void actionPerformed(ActionEvent e) {
    DataModel dataModel = getDataEditor().getSelectedDataModel();

    if (!(dataModel instanceof DataSet)) {
      JOptionPane.showMessageDialog(JOptionUtils.centeringComp(), "Must be a tabular data set.");
      return;
    }

    this.dataSet = (DataSet) dataModel;

    SpinnerNumberModel spinnerNumberModel = new SpinnerNumberModel(getNumLags(), 0, 20, 1);
    JSpinner jSpinner = new JSpinner(spinnerNumberModel);
    jSpinner.setPreferredSize(jSpinner.getPreferredSize());

    spinnerNumberModel.addChangeListener(
        new ChangeListener() {
          public void stateChanged(ChangeEvent e) {
            SpinnerNumberModel model = (SpinnerNumberModel) e.getSource();
            setNumLags(model.getNumber().intValue());
          }
        });

    JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout());

    Box b = Box.createVerticalBox();
    Box b1 = Box.createHorizontalBox();
    b1.add(new JLabel("Number of time lags: "));
    b1.add(Box.createHorizontalGlue());
    b1.add(Box.createHorizontalStrut(15));
    b1.add(jSpinner);
    b1.setBorder(new EmptyBorder(10, 10, 10, 10));
    b.add(b1);

    panel.add(b, BorderLayout.CENTER);

    EditorWindow editorWindow = new EditorWindow(panel, "Create time series data", "Save", true);
    DesktopController.getInstance().addEditorWindow(editorWindow);
    editorWindow.setVisible(true);

    editorWindow.addInternalFrameListener(
        new InternalFrameAdapter() {
          public void internalFrameClosed(InternalFrameEvent e) {
            EditorWindow window = (EditorWindow) e.getSource();

            if (!window.isCanceled()) {
              if (dataSet.isContinuous()) {
                createContinuousTimeSeriesData();
              } else if (dataSet.isDiscrete()) {
                createDiscreteTimeSeriesData();
              } else {
                JOptionPane.showMessageDialog(
                    JOptionUtils.centeringComp(),
                    "Data set must be either continuous or discrete.");
              }
            }
          }
        });
  }
 /** Sets the name of this editor. */
 public final void setName(String name) {
   String oldName = getName();
   super.setName(name);
   firePropertyChange("name", oldName, getName());
 }