I need the handle to the currently active file or the file name which is currently clicked in eclipse navigator or package explorer
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Prasanna_Kumar
Posted On:   Wednesday, November 8, 2006 09:20 AM

have one requirement. An Eclipse plug-in that reads specific XML files and generates respective java files.Plug-in is created and file name is hard coded now. Only for xml files a new item in context menu will appear as “Generate”. What I need to do is if I right click on any xml file in eclipse explorer, the file that was clicked needs to be parsed and a java file should be created with the same file name as the clicked xml file. So I need the handle to the currently active file or the file name which is currently clicked in eclipse navigator or package explorer How to get the active file name or the currently working file? If I use the following code and run my plug-in in run-t   More>>

have one requirement. An Eclipse plug-in that reads specific XML files and generates respective java files.Plug-in is created and file name is hard coded now. Only for xml files a new item in context menu will appear as “Generate”.


What I need to do is if I right click on any xml file in eclipse explorer, the file that was clicked needs to be parsed and a java file should be created with the same file name as the clicked xml file.



So I need the handle to the currently active file or the file name which is currently clicked in eclipse navigator or package explorer




How to get the active file name or the currently working file?


If I use the following code and run my plug-in in run-time workbench,


Workspace workspace = (Workspace)ResourcesPlugin.getWorkspace();


IWorkspaceRoot myWorkspaceRoot = ResourcesPlugin.getWorkspace().getRoot();


I cannot get the correct workspace location


If I use this code,

IPath path = Platform.getLocation();


I can get only the workspace name and cannot traverse after that.

   <<Less
About | Sitemap | Contact