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 public ISchedulingRule getSchedulingRule() { if (info.fElement instanceof IFileEditorInput) { IFile file= ((IFileEditorInput) info.fElement).getFile(); return computeSchedulingRule(file); } else 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; } };
public IProject getCommonProject() { for (Enumeration<Object> contexts = inputContexts.elements(); contexts.hasMoreElements();) { InputContext context = (InputContext) contexts.nextElement(); IEditorInput input = context.getInput(); if (input instanceof IFileEditorInput) return ((IFileEditorInput) input).getFile().getProject(); } return null; }
@Override public boolean isShownInEditor(Match match, IEditorPart editor) { IEditorInput ei= editor.getEditorInput(); if (ei instanceof IFileEditorInput) { IFileEditorInput fi= (IFileEditorInput) ei; return match.getElement().equals(fi.getFile()); } return false; }
public long getModificationStamp(Object element) { if (element instanceof IFileEditorInput) { IFileEditorInput input= (IFileEditorInput) element; return computeModificationStamp(input.getFile()); } return super.getModificationStamp(element); }
private IBaseModel createResourceModel(IFileEditorInput input) { IFile file = input.getFile(); WorkspaceFeatureModel model = new WorkspaceFeatureModel(file); model.load(); return model; }
public Match[] computeContainedMatches(AbstractTextSearchResult result, IEditorPart editor) { IEditorInput ei= editor.getEditorInput(); if (ei instanceof IFileEditorInput) { IFileEditorInput fi= (IFileEditorInput) ei; return getMatches(fi.getFile()); } return EMPTY_ARR; }
protected IProject getCurrentProject() { if (fEditor != null) { IEditorInput ei= fEditor.getEditorInput(); if (ei instanceof IFileEditorInput) { return ((IFileEditorInput) ei).getFile().getProject(); } } return null; }
public void selectionChanged(IWorkbenchPart part, ISelection selection) { if (part instanceof IEditorPart) { IEditorInput input = ((IEditorPart) part).getEditorInput(); if (input instanceof IFileEditorInput) reactOnSelection(new StructuredSelection( ((IFileEditorInput) input).getFile())); } else reactOnSelection(selection); } };
private IResource getEditorInputResource(ExecutionEvent event) { IWorkbenchPart activePart = HandlerUtil.getActivePart(event); if (!(activePart instanceof IEditorPart)) { return null; } IEditorInput input = ((IEditorPart)activePart).getEditorInput(); if (input instanceof IFileEditorInput) { return ((IFileEditorInput)input).getFile(); } return Adapters.adapt(input, IResource.class); }
public void setInput(IEditorInput iei ) { super.setInput(iei); setPartName( iei.getName()); setContentDescription(iei.getToolTipText()); if ( iei instanceof IFileEditorInput ) { IFileEditorInput in = (IFileEditorInput) iei; IProject project = in.getFile().getProject(); setPartName(project.getName()); } }
private void handleNew() { IFile file = ((IFileEditorInput) getPage().getPDEEditor().getEditorInput()).getFile(); final IProject project = file.getProject(); BusyIndicator.showWhile(pointTable.getTable().getDisplay(), () -> { NewExtensionPointWizard wizard = new NewExtensionPointWizard(project, (IPluginModelBase) getPage().getModel(), (ManifestEditor) getPage().getPDEEditor()); WizardDialog dialog = new WizardDialog(PDEPlugin.getActiveWorkbenchShell(), wizard); dialog.create(); SWTUtil.setDialogSize(dialog, 400, 450); dialog.open(); }); }