[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [pde-dev] Path of a document.
|
Hello Spiros,
I had the same problem some time ago in my editor plugin. You have to
do the following:
--------------------------------------------------------------
public static String getCurrentFileRealPath(){
IWorkbenchWindow win = PlatformUI.getWorkbench
().getActiveWorkbenchWindow();
IWorkbenchPage page = win.getActivePage();
if (page != null) {
IEditorPart editor = page.getActiveEditor();
if (editor != null) {
IEditorInput input = editor.getEditorInput();
if (input instanceof IFileEditorInput) {
return ((IFileEditorInput)input).getFile
().getLocation().toOSString();
}
}
}
return null;
}
----------------------------------------------------------
I expect it will be useful for you. Regards,
Alberto Montes
Informatica de Euskadi
Bilbao, Spain
> Hi,
> I am writing an editor plugin and I want to access the full path of
the
> file that the user is currently editing (or the path of the project).
> How can I do this?
>
> Thanks.
> --Spiros
> _______________________________________________
> pde-dev mailing list
> pde-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/pde-dev
>