1 19 20 21 package ca.mcgill.sable.soot.attributes; 22 23 import java.util.ArrayList ; 24 25 import org.eclipse.core.resources.*; 26 import org.eclipse.core.runtime.IAdaptable; 27 import org.eclipse.ui.IEditorInput; 28 import org.eclipse.ui.texteditor.*; 29 30 public class JimpleAttributesComputer extends AbstractAttributesComputer { 31 32 protected ArrayList computeNames(IFile file){ 33 return getNames(); 34 } 35 36 39 protected ArrayList computeNames(AbstractTextEditor editor) { 40 return getNames(); 41 } 42 43 private ArrayList getNames(){ 44 ArrayList names = new ArrayList (); 45 names.add(fileToNoExt(getRec().getName())); 46 return names; 47 } 48 49 52 protected void init(AbstractTextEditor editor) { 53 setRec(getResource(editor)); 54 setProj(getRec().getProject()); 55 56 } 57 58 public IResource getResource(AbstractTextEditor textEditor) { 59 IEditorInput input= textEditor.getEditorInput(); 60 return (IResource) ((IAdaptable) input).getAdapter(IResource.class); 61 } 62 63 public String fileToNoExt(String filename) { 64 return filename.substring(0, filename.lastIndexOf('.')); 65 } 66 67 68 69 70 } 71 | Popular Tags |