cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Translate the entire conversation x

Can someone help in writing code to add action listener on Model Save

SD_10158207
7-Bedrock

Can someone help in writing code to add action listener on Model Save

Hello Everyone,

 

I am developing a J-Link tool the requirement is to execute the tool on every save of the model.

 

I have implemented this on session objection performing session.AddActionListener but this is resulting into clearing undo/redo stack into session.

 

Looking for better option to keep the track on undo\redo stack and tool should run on every model save.

 

Thanks in advance

Swapnil

4 REPLIES 4
remy
21-Topaz I
(To:SD_10158207)

Hi this is a known and general limitation. This applies to Toolkit hence to Java OTK : https://www.ptc.com/en/support/article/CS143895

and not only to listeners but also to the whole API.

If I skip the session action listeners it maintains the undo/redo stack. As soon I add Action Listener to session it clears the stack. Much appreciated help if someone provide sample code to add model action listener to on after active model save

remy
21-Topaz I
(To:SD_10158207)

Hi,

please find a generic article with a code sample : https://www.ptc.com/en/support/article/CS316823

the code enables to catch the event when creating a parameter.

Have it run first successfully and then iterate it to your likings.

 

//edit the example above is Toolkit. Apologies.

here is an article about Java Object Toolkit (JOTK aka Jlink) code : https://www.ptc.com/en/support/article/CS408439 

look into it and derive from it.

Hello @SD_10158207,

 

It looks like you have a response from our support expert. If it helped to answer your question please mark the reply as the Accepted Solution. 
Of course, if you have more to share on your issue, please let the Community know so other community members can continue to help you.

Thanks,
Vivek N.
Community Moderation Team.

Announcements


Top Tags