Is it possible to access Java values declared in a custom Widget class, from an erb template using the sonar api.
Thanks in advance for any help.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
WHen you say Java values, do you mean attributes of the widget instance? If so, then it’s not possible.
However, there are the @WidgetProperties and @WidgetProperty annotation (see [1]) that allow you define widget properties (with default values if you want) that a user will be able to customize. And in your Ruby template, you’ll be able to access them with the syntax “widget_properties[‘the_property_name’]” (see [2]).
[1] https://github.com/SonarSource/sonar/blob/master/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/TimelineWidget.java
[2] https://github.com/SonarSource/sonar/blob/master/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/timeline.html.erb