anon
anon

Reputation:

JFace: How to get caller of Action#run()?

I have a ContentProvider for a Tree view. There I add some actions that can be performed on an item of the tree. The method looks like this:

private void makeActions() {
   action1 = new Action() {

   @Override
   public void runWithEvent(Event event) {
      System.out.println(event);
      System.out.println(event.data.getClass());
      //How can I find the caller of runWithEvent?          
   }    
};

How can I find the object of the tree that has caused the call of Action#runWithEvent?

Upvotes: 0

Views: 153

Answers (1)

Tonny Madsen
Tonny Madsen

Reputation: 12718

Consider using the new Command API instead of the older Action API. In the new API, you can easily access the relevant information in the handler for the command.

Upvotes: 3

Related Questions