Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Open File... menu command - get path of opened file(To get the file opened by the File Dialog in Open File... menu command)
Open File... menu command - get path of opened file [message #496059] Sat, 07 November 2009 18:00 Go to next message
Abhinav Mishra is currently offline Abhinav MishraFriend
Messages: 10
Registered: November 2009
Junior Member
Hi,

I need to get the absolute path of the file which is opened by selecting through the File Open dialog via the menu command.

I am not able to get the same using the getEditorInput() function once it is loaded into the editor as this is a special file (.mdzip). Please find my related post reference for this as:
http://www.eclipse.org/forums/index.php?t=msg&goto=49549 2&S=9f327d5748b90cf305bfc6a31a16e637#msg_495492

So, I need to get file path information by hooking the Open File command somehow not from the editor. Is it possible to do the same. Any suggestions or other ways to achieve he same are always welcome.

Thanks in advance,
Abhinav

[Updated on: Sat, 07 November 2009 18:03]

Report message to a moderator

Re: Open File... menu command get path of file opened [message #496172 is a reply to message #496059] Mon, 09 November 2009 09:25 Go to previous messageGo to next message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
Registered: July 2009
Senior Member
Abhinav Mishra wrote:
> Hi,
>
> I need to get the absolute path of the file which is opened by
> selecting through the File Open dialog via the menu command.
>
> I am not able to get the same using the getEditorInput() function once
> it is loaded into the editor as this is a special file (.mdzip).
> Please find my related post rference for this as:
> http://www.eclipse.org/forums/index.php?t=msg&goto=49549 2&S=9f327d5748b90cf305bfc6a31a16e637#msg_495492
>
>
> So, I need to get file path information by hooking the Open File
> command somehow not from the editor. Is it possible to do the same.
> Any suggestions or other ways to achieve he same are always welcome.
Take a look at org.eclipse.ui.internal.ide.actions.OpenLocalFileAction.

Dani
>
> Thanks in advance,
> Abhinav
>
>
Re: Open File... menu command get path of file opened [message #496439 is a reply to message #496172] Tue, 10 November 2009 06:12 Go to previous messageGo to next message
Abhinav Mishra is currently offline Abhinav MishraFriend
Messages: 10
Registered: November 2009
Junior Member
hi Dani,

Thanks for the reply.

>Take a look at org.eclipse.ui.internal.ide.actions.OpenLocalFileAction.

As per I have seen this, OpenLocalFileAction is used to programatically open any file in the Editor. But in my case, I need to open the file via Eclipse menu File->Open and get the value of selected filepath from the filedialog.i.e. I need to listen somehow for this action command.

Re: Open File... menu command get path of file opened [message #496455 is a reply to message #496439] Tue, 10 November 2009 08:10 Go to previous messageGo to next message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
Registered: July 2009
Senior Member
Abhinav Mishra wrote:
> hi Dani,
>
> Thanks for the reply.
>
>> Take a look at org.eclipse.ui.internal.ide.actions.OpenLocalFileAction.
>
> As per I have seen this, OpenLocalFileAction is used to
> programatically open any file in the Editor. But in my case, I need to
> open the file via Eclipse menu File->Open and get the value of
> selected filepath from the filedialog.i.e. I need to listen somehow
> for this action command.
You need to provide your own action i.e. you can't modify or extend the
existing Open action.

Dani
>
>
Re: Open File... menu command get path of file opened [message #496474 is a reply to message #496455] Tue, 10 November 2009 09:10 Go to previous message
Abhinav Mishra is currently offline Abhinav MishraFriend
Messages: 10
Registered: November 2009
Junior Member
Hi Dani,

>You need to provide your own action i.e. you can't modify or >extend the existing Open action.

This is what I am doing right now. I've made a separate menu command like 'Open MDZIP File' and use this action.
This is working fine and I am able to get the filepath of MDZIP file.

But I need to do this without creating any new menu action i.e. existing Open File.. command.
Is it possible to do that way?
Previous Topic:Change cursor
Next Topic:Error decoration and custom overlay decoration
Goto Forum:
  


Current Time: Thu Apr 25 23:56:57 GMT 2024

Powered by FUDForum. Page generated in 0.04050 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top