Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 07:57 Go to next message
Hakan  Yüksek is currently offline Hakan YüksekFriend
Messages: 20
Registered: October 2021
Junior Member
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 19:58 Go to previous messageGo to next message
Pierre-Charles David is currently offline Pierre-Charles DavidFriend
Messages: 640
Registered: July 2009
Senior Member
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.


Pierre-Charles David - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Close Sirius Dialog Widget from Java Services [message #1851547 is a reply to message #1851305] Fri, 08 April 2022 07:39 Go to previous message
Hakan  Yüksek is currently offline Hakan YüksekFriend
Messages: 20
Registered: October 2021
Junior Member
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 Aug 18 12:11:42 GMT 2022

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

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

Back to the top