KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > core > runtime > model > PluginPrerequisiteModel


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.core.runtime.model;
12
13 import org.eclipse.core.runtime.Assert;
14
15 /**
16  * An object which represents the relationship between a plug-in and a
17  * prerequisite plug-in in the dependent's plug-in manifest.
18  * <p>
19  * This class may be instantiated, or further subclassed.
20  * </p>
21  * @deprecated In Eclipse 3.0 the runtime was refactored and all
22  * non-essential elements removed. This class provides facilities primarily intended
23  * for tooling. As such it has been removed and no directly substitutable API provided.
24  */

25 public class PluginPrerequisiteModel extends PluginModelObject {
26
27     public static final byte PREREQ_MATCH_UNSPECIFIED = 0;
28     public static final byte PREREQ_MATCH_PERFECT = 1;
29     public static final byte PREREQ_MATCH_EQUIVALENT = 2;
30     public static final byte PREREQ_MATCH_COMPATIBLE = 3;
31     public static final byte PREREQ_MATCH_GREATER_OR_EQUAL = 4;
32
33     // DTD properties (included in plug-in manifest)
34
private String JavaDoc plugin = null;
35     private String JavaDoc version = null;
36     private byte match = PREREQ_MATCH_UNSPECIFIED;
37     private boolean export = false;
38     private String JavaDoc resolvedVersion = null;
39     private boolean optional = false;
40
41     /**
42      * Creates a new plug-in prerequisite model in which all fields
43      * are <code>null</code>.
44      */

45     public PluginPrerequisiteModel() {
46         super();
47     }
48
49     /**
50      * Returns whether or not the code in this pre-requisite is exported.
51      *
52      * @return whether or not the code in this pre-requisite is exported
53      */

54     public boolean getExport() {
55         return export;
56     }
57
58     /**
59      * Returns whether or not this pre-requisite requires an exact match.
60      *
61      * @return whether or not this pre-requisite requires an exact match
62      * @deprecated - use getMatchByte
63      */

64     public boolean getMatch() {
65         return (match == PREREQ_MATCH_EQUIVALENT);
66     }
67
68     /**
69      * Returns a byte code indicating the type of match this pre-requisite requires.
70      * The byte code can be any one of the following:
71      * PREREQ_MATCH_UNSPECIFIED initial value
72      * PREREQ_MATCH_PERFECT perfectly equal match
73      * PREREQ_MATCH_EQUIVALENT equivalent match
74      * PREREQ_MATCH_COMPATIBLE compatible match
75      * PREREQ_MATCH_GREATER_OR_EQUAL greater than or equal to match
76      *
77      * @return a byte code indicating the type of match this pre-requisite requires
78      * @since 2.0
79      */

80     public byte getMatchByte() {
81         return match;
82     }
83
84     /**
85      * Returns whether this pre-requisite is optional.
86      *
87      * @return whether this pre-requisite is optional
88      */

89     public boolean getOptional() {
90         return optional;
91     }
92
93     /**
94      * Returns the plug-in identifier of the prerequisite plug-in.
95      *
96      * @return the plug-in identifier or <code>null</code>
97      */

98     public String JavaDoc getPlugin() {
99         return plugin;
100     }
101
102     /**
103      * Returns the resolved version of the prerequisite plug-in. The
104      * returned value is in the format specified by <code>PluginVersionIdentifier</code>.
105      *
106      * @return the version of the prerequisite plug-in
107      * @see org.eclipse.core.runtime.PluginVersionIdentifier
108      */

109     public String JavaDoc getResolvedVersion() {
110         return resolvedVersion;
111     }
112
113     /**
114      * Returns the version name of this plug-in.
115      *
116      * @return the version name of this plug-in or <code>null</code>
117      */

118     public String JavaDoc getVersion() {
119         return version;
120     }
121
122     /**
123      * Sets whether or not the code in this pre-requisite is exported.
124      * This object must not be read-only.
125      *
126      * @param value whether or not the code in this pre-requisite is exported
127      */

128     public void setExport(boolean value) {
129         assertIsWriteable();
130         export = value;
131     }
132
133     /**
134      * Sets whether or not this pre-requisite requires an exact match.
135      * This object must not be read-only.
136      *
137      * @param value whether or not this pre-requisite requires an exact match
138      * @deprecated use setMatchByte
139      */

140     public void setMatch(boolean value) {
141         assertIsWriteable();
142         if (value) {
143             setMatchByte(PREREQ_MATCH_EQUIVALENT);
144         } else {
145             setMatchByte(PREREQ_MATCH_COMPATIBLE);
146         }
147     }
148
149     /**
150      * Sets whether or not this pre-requisite requires an exact match.
151      * This object must not be read-only.
152      *
153      * @param value whether or not this pre-requisite requires an exact match
154      * @since 2.0
155      */

156     public void setMatchByte(byte value) {
157         assertIsWriteable();
158         Assert.isTrue((value == PREREQ_MATCH_PERFECT) || (value == PREREQ_MATCH_EQUIVALENT) || (value == PREREQ_MATCH_COMPATIBLE) || (value == PREREQ_MATCH_GREATER_OR_EQUAL));
159         match = value;
160     }
161
162     /**
163      * Sets whether this pre-requisite is optional.
164      * This object must not be read-only.
165      *
166      * @param value whether this pre-requisite is optional
167      */

168     public void setOptional(boolean value) {
169         assertIsWriteable();
170         optional = value;
171     }
172
173     /**
174      * Sets the plug-in identifier of this prerequisite plug-in.
175      * This object must not be read-only.
176      *
177      * @param value the prerequisite plug-in identifier. May be <code>null</code>.
178      */

179     public void setPlugin(String JavaDoc value) {
180         assertIsWriteable();
181         plugin = value;
182     }
183
184     /**
185      * Sets the resolved version of the prerequisite plug-in. The
186      * given value is in the format specified by <code>PluginVersionIdentifier</code>.
187      *
188      * @param value the version of the prerequisite plug-in
189      * @see org.eclipse.core.runtime.PluginVersionIdentifier
190      */

191     public void setResolvedVersion(String JavaDoc value) {
192         assertIsWriteable();
193         resolvedVersion = value;
194     }
195
196     /**
197      * Sets the version name of this plug-in prerequisite.
198      * This object must not be read-only.
199      *
200      * @param value the version name of this plug-in prerequisite.
201      * May be <code>null</code>.
202      */

203     public void setVersion(String JavaDoc value) {
204         assertIsWriteable();
205         version = value;
206     }
207 }
208
Popular Tags