1 11 package org.eclipse.update.internal.operations; 12 13 import org.eclipse.core.runtime.*; 14 import org.eclipse.update.configuration.*; 15 import org.eclipse.update.core.*; 16 import org.eclipse.update.operations.*; 17 18 22 public class ConfigOperation 23 extends FeatureOperation 24 implements IConfigFeatureOperation { 25 26 public ConfigOperation( 27 IConfiguredSite site, 28 IFeature feature) { 29 super(site, feature); 30 } 31 32 public boolean execute(IProgressMonitor pm, IOperationListener listener) 33 throws CoreException { 34 35 IStatus status = 36 OperationsManager.getValidator().validatePendingConfig(feature); 37 if (status != null && status.getCode() == IStatus.ERROR) { 38 throw new CoreException(status); 39 } 40 try { 41 targetSite.configure(feature); 42 44 boolean restartNeeded = false; 46 47 IOperation pendingOperation = 49 OperationsManager.findPendingOperation(feature); 50 51 if (pendingOperation instanceof IUnconfigFeatureOperation) { 52 OperationsManager.removePendingOperation(pendingOperation); 54 } else { 55 OperationsManager.addPendingOperation(this); 56 } 57 58 markProcessed(); 59 if (listener != null) 60 listener.afterExecute(this, null); 61 62 restartNeeded = SiteManager.getLocalSite().save() && restartNeeded; 63 64 OperationsManager.fireObjectChanged(feature, null); 66 67 return restartNeeded; 68 } catch (CoreException e) { 69 undo(); 70 UpdateUtils.logException(e); 71 throw e; 72 } 73 } 74 75 public void undo() throws CoreException { 76 targetSite.unconfigure(feature); 77 } 78 } 79 | Popular Tags |