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

HI again,

I already thought of the Display variant, but as Tom proposed I thought I could go an e4 way of making the bindingContext of my Dialogs visible to the Command Handler. But maybe taking the Shell.setData way is truly easy to go. Although I would prefer a generic approach. Unfortunatley the DataBindingContext is a very local thing but its the only bridge between my UI and the Domain model.

If you're interested in what I'm doing you may read. It's already working for my Parts.
http://www.thomaskratz.name/?p=221

So long
Thomas



2011/8/30 Eric Moffatt <emoffatt@xxxxxxxxxx>

Thomas...I'm not really clear how we currently handle all the cases but here are a few ideas...

From the SWT side Dialogs are created as children of their ancestor shell (i.e. the 'getParent' of a dialog will return its ancestor, not null). A dialog that just wants to open a 'child' just uses itself as the parent, if not (say its a Job in the background) then Display has a 'getActiveShell' which could be used. Note that if they aren't modal then they could all just be children of the main shell...

I'm pretty sure that 'modality' is inherited in SWT; a Dialog created from a model Dialog must itself be modal...

Hope this helps,
Eric


From:
Thomas Kratz <eiswind@xxxxxxxxxxxxxx>
To: E4 Project developer mailing list <e4-dev@xxxxxxxxxxx>
Date: 08/30/2011 10:05 AM
Subject: Re: [e4-dev] Command handler and active dialog
Sent by: e4-dev-bounces@xxxxxxxxxxx





HI  again,

This went through my head the last hours. What if I have a stack of dialogs (i.e. sometimes one dialog opens anotherone to go into details)? How would you do that ? I guess I need more proper understanding of the context workings...

So long Thomas



2011/8/29 Tom Schindl <tom.schindl@xxxxxxxxxxxxxxx>
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
_______________________________________________
e4-dev mailing list

e4-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/e4-dev
_______________________________________________
e4-dev mailing list
e4-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/e4-dev



_______________________________________________
e4-dev mailing list
e4-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/e4-dev



Back to the top