1 package net.sourceforge.phpeclipse.builder;
3 import org.eclipse.core.resources.IStorage;
4 import org.eclipse.jface.resource.ImageDescriptor;
5 import org.eclipse.ui.IEditorRegistry;
6 import org.eclipse.ui.IPersistableElement;
7 import org.eclipse.ui.IStorageEditorInput;
8 import org.eclipse.ui.PlatformUI;
11 * An EditorInput for an external file.
13 public class ExternalEditorInput implements IStorageEditorInput {
15 IStorage externalFile;
18 * Two ExternalEditorInputs are equal if their IStorage's are equal.
20 * @see java.lang.Object#equals(java.lang.Object)
22 public boolean equals(Object obj) {
25 if (!(obj instanceof ExternalEditorInput))
27 ExternalEditorInput other = (ExternalEditorInput) obj;
28 return externalFile.equals(other.externalFile);
32 * @see IEditorInput#exists()
34 public boolean exists() {
35 // External file can not be deleted
40 * @see IAdaptable#getAdapter(Class)
42 public Object getAdapter(Class adapter) {
47 * @see IEditorInput#getContentType()
49 public String getContentType() {
50 return externalFile.getFullPath().getFileExtension();
54 * @see IEditorInput#getFullPath()
56 public String getFullPath() {
57 return externalFile.getFullPath().toString();
61 * @see IEditorInput#getImageDescriptor()
63 public ImageDescriptor getImageDescriptor() {
64 IEditorRegistry registry = PlatformUI.getWorkbench()
66 return registry.getImageDescriptor(externalFile.getFullPath()
71 * @see IEditorInput#getName()
73 public String getName() {
74 return externalFile.getName();
78 * @see IEditorInput#getPersistable()
80 public IPersistableElement getPersistable() {
85 * see IStorageEditorInput#getStorage()
87 public IStorage getStorage() {
92 * @see IEditorInput#getToolTipText()
94 public String getToolTipText() {
95 return externalFile.getFullPath().toString();
98 public ExternalEditorInput(IStorage exFile) {
99 externalFile = exFile;