1 11 package org.eclipse.update.internal.operations; 12 13 import java.io.File ; 14 import java.io.FileInputStream ; 15 import java.io.FileOutputStream ; 16 import java.io.IOException ; 17 import java.lang.reflect.InvocationTargetException ; 18 import java.net.URL ; 19 import java.util.Properties ; 20 21 import org.eclipse.core.runtime.CoreException; 22 import org.eclipse.core.runtime.IProgressMonitor; 23 import org.eclipse.update.configuration.IConfiguredSite; 24 import org.eclipse.update.configurator.ConfiguratorUtils; 25 import org.eclipse.update.core.IFeature; 26 import org.eclipse.update.operations.IOperationListener; 27 import org.eclipse.update.operations.IUnconfigFeatureOperation; 28 import org.eclipse.update.operations.OperationsManager; 29 30 public class UnconfigureAndUninstallFeatureOperation extends FeatureOperation 31 implements IUnconfigureAndUninstallFeatureOperation { 32 33 public UnconfigureAndUninstallFeatureOperation(IConfiguredSite targetSite, IFeature feature) { 34 super(targetSite, feature); 35 } 36 37 public boolean execute(IProgressMonitor pm, IOperationListener listener) 38 throws CoreException, InvocationTargetException { 39 40 IUnconfigFeatureOperation unconfigOperation = OperationsManager.getOperationFactory().createUnconfigOperation(targetSite, feature); 41 42 unconfigOperation.execute(pm, listener); 43 44 45 URL platformXML = ConfiguratorUtils.getCurrentPlatformConfiguration().getConfigurationLocation(); 46 47 File f = new File (platformXML.getFile()); 48 49 f = new File (f.getParentFile(), "toBeUninstalled"); try { 51 if (!f.exists()) { 52 f.createNewFile(); 53 } 54 FileInputStream fis = new FileInputStream (f); 55 Properties toBeUninstalled = new Properties (); 56 toBeUninstalled.load(fis); 57 toBeUninstalled.put(new Integer (toBeUninstalled.size()+1).toString(), targetSite.getSite().getURL() + ";" + feature.getVersionedIdentifier().toString()); fis.close(); 59 FileOutputStream fos = new FileOutputStream (f); 60 toBeUninstalled.store(fos, "to be uninstalled on start-up"); fos.close(); 62 63 } catch (IOException ioe) { 64 65 } 66 67 68 return true; 69 } 70 71 } 72 | Popular Tags |