Question regarding types #1286

CLOSED
Submitted 5 months ago

The video on the next topic says that you can listen to specific types of selection.

Then I added on my PlaygroundPart this method:

@Inject public void setTasks( @Optional @Named(IServiceConstants.ACTIVE_SELECTION) String tasks ) { System.err.println( "PlaygroundPart.setTasks fired" ); }

And it was fired when I selected a Task on my table. Is it expected? From the video, I understood that this method would be called only when the active selection was a String

Comments

  5 months ago

Is the provided String null? In this case this is expected. @Optional used on a parameter will ensure this method is called, even if the required parameter is null (and as you are not setting a String it is null for this parameter). You can move the @Optional to the method to avoid such calls.

Does that help?

  4 months ago

Indeed. The String received by the method is null and moving the @Optional to the method avoids such calls. Thanks!

  4 months ago

Thanks for the feedback.

Please login to write a comment.