Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » How to get the ICompilationUnit
How to get the ICompilationUnit [message #650348] Mon, 24 January 2011 14:11 Go to next message
Pfeiffy  is currently offline Pfeiffy Friend
Messages: 1
Registered: January 2011
Junior Member
Hello,
Crying or Very Sad Crying or Very Sad
for an Eclipse-Plugin I need the ICompilation in an ExecutionEvent, how ca I get that?
The event will start with the context-menue in an java-editor.
public Object execute(ExecutionEvent event) throws ExecutionException {

ICompilationUnit icm = ????????;




Can somebody help me???

Pfeiffy
Re: How to get the ICompilationUnit [message #650403 is a reply to message #650348] Mon, 24 January 2011 17:49 Go to previous messageGo to next message
Deepak Azad is currently offline Deepak AzadFriend
Messages: 543
Registered: July 2009
Senior Member
On 1/24/2011 7:41 PM, Pfeiffy wrote:
> Hello,
> :cry: :cry: for an Eclipse-Plugin I need the ICompilation in an
> ExecutionEvent, how ca I get that?
> The event will start with the context-menue in an java-editor.
>
> public Object execute(ExecutionEvent event) throws ExecutionException {
>
> ICompilationUnit icm = ????????;
>
>
>
>
> Can somebody help me???
>
> Pfeiffy
>
You would probably first need to get a IJavaProject. Once you have that
you can use org.eclipse.jdt.core.IJavaProject.findElement(IPath).
Re: How to get the ICompilationUnit [message #650420 is a reply to message #650348] Mon, 24 January 2011 19:01 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

HandlerUtil can get the current selection (if you're in a handler and
have the ExecutionEvent).

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Platform_Expression_Framework
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Previous Topic:Debug memory in Java
Next Topic:iGesture compilation error
Goto Forum:
  


Current Time: Fri Apr 19 02:04:51 GMT 2024

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

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

Back to the top