2  * Created on 06.09.2003
 
   4  * To change the template for this generated file go to
 
   5  * Window>Preferences>Java>Code Generation>Code and Comments
 
   7 package net.sourceforge.phpeclipse.builder;
 
   9 import org.eclipse.core.resources.IStorage;
 
  10 import org.eclipse.jface.resource.ImageDescriptor;
 
  11 import org.eclipse.ui.IEditorRegistry;
 
  12 import org.eclipse.ui.IPersistableElement;
 
  13 import org.eclipse.ui.IStorageEditorInput;
 
  14 import org.eclipse.ui.PlatformUI;
 
  17  * An EditorInput for an external file.
 
  19 public class ExternalEditorInput implements IStorageEditorInput {
 
  21          IStorage externalFile;
 
  24                 * Two ExternalEditorInputs are equal if their IStorage's are equal.
 
  25                 * @see java.lang.Object#equals(java.lang.Object)
 
  27          public boolean equals(Object obj) {
 
  30                         if (!(obj instanceof ExternalEditorInput))
 
  32                         ExternalEditorInput other = (ExternalEditorInput) obj;
 
  33                         return externalFile.equals(other.externalFile);
 
  37                 * @see IEditorInput#exists()
 
  39          public boolean exists() {
 
  40                         // External file can not be deleted
 
  45                 * @see IAdaptable#getAdapter(Class)
 
  47          public Object getAdapter(Class adapter) {
 
  52                 * @see IEditorInput#getContentType()
 
  54          public String getContentType() {
 
  55                         return externalFile.getFullPath().getFileExtension();
 
  59                 * @see IEditorInput#getFullPath()
 
  61          public String getFullPath() {
 
  62                         return externalFile.getFullPath().toString();
 
  66                 * @see IEditorInput#getImageDescriptor()
 
  68          public ImageDescriptor getImageDescriptor() {
 
  69                         IEditorRegistry registry = PlatformUI.getWorkbench().getEditorRegistry();
 
  70                         return registry.getImageDescriptor(externalFile.getFullPath().getFileExtension());
 
  74                 * @see IEditorInput#getName()
 
  76          public String getName() {
 
  77                         return externalFile.getName();
 
  81                 * @see IEditorInput#getPersistable()
 
  83          public IPersistableElement getPersistable() {
 
  88                 * see IStorageEditorInput#getStorage()
 
  90          public IStorage getStorage() {
 
  95                 * @see IEditorInput#getToolTipText()
 
  97          public String getToolTipText() {
 
  98                         return externalFile.getFullPath().toString();
 
 101          public ExternalEditorInput(IStorage exFile) {
 
 102                         externalFile = exFile;