1 11 package org.eclipse.jdt.internal.ui.javaeditor; 12 13 14 15 import org.eclipse.core.resources.IFile; 16 17 import org.eclipse.ui.part.FileEditorInput; 18 19 import org.eclipse.jdt.core.IClassFile; 20 import org.eclipse.jdt.core.JavaCore; 21 22 23 26 public class ExternalClassFileEditorInput extends FileEditorInput implements IClassFileEditorInput { 27 28 private IClassFile fClassFile; 29 30 ExternalClassFileEditorInput(IFile file) { 31 super(file); 32 refresh(); 33 } 34 35 38 public IClassFile getClassFile() { 39 return fClassFile; 40 } 41 42 45 public void refresh() { 46 Object element= JavaCore.create(getFile()); 47 if (element instanceof IClassFile) 48 fClassFile= (IClassFile) element; 49 } 50 51 54 public Object getAdapter(Class adapter) { 55 if (adapter == IClassFile.class) 56 return fClassFile; 57 return fClassFile.getAdapter(adapter); 58 } 59 60 } 61 | Popular Tags |