1 package tim.prune.function.compress;
3 import javax.swing.JOptionPane;
6 import tim.prune.GenericFunction;
7 import tim.prune.I18nManager;
10 * Superclass of those functions which mark points for deletion
11 * (and optionally delete them automatically)
13 public abstract class MarkAndDeleteFunction extends GenericFunction
15 /** flag to remember whether the automatic deletion has been set to always */
16 private boolean _automaticallyDelete = false;
21 * @param inApp App object
23 public MarkAndDeleteFunction(App inApp)
29 * optionally delete the marked points
31 protected void optionallyDeleteMarkedPoints(int inNumMarked)
33 // Allow calling of delete function with one click
34 final String[] buttonTexts = {I18nManager.getText("button.yes"), I18nManager.getText("button.no"),
35 I18nManager.getText("button.always")};
36 int answer = _automaticallyDelete ? JOptionPane.YES_OPTION :
37 JOptionPane.showOptionDialog(_parentFrame,
38 I18nManager.getTextWithNumber("dialog.compress.confirm", inNumMarked),
39 I18nManager.getText(getNameKey()), JOptionPane.YES_NO_CANCEL_OPTION,
40 JOptionPane.WARNING_MESSAGE, null, buttonTexts, buttonTexts[1]);
41 if (answer == JOptionPane.CANCEL_OPTION) {_automaticallyDelete = true;} // "always" is third option
42 if (_automaticallyDelete || answer == JOptionPane.YES_OPTION)
44 new Thread(new Runnable() {
46 _app.finishCompressTrack();