Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » How accessing file complete location ?(Is it possible ?)
How accessing file complete location ? [message #868784] Wed, 02 May 2012 14:36 Go to next message
Florian Yger is currently offline Florian YgerFriend
Messages: 5
Registered: May 2012
Junior Member
Hello,

I'm new on Xtext !

I would like to know how accessing to complete location of current edited file ?

"C:\ ...... \currentfile.mydsl"

Actually, i have added a button to the eclipse toolbar, and with this code, i have only "\project\currentfile.mydsl" :

public class DGSMenuHandler extends AbstractHandler {

	public Object execute(ExecutionEvent event) throws ExecutionException {
		IEditorPart activeEditor = HandlerUtil.getActiveEditor(event);
  
                File file = (File) 
                       activeEditor.getEditorInput().getAdapter(IFile.class); 
 
		System.out.println(file.getPath());
		return null;
	}
}


Thanks in advance !
Re: How accessing file complete location ? [message #868815 is a reply to message #868784] Wed, 02 May 2012 15:21 Go to previous messageGo to next message
Henrik Lindberg is currently offline Henrik LindbergFriend
Messages: 2509
Registered: July 2009
Senior Member
Did you try "google" :P

http://stackoverflow.com/questions/299619/get-the-absolute-path-of-the-currently-edited-file-in-eclipse

- henrik

On 2012-02-05 16:36, Florian Yger wrote:
> Hello,
>
> I'm new on Xtext !
>
> I would like to know how accessing to complete location of current
> edited file ?
>
> "C:\ ...... \currentfile.mydsl"
>
> Actually, i have added a button to the eclipse toolbar, and with this
> code, i have only "\project\currentfile.mydsl" :
>
> public class DGSMenuHandler extends AbstractHandler {
>
> public Object execute(ExecutionEvent event) throws ExecutionException {
> IEditorPart activeEditor = HandlerUtil.getActiveEditor(event);
>
> File file = (File) activeEditor.getEditorInput().getAdapter(IFile.class);
> System.out.println(file.getPath());
> return null;
> }
> }
>
> Thanks in advance !
Re: How accessing file complete location ? [message #868852 is a reply to message #868815] Wed, 02 May 2012 16:24 Go to previous message
Florian Yger is currently offline Florian YgerFriend
Messages: 5
Registered: May 2012
Junior Member
Thank you !
Previous Topic:Confused about the map function
Next Topic:trying to understand jvmInferer and JvmModelAssociator.getLogicalContainer
Goto Forum:
  


Current Time: Sat Jul 11 03:34:43 GMT 2020

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

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

Back to the top