private void saveDecompiledButtonActionPerformed(ActionEvent evt) {
    ScriptPack pack = decompiledTextArea.getScriptLeaf();
    int oldIndex = pack.scriptIndex;
    SWF.uncache(pack);

    try {
      String oldSp = null;
      List<ScriptPack> packs = abc.script_info.get(oldIndex).getPacks(abc, oldIndex, null);
      if (!packs.isEmpty()) {
        oldSp = packs.get(0).getClassPath().toString();
      }

      String as = decompiledTextArea.getText();
      abc.replaceScriptPack(pack, as);
      lastDecompiled = as;
      mainPanel.updateClassesList();

      if (oldSp != null) {
        hilightScript(getSwf(), oldSp);
      }
      setDecompiledEditMode(false);
      reload();
      View.showMessageDialog(
          this,
          AppStrings.translate("message.action.saved"),
          AppStrings.translate("dialog.message.title"),
          JOptionPane.INFORMATION_MESSAGE,
          Configuration.showCodeSavedMessage);
    } catch (AVM2ParseException ex) {
      abc.script_info.get(oldIndex).delete(abc, false);
      decompiledTextArea.gotoLine((int) ex.line);
      decompiledTextArea.markError();
      View.showMessageDialog(
          this,
          AppStrings.translate("error.action.save")
              .replace("%error%", ex.text)
              .replace("%line%", Long.toString(ex.line)),
          AppStrings.translate("error"),
          JOptionPane.ERROR_MESSAGE);
    } catch (CompilationException ex) {
      abc.script_info.get(oldIndex).delete(abc, false);
      decompiledTextArea.gotoLine((int) ex.line);
      decompiledTextArea.markError();
      View.showMessageDialog(
          this,
          AppStrings.translate("error.action.save")
              .replace("%error%", ex.text)
              .replace("%line%", Long.toString(ex.line)),
          AppStrings.translate("error"),
          JOptionPane.ERROR_MESSAGE);
    } catch (Throwable ex) {
      Logger.getLogger(ABCPanel.class.getName()).log(Level.SEVERE, null, ex);
    }
  }
  public void setDecompiledEditMode(boolean val) {
    if (val) {
      lastDecompiled = decompiledTextArea.getText();
    } else {
      decompiledTextArea.setText(lastDecompiled);
    }

    decompiledTextArea.setEditable(val);
    saveDecompiledButton.setVisible(val);
    saveDecompiledButton.setEnabled(false);
    editDecompiledButton.setVisible(!val);
    experimentalLabel.setVisible(!val);
    cancelDecompiledButton.setVisible(val);
    decompiledTextArea.getCaret().setVisible(true);
    decLabel.setIcon(val ? View.getIcon("editing16") : null);
    detailPanel.setVisible(!val);

    decompiledTextArea.ignoreCarret = val;
    decompiledTextArea.requestFocusInWindow();
  }