In what resource my action is being invoked ? [message #526] |
Mon, 21 April 2003 04:34 |
Eclipse User |
|
|
|
Originally posted by: nospam_danilo.floripa.com.br
Hi,
I have in my project a action invoked using the context menu in a
project file.
How I can know what is this file ? How I can get the IResource
interface for this file ?
Danilo.
|
|
|
Re: In what resource my action is being invoked ? [message #7715 is a reply to message #526] |
Wed, 23 April 2003 20:20 |
Eclipse User |
|
|
|
Originally posted by: John_Arthorne.oti.com_
Your action should implement IActionDelegate, which is notified of the
selection via the method selectionChanged. To extract a resource from a
selection, you'll need to cast the selection to IStructuredSelection,
and then extract the resources using the iterator, toList, or toArray
method on IStructuredSelection.
--
|
|
|
Re: In what resource my action is being invoked ? [message #7938 is a reply to message #7715] |
Wed, 23 April 2003 23:54 |
Eclipse User |
|
|
|
Originally posted by: nospam_danilo.floripa.com.br
On Wed, 23 Apr 2003 16:20:08 -0400, John Arthorne
<John_Arthorne@oti.com_> wrote:
>Your action should implement IActionDelegate, which is notified of the
>selection via the method selectionChanged. To extract a resource from a
>selection, you'll need to cast the selection to IStructuredSelection,
>and then extract the resources using the iterator, toList, or toArray
>method on IStructuredSelection.
Thanks John, I already something like this. It is working now.
But I have another question to you. This is the same question on the
first message of this newsgroup.
How to programatically call an action ? Your answer was to call the
run method of the action.
But what if the action use methods like selectionChanged to get
informations.
So to it work is not only create the action class and call run, but
call the right methods to simulate a IDE call.
In my case I want to call the refresh popup menu option. How I can
do it ?
Danilo.
|
|
|
Re: In what resource my action is being invoked ? [message #10716 is a reply to message #7938] |
Thu, 24 April 2003 14:46 |
Eclipse User |
|
|
|
Originally posted by: John_Arthorne.oti.com_
Typically you don't call actions directly like this. Instead you could
call the underlying core methods that the UI action is calling. For
example, the refresh UI action is probably just calling
IResource.refreshLocal on the selected resources. If you wanted to call
the action directly, you'll probably need to call selectionChanged()
followed by run().
--
Danilo Luiz Rheinheimer wrote:
> How to programatically call an action ? Your answer was to call the
> run method of the action.
> But what if the action use methods like selectionChanged to get
> informations.
> So to it work is not only create the action class and call run, but
> call the right methods to simulate a IDE call.
> In my case I want to call the refresh popup menu option. How I can
> do it ?
|
|
|
Powered by
FUDForum. Page generated in 0.02666 seconds