KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > update > internal > operations > FeatureOperation


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

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
19 public abstract class FeatureOperation extends Operation implements IFeatureOperation {
20     
21     protected IFeature feature;
22     protected IFeature oldFeature;
23     protected IConfiguredSite targetSite;
24
25 // private boolean optionalDelta;
26

27     
28     public FeatureOperation(IConfiguredSite targetSite, IFeature feature) {
29         super();
30         this.feature = feature;
31         this.targetSite = targetSite;
32     }
33
34     public IFeature getFeature() {
35         return feature;
36     }
37     
38     public IFeature getOldFeature() {
39         return oldFeature;
40     }
41     
42 // public boolean isOptionalDelta() {
43
// return optionalDelta;
44
// }
45

46     public IConfiguredSite getTargetSite() {
47         return targetSite;
48     }
49
50     public void setTargetSite(IConfiguredSite targetSite) {
51         this.targetSite = targetSite;
52     }
53     
54
55     static boolean unconfigure(IFeature feature, IConfiguredSite site)
56         throws CoreException {
57         IInstallConfiguration config = SiteManager.getLocalSite().getCurrentConfiguration();
58         if (site == null)
59             site = UpdateUtils.getConfigSite(feature, config);
60         
61         if (site != null) {
62             PatchCleaner cleaner = new PatchCleaner(site, feature);
63             boolean result = site.unconfigure(feature);
64             cleaner.dispose();
65             return result;
66         }
67         return false;
68     }
69
70     public void setFeature(IFeature feature) {
71         this.feature = feature;
72     }
73     
74
75 }
76
Popular Tags