Test URCap without running on Polyscope

Hello everyone,

I am new to URCap dev. I have been exploring the starter package for a while and have some questions.

Is it possible to test URCap in IDE instead of building .urcap file and run on Polyscope?
and how can I test my URCap and fix some bugs?

Thank you

You can compile and automatically push into URSim without needing to manually install the URCap file every time using

mvn install -P ursim

It’s also possible to modify your java project to allow it to run in Eclipse and display just your GUI window to give you some idea of how the layout will look… but I don’t remember the specifics. If this would be helpful we can find someone to explain it.

2 Likes

Thank you for your reply. I think it’d be helpful if someone can explain how to do it.

@jbm is this something you can give a quick intro to? Or does it already exist on the forum?

In your View-class, you could add a new main, that would allow you to start just the View-class from Eclipse, to see how your components are looking.
Naturally, the limitation is, that there is no linking to PolyScope, so anything pulled from the API og the Contribution (i.e. dropdown list content, keyboards etc.) will not work.

I.e. add something like:

public static void main(String... args) {
		int margin = 8;
		Style style = new V5Style();
		//Style style = new V3Style();

		JPanel jPanel = new JPanel();
		jPanel.setBorder(BorderFactory.createEmptyBorder(margin, margin, margin, margin));
		new MyViewClass(null, style).buildUI(jPanel, null);

		JFrame jFrame = new JFrame();
		jFrame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
		jFrame.add(jPanel);
		jFrame.setPreferredSize(style.getInstallationNodeSize());
		jFrame.setVisible(true);
		jFrame.pack();
}
6 Likes

Hi @jbm ,
thanks for your input, it works well without style unable to instantiate with V5Style. thus i am not able to get the Jframe size how do i solve this.
or what is the preferred jframe size.

The approach kind of works for me, thanks.
However, the style class does not have a “getInstallationNodeSize()” Function. It only provides “getInputFieldSize” which is probably just a wrong size.
Anyways, I can manually pull the window to some size that gives me an impression how it would look.

It works only for very simple setups, since the NodeContribution is not used and thus no connection to any data model.