private String getFileLocation() { IEditorInput editorInput = getEditorInput(); if (!(editorInput instanceof IFileEditorInput)) return null; IFileEditorInput fileEditorInput = (IFileEditorInput) editorInput; IFile currFile = fileEditorInput.getFile(); return currFile.getLocation().toOSString(); }
private IFile getFile() { IEditorInput editorInput = getEditorInput(); if (!(editorInput instanceof IFileEditorInput)) return null; IFileEditorInput fileEditorInput = (IFileEditorInput) editorInput; IFile currFile = fileEditorInput.getFile(); return currFile; }
private static IEditorInput convertFileInput(IFileEditorInput input) { IFileEditorInput fi = (IFileEditorInput) input; IFile f = fi.getFile(); if (f != null && !f.isSynchronized(IResource.DEPTH_INFINITE)) { try { f.refreshLocal(IResource.DEPTH_INFINITE, null); } catch (CoreException e) { // ignore } } XModelObject o = EclipseResourceUtil.getObjectByResource(f); if (o == null) { o = EclipseResourceUtil.createObjectForResource(f); } return (o == null || o.getFileType() != XModelObject.FILE) ? input : new XModelObjectEditorInput(getMainObject(o)); }
public IFile getCurrentJavaFile() throws IOException { IEditorInput ei = getEditorInput(); if (!(ei instanceof IFileEditorInput)) throw new IOException("IFileEditorInput expected"); IFileEditorInput fei = (IFileEditorInput) ei; return fei.getFile(); }
protected void createResourceContexts(InputContextManager manager, IFileEditorInput input) { manager.putContext(input, new CategoryInputContext(this, input, true)); manager.monitorFile(input.getFile()); }