Issue
When I create new project, there're files that I have to add to project by click on link additional sources like below
And now I want to create a plugin that reads name of project that the active file is in the project additional sources How can I do that?
Solution
If anyone ever needed this, I found project like below:
IWorkbenchPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart();
IEditorPart editorPart = part.getSite().getWorkbenchWindow().getActivePage().getActiveEditor();
IFileEditorInput input = (IFileEditorInput) editorPart.getEditorInput();
IFile file = input.getFile();
IProject activeProject = file.getProject();
return activeProject.getName();
Answered By - Matin Parsapour
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.