Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Scout » Menu Class(Null error when getting menu class using getMenuByClass(..) method)
Menu Class [message #1830219] Tue, 21 July 2020 04:08 Go to next message
Mark Novem Grisola is currently offline Mark Novem GrisolaFriend
Messages: 27
Registered: November 2017
Junior Member
Good day,

Just recently when i want to manipulate the visibility of the table menu by using the getMenuByClass( AddSample.menu).setVisible(Boolean.FALSE) it throws a null error: 2020-07-21 04:00:46,533 ERROR [scout-model-thread-22] org.eclipse.scout.rt.platform.exception.ExceptionHandler - NullPointerException:n/a -Ex: java.lang.NullPointerException: null
. So i switched to debug mode to trace the causes, when i check the AddSampleMenu.class on the Expressions tools of eclipse it exist. Why is it it throws a null error? What could be the other possible reason? By the way i am using version 10.0 of scout.

Sincerely,

mark
Re: Menu Class [message #1830220 is a reply to message #1830219] Tue, 21 July 2020 04:32 Go to previous messageGo to next message
Mark Novem Grisola is currently offline Mark Novem GrisolaFriend
Messages: 27
Registered: November 2017
Junior Member
Solved.

It turns out that menu is not accessible outside its parent class. If some point of the parent class a method which is outside of the class is invoke and part of the method is to manipulate the parent class menu that could raise a null error.

Re: Menu Class [message #1830221 is a reply to message #1830220] Tue, 21 July 2020 05:42 Go to previous messageGo to next message
Andre Wegmueller is currently offline Andre WegmuellerFriend
Messages: 204
Registered: September 2012
Location: Baden-Dättwil, Switzerla...
Senior Member
Hi Mark

Exactly. A typical getter method on the Form-class for a menu somewhere deep within the form looks like this:

public EditorLocaleFieldMenu getEditorLocaleFieldMenu() {
  return getTabBox().getMenuByClass(EditorLocaleFieldMenu.class);
}


In this example the form has a TabBox-field, and its menus are accessed via the TabBox reference.

Cheers
André


Eclipse Scout Homepage | Documentation | GitHub
Re: Menu Class [message #1830225 is a reply to message #1830221] Tue, 21 July 2020 07:23 Go to previous message
Mark Novem Grisola is currently offline Mark Novem GrisolaFriend
Messages: 27
Registered: November 2017
Junior Member
Thanks Andre, it further improve my understanding.

sincerely,
mark
Previous Topic:Action on table column
Next Topic:500 Internal Server Error
Goto Forum:
  


Current Time: Fri Apr 26 11:14:00 GMT 2024

Powered by FUDForum. Page generated in 0.03286 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top