Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [e4-dev] Command handler and active dialog

Am 28.08.11 09:52, schrieb Thomas Kratz:
> HI again,
> 
> I don't know if this is e4 specific, but I'm having a hard time with a
> otherwise simple problem.
> 
> I want to access the active Dialog from a KeyBinding Handler.
> I found that the HandlerUtil.getActiveShell gives me always the parent
> (Workbench) Shell. Thats the same when I manually register my Dialigs
> Shell with the IContextService.registerShell. (Wondering why?, don't
> understand what I'm doing wrong here).
> 

Is the dialog a workbench-dialog or simply a subclass from JFace-Dialog
which you open in your custom code?

> But all in all I think this approach won't work anyway, as I need to get
> grasp of the DataBindingContext of the active Dialog (I have a generic
> base dialog that provides always a DataBindingContext), and as far as I
> can see I cannot get hold of the Dialog instance when looking at the
> Shell the the ExecutionEvent would hopefully present to me.

Well because you control the subclass you could push the value into
Shell#setData() :-)

> 
> What Do you think what be a clean way to get hold of the active Dialog
> in a command Handler in e4 style?

Well in e4 you could push the value in the IEclipseContext while the
dialog is open and which would make it subject of injection to all
command handlers @Execute but I guess you are singlesourcing for 3.x and
4.x, right?

Tom

-- 
B e s t S o l u t i o n . a t                        EDV Systemhaus GmbH
------------------------------------------------------------------------
tom schindl                 geschäftsführer/CEO
------------------------------------------------------------------------
eduard-bodem-gasse 5-7/1   A-6020 innsbruck     fax      ++43 512 935833
http://www.BestSolution.at                      phone    ++43 512 935834


Back to the top