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