1 11 package org.eclipse.update.standalone; 12 import org.eclipse.core.runtime.*; 13 import org.eclipse.update.configuration.*; 14 import org.eclipse.update.core.*; 15 import org.eclipse.update.internal.core.*; 16 import org.eclipse.update.operations.*; 17 18 29 public abstract class ScriptedCommand implements IOperationListener { 30 31 private IInstallConfiguration config; 32 protected boolean verifyOnly; 33 34 38 public ScriptedCommand() { 39 this(null); 40 } 41 42 48 public ScriptedCommand(String verifyOnly) { 49 this.verifyOnly = "true".equals(verifyOnly); } 51 52 56 protected final boolean isVerifyOnly() { 57 return verifyOnly; 58 } 59 60 63 public final boolean run() { 64 return run(new NullProgressMonitor()); 65 } 66 67 72 public abstract boolean run(IProgressMonitor monitor); 73 74 77 public void applyChangesNow() { 78 OperationsManager.applyChangesNow(); 79 } 80 81 84 public boolean afterExecute(IOperation operation, Object data) { 85 return true; 86 } 87 88 91 public boolean beforeExecute(IOperation operation, Object data) { 92 return true; 93 } 94 95 98 public final IInstallConfiguration getConfiguration() { 99 try { 100 ILocalSite localSite = SiteManager.getLocalSite(); 101 config = localSite.getCurrentConfiguration(); 102 } catch (CoreException e) { 103 StandaloneUpdateApplication.exceptionLogged(); 104 UpdateCore.log(e); 105 } 106 return config; 107 } 108 109 } 110 | Popular Tags |