KickJava   Java API By Example, From Geeks To Geeks.

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


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

26 public class PluginFragmentModel extends PluginModel {
27
28     public static final byte FRAGMENT_MATCH_UNSPECIFIED = 0;
29     public static final byte FRAGMENT_MATCH_PERFECT = 1;
30     public static final byte FRAGMENT_MATCH_EQUIVALENT = 2;
31     public static final byte FRAGMENT_MATCH_COMPATIBLE = 3;
32     public static final byte FRAGMENT_MATCH_GREATER_OR_EQUAL = 4;
33
34     // DTD properties (included in plug-in manifest)
35
private String JavaDoc plugin = null;
36     private String JavaDoc pluginVersion = null;
37     private byte pluginMatch = FRAGMENT_MATCH_UNSPECIFIED;
38
39     /**
40      * Creates a new plug-in descriptor model in which all fields
41      * are <code>null</code>.
42      */

43     public PluginFragmentModel() {
44         super();
45     }
46
47     /**
48      * Returns a byte code indicating the type of match this fragment requires
49      * when trying to find its associated plugin.
50      * The byte code can be any one of the following:
51      * FRAGMENT_MATCH_UNSPECIFIED initial value
52      * FRAGMENT_MATCH_PERFECT perfectly equal match
53      * FRAGMENT_MATCH_EQUIVALENT equivalent match
54      * FRAGMENT_MATCH_COMPATIBLE compatible match
55      * FRAGMENT_MATCH_GREATER_OR_EQUAL greater than or equal to match
56      *
57      * @return a byte code indicating the type of match this fragment requires
58      * @since 2.0
59      */

60     public byte getMatch() {
61         return pluginMatch;
62     }
63
64     /**
65      * Returns the fully qualified name of the plug-in for which this is a fragment
66      *
67      * @return the name of this fragment's plug-in or <code>null</code>.
68      */

69     public String JavaDoc getPlugin() {
70         return plugin;
71     }
72
73     /**
74      * Returns the unique identifier of the plug-in related to this model
75      * or <code>null</code>.
76      * This identifier is a non-empty string and is unique
77      * within the plug-in registry.
78      *
79      * @return the unique identifier of the plug-in related to this model
80      * (e.g. <code>"com.example"</code>) or <code>null</code>.
81      */

82     public String JavaDoc getPluginId() {
83         return getPlugin();
84     }
85
86     /**
87      * Returns the version name of the plug-in for which this is a fragment.
88      *
89      * @return the version name of this fragment's plug-in or <code>null</code>
90      */

91     public String JavaDoc getPluginVersion() {
92         return pluginVersion;
93     }
94
95     /**
96      * Sets the type of match this fragment requires when trying to
97      * find its associated plugin. The value parameter may be any
98      * one of the following:
99      * FRAGMENT_MATCH_UNSPECIFIED initial value
100      * FRAGMENT_MATCH_PERFECT perfectly equal match
101      * FRAGMENT_MATCH_EQUIVALENT equivalent match
102      * FRAGMENT_MATCH_COMPATIBLE compatible match
103      * FRAGMENT_MATCH_GREATER_OR_EQUAL greater than or equal to match
104      * This object must not be read-only.
105      *
106      * @param value the type of match required with the associated plugin
107      * @since 2.0
108      */

109     public void setMatch(byte value) {
110         assertIsWriteable();
111         Assert.isTrue((value == FRAGMENT_MATCH_PERFECT) || (value == FRAGMENT_MATCH_EQUIVALENT) || (value == FRAGMENT_MATCH_COMPATIBLE) || (value == FRAGMENT_MATCH_GREATER_OR_EQUAL));
112         pluginMatch = value;
113     }
114
115     /**
116      * Sets the fully qualified name of the plug-in for which this is a fragment
117      * This object must not be read-only.
118      *
119      * @param value the name of this fragment's plug-in.
120      * May be <code>null</code>.
121      */

122     public void setPlugin(String JavaDoc value) {
123         assertIsWriteable();
124         plugin = value;
125     }
126
127     /**
128      * Sets the version name of the plug-in for which this is a fragment.
129      * The given version number is canonicalized.
130      * This object must not be read-only.
131      *
132      * @param value the version name of this fragment's plug-in.
133      * May be <code>null</code>.
134      */

135     public void setPluginVersion(String JavaDoc value) {
136         assertIsWriteable();
137         pluginVersion = new PluginVersionIdentifier(value).toString();
138     }
139 }
140
Popular Tags