Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Edit a list of parameters
Edit a list of parameters [message #786355] Mon, 30 January 2012 10:11 Go to next message
Markus Knoop is currently offline Markus KnoopFriend
Messages: 14
Registered: January 2012
Junior Member
Hello,

a need help again. First i will describe the environment. I have two ecore models. One external model decribe a service class. This class have a list of inputparameterstypes (reference 0...*).
My ecore model decribe a process with task and transisitons. A task have a reference (0...1) to a service. Within the GMF editor i can select a service. Now i want to edit a list of the inputparameter filds to map them, e.g.

parametertype1 = "here i want to enter a definition of type string"
parametertype2 = "here i want to enter a definition of type string"

...and so on.

The task in my model have a reference (0...*) to a map class with the parametertype and string to save this mapping.

Did anyone have an idea how i could realize this in GMF?

Regards,
Markus
Re: Edit a list of parameters [message #788608 is a reply to message #786355] Thu, 02 February 2012 01:55 Go to previous messageGo to next message
Michael Golubev is currently offline Michael GolubevFriend
Messages: 383
Registered: July 2009
Senior Member
Hello,

You may find useful this old code from UML2Tools project.

The code there parses and applies into the UML (Operation + val Parameter[*]) the string like "operation(in p1:T1, inout p2:T2, p3:T3) : RT4", but it may be used just as a sample of integration of javacc-generated parser with GMF-T generated diagram.

Regards,
Michael "Borlander" Golubev
at Montages Think Tank, Prague, Czech Republic
Montages AG, Zürich, Switzerland
Re: Edit a list of parameters [message #797283 is a reply to message #788608] Mon, 13 February 2012 09:23 Go to previous messageGo to next message
Markus Knoop is currently offline Markus KnoopFriend
Messages: 14
Registered: January 2012
Junior Member
Hello,

i don't find a matching solution for me inside this code. I will explain the environment detailt.
We hava an editor based on emf to decribe service classes. This decription of a class could have a undefined list of input parameters. With this editor i create a model with one service with e.g. two input parameter from type int and string.
My second gmf editor could model a process. A node in this process is a servicetask. This has a reference to one service. I could load the servicedescription created before (with the service class) as resource file and now i can choose this service for the reference of the servicetask properties. This currently works.
But i want to extend the servicetask with the input parameters automaticly by select the service.
I think one solution is to implement an own class, that create a containment for each input parameter of the service and add them to ther servicetask-editpart.

Now i add a new class devided from the servicetask-editpart class and overwrite the notifyChanged method. So i be able to recognize the selection of a service class.
How can i create manualy a compartment? I add a compartment to my process model, but i will create and set it inside my new class. By sending a create command (model and view should contain the changes). How can i create this command?

Rgards,
Markus Knoop

[Updated on: Mon, 13 February 2012 13:04]

Report message to a moderator

Re: Edit a list of parameters [message #797779 is a reply to message #797283] Mon, 13 February 2012 22:09 Go to previous messageGo to next message
Michael Golubev is currently offline Michael GolubevFriend
Messages: 383
Registered: July 2009
Senior Member
Markus,

Indeed my first answer does not look relevant now. Let me do a second try Smile

So you have something like:
class Parameter { attr String name; ... }
class ServiceClass { val Parameter[*] params; ...}
class Process { ref ServiceClass service; ... }


At the diagram you have a node for Process and some action that allows user to select one of preloaded ServiceClass instances and sets self.service for this node.

Now you want to show the compartment for Parameter's inside the Process node and on every change of self.service to populate this compartment with actual parameters taken from the bound ServiceClass.

So if you have 2 service instances S1 { parameters = {'P1', 'P2'} ...} and S2 { parameters = {'P3'} ...}, and the Process node P you want the diagram show the P-node with compartment that has 0 parameters while the P has not bound to Service, 2 parameters when user set the P.service = S1 and single parameter when user change P.servce = S2.

If this is correct, I would changed the Process to be:
class Process {
  ref ServiceClass service; 
  derived transient volatile readonly ref Parameter[*] serviceParams; 
} 
implement it in a obvious way and continued with standard GMF definitions (pretending this new 'serviceParams' feature is a containment).

You definitely will need to modify some generated code (block the creation/deletion/... of parameters, refresh the parameters on process#service changes, etc) but GMFT will generate the boilerplate code suitable for your use case. For me, it is definitely better than attempting to mix generated and non-generated code for editparts.

If I missed your point again, please post the relevant part of the models, your actual diagram screenshots and possibly some sketches for desired look and feel.

Regards,
Michael "Borlander" Golubev
at Montages Think Tank, Prague, Czech Republic
Montages AG, Zürich, Switzerland
Re: Edit a list of parameters [message #798956 is a reply to message #797779] Wed, 15 February 2012 09:13 Go to previous messageGo to next message
Markus Knoop is currently offline Markus KnoopFriend
Messages: 14
Registered: January 2012
Junior Member
Hello Michael,

thanks for help but now we have change the model so we don't have this problem any more. But now i've a new problem related to the old problem.
My model has the top class "diagram" which contains all other objects (classes, transisitons, etc.). When i create a new "diagram" inside the GMF editor, i should create a config object. Here is the simple ecore model:

- class diagram
reference (1...1) conf: Config

- class config

What i the best way to create this config object automaticly while create a new diagram so this will be shown by startup in the plain diagram as a rectangle. How i can avoid the deletion of this object because a diagramm must contain the config object?

Regards,
Markus Knoop
Re: Edit a list of parameters [message #799004 is a reply to message #798956] Wed, 15 February 2012 10:23 Go to previous message
Michael Golubev is currently offline Michael GolubevFriend
Messages: 383
Registered: July 2009
Senior Member
Markus,

Quote:
What is the best way to create some new containing object automatically while creating a new diagram so this will be shown by startup in the plain diagram as a rectangle. How i can avoid the deletion of this object because a diagram must always contain this auto-created object?


It seems to be a bit too far from the original subject for this topic Smile
So I will create a new topic and answer there, to simplify searching.

Regards,
Michael
Previous Topic:making nodes read only
Next Topic:Looking for a GEF tutorial ...
Goto Forum:
  


Current Time: Sat Apr 20 03:45:59 GMT 2024

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

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

Back to the top