IEditorPart editorPart = getSite().getWorkbenchWindow().getActivePage().getActiveEditor(); if(editorPart != null) { IFileEditorInput input = (IFileEditorInput)editorPart.getEditorInput() ; IFile file = input.getFile(); IProject activeProject = file.getProject(); String activeProjectName = activeProject.getName(); //... use activeProjectName }
@Override protected ITextEditor run() throws Exception { IWorkbenchWindow activeWorkbenchWindow = workbench.getActiveWorkbenchWindow(); IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage(); IEditorPart editor = activePage.findEditor(fileEditorInput); if (editor instanceof ITextEditor) { if (editor instanceof ITextEditorExtension && ((ITextEditorExtension) editor).isEditorInputReadOnly()) status.add(ERROR, "Editor for {0} is read only", fileEditorInput.getName()); return ((ITextEditor) editor); } return null; } }.syncExec();
@Override public ISchedulingRule getSchedulingRule() { if (info.fElement instanceof IFileEditorInput) { IFile file= ((IFileEditorInput) info.fElement).getFile(); return computeSchedulingRule(file); } else return null; } };
/** * Obtains the {@link IFile} from the input {@link IEditorInput}. * * @param editorInput * {@link IEditorInput}. * @return {@link IFile} for the input {@link IEditorInput}. */ public static IFile getFile(IEditorInput editorInput) { return ((IFileEditorInput) editorInput).getFile(); }
public ISchedulingRule getSchedulingRule() { if (info.fElement instanceof IFileEditorInput) { IFile file= ((IFileEditorInput) info.fElement).getFile(); return computeSchedulingRule(file); } else return null; } };
@Override public ISchedulingRule getSchedulingRule() { if (info.fElement instanceof IFileEditorInput) { IFile file= ((IFileEditorInput) info.fElement).getFile(); return computeSchedulingRule(file); } else return null; } };
/** * Returns the file wrapped by the file editor input. * * @return the file wrapped by the editor input associated with that synchronizer */ protected IFile getFile() { return fFileEditorInput.getFile(); }
public IFile getFile() { if (fEditorInput instanceof IFileEditorInput) { return ((IFileEditorInput) fEditorInput).getFile(); } return null; } }
/** * Returns the file wrapped by the file editor input. * * @return the file wrapped by the editor input associated with that synchronizer */ protected IFile getFile() { return fFileEditorInput.getFile(); }
@Override public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) { if (IFile.class.equals(adapterType)) { return adapterType.cast(((IFileEditorInput) adaptableObject).getFile()); } if (IResource.class.equals(adapterType)) { return adapterType.cast(((IFileEditorInput) adaptableObject).getFile()); } return null; }
public ISchedulingRule getSchedulingRule() { if (info.fElement instanceof IFileEditorInput) { IFileEditorInput input= (IFileEditorInput) info.fElement; return fResourceRuleFactory.refreshRule((input).getFile()); } return null; } };
public IFile getFile() { IEditorInput editorInput = getEditorInput(); if (editorInput instanceof IFileEditorInput) { IFileEditorInput fileEditorInput = (IFileEditorInput) editorInput; return fileEditorInput.getFile(); } return null; }
@Override protected ISchedulingRule getResetRule(Object element) { if (element instanceof IFileEditorInput) { IFileEditorInput input= (IFileEditorInput) element; return fResourceRuleFactory.refreshRule(input.getFile()); } return null; }
protected IResource getResource() { IResource resource = null; IEditorInput editorInput = fTextEditor.getEditorInput(); if (editorInput instanceof IFileEditorInput) { resource = ((IFileEditorInput) editorInput).getFile(); } return resource; }
private IProject getCurrentProject(IEditorInput input) { IProject curProject = null; IFile inputFile = null; if (input instanceof IFileEditorInput) { inputFile = ((IFileEditorInput) input).getFile(); curProject = inputFile.getProject(); } return curProject; }
protected ISchedulingRule getValidateStateRule(Object element) { if (element instanceof IFileEditorInput) { IFileEditorInput input= (IFileEditorInput) element; return fResourceRuleFactory.validateEditRule(new IResource[] { input.getFile() }); } return null; }
public ISchedulingRule getSchedulingRule() { if (info.fElement instanceof IFileEditorInput) { IFileEditorInput input= (IFileEditorInput) info.fElement; return fResourceRuleFactory.validateEditRule(new IResource[] { input.getFile() }); } return null; } };
public ISchedulingRule getSchedulingRule() { if (info.fElement instanceof IFileEditorInput) { IFileEditorInput input= (IFileEditorInput) info.fElement; return fResourceRuleFactory.refreshRule(input.getFile()); } return null; } };
/** * Returns the element contained in the EditorInput * @param input the editor input * @return the input element */ Object getElementOfInput(IEditorInput input) { if (input instanceof IFileEditorInput) return ((IFileEditorInput)input).getFile(); if (input != null) return JavaUI.getEditorInputJavaElement(input); return null; }
private IFile getFile() { if (fEditor != null) { IEditorInput ei= fEditor.getEditorInput(); if (ei instanceof IFileEditorInput) { return ((IFileEditorInput) ei).getFile(); } } return null; }