file [Solved] Customize PropertyPages

5 years 3 months ago #3280 by INTO-CPS-Rasmus
Hi

I have a couple of questions about the PropertyPage for a new module. Lets use the SysMLArchitect Block as an example.

1. I would like to add new properties in the PropertyPage when a Block is selected. I can currently add them, but I can not get the code right for changing them.
One property I would like to add is a string, which should be changed by writing a new string.

2. I would like to get the properties in a PropertyPage from a selected model element when doing a command.
I imaging it would be something like modelelt.getPropertyPage(int row).

Best regards,

Please Log in or Create an account to join the conversation.

5 years 3 months ago - 5 years 3 months ago #3284 by INTO-CPS-Rasmus
Hi again,

So I discovered the solution to my problem from a night sleep.

For reference what I did was the following.
Create a block stereotype in my own module.xml with a different ID from SysMLArchitect, and add my own TagTypes.

Then I created a new BlockPropertyPage for my own module and used the following update and change.
public void update(ModelElement element, IModulePropertyTable table) {
    	String value_kind = ModelUtils.getTaggedValue("ToolPath", element);
    	
    	table.addProperty(SysMLResourcesManager.getInstance().getPropertyName("ToolPath"),value_kind);

  public void changeProperty(ModelElement element, int row, String value) {
    	
    	
        if(row == 1){
        	ModelUtils.addValue("HelloWorld","ToolPath", value, element);
         }}

Now if I want to get this value from a command I call the following where modelet is the model element selected.
ModelUtils.getTaggedValue("ToolPath", modelelt)

Regards

Please Log in or Create an account to join the conversation.

Moderators: tmachmaab
Time to create page: 0.032 seconds
^ Back to Top