How to get an instance of the IWorkbenchPart? [message #275532] |
Tue, 09 November 2004 11:31 |
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 12:02 |
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 16:47 |
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 21:38 |
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 17:24 |
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.
>
>
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.03762 seconds