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);
    }
  }
 private void buttonActionPerformed(ActionEvent evt) {
   File selectedFile = mainPanel.showImportFileChooser("");
   if (selectedFile != null) {
     File selfile = Helper.fixDialogFile(selectedFile);
     byte[] data = Helper.readFile(selfile.getAbsolutePath());
     setToolTipText(data.length + " bytes");
     Class type = field.getType();
     if (type.equals(byte[].class)) {
       value = data;
     } else if (type.equals(ByteArrayRange.class)) {
       value = new ByteArrayRange(data);
     }
   }
 }
  public boolean search(final String txt, boolean ignoreCase, boolean regexp) {
    if ((txt != null) && (!txt.isEmpty())) {
      searchPanel.setOptions(ignoreCase, regexp);
      TagTreeModel ttm = (TagTreeModel) mainPanel.tagTree.getModel();
      TreeItem scriptsNode = ttm.getScriptsNode(mainPanel.getCurrentSwf());
      final List<ABCPanelSearchResult> found = new ArrayList<>();
      if (scriptsNode instanceof ClassesListTreeModel) {
        ClassesListTreeModel clModel = (ClassesListTreeModel) scriptsNode;
        List<ScriptPack> allpacks = clModel.getList();
        final Pattern pat =
            regexp
                ? Pattern.compile(
                    txt, ignoreCase ? (Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE) : 0)
                : Pattern.compile(
                    Pattern.quote(txt),
                    ignoreCase ? (Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE) : 0);
        int pos = 0;
        for (final ScriptPack pack : allpacks) {
          pos++;
          String workText = AppStrings.translate("work.searching");
          String decAdd = "";
          if (!SWF.isCached(pack)) {
            decAdd = ", " + AppStrings.translate("work.decompiling");
          }

          try {
            CancellableWorker worker =
                new CancellableWorker() {

                  @Override
                  public Void doInBackground() throws Exception {
                    if (pat.matcher(SWF.getCached(pack).text).find()) {
                      ABCPanelSearchResult searchResult = new ABCPanelSearchResult();
                      searchResult.scriptPack = pack;
                      found.add(searchResult);
                    }
                    return null;
                  }
                };
            worker.execute();
            Main.startWork(
                workText
                    + " \""
                    + txt
                    + "\""
                    + decAdd
                    + " - ("
                    + pos
                    + "/"
                    + allpacks.size()
                    + ") "
                    + pack.getClassPath().toString()
                    + "... ",
                worker);
            worker.get();
          } catch (InterruptedException ex) {
            break;
          } catch (ExecutionException ex) {
            Logger.getLogger(ABCPanel.class.getName()).log(Level.SEVERE, null, ex);
          }
        }
      }

      Main.stopWork();

      searchPanel.setSearchText(txt);

      View.execInEventDispatch(
          () -> {
            SearchResultsDialog<ABCPanelSearchResult> sr =
                new SearchResultsDialog<>(
                    ABCPanel.this.mainPanel.getMainFrame().getWindow(), txt, ABCPanel.this);
            sr.setResults(found);
            sr.setVisible(true);
          });

      return true;

      // return searchPanel.setResults(found);
    }
    return false;
  }