I'm a PhD student and I published two papers till now, both of them are based on the enterprise architecture and I used ArchiMate and Archi. The latest paper is accepted in the conference sensorcom2014.I'm working in the context of deep sea observatories and I have succeeded by extending ArchiMate using Archi tool.My new contribution is requiring to know: How can I add some lines of java code on the "on click" event on any extended relation ship What are the concerned class to check them? Where I can add my java code? on which class or function in Archi?I really need your help in order to continue my future contribution, I will appreciate my help a lot.Waiting your kindly reply,Thank you

Hello, Thank you for answering me.What I need exactly is: when I click on a new extended relationship (I added one), I need to get a dialog box or any field to enter data or value in it.Once the value is entered by the designer, so the designer will be able to drag and drop this relationship, i another way to use this relationship.Another concern which is, the value X entered by the designer should be between two values (Y & Z) that already should be defined as maximum and minimum values, for example Y<X<Z.In conclusion, I have two questions: - How I can have a dialog box or any field when I click on a new extended realtionship? - How I can put the Values Y and Z as constraints for the value X entered by the design, where I can add these or implement these two values?

I think it's not a good idea for usability to open a dialog box when clicking on a palette tool. It's better to set values on a concept or relationship in Archi's Properties window. Unless you are trying to achieve something else?

Quote

Once the value is entered by the designer, so the designer will be able to drag and drop this relationship, i another way to use this relationship.

What do you mean by this? Do you mean anything special in the use of drag and drop?

Thank you for your cooperation.I will give you an example, consider hat I have two PCs and I need to link these two pcs by the new extended relation ship.In order to to use this relationship from the designer or developer a value X should be entered by him and this value should between less < Y and > Z (Y<X<Z).The Y and Z are constraints to enter the X value between. For example if we have a constraint the value entered by the design for the connection between two servers should between Y = 50 and Z= 70 so the value X coudl be 51 or 52 .................... 68 or 69.Hope it's more clear now

Your Y and Z values (or any other parameters) can be defined as preferences. Look at com.archimatetool.editor/src/com/archimatetool/editor/preferences, and in particularPreferences.java and PreferenceInitializer.java. You should find enough example to use it.

From an end-user perspective, having to set a value before creating a new relation doesn't make much sens. You should instead set it just after its creation. In an ideal world, this should be in fact nothing more than a required Property set in an ArchiMate profile. As this is not possible in Archi for the moment, maybe we could try to do a first step in this direction...

@Phil: is it possible to create some "entry points" activated on basic events like creation of a new object or relation. We could them imagine using those "entry points" in plugins. Charbel's plugin could be the hard coded behaviour for entering X, mine could be an ArchiMate profile implementation ;-)

Concerning the Y and Z value:I found in the PreferenceInitialzer.java for example : store.setDefault(GRID_SIZE, 6); so the GRID_SIZE should be replaced by the name of my new relationship?then, I need to go to Preferences.java and add for example??: public static int getGridSize() { return STORE.getInt(GRID_SIZE); }As I understand currently Archi doesn't support that an end user or designer can click on a concept or on a relation and get a dialogbox to insert a value that should be between Y and Z?? is that what you mean?In case is not possible this with Archi, do you think can I add some java code to have this dialog box and at the same time I need to read the values Y and Z on such event (ex a click on the new realtionship)??

Sorry for asking a lot, but this my contribution and I need to make sure if it's feasible or not.

@Phil: is it possible to create some "entry points" activated on basic events like creation of a new object or relation. We could them imagine using those "entry points" in plugins. Charbel's plugin could be the hard coded behaviour for entering X, mine could be an ArchiMate profile implementation ;-)

JB

Normally, an interested client (UI element, plugin, whatever) would register itself as a model listener in EditorModelManager and respond when a new model element is created. Always work at the "M" level of MVC. However, the type of creation event is not always easy to determine (was it copy and paste, created from palette).

But in this case, the non-intrusive behaviour should be:- create a connection without nagging the user (an exception to this is the nested relationship dialog, but even this can be turned off.) If there are additional properties to be set for the relation, these should be added to the relationship in the eCore model, and exposed in the Properties window.

I added a new relationship which is specialized only to relate two devices such a pc with a server, my main question is that:if we consider that, this relationship is a cable and this cable could only between 50 meters and 100 meters so I need to put constraints for this realtionship ( the value should be >50 and < 100).That is why I gave the example of X,Y,Z so I considered Y and Z are the constraints and the X value is the value should be entered by the designer when he is using this realtionship, at the end the designer should insert a value X when he wants to use this realtionship and this value should respect the constraints the Y and Z values.Hope it's more clear, really I need yourhelp

In fact, what you are doing is a typical use case of an ArchiMate Profile (not supported at the moment by Archi).

If I understand well, I could translate it to: create a profile in which we define a "cable" stereotype assigned to an "association" relationship. On this stereotype, we define a "length" property with a constraint to be a number between 50 and 100.

So IMHO, the best way to manage your requirement is to try to implement a lightweight profile mecanism in Archi.

Some ideas to do it:

Find a way to store profile definition. One potential way of doing it is to create a Canvas view (thus allowing to save/reuse them in templates) in which we create a note/relation where name is the stereotype, notes is the ArchiMate concept type, properties are defaults properties for this stereotype, and property value is a validation script (written in javascript)

Use a property named "stereotype" whose value is the.. stereotype ;-)

Find a way to detect when a "stereotype" property has been created and then check that pre-defined properties exist and that their associated validation function is run (through a javascript javax.script.ScriptEngine). If not, show a message either in status bar or modal dialog.

Of course, it would be best to add those stereotype to the palette, to be able to create element linked to stereotypes quickly

Yes you understood right and I think we are in progress, thk you a lotI have to explain for you more what I did and what I need.As you mentioned "it would be best to add those stereotype to the palette, to be able to create element linked to stereotypes quickly" I already did a contribution in my thesis by adding new specific concepts for marine observatories(MO). I have extended the archimate metamodel by providing a new mtemodel and we applied this metamodel in eclispe then we generate the new archi tool in order to have new concrete syntax which contains all the new specific concepts for MO. we create a new model using the new generated archi tool and so on (all is working well).For now, I have added a new relationship which is extended from an association relationship and it should be specific only for two devices such a server and PC. I succeeded to add it to the palette as the other concepts but I need now is the following:As you mentioned if I consider this realtionship like a cable so I need to put constraints when the designer is using this relationship. I mean for example the length of the cable should be between 50 and 100 meters. that is why I have asked you all the above questions.What I thought is that: when the designer will use this relationship or the cable so the designer should enter a value that should be between 50 and 100 m in order to continue the design, in case the value is not between 50 and 100 meters so the designer shouldn't be able to use this realtionship or cable.I think now it's better, so what do you advise me to do? the most simple way.really I'm thanking you a lot

Hello again, I think now the image is more clear for me.If we consider that I'm selecting the association relation ship from the palette and I'm using it between two elements. What I need to know is that, where I can find the java code (classes or library or methods) in eclipse that is called on the on click event in the palette and the event when I'm relating the two elements. I need to see the java code for that. could you help me please?