KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > update > internal > ui > model > FeatureAdapter


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.ui.model;
12
13 import org.eclipse.core.runtime.*;
14 import org.eclipse.update.configuration.*;
15 import org.eclipse.update.core.*;
16 import org.eclipse.update.internal.ui.UpdateUIMessages;
17
18 /**
19  * @version 1.0
20  * @author
21  */

22 public abstract class FeatureAdapter extends UIModelObject implements IFeatureAdapter {
23     private boolean included=false;
24
25     /*
26      * @see IFeatureAdapter#getInstallConfiguration()
27      */

28     public IInstallConfiguration getInstallConfiguration() {
29         return null;
30     }
31     
32     public boolean isIncluded() {
33         return included;
34     }
35     
36     protected void setIncluded(boolean included) {
37         this.included = included;
38     }
39     
40     public String JavaDoc toString() {
41         try {
42             IFeature feature = getFeature(null);
43             return feature.getLabel();
44         }
45         catch (CoreException e) {
46             return UpdateUIMessages.FeatureAdapter_failure;
47         }
48     }
49     public boolean hasIncludedFeatures(IProgressMonitor monitor) {
50         try {
51             IFeatureReference [] included = getFeature(monitor).getIncludedFeatureReferences();
52             return included.length>0;
53         }
54         catch (CoreException e) {
55             return false;
56         }
57     }
58 }
59
Popular Tags