Skip to main content



      Home
Home » Eclipse Projects » Sirius » Close Sirius Dialog Widget from Java Services
Close Sirius Dialog Widget from Java Services [message #1850915] Tue, 22 March 2022 03:57 Go to next message
Eclipse UserFriend
Hi everyone, I am struggling to save changes and close the sirius dialog box in java service method.

I have a Dialog Box in the odesign file. The user can enter inputs by using this dialog. After the user clicks to the OK Button, my service method starts to running, In this method, I checked the inputs. If all inputs is valid according to my rules, I want to save the new instance to the model and close the diagram.
I tried to solve this problem by using the following code;

Display.getCurrent().getActiveShell().close();

This code helps to close dialog box but the new instance won't be created in this situation.

If I select the "Close Dialog On Click "Option of the OK Button, this solves the problem but in this situation my validation rules will not be performed.

How can I solve this problem?
Re: Close Sirius Dialog Widget from Java Services [message #1851305 is a reply to message #1850915] Fri, 01 April 2022 15:58 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

You do not need to "save" anything in the case when the changes are valid.
All the model changes performed inside such a dialog are directly applied to the edited model elements (even though they appear in dialog they behave like properties views in this regard).

What you can try is to rollback the changes if they are *not* valid: in your Java service try to "throw new OperationCanceledException()". This is actually what the "Cancel" button does to revert the already applied changes if the user cancels the dialog.
Re: Close Sirius Dialog Widget from Java Services [message #1851547 is a reply to message #1851305] Fri, 08 April 2022 03:39 Go to previous message
Eclipse UserFriend
index.php/fa/41877/0/
Hi Pierre, I want to handle the option of the "Close Dialog On Click" in the code. How can I do it?


Pierre-Charles David wrote on Fri, 01 April 2022 19:58
Hi,

You do not need to "save" anything in the case when the changes are valid.
All the model changes performed inside such a dialog are directly applied to the edited model elements (even though they appear in dialog they behave like properties views in this regard).

What you can try is to rollback the changes if they are *not* valid: in your Java service try to "throw new OperationCanceledException()". This is actually what the "Cancel" button does to revert the already applied changes if the user cancels the dialog.

Previous Topic:Invalid feature as name
Next Topic:Sirius edge based on the graphical element
Goto Forum:
  


Current Time: Thu May 15 15:42:53 EDT 2025

Powered by FUDForum. Page generated in 0.06804 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top