Issues in Merging DesignToolbar into TopPanel

So, what i am trying to do is to move ProjectNameLabel, Screen Menu, addScreen, removeScreen, Designer and Blocks from DesignToolbar to TopPanel and TopToolbar respectively.

To merge ProjectNameLabel, i tried to do it like this, but the text is not showing. :

public Label projectNameLabel;

projectNameLabel = new Label();

panel.setCellWidth(logo, "60px");
panel.setCellWidth(projectNameLabel, "200px"); 

public void updateProjectName(String projectName) {

  TopPanel toppanelt = new TopPanel();

Then i added the SwitchToBlockButton to TopPanel,
I did a few trial, so using DesignToolbar var = new DesignToolbar() then call out the function does not do anything.

By reading Ode,getInstance(), i found out the method below :

So, in :
private static DesignToolbar instance;

public static DesignToolbar getInstance() {
return instance;

Then i added a public function :

  public void switchToBlockEdit() {
new SwitchToBlocksEditorAction();

Now back to :
final DesignToolbar designtoolbar = DesignToolbar.getInstance();

TextButton blocksButton = new TextButton(assetsButtonLogo);
  blocksButton.addClickHandler(new ClickHandler() {
  public void onClick(ClickEvent event) {

Now the onClick respond " a bug occured "

The error is

faultData = Exception caught: (TypeError) : Cannot read property '$_nullMethod' of null

Could anyone kindly help with this issue ?
Is there a good way to achieve that ?
Thank you !

1 Like

Have you initialized DesignToolbar ? Probably that's why it is null.

1 Like

I think he is trying to do with Static instance not with its Object :thinking:

1 Like

You can't return anything if you have not initialized anything.