Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » How to pass Keyboard Events to the MPart?
How to pass Keyboard Events to the MPart? [message #986381] Tue, 20 November 2012 04:58 Go to previous message
Alex Kipling is currently offline Alex Kipling
Messages: 211
Registered: July 2012
Senior Member
I have the following situation:

Situation:
In my application I need to redirect the keyboard events to the active part,
so that the content inside the acive MPart can handle the events.


What did I try:
What I wanted to do was monitoring the active Part:

//Monitoring the active part.
class Delegator{
 MPart activePart;

 public Delegator{
  this.addListener(SWT.KeyDown, new Listener{
    //pass the Keyboard Events to the activePart here
    activePart.getListeners.PASS_EVENTS_HERE
  });

}

@Inject
    private void getActivePart(@Named(IServiceConstants.ACTIVE_PART) MPart part) {
        if (part != null) {
            activePart = part;
        }
    }


Inside of the MParts-Contributions i would like to listen for the Events, which will be passed to the MPart (when the MPart is active) from the Delegator.class:
class PartContribution{

 //the part which the PartContribution is in will be injected here
 @Inject
 MPart part;

 public PartContribution{
   //Listen to the events, passed to the active part.
   part.addListener...
 }

}



Problem:
Now the problem is, that the MPart can not have any Listeners registered to it,
so I have no Idea how to pass the events to the acive part and read it from there.
The SWT Widget doesn't exist yet, when I am creating the listeners.

Question:
Is there some functionality, which would allow to pass KeyBoardEvents to a MParts?

[Updated on: Tue, 20 November 2012 07:35]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic:How to execute a Handler by id?
Next Topic:Difference between org. .. .observable and org. .. .observable.source
Goto Forum:
  


Current Time: Sun May 19 03:13:32 EDT 2013

Powered by FUDForum. Page generated in 0.01625 seconds