KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 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.core.*;
15
16
17 /**
18  * The feature status provide info about the broken features and what is
19  * wrong.
20  */

21 public class FeatureStatus extends Status {
22     public final static int CODE_OTHER = IStatus.OK;//0
23
public final static int CODE_PREREQ_FEATURE = 1;
24     public final static int CODE_PREREQ_PLUGIN = 2;
25     public final static int CODE_EXCLUSIVE = 4;
26     public final static int CODE_CYCLE = 8;
27     public final static int CODE_OPTIONAL_CHILD = 16;
28     public final static int CODE_ENVIRONMENT = 32;
29     IFeature feature;
30
31     public FeatureStatus(IFeature feature, int severity, String JavaDoc pluginId, int code, String JavaDoc message, Throwable JavaDoc exception) {
32         super(severity, pluginId, code, message, exception);
33         this.feature = feature;
34     }
35     public IFeature getFeature() {
36         return feature;
37     }
38     public boolean equals(Object JavaDoc obj) {
39         if (!(obj instanceof FeatureStatus))
40             return false;
41         FeatureStatus fs = (FeatureStatus) obj;
42         // only check for feature, regardless of status type
43
if (fs.getFeature() == feature)
44             return true;
45         else if (fs.getFeature() == null && feature == null)
46             return fs.getMessage().equals(getMessage());
47         else if (fs.getFeature() == null && feature != null)
48             return false;
49         else if (fs.getFeature() != null && feature == null)
50             return false;
51         else if (fs.getFeature().equals(feature))
52             return true;
53         else
54             return false;
55     }
56
57 }
58
Popular Tags