KickJava   Java API By Example, From Geeks To Geeks.

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


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.ui.model;
12
13 import java.io.*;
14 import java.net.*;
15
16 import org.eclipse.core.runtime.*;
17 import org.eclipse.update.core.*;
18 import org.eclipse.update.core.model.*;
19 import org.eclipse.update.internal.ui.*;
20
21 public class MissingFeature implements IFeature {
22
23     private URL url;
24     private ISite site;
25     private IFeatureReference reference;
26     private IFeature parent;
27     private IURLEntry desc;
28     private VersionedIdentifier id = new VersionedIdentifier(UpdateUIMessages.MissingFeature_id, "0.0.0"); //$NON-NLS-1$
29
public MissingFeature(ISite site, URL url) {
30         this.site = site;
31         this.url = url;
32         desc = new IURLEntry() {
33             public URL getURL() {
34                 return null;
35             }
36             public String JavaDoc getAnnotation() {
37                 return UpdateUIMessages.MissingFeature_desc_unknown;
38             }
39             public Object JavaDoc getAdapter(Class JavaDoc key) {
40                 return null;
41             }
42             public int getType() {
43                 return IURLEntry.UPDATE_SITE;
44             }
45         };
46     }
47     public MissingFeature(IFeatureReference ref) {
48         this(null, ref);
49     }
50
51     public MissingFeature(IFeature parent, IFeatureReference ref) {
52         this(ref.getSite(), ref.getURL());
53         this.reference = ref;
54         this.parent = parent;
55
56         if (isOptional()) {
57             desc = new IURLEntry() {
58                 public URL getURL() {
59                     return null;
60                 }
61                 public String JavaDoc getAnnotation() {
62                     return UpdateUIMessages.MissingFeature_desc_optional;
63                 }
64                 public Object JavaDoc getAdapter(Class JavaDoc key) {
65                     return null;
66                 }
67                 public int getType() {
68                     return IURLEntry.UPDATE_SITE;
69                 }
70             };
71         }
72     }
73
74     public boolean isOptional() {
75         return reference != null
76             && reference instanceof IIncludedFeatureReference
77             && ((IIncludedFeatureReference) reference).isOptional();
78     }
79
80     public IFeature getParent() {
81         return parent;
82     }
83
84     public URL getOriginatingSiteURL() {
85         VersionedIdentifier vid = getVersionedIdentifier();
86         if (vid == null)
87             return null;
88         String JavaDoc key = vid.getIdentifier();
89         return UpdateUI.getOriginatingURL(key);
90     }
91
92     /*
93      * @see IFeature#getIdentifier()
94      */

95     public VersionedIdentifier getVersionedIdentifier() {
96         if (reference != null) {
97             try {
98                 return reference.getVersionedIdentifier();
99             } catch (CoreException e) {
100             }
101         }
102         return id;
103     }
104
105     /*
106      * @see IFeature#getSite()
107      */

108     public ISite getSite() {
109         return site;
110     }
111
112     /*
113      * @see IFeature#getLabel()
114      */

115     public String JavaDoc getLabel() {
116         if (reference != null
117             && reference instanceof IIncludedFeatureReference) {
118             String JavaDoc name = ((IIncludedFeatureReference) reference).getName();
119             if (name != null)
120                 return name;
121         }
122         return url.toString();
123     }
124
125     /*
126      * @see IFeature#getURL()
127      */

128     public URL getURL() {
129         return url;
130     }
131
132     /*
133      * @see IFeature#getUpdateInfo()
134      */

135     public IURLEntry getUpdateSiteEntry() {
136         return null;
137     }
138
139     /*
140      * @see IFeature#getDiscoveryInfos()
141      */

142     public IURLEntry[] getDiscoverySiteEntries() {
143         return null;
144     }
145
146     /*
147      * @see IFeature#getProvider()
148      */

149     public String JavaDoc getProvider() {
150         return UpdateUIMessages.MissingFeature_provider;
151     }
152
153     /*
154      * @see IFeature#getDescription()
155      */

156     public IURLEntry getDescription() {
157         return desc;
158     }
159
160     /*
161      * @see IFeature#getCopyright()
162      */

163     public IURLEntry getCopyright() {
164         return null;
165     }
166
167     /*
168      * @see IFeature#getLicense()
169      */

170     public IURLEntry getLicense() {
171         return null;
172     }
173
174     /*
175      * @see IFeature#getOS()
176      */

177     public String JavaDoc getOS() {
178         return null;
179     }
180
181     /*
182      * @see IFeature#getWS()
183      */

184     public String JavaDoc getWS() {
185         return null;
186     }
187
188     /*
189      * @see IFeature#getNL()
190      */

191     public String JavaDoc getNL() {
192         return null;
193     }
194
195     /*
196      * @see IFeature#getArch()
197      */

198     public String JavaDoc getOSArch() {
199         return null;
200     }
201
202     /*
203      * @see IFeature#getImage()
204      */

205     public URL getImage() {
206         return null;
207     }
208
209     /*
210      * @see IFeature#getImports()
211      */

212     public IImport[] getImports() {
213         return null;
214     }
215
216     /*
217      * @see IFeature#getArchives()
218      */

219     public String JavaDoc[] getArchives() {
220         return null;
221     }
222
223     /*
224      * @see IFeature#getDataEntries()
225      */

226     public INonPluginEntry[] getNonPluginEntries() {
227         return null;
228     }
229
230     /*
231      * @see IFeature#addDataEntry(IDataEntry)
232      */

233     public void addNonPluginEntry(INonPluginEntry dataEntry) {
234     }
235
236     /*
237      * @see IFeature#getDownloadSize()
238      */

239     public long getDownloadSize() {
240         return 0;
241     }
242
243     /*
244      * @see IFeature#getInstallSize(ISite)
245      */

246     public long getInstallSize() {
247         return 0;
248     }
249
250     /*
251      * @see IFeature#isPrimary()
252      */

253     public boolean isPrimary() {
254         return false;
255     }
256
257     /*
258      * @see IFeature#getApplication()
259      */

260     public String JavaDoc getApplication() {
261         return null;
262     }
263
264     /*
265      * @see IPluginContainer#getPluginEntries()
266      */

267     public IPluginEntry[] getPluginEntries() {
268         return new IPluginEntry[0];
269     }
270
271     /*
272      * @see IPluginContainer#getPluginEntryCount()
273      */

274     public int getPluginEntryCount() {
275         return 0;
276     }
277
278     /*
279      * @see IPluginContainer#getDownloadSize(IPluginEntry)
280      */

281     public long getDownloadSize(IPluginEntry entry) {
282         return 0;
283     }
284
285     /*
286      * @see IPluginContainer#getInstallSize(IPluginEntry)
287      */

288     public long getInstallSize(IPluginEntry entry) {
289         return 0;
290     }
291
292     /*
293      * @see IPluginContainer#addPluginEntry(IPluginEntry)
294      */

295     public void addPluginEntry(IPluginEntry pluginEntry) {
296     }
297
298     /*
299      * @see IPluginContainer#store(IPluginEntry, String, InputStream)
300      */

301     public void store(IPluginEntry entry, String JavaDoc name, InputStream inStream)
302         throws CoreException {
303     }
304
305     /*
306      * @see IAdaptable#getAdapter(Class)
307      */

308     public Object JavaDoc getAdapter(Class JavaDoc adapter) {
309         return null;
310     }
311
312     /*
313      * @see IPluginContainer#remove(IPluginEntry)
314      */

315     public void remove(IPluginEntry entry) throws CoreException {
316     }
317
318     /*
319      * @see IFeature#setFeatureContentProvider(IFeatureContentProvider)
320      */

321     public void setFeatureContentProvider(IFeatureContentProvider featureContentProvider) {
322     }
323
324     /*
325      * @see IFeature#getFeatureContentConsumer()
326      */

327     public IFeatureContentConsumer getFeatureContentConsumer()
328         throws CoreException {
329         return null;
330     }
331
332     /*
333      * @see IFeature#setSite(ISite)
334      */

335     public void setSite(ISite site) throws CoreException {
336         this.site = site;
337     }
338
339     /*
340      * @see IFeature#getFeatureContentProvider()
341      */

342     public IFeatureContentProvider getFeatureContentProvider()
343         throws CoreException {
344         return null;
345     }
346
347     /*
348      * @see IFeature#install(IFeature,IVerifier, IProgressMonitor)
349      */

350     public IFeatureReference install(
351         IFeature targetFeature,
352         IVerificationListener verificationListener,
353         IProgressMonitor monitor)
354         throws CoreException {
355         return null;
356     }
357
358     /*
359      * @see org.eclipse.update.core.IFeature#install(IFeature, IFeatureReference[], IVerificationListener, IProgressMonitor)
360      */

361     public IFeatureReference install(
362         IFeature targetFeature,
363         IFeatureReference[] optionalFeatures,
364         IVerificationListener verificationListener,
365         IProgressMonitor monitor)
366         throws InstallAbortedException, CoreException {
367         return null;
368     }
369     /*
370      * @see IFeature#remove(IProgressMonitor)
371      */

372     public void remove(IProgressMonitor monitor) throws CoreException {
373     }
374
375     /*
376      * @see IPluginContainer#remove(IPluginEntry, IProgressMonitor)
377      */

378     public void remove(IPluginEntry entry, IProgressMonitor monitor)
379         throws CoreException {
380     }
381
382     /*
383      * @see IFeature#getNonPluginEntryCount()
384      */

385     public int getNonPluginEntryCount() {
386         return 0;
387     }
388
389     /*
390      * @see IFeature#getInstallHandlerEntry()
391      */

392     public IInstallHandlerEntry getInstallHandlerEntry() {
393         return null;
394     }
395     /*
396      * @see IFeature#getIncludedFeatureReferences()
397      */

398     public IIncludedFeatureReference[] getIncludedFeatureReferences()
399         throws CoreException {
400         return new IIncludedFeatureReference[0];
401     }
402
403     /**
404      * @see IFeature#getAffinityFeature()
405      */

406     public String JavaDoc getAffinityFeature() {
407         return null;
408     }
409     /**
410      * @see org.eclipse.update.core.IFeature#getRawIncludedFeatureReferences()
411      */

412     public IIncludedFeatureReference[] getRawIncludedFeatureReferences()
413         throws CoreException {
414         return getIncludedFeatureReferences();
415     }
416
417     /**
418      * @see org.eclipse.update.core.IFeature#getRawNonPluginEntries()
419      */

420     public INonPluginEntry[] getRawNonPluginEntries() {
421         return getNonPluginEntries();
422     }
423
424     /**
425      * @see org.eclipse.update.core.IFeature#getRawPluginEntries()
426      */

427     public IPluginEntry[] getRawPluginEntries() {
428         return getPluginEntries();
429     }
430
431     /**
432      * @see org.eclipse.update.core.IFeature#getPrimaryPluginID()
433      */

434     public String JavaDoc getPrimaryPluginID() {
435         return null;
436     }
437
438     /**
439      * @see org.eclipse.update.core.IFeature#getRawImports()
440      */

441     public IImport[] getRawImports() {
442         return new IImport[0];
443     }
444
445     /**
446      * @see org.eclipse.update.core.IFeature#isPatch()
447      */

448     public boolean isPatch() {
449         return false;
450     }
451     
452     public boolean isExclusive() {
453         return false;
454     }
455
456 }
457
Popular Tags