1 package org.oddjob.monitor.action; 2 3 import org.oddjob.Resetable; 4 import org.oddjob.designer.model.DesignDefinition; 5 import org.oddjob.monitor.model.ExplorerContext; 6 import org.oddjob.monitor.model.JobAction; 7 import org.oddjob.util.ThreadManager; 8 9 14 15 public class HardResetAction extends JobAction { 16 17 18 private Object job = null; 19 20 21 private ThreadManager threadManager; 22 23 24 private boolean enabled; 25 26 30 public String getName() { 31 return "Hard Reset"; 32 } 33 34 38 protected void select(Object component, ExplorerContext eContext) { 39 if (!(component instanceof Resetable)) { 40 this.job = null; 41 this.enabled = false; 42 return; 43 } 44 45 this.job = component; 46 this.enabled = true; 47 this.threadManager = eContext.getThreadManager(); 48 } 49 50 54 protected void deSelect() { 55 job = null; 56 enabled = false; 57 } 58 59 63 public boolean enabled() { 64 return enabled; 65 } 66 67 71 public DesignDefinition form() { 72 return null; 73 } 74 75 79 public void action() throws Exception { 80 threadManager.run(new Runnable () { 81 public void run() { 82 ((Resetable) job).hardReset(); 83 } 84 }, "Hard Reset of " + job); 85 } 86 87 } 88 | Popular Tags |