Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » How to get an instance of the IWorkbenchPart?
How to get an instance of the IWorkbenchPart? [message #275532] Tue, 09 November 2004 06:31 Go to next message
Eclipse User
Originally posted by: pimenta.inatel.br

Hi.

I'm developing my plugin and now I'm codifying a concrete class
derived from an AbstractJavaLaunchConfigurationDelegate.

In a new method of such concrete class, I need the instance of the
IWorkbenchPart.

How can I get this instance??


Some time ago I worked with an IObjectActionDelegate and then it was easy
to get the WorkbenchPart, because such class has the method
setActivePart(IAction action, IWorkbenchPart targetPart) and a just had to
get thetargetPart.

Any hint will be very helpful.

Thanks.
Rodrigo Pimenta.
Re: How to get an instance of the IWorkbenchPart? [message #275534 is a reply to message #275532] Tue, 09 November 2004 07:02 Go to previous messageGo to next message
Eclipse User
Originally posted by: brendan.moorehead.gmail.com

PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage().getActivePart();
this will return current IWorkbenchPart



Rodrigo Pimenta Carvalho wrote:

> Hi.

> I'm developing my plugin and now I'm codifying a concrete class
> derived from an AbstractJavaLaunchConfigurationDelegate.

> In a new method of such concrete class, I need the instance of the
> IWorkbenchPart.

> How can I get this instance??


> Some time ago I worked with an IObjectActionDelegate and then it was easy
> to get the WorkbenchPart, because such class has the method
> setActivePart(IAction action, IWorkbenchPart targetPart) and a just had to
> get thetargetPart.

> Any hint will be very helpful.

> Thanks.
> Rodrigo Pimenta.
Re: How to get an instance of the IWorkbenchPart? [message #275591 is a reply to message #275534] Tue, 09 November 2004 11:47 Go to previous messageGo to next message
Eclipse User
Originally posted by: pimenta.inatel.br

Ok. Thanks.
But, I tried it and got a Exception.
What could be wrong?
Hugs.
Rodrigo.

Brendan Moorehead wrote:

>
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage().getActivePart();
> this will return current IWorkbenchPart



> Rodrigo Pimenta Carvalho wrote:

>> Hi.

>> I'm developing my plugin and now I'm codifying a concrete class
>> derived from an AbstractJavaLaunchConfigurationDelegate.

>> In a new method of such concrete class, I need the instance of the
>> IWorkbenchPart.

>> How can I get this instance??


>> Some time ago I worked with an IObjectActionDelegate and then it was easy
>> to get the WorkbenchPart, because such class has the method
>> setActivePart(IAction action, IWorkbenchPart targetPart) and a just had to
>> get thetargetPart.

>> Any hint will be very helpful.

>> Thanks.
>> Rodrigo Pimenta.
Re: How to get an instance of the IWorkbenchPart? [message #275605 is a reply to message #275534] Tue, 09 November 2004 16:38 Go to previous messageGo to next message
Eclipse User
Originally posted by: Chris_Laffra.ca.ibm.com

See also: http://www.eclipsefaq.org/chris/faq/html/faq167.html

Chris

"Brendan Moorehead" <brendan.moorehead@gmail.com> wrote in message
news:cmqbku$vd2$1@eclipse.org...
>
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage().getActi
vePart();
> this will return current IWorkbenchPart
>
>
>
> Rodrigo Pimenta Carvalho wrote:
>
> > Hi.
>
> > I'm developing my plugin and now I'm codifying a concrete class
> > derived from an AbstractJavaLaunchConfigurationDelegate.
>
> > In a new method of such concrete class, I need the instance of the
> > IWorkbenchPart.
>
> > How can I get this instance??
>
>
> > Some time ago I worked with an IObjectActionDelegate and then it was
easy
> > to get the WorkbenchPart, because such class has the method
> > setActivePart(IAction action, IWorkbenchPart targetPart) and a just had
to
> > get thetargetPart.
>
> > Any hint will be very helpful.
>
> > Thanks.
> > Rodrigo Pimenta.
>
>
Re: How to get an instance of the IWorkbenchPart? [message #275814 is a reply to message #275591] Fri, 12 November 2004 12:24 Go to previous messageGo to next message
Eclipse User
Originally posted by: kim_horne.ca.ibm.com

What exception did you get?

Also note that this call must be done from the UI thread. If you're
making this call from a non-UI thread you'll need to do an (a)syncExec
on the display returned by PlatformUI.getWorkbench().getDisplay().

Rodrigo Pimenta wrote:

>
> Ok. Thanks.
> But, I tried it and got a Exception.
> What could be wrong?
> Hugs.
> Rodrigo.
>
> Brendan Moorehead wrote:
>
>>
> PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage().getActivePart();
>
>
>> this will return current IWorkbenchPart
>
>
>
>
>> Rodrigo Pimenta Carvalho wrote:
>
>
>>> Hi.
>
>
>>> I'm developing my plugin and now I'm codifying a concrete class
>>> derived from an AbstractJavaLaunchConfigurationDelegate.
>
>
>>> In a new method of such concrete class, I need the instance of the
>>> IWorkbenchPart.
>
>
>>> How can I get this instance??
>
>
>
>>> Some time ago I worked with an IObjectActionDelegate and then it was
>>> easy to get the WorkbenchPart, because such class has the method
>>> setActivePart(IAction action, IWorkbenchPart targetPart) and a just
>>> had to get thetargetPart.
>
>
>>> Any hint will be very helpful.
>
>
>>> Thanks.
>>> Rodrigo Pimenta.
>
>
>
icon12.gif  Re: How to get an instance of the IWorkbenchPart? [message #698842 is a reply to message #275814] Wed, 20 July 2011 07:11 Go to previous message
Abdul Rehman Shaik is currently offline Abdul Rehman Shaik
Messages: 4
Registered: July 2011
Junior Member
Thanks a lot for the shortcut, really helped me Razz
Previous Topic:Find the Configuration directory
Next Topic:[solved] popupMenus on IMarker
Goto Forum:
  


Current Time: Fri Jul 25 14:21:53 EDT 2014

Powered by FUDForum. Page generated in 0.02459 seconds