Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » How to create more than one instance in sirius through design(How to create more than one instance in sirius through design)
How to create more than one instance in sirius through design [message #1808892] Thu, 04 July 2019 05:07 Go to next message
Sharmila D is currently offline Sharmila DFriend
Messages: 79
Registered: June 2018
Member
Hii

I want to create instances based on input from user. for examples If user give value 2 then he need to create 2 instances of same type.

can we do this thing in design using for loop

I will provide a screen shot where in design I have used 'for loop' for creating instances but it is not creating.
My Problem:
At the time of dragging and dropping an element from palette to editor. Iam writing service method where it will ask user to enter the no.of instances to be created, In service method Iam getting only parent container not actual object which needs to be created. Please give some suggestions.

Re: How to create more than one instance in sirius through design [message #1808972 is a reply to message #1808892] Fri, 05 July 2019 10:14 Go to previous messageGo to next message
Pierre Guilet is currently offline Pierre GuiletFriend
Messages: 249
Registered: June 2017
Senior Member
Hi,

It is up to you to create the instances in your services if you ask here the user the number.

Another solution for me is to use in your creation tool a wizard operation where you put a textfield from which you retrieve the number of instance. You put the result in a variable with the let operation.
Then in the begin operation of the wizard you set a loop based on the variable you set previously.
And add a create instance inside.

You should be good.

Regards


Pierre Guilet - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: How to create more than one instance in sirius through design [message #1808987 is a reply to message #1808892] Fri, 05 July 2019 13:26 Go to previous messageGo to next message
Sharmila D is currently offline Sharmila DFriend
Messages: 79
Registered: June 2018
Member
Hi Pierre Guilet

Thank you for the reply. But I am still facing the issue Iam not getting how to use open wizard operation in design. I have searched for so many examples but still I didnt find how to use it.

I have tried using let operation after that for loop operation after that createContainer operation but still it is creating for once.

I will give you the screenshots of design.Please help me I am trying these from one week
In Services for public static int checkcopInstance() {

try {
int modulesTocreate = 0;
modulesTocreate = openCreateDialog(Integer.toString(5));

}
catch (Exception e) {
e.getStackTrace();
}
return modulesTocreate;

}

public static int openCreateDialog(String maxInstance) {
int instanceEntered = 0;
CustomDialog customdialog =
new CustomDialog(Display.getDefault().getActiveShell(), maxInstance);
customdialog.setSubmitButtonText("Create");
customdialog.setShellText("Multiple Instances");
customdialog.create();
customdialog.setTitle(" Create Module Instance(s)");
customdialog.setMessage("Enter the number of instances to be created", MessageDialog.CONFIRM);
if (customdialog.open() == Window.OK) {
instanceEntered = customdialog.getInstanceEntered();
}
return instanceEntered;
}

Iam returning the instances but still it is creating once.
Re: How to create more than one instance in sirius through design [message #1809064 is a reply to message #1808987] Mon, 08 July 2019 08:26 Go to previous messageGo to next message
Pierre Guilet is currently offline Pierre GuiletFriend
Messages: 249
Registered: June 2017
Senior Member
Hi,

The loop operation need to return a list of object so it cannot work with a number.
But even with the right type , it does not work.
So you will have to create the two instance from a service yourself.

To do that you can use the let operation specifying the number then use a change context under where you call your instances creation service.

Regards,


Pierre Guilet - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: How to create more than one instance in sirius through design [message #1809112 is a reply to message #1809064] Tue, 09 July 2019 09:57 Go to previous messageGo to next message
Sharmila D is currently offline Sharmila DFriend
Messages: 79
Registered: June 2018
Member
Hi Pierre Guilet

Thank you for the reply.Then I need to create the number of instances through services only. I cannot use createInstance operation in design.
No other way to create the instances through design based on the number of instances returned.
Re: How to create more than one instance in sirius through design [message #1809121 is a reply to message #1809112] Tue, 09 July 2019 13:46 Go to previous message
Pierre Guilet is currently offline Pierre GuiletFriend
Messages: 249
Registered: June 2017
Senior Member
Hi,

I don't see any.

Regars,


Pierre Guilet - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Previous Topic:How to activate the filter programatically in eclipse sirius
Next Topic:How to trigger validation on children of the target class?
Goto Forum:
  


Current Time: Thu Aug 22 13:22:48 GMT 2019

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

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

Back to the top