|
Re: ECLIPSE JUNO RCP application.e4xmi eventBroker [message #977731 is a reply to message #977397] |
Fri, 09 November 2012 14:23 |
Thomas Schindl Messages: 6651 Registered: July 2009 |
Senior Member |
|
|
Better ask the eclipse.e4 newsgroup.
Tom
Am 09.11.12 14:36, schrieb Angel Manica Raquel:
> Hi there everyone! we're trying to figure out where to call the
> "Do you want to save the changes you made to *insert file here*?"
> question when a user closes a file which is an opened part on the
> PartStack for opened files.
>
> At the moment, what I did was to place it on a disposeListener() on my
> fileViewer class. However, the user can only have two options which is
> to either Save the changes or not because I can't place there a cancel
> button which would just close the dialog and return to his file because
> it has already been disposed.
> So, I wanted to edit it in such a way that the user can have the option to:
>
> a. Save - Close File and Save Changes
> b. not save - close file and not save changes
> c. cancel- do not close the file and just return to what the user was
> doing.
>
> My teammate researched on the event broker handler:
>
>
> private EventHandler testHandler;
> @PostConstruct
> public void pc(IEventBroker eventBroker)
> {
> testHandler = new EventHandler() {
> @Override
> public void handleEvent(Event event) {
> Object part =
> event.getProperty(UIEvents.EventTags.ELEMENT);
> boolean tbr =(Boolean)
> event.getProperty(UIEvents.EventTags.NEW_VALUE);
>
> System.out.println(event.getTopic().toString());
> if (part instanceof MPart){
> System.out.println("Part
> "+((MPart)part).getElementId()+" is "+(!tbr?"NOT":"")+" visible");
>
> if(MessageDialog.openConfirm(Display.getCurrent().getActiveShell(),
> "Confirmation", "Do you really want to close? ")){
> System.out.println("exit!");
> }
> else{
> }
> }
> }
> };
>
> eventBroker.subscribe(UIEvents.UIElement.TOPIC_TOBERENDERED, testHandler);
> }
>
> Here we saw the confirmation Message appear before the part containing
> the file was disposed, but still, we can't figure out how to keep the
> file from disposing after the confirmationDialog closes. :blush:
> So where should I place the confirmationDialog?
>
> Your advice would be greatly appreciated! Thank you! :d
|
|
|
Powered by
FUDForum. Page generated in 0.08214 seconds