Skip to main content
Mar 30, 2022 12:00 PM UTC
Solved

How to run a Custom Widget in Eclipse IDE

Hello All,

 

I'm trying to develop a custom widget. After my code changes, I use to import the extension file into TWX Composer and test it.

This process takes time for each minor change.

Is there any other option to run in Eclipse IDE level and test it?

 

-MK

 

 

BogdanMAnswer
Mar 30, 2022 1:50 PM UTC

You could potentially do this, but you'd need to have a very good separation of your widget code from code that could run independently. Even then, you wouldn't be able to fully test your widget since the parts that depend on the Thingworx runtime won't run outside of it - just the parts that don't directly depend on Thingworx.

 

Alternatively, you could consider using a build script such as the one used by this widget which contains a task that increments the extension version, creates the zip package and uploads the extension to Thingworx. This way you could just assign that task to a build shortcut (e.g. ctrl+b) and use it to quickly deploy your changes to the Thingworx server for testing. Additionally this would let you use a different javascript ide if you prefer, such as visual studio code.

 

Another option, though more complex, would be to use a template such as demo webpack widget that has a series of tasks predefined but is a completely different way of building widgets that is not supported by PTC.

4 replies

Mar 30, 2022 12:56 PM UTC

Hello @MM_10109894 ,

 

pls check the below given link of the thread having same issue:

 

https://community.ptc.com/t5/ThingWorx-Developers/Custom-Widget-not-displaying-in-runtime/td-p/520767?posno=1&q=custom%20widget%20in%20Eclipse%20IDE&source=search

 

Kindly revert back if you have any further queries.

 

Regards

Bhawna

Mar 30, 2022 1:40 PM UTC

Hello,

If you are using Ant to build the JAR, you can try to update Ant file in order to include:

It is still not testable inside Eclipse but you will gain a lot of time.

Hope it helps.

BogdanMAnswer
Mar 30, 2022 1:50 PM UTC

You could potentially do this, but you'd need to have a very good separation of your widget code from code that could run independently. Even then, you wouldn't be able to fully test your widget since the parts that depend on the Thingworx runtime won't run outside of it - just the parts that don't directly depend on Thingworx.

 

Alternatively, you could consider using a build script such as the one used by this widget which contains a task that increments the extension version, creates the zip package and uploads the extension to Thingworx. This way you could just assign that task to a build shortcut (e.g. ctrl+b) and use it to quickly deploy your changes to the Thingworx server for testing. Additionally this would let you use a different javascript ide if you prefer, such as visual studio code.

 

Another option, though more complex, would be to use a template such as demo webpack widget that has a series of tasks predefined but is a completely different way of building widgets that is not supported by PTC.

Mar 31, 2022 11:40 AM UTC

I am doing it very similar to how BogdanM suggested.

I added in my ANT task dependency chain 2 tasks that increment the version, then, after packaging, it uploads the widget to ThingWorx.