1 11 package org.eclipse.update.internal.operations; 12 13 import java.lang.reflect.*; 14 15 import org.eclipse.core.runtime.*; 16 import org.eclipse.update.configuration.*; 17 import org.eclipse.update.core.*; 18 import org.eclipse.update.operations.*; 19 20 public class RevertConfigurationOperation extends Operation implements IRevertConfigurationOperation { 21 22 private IInstallConfiguration config; 23 private IProblemHandler problemHandler; 24 25 public RevertConfigurationOperation( 26 IInstallConfiguration config, 27 IProblemHandler problemHandler) { 28 super(); 29 this.config = config; 30 this.problemHandler = problemHandler; 31 } 32 33 36 public boolean execute(IProgressMonitor monitor, IOperationListener listener) 37 throws CoreException, InvocationTargetException { 38 IStatus status = 39 OperationsManager.getValidator().validatePendingRevert(config); 40 if (status != null && status.getCode() == IStatus.ERROR) { 41 throw new CoreException(status); 42 } 43 44 try { 45 ILocalSite localSite = SiteManager.getLocalSite(); 46 localSite.revertTo(config, monitor, problemHandler); 47 localSite.save(); 48 return true; 49 } catch (CoreException e) { 50 UpdateUtils.logException(e); 51 throw e; 52 } 53 } 54 } 55 | Popular Tags |