1 package jimm.datavision.gui.cmd; 2 import jimm.datavision.Scripting; 3 import jimm.util.I18N; 4 import java.util.HashMap ; 5 import java.util.Map ; 6 7 12 public class ScriptingCommand extends CommandAdapter { 13 14 protected Scripting scripting; 15 protected String newDefaultLang; 16 protected Map newLangs; 17 protected String origDefaultLang; 18 protected Map origLangs; 19 20 public ScriptingCommand(Scripting scripting, String newDefaultLang, 21 Map newLangs) 22 { 23 super(I18N.get("ScriptingCommand.name")); 24 25 this.scripting = scripting; 26 this.newDefaultLang = newDefaultLang; 27 this.newLangs = newLangs; 28 29 origDefaultLang = scripting.getDefaultLanguage(); 30 origLangs = new HashMap (scripting.getLanguages()); } 32 33 public void perform() { 34 scripting.setDefaultLanguage(newDefaultLang); 35 scripting.replaceLanguages(newLangs); 36 } 37 38 public void undo() { 39 scripting.setDefaultLanguage(origDefaultLang); 40 scripting.replaceLanguages(origLangs); 41 } 42 43 } 44 | Popular Tags |