View Javadoc

1   /*
2    * $Id: LibraryOWLDocument.java,v 1.13 2005/07/11 20:31:11 jlerner Exp $
3    *
4    * Copyright (c) 1999-2004, BBN Technologies, LLC.
5    * All rights reserved.
6    * http://www.daml.org/legal/opensource/bbn_license.html
7    */
8    
9   package com.bbn.swede.core.libraries;
10  
11  import java.io.InputStream;
12  import java.io.Reader;
13  import java.util.HashMap;
14  import java.util.Map;
15  
16  import org.eclipse.core.resources.IContainer;
17  import org.eclipse.core.resources.IFile;
18  import org.eclipse.core.resources.IFileState;
19  import org.eclipse.core.resources.IMarker;
20  import org.eclipse.core.resources.IProject;
21  import org.eclipse.core.resources.IProjectDescription;
22  import org.eclipse.core.resources.IResource;
23  import org.eclipse.core.resources.IResourceProxyVisitor;
24  import org.eclipse.core.resources.IResourceVisitor;
25  import org.eclipse.core.resources.IWorkspace;
26  import org.eclipse.core.resources.ResourceAttributes;
27  import org.eclipse.core.resources.ResourcesPlugin;
28  import org.eclipse.core.runtime.CoreException;
29  import org.eclipse.core.runtime.IPath;
30  import org.eclipse.core.runtime.IProgressMonitor;
31  import org.eclipse.core.runtime.Path;
32  import org.eclipse.core.runtime.QualifiedName;
33  import org.eclipse.core.runtime.content.IContentDescription;
34  import org.eclipse.core.runtime.jobs.ISchedulingRule;
35  
36  import com.bbn.swede.core.IOWLDocument;
37  import com.bbn.swede.core.IOWLElement;
38  import com.bbn.swede.core.IOWLLibrary;
39  import com.bbn.swede.core.IOWLProject;
40  import com.bbn.swede.core.OWLCore;
41  import com.bbn.swede.core.OWLDocumentInfo;
42  import com.bbn.swede.core.resources.OWLElement;
43  import com.bbn.swede.core.resources.SWResourceManager;
44  import com.hp.hpl.jena.rdf.arp.MalformedURIException;
45  
46  /***
47   * Implementation of the IOWLDocument interface to allow SWeDE and 
48   * Eclipse into thinking that entries that exist only in a library 
49   * ZIP file are valid resources.  This involves some trickery, including 
50   * a reimplementation of Eclipse's IFile interface.
51   * 
52   * @author aperezlo
53   */
54  public class LibraryOWLDocument extends OWLElement implements IOWLDocument, ILibraryChangeListener
55  {
56     private OWLDocumentInfo _documentInfo;
57     private ILibraryEntryDescriptor _entryDescriptor;
58     private IOWLLibrary _parent;
59     private InternalIFileWrapper _iFile;
60     private String _entryName; 
61     private HashMap _codegenerationMap;
62     /***
63      * Create a new LibraryOWLDocument.
64      * 
65      * @param entry the entry that holds the file this IOWLDocument represents
66      * @param parent the parent in the resource tree 
67      */
68     public LibraryOWLDocument(ILibraryEntryDescriptor entry, IOWLLibrary parent)
69     {
70        _parent = parent;
71        _codegenerationMap = new HashMap();
72        _entryName = entry.getConfiguration().getName();
73        _entryDescriptor = _parent.getLibrary().getDescriptorFor(_entryName);
74     }
75     
76     /* (non-Javadoc)
77      * @see com.bbn.swede.core.libraries.ILibraryChangeListener#libraryChanged(
78      *    com.bbn.swede.core.libraries.LibraryChangeEvent)
79      */
80     public void libraryChanged(LibraryChangeEvent lce)
81     {
82  //      IPath path = new Path(Libraries.getLibraryTempLocationPath()); 
83  //      path = path.append(_entryName);
84  //      
85  //      if((lce.getType() & LibraryChangeEvent.CHANGED) == LibraryChangeEvent.CHANGED)
86  //      {
87  //         _entryDescriptor = _parent.getLibrary().getDescriptorFor(_entryName);
88  //         _iFile = new InternalIFileWrapper(ResourcesPlugin.getWorkspace().getRoot().getFile(path));
89  //      }
90     }   
91     
92     
93     /***
94      * Returns an IFile which is of the internal IFile implementation.
95      * 
96      * @see com.bbn.swede.core.IOWLDocument#getFile()
97      */
98     public IFile getFile()
99     {
100       IPath path = new Path(Libraries.getLibraryTempLocationPath()); 
101       path = path.append(_entryName);
102  
103       if(_iFile == null)
104       {
105          _iFile = new InternalIFileWrapper(ResourcesPlugin.getWorkspace().getRoot().getFile(path)); 
106       }
107 
108       return _iFile;
109    }
110 
111    /* (non-Javadoc)
112     * @see com.bbn.swede.core.IOWLElement#getURI()
113     */
114    public String getURI()
115    {
116       return ((LibraryEntryConfiguration) _entryDescriptor.getConfiguration()).getURI();
117    }
118 
119    
120    /***
121     * This operation is not allowed as these documents are read-only.
122     * If invoked, this method does nothing.
123     * 
124     * @see com.bbn.swede.core.IOWLDocument#setURI(java.lang.String)
125     */
126    public void setURI(String uri) throws MalformedURIException
127    {
128       
129    }
130 
131    /* (non-Javadoc)
132     * @see com.bbn.swede.core.IOWLDocument#getDocumentInfo()
133     */
134    public OWLDocumentInfo getDocumentInfo()
135    {
136       if(_documentInfo == null)
137       {
138          _documentInfo = SWResourceManager.createDocumentInfo(this);
139       }
140       return _documentInfo;
141    }
142    /***
143     * Returns <code>null</code> to indicate that code generators cannot be run
144     * against library entries.
145     * @param sGeneratorID The generator ID
146     * @return null
147     * 
148     * @see com.bbn.swede.core.IOWLDocument#getGeneratedCodeLocation(String)
149     */
150    public IPath getGeneratedCodeLocation(String sGeneratorID)
151    {
152       return (IPath) _codegenerationMap.get(sGeneratorID);
153    }
154    /***
155     * Returns <code>null</code> to indicate that code generators cannot be
156     * run against library entries.
157     * @return null.
158     * 
159     * @see com.bbn.swede.core.IOWLDocument#getGeneratedCodeMap()
160     */
161    public Map getGeneratedCodeMap()
162    {
163       return _codegenerationMap;
164    }
165    /***
166     * This method does nothing.
167     * 
168     * @see com.bbn.swede.core.IOWLDocument#setGeneratedCodeLocation(java.lang.String, org.eclipse.core.runtime.IPath)
169     */
170    public void setGeneratedCodeLocation(String sGeneratorID, IPath path)
171    {
172       _codegenerationMap.put(sGeneratorID, path);
173    }
174 
175    /***
176     * Returns <code>null</code> to indicate that library entries have no path.
177     * @return null.
178     * 
179     * @see com.bbn.swede.core.IOWLElement#getPath()
180     */
181    public IPath getPath()
182    {
183       return null;
184    }
185 
186    /* (non-Javadoc)
187     * @see com.bbn.swede.core.IOWLElement#getResource()
188     */
189    public IResource getResource()
190    {
191       return getFile();
192    }
193 
194    /* (non-Javadoc)
195     * @see com.bbn.swede.core.IOWLElement#getCorrespondingResource()
196     */
197    public IResource getCorrespondingResource()
198    {
199       return getFile();
200    }
201 
202    /* (non-Javadoc)
203     * @see com.bbn.swede.core.IOWLElement#getElementName()
204     */
205    public String getElementName()
206    {
207       return ((LibraryEntryConfiguration) _entryDescriptor.getConfiguration()).getName();
208    }
209 
210    /***
211     * Returns <code>true</code>, as library entries are always read-only.
212     * @return true
213     * @see com.bbn.swede.core.IOWLElement#isReadOnly()
214     */
215    public boolean isReadOnly()
216    {
217       return true;
218    }
219 
220    /* (non-Javadoc)
221     * @see com.bbn.swede.core.IOWLElement#getLocalURI()
222     */
223    public String getLocalURI()
224    {
225       return getURI();
226    }
227 
228    /* (non-Javadoc)
229     * @see com.bbn.swede.core.IOWLElement#contains(org.eclipse.core.resources.IResource)
230     */
231    public boolean contains(IResource resource)
232    {
233       boolean toReturn = false;
234       if(resource.equals(getFile()))
235       {
236          toReturn = true;
237       }
238       return toReturn;
239    }
240 
241    /* (non-Javadoc)
242     * @see com.bbn.swede.core.IOWLElement#getCorrespondingElement(org.eclipse.core.resources.IResource)
243     */
244    public IOWLElement getCorrespondingElement(IResource resource)
245    {
246       IOWLElement toReturn = null;
247       IFile res = null;
248       if(resource instanceof IFile)
249       {
250          res = (IFile) resource;
251          if(res.equals(getFile()))
252          {
253             toReturn = this;
254          }
255       }
256       return toReturn;
257    }
258    
259    private abstract class AbstractIFileWrapper implements IFile
260    {
261       protected IFile _delegate;
262 
263       public String getCharsetFor(Reader reader) throws CoreException
264       {
265          OWLCore.logWarning(OWLCore.PLUGIN_ID, "AbstractIFileWrapper: Called getCharsetFor()...", null);
266          return null;
267       }
268 
269       public ResourceAttributes getResourceAttributes()
270       {
271          OWLCore.logWarning(OWLCore.PLUGIN_ID, "AbstractIFileWrapper: Called getResourceAttributes()...", null);
272          return null;
273       }
274 
275       public void revertModificationStamp(long value) throws CoreException
276       {
277       }
278 
279       public void setResourceAttributes(ResourceAttributes attributes) throws CoreException
280       {
281       }
282 
283       
284       protected void setDelegate(IFile iFile)
285       {
286          _delegate = iFile;
287       }
288       /* (non-Javadoc)
289        * @see org.eclipse.core.resources.IResource#accept(
290        *    org.eclipse.core.resources.IResourceProxyVisitor, int)
291        */
292       public void accept(IResourceProxyVisitor visitor, int memberFlags)
293          throws CoreException
294       {
295          _delegate.accept(visitor, memberFlags);
296       }
297       /* (non-Javadoc)
298        * @see org.eclipse.core.resources.IResource#accept(org.eclipse.core.resources.IResourceVisitor)
299        */
300       public void accept(IResourceVisitor visitor) throws CoreException
301       {
302          _delegate.accept(visitor);
303       }
304       /* (non-Javadoc)
305        * @see org.eclipse.core.resources.IResource#accept(org.eclipse.core.resources.IResourceVisitor, int, boolean)
306        */
307       public void accept(IResourceVisitor visitor, int depth,
308          boolean includePhantoms) throws CoreException
309       {
310          _delegate.accept(visitor, depth, includePhantoms);
311       }
312       /* (non-Javadoc)
313        * @see org.eclipse.core.resources.IResource#accept(org.eclipse.core.resources.IResourceVisitor, int, int)
314        */
315       public void accept(IResourceVisitor visitor, int depth, int memberFlags)
316          throws CoreException
317       {
318          _delegate.accept(visitor, depth, memberFlags);
319       }
320       /* (non-Javadoc)
321        * @see org.eclipse.core.resources.IFile#appendContents(
322        *    java.io.InputStream, boolean, boolean, org.eclipse.core.runtime.IProgressMonitor)
323        */
324       public void appendContents(InputStream source, boolean force,
325          boolean keepHistory, IProgressMonitor monitor) throws CoreException
326       {
327          _delegate.appendContents(source, force, keepHistory, monitor);
328       }
329       /* (non-Javadoc)
330        * @see org.eclipse.core.resources.IFile#appendContents(
331        *    java.io.InputStream, int, org.eclipse.core.runtime.IProgressMonitor)
332        */
333       public void appendContents(InputStream source, int updateFlags,
334          IProgressMonitor monitor) throws CoreException
335       {
336          _delegate.appendContents(source, updateFlags, monitor);
337       }
338       /* (non-Javadoc)
339        * @see org.eclipse.core.resources.IResource#clearHistory(org.eclipse.core.runtime.IProgressMonitor)
340        */
341       public void clearHistory(IProgressMonitor monitor) throws CoreException
342       {
343          _delegate.clearHistory(monitor);
344       }
345       /* (non-Javadoc)
346        * @see org.eclipse.core.runtime.jobs.ISchedulingRule#contains(org.eclipse.core.runtime.jobs.ISchedulingRule)
347        */
348       public boolean contains(ISchedulingRule rule)
349       {
350          return _delegate.contains(rule);
351       }
352       /* (non-Javadoc)
353        * @see org.eclipse.core.resources.IResource#copy(
354        *    org.eclipse.core.resources.IProjectDescription, boolean, org.eclipse.core.runtime.IProgressMonitor)
355        */
356       public void copy(IProjectDescription description, boolean force,
357          IProgressMonitor monitor) throws CoreException
358       {
359          _delegate.copy(description, force, monitor);
360       }
361       /* (non-Javadoc)
362        * @see org.eclipse.core.resources.IResource#copy(
363        *    org.eclipse.core.resources.IProjectDescription,
364        *     int, org.eclipse.core.runtime.IProgressMonitor)
365        */
366       public void copy(IProjectDescription description, int updateFlags,
367          IProgressMonitor monitor) throws CoreException
368       {
369          _delegate.copy(description, updateFlags, monitor);
370       }
371       /* (non-Javadoc)
372        * @see org.eclipse.core.resources.IResource#copy(
373        *    org.eclipse.core.runtime.IPath, boolean, org.eclipse.core.runtime.IProgressMonitor)
374        */
375       public void copy(IPath destination, boolean force,
376          IProgressMonitor monitor) throws CoreException
377       {
378          _delegate.copy(destination, force, monitor);
379       }
380       /* (non-Javadoc)
381        * @see org.eclipse.core.resources.IResource#copy(
382        *    org.eclipse.core.runtime.IPath, int, org.eclipse.core.runtime.IProgressMonitor)
383        */
384       public void copy(IPath destination, int updateFlags,
385          IProgressMonitor monitor) throws CoreException
386       {
387          _delegate.copy(destination, updateFlags, monitor);
388       }
389       /* (non-Javadoc)
390        * @see org.eclipse.core.resources.IFile#create(
391        *    java.io.InputStream, boolean, org.eclipse.core.runtime.IProgressMonitor)
392        */
393       public void create(InputStream source, boolean force,
394          IProgressMonitor monitor) throws CoreException
395       {
396          _delegate.create(source, force, monitor);
397       }
398       /* (non-Javadoc)
399        * @see org.eclipse.core.resources.IFile#create(
400        *    java.io.InputStream, int, org.eclipse.core.runtime.IProgressMonitor)
401        */
402       public void create(InputStream source, int updateFlags,
403          IProgressMonitor monitor) throws CoreException
404       {
405          _delegate.create(source, updateFlags, monitor);
406       }
407       /* (non-Javadoc)
408        * @see org.eclipse.core.resources.IFile#createLink(
409        *    org.eclipse.core.runtime.IPath, int, org.eclipse.core.runtime.IProgressMonitor)
410        */
411       public void createLink(IPath localLocation, int updateFlags,
412          IProgressMonitor monitor) throws CoreException
413       {
414          _delegate.createLink(localLocation, updateFlags, monitor);
415       }
416       /* (non-Javadoc)
417        * @see org.eclipse.core.resources.IResource#createMarker(java.lang.String)
418        */
419       public IMarker createMarker(String type) throws CoreException
420       {
421          return _delegate.createMarker(type);
422       }
423       /* (non-Javadoc)
424        * @see org.eclipse.core.resources.IFile#delete(boolean, boolean, org.eclipse.core.runtime.IProgressMonitor)
425        */
426       public void delete(boolean force, boolean keepHistory,
427          IProgressMonitor monitor) throws CoreException
428       {
429          _delegate.delete(force, keepHistory, monitor);
430       }
431       /* (non-Javadoc)
432        * @see org.eclipse.core.resources.IResource#delete(boolean, org.eclipse.core.runtime.IProgressMonitor)
433        */
434       public void delete(boolean force, IProgressMonitor monitor)
435          throws CoreException
436       {
437          _delegate.delete(force, monitor);
438       }
439       /* (non-Javadoc)
440        * @see org.eclipse.core.resources.IResource#delete(int, org.eclipse.core.runtime.IProgressMonitor)
441        */
442       public void delete(int updateFlags, IProgressMonitor monitor)
443          throws CoreException
444       {
445          _delegate.delete(updateFlags, monitor);
446       }
447       /* (non-Javadoc)
448        * @see org.eclipse.core.resources.IResource#deleteMarkers(java.lang.String, boolean, int)
449        */
450       public void deleteMarkers(String type, boolean includeSubtypes, int depth)
451          throws CoreException
452       {
453          _delegate.deleteMarkers(type, includeSubtypes, depth);
454       }
455       /* (non-Javadoc)
456        * @see java.lang.Object#equals(java.lang.Object)
457        */
458       public boolean equals(Object arg0)
459       {
460          return _delegate.equals(arg0);
461       }
462       /* (non-Javadoc)
463        * @see org.eclipse.core.resources.IResource#exists()
464        */
465       public boolean exists()
466       {
467          return _delegate.exists();
468       }
469       /* (non-Javadoc)
470        * @see org.eclipse.core.resources.IResource#findMarker(long)
471        */
472       public IMarker findMarker(long id) throws CoreException
473       {
474          return _delegate.findMarker(id);
475       }
476       /* (non-Javadoc)
477        * @see org.eclipse.core.resources.IResource#findMarkers(java.lang.String, boolean, int)
478        */
479       public IMarker[] findMarkers(String type, boolean includeSubtypes,
480          int depth) throws CoreException
481       {
482          return _delegate.findMarkers(type, includeSubtypes, depth);
483       }
484       /* (non-Javadoc)
485        * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
486        */
487       public Object getAdapter(Class adapter)
488       {
489          return _delegate.getAdapter(adapter);
490       }
491       /* (non-Javadoc)
492        * @see org.eclipse.core.resources.IEncodedStorage#getCharset()
493        */
494       public String getCharset() throws CoreException
495       {
496          return _delegate.getCharset();
497       }
498       /* (non-Javadoc)
499        * @see org.eclipse.core.resources.IFile#getCharset(boolean)
500        */
501       public String getCharset(boolean checkImplicit) throws CoreException
502       {
503          return _delegate.getCharset(checkImplicit);
504       }
505       /* (non-Javadoc)
506        * @see org.eclipse.core.resources.IFile#getContentDescription()
507        */
508       public IContentDescription getContentDescription() throws CoreException
509       {
510          return _delegate.getContentDescription();
511       }
512       /* (non-Javadoc)
513        * @see org.eclipse.core.resources.IStorage#getContents()
514        */
515       public InputStream getContents() throws CoreException
516       {
517          return _delegate.getContents();
518       }
519       /* (non-Javadoc)
520        * @see org.eclipse.core.resources.IFile#getContents(boolean)
521        */
522       public InputStream getContents(boolean force) throws CoreException
523       {
524          return _delegate.getContents(force);
525       }
526       /* (non-Javadoc)
527        * @see org.eclipse.core.resources.IFile#getEncoding()
528        */
529       public int getEncoding() throws CoreException
530       {
531          return _delegate.getEncoding();
532       }
533       /* (non-Javadoc)
534        * @see org.eclipse.core.resources.IResource#getFileExtension()
535        */
536       public String getFileExtension()
537       {
538          return _delegate.getFileExtension();
539       }
540       /* (non-Javadoc)
541        * @see org.eclipse.core.resources.IStorage#getFullPath()
542        */
543       public IPath getFullPath()
544       {
545          return _delegate.getFullPath();
546       }
547       /* (non-Javadoc)
548        * @see org.eclipse.core.resources.IFile#getHistory(org.eclipse.core.runtime.IProgressMonitor)
549        */
550       public IFileState[] getHistory(IProgressMonitor monitor)
551          throws CoreException
552       {
553          return _delegate.getHistory(monitor);
554       }
555       /* (non-Javadoc)
556        * @see org.eclipse.core.resources.IResource#getLocalTimeStamp()
557        */
558       public long getLocalTimeStamp()
559       {
560          return _delegate.getLocalTimeStamp();
561       }
562       /* (non-Javadoc)
563        * @see org.eclipse.core.resources.IResource#getLocation()
564        */
565       public IPath getLocation()
566       {
567          return _delegate.getLocation();
568       }
569       /* (non-Javadoc)
570        * @see org.eclipse.core.resources.IResource#getMarker(long)
571        */
572       public IMarker getMarker(long id)
573       {
574          return _delegate.getMarker(id);
575       }
576       /* (non-Javadoc)
577        * @see org.eclipse.core.resources.IResource#getModificationStamp()
578        */
579       public long getModificationStamp()
580       {
581          return _delegate.getModificationStamp();
582       }
583       /* (non-Javadoc)
584        * @see org.eclipse.core.resources.IStorage#getName()
585        */
586       public String getName()
587       {
588          return _delegate.getName();
589       }
590       /* (non-Javadoc)
591        * @see org.eclipse.core.resources.IResource#getParent()
592        */
593       public IContainer getParent()
594       {
595          return _delegate.getParent();
596       }
597       /* (non-Javadoc)
598        * @see org.eclipse.core.resources.IResource#getPersistentProperty(
599        *    org.eclipse.core.runtime.QualifiedName)
600        */
601       public String getPersistentProperty(QualifiedName key)
602          throws CoreException
603       {
604          return null;
605       }
606       /* (non-Javadoc)
607        * @see org.eclipse.core.resources.IResource#getProject()
608        */
609       public IProject getProject()
610       {
611          return _delegate.getProject();
612       }
613       /* (non-Javadoc)
614        * @see org.eclipse.core.resources.IResource#getProjectRelativePath()
615        */
616       public IPath getProjectRelativePath()
617       {
618          return _delegate.getProjectRelativePath();
619       }
620       /* (non-Javadoc)
621        * @see org.eclipse.core.resources.IResource#getRawLocation()
622        */
623       public IPath getRawLocation()
624       {
625          return _delegate.getRawLocation();
626       }
627       /* (non-Javadoc)
628        * @see org.eclipse.core.resources.IResource#getSessionProperty(org.eclipse.core.runtime.QualifiedName)
629        */
630       public Object getSessionProperty(QualifiedName key) throws CoreException
631       {
632          return null;
633       }
634       /* (non-Javadoc)
635        * @see org.eclipse.core.resources.IResource#getType()
636        */
637       public int getType()
638       {
639          return _delegate.getType();
640       }
641       /* (non-Javadoc)
642        * @see org.eclipse.core.resources.IResource#getWorkspace()
643        */
644       public IWorkspace getWorkspace()
645       {
646          return _delegate.getWorkspace();
647       }
648       /* (non-Javadoc)
649        * @see java.lang.Object#hashCode()
650        */
651       public int hashCode()
652       {
653          return _delegate.hashCode();
654       }
655       /* (non-Javadoc)
656        * @see org.eclipse.core.resources.IResource#isAccessible()
657        */
658       public boolean isAccessible()
659       {
660          return _delegate.isAccessible();
661       }
662       /* (non-Javadoc)
663        * @see org.eclipse.core.runtime.jobs.ISchedulingRule#isConflicting(
664        *    org.eclipse.core.runtime.jobs.ISchedulingRule)
665        */
666       public boolean isConflicting(ISchedulingRule rule)
667       {
668          return _delegate.isConflicting(rule);
669       }
670       /* (non-Javadoc)
671        * @see org.eclipse.core.resources.IResource#isDerived()
672        */
673       public boolean isDerived()
674       {
675          return true;
676       }
677       /* (non-Javadoc)
678        * @see org.eclipse.core.resources.IResource#isLinked()
679        */
680       public boolean isLinked()
681       {
682          return _delegate.isLinked();
683       }
684       /* (non-Javadoc)
685        * @see org.eclipse.core.resources.IResource#isLocal(int)
686        */
687       public boolean isLocal(int depth)
688       {
689          return _delegate.isLocal(depth);
690       }
691       /* (non-Javadoc)
692        * @see org.eclipse.core.resources.IResource#isPhantom()
693        */
694       public boolean isPhantom()
695       {
696          return _delegate.isPhantom();
697       }
698       /* (non-Javadoc)
699        * @see org.eclipse.core.resources.IStorage#isReadOnly()
700        */
701       public boolean isReadOnly()
702       {
703          return _delegate.isReadOnly();
704       }
705       /* (non-Javadoc)
706        * @see org.eclipse.core.resources.IResource#isSynchronized(int)
707        */
708       public boolean isSynchronized(int depth)
709       {
710          return _delegate.isSynchronized(depth);
711       }
712       /* (non-Javadoc)
713        * @see org.eclipse.core.resources.IResource#isTeamPrivateMember()
714        */
715       public boolean isTeamPrivateMember()
716       {
717          return _delegate.isTeamPrivateMember();
718       }
719       /* (non-Javadoc)
720        * @see org.eclipse.core.resources.IResource#move(
721        *    org.eclipse.core.resources.IProjectDescription,
722        *    boolean, boolean, org.eclipse.core.runtime.IProgressMonitor)
723        */
724       public void move(IProjectDescription description, boolean force,
725          boolean keepHistory, IProgressMonitor monitor) throws CoreException
726       {
727          _delegate.move(description, force, keepHistory, monitor);
728       }
729       /* (non-Javadoc)
730        * @see org.eclipse.core.resources.IResource#move(
731        *    org.eclipse.core.resources.IProjectDescription,
732        *    int, org.eclipse.core.runtime.IProgressMonitor)
733        */
734       public void move(IProjectDescription description, int updateFlags,
735          IProgressMonitor monitor) throws CoreException
736       {
737          _delegate.move(description, updateFlags, monitor);
738       }
739       /* (non-Javadoc)
740        * @see org.eclipse.core.resources.IFile#move(
741        *    org.eclipse.core.runtime.IPath, boolean, boolean,
742        *    org.eclipse.core.runtime.IProgressMonitor)
743        */
744       public void move(IPath destination, boolean force, boolean keepHistory,
745          IProgressMonitor monitor) throws CoreException
746       {
747          _delegate.move(destination, force, keepHistory, monitor);
748       }
749       /* (non-Javadoc)
750        * @see org.eclipse.core.resources.IResource#move(
751        *    org.eclipse.core.runtime.IPath, boolean, org.eclipse.core.runtime.IProgressMonitor)
752        */
753       public void move(IPath destination, boolean force,
754          IProgressMonitor monitor) throws CoreException
755       {
756          _delegate.move(destination, force, monitor);
757       }
758       /* (non-Javadoc)
759        * @see org.eclipse.core.resources.IResource#move(
760        *    org.eclipse.core.runtime.IPath, int, org.eclipse.core.runtime.IProgressMonitor)
761        */
762       public void move(IPath destination, int updateFlags,
763          IProgressMonitor monitor) throws CoreException
764       {
765          _delegate.move(destination, updateFlags, monitor);
766       }
767       /* (non-Javadoc)
768        * @see org.eclipse.core.resources.IResource#refreshLocal(
769        *    int, org.eclipse.core.runtime.IProgressMonitor)
770        */
771       public void refreshLocal(int depth, IProgressMonitor monitor)
772          throws CoreException
773       {
774          _delegate.refreshLocal(depth, monitor);
775       }
776       /* (non-Javadoc)
777        * @see org.eclipse.core.resources.IFile#setCharset(java.lang.String)
778        */
779       public void setCharset(String newCharset) throws CoreException
780       {
781          _delegate.setCharset(newCharset);
782       }
783       /* (non-Javadoc)
784        * @see org.eclipse.core.resources.IFile#setCharset(
785        *    java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
786        */
787       public void setCharset(String newCharset, IProgressMonitor monitor)
788          throws CoreException
789       {
790          _delegate.setCharset(newCharset, monitor);
791       }
792       /* (non-Javadoc)
793        * @see org.eclipse.core.resources.IFile#setContents(
794        *    java.io.InputStream, boolean, boolean, org.eclipse.core.runtime.IProgressMonitor)
795        */
796       public void setContents(InputStream source, boolean force,
797          boolean keepHistory, IProgressMonitor monitor) throws CoreException
798       {
799          _delegate.setContents(source, force, keepHistory, monitor);
800       }
801       /* (non-Javadoc)
802        * @see org.eclipse.core.resources.IFile#setContents(
803        *    java.io.InputStream, int, org.eclipse.core.runtime.IProgressMonitor)
804        */
805       public void setContents(InputStream source, int updateFlags,
806          IProgressMonitor monitor) throws CoreException
807       {
808          _delegate.setContents(source, updateFlags, monitor);
809       }
810       /* (non-Javadoc)
811        * @see org.eclipse.core.resources.IFile#setContents(
812        *    org.eclipse.core.resources.IFileState, boolean,
813        *    boolean, org.eclipse.core.runtime.IProgressMonitor)
814        */
815       public void setContents(IFileState source, boolean force,
816          boolean keepHistory, IProgressMonitor monitor) throws CoreException
817       {
818          _delegate.setContents(source, force, keepHistory, monitor);
819       }
820       /* (non-Javadoc)
821        * @see org.eclipse.core.resources.IFile#setContents(
822        *    org.eclipse.core.resources.IFileState, int, org.eclipse.core.runtime.IProgressMonitor)
823        */
824       public void setContents(IFileState source, int updateFlags,
825          IProgressMonitor monitor) throws CoreException
826       {
827          _delegate.setContents(source, updateFlags, monitor);
828       }
829       /* (non-Javadoc)
830        * @see org.eclipse.core.resources.IResource#setDerived(boolean)
831        */
832       public void setDerived(boolean isDerived) throws CoreException
833       {
834          _delegate.setDerived(isDerived);
835       }
836       /* (non-Javadoc)
837        * @see org.eclipse.core.resources.IResource#setLocal(boolean, int, org.eclipse.core.runtime.IProgressMonitor)
838        */
839       public void setLocal(boolean flag, int depth, IProgressMonitor monitor)
840          throws CoreException
841       {
842          _delegate.setLocal(flag, depth, monitor);
843       }
844       /* (non-Javadoc)
845        * @see org.eclipse.core.resources.IResource#setLocalTimeStamp(long)
846        */
847       public long setLocalTimeStamp(long value) throws CoreException
848       {
849          return _delegate.setLocalTimeStamp(value);
850       }
851       /* (non-Javadoc)
852        * @see org.eclipse.core.resources.IResource#setPersistentProperty(
853        *    org.eclipse.core.runtime.QualifiedName, java.lang.String)
854        */
855       public void setPersistentProperty(QualifiedName key, String value)
856          throws CoreException
857       {
858          //_delegate.setPersistentProperty(key, value);
859       }
860       /* (non-Javadoc)
861        * @see org.eclipse.core.resources.IResource#setReadOnly(boolean)
862        */
863       public void setReadOnly(boolean readOnly)
864       {
865          _delegate.setReadOnly(readOnly);
866       }
867       /* (non-Javadoc)
868        * @see org.eclipse.core.resources.IResource#setSessionProperty(
869        *    org.eclipse.core.runtime.QualifiedName, java.lang.Object)
870        */
871       public void setSessionProperty(QualifiedName key, Object value)
872          throws CoreException
873       {
874          //_delegate.setSessionProperty(key, value);
875       }
876       /* (non-Javadoc)
877        * @see org.eclipse.core.resources.IResource#setTeamPrivateMember(boolean)
878        */
879       public void setTeamPrivateMember(boolean isTeamPrivate)
880          throws CoreException
881       {
882          _delegate.setTeamPrivateMember(isTeamPrivate);
883       }
884       /* (non-Javadoc)
885        * @see java.lang.Object#toString()
886        */
887       public String toString()
888       {
889          return _delegate.toString();
890       }
891       /* (non-Javadoc)
892        * @see org.eclipse.core.resources.IResource#touch(org.eclipse.core.runtime.IProgressMonitor)
893        */
894       public void touch(IProgressMonitor monitor) throws CoreException
895       {
896          _delegate.touch(monitor);
897       }
898    }
899    
900    private final class InternalIFileWrapper extends AbstractIFileWrapper
901    {
902       private InternalIFileWrapper(IFile toWrap)
903       {
904          setDelegate(toWrap);
905       }
906       
907       /* (non-Javadoc)
908        * @see org.eclipse.core.resources.IStorage#getContents()
909        */
910       public InputStream getContents() throws CoreException
911       {
912          if(_parent.getLibrary().isAvailable())
913          {
914             return _entryDescriptor.getFileInputStream();
915          }
916          else
917          {
918             return null;
919          }
920       }
921       
922       /* (non-Javadoc)
923        * @see java.lang.Object#equals(java.lang.Object)
924        */
925       public boolean equals(Object arg0)
926       {
927          boolean toReturn = false;
928          if(this == arg0)
929          {
930             toReturn = true;
931          }
932          else
933          {
934             toReturn = _delegate.equals(arg0); 
935          }
936    
937          return toReturn; 
938       }      
939          
940       /* (non-Javadoc)
941        * @see org.eclipse.core.resources.IResource#getProject()
942        */
943       public IProject getProject()
944       {
945 //       libraries live right under projects, so...
946          return ((IOWLProject)_parent.getParent()).getProject(); 
947       }
948       
949    }  // end InternalFileWrapper...
950    
951    
952 }