private void handlePrimaryClick() {
    final int currentClicks = ++clicks;
    manager.submitTask(() -> manager.findReferingNodes(node, false));

    if (isExpanded.get()) {
      getMaterial().setDiffuseMap(Resources.SPINNER);
      manager.submitTask(
          () ->
              manager.collapseNode(
                  node,
                  () -> {
                    if (clicks == currentClicks) collapseNodeCallback();
                  }));
    } else {
      getMaterial().setDiffuseMap(Resources.SPINNER);
      manager.submitTask(
          () ->
              manager.expandNode(
                  node,
                  () -> {
                    if (clicks == currentClicks) expandNodeCallback();
                  }));
    }
    isExpanded.setValue(!isExpanded.get());
  }
  @Override
  public void handle(MouseEvent event) {
    EventType<? extends MouseEvent> eventType = event.getEventType();
    if (eventType.equals(MouseEvent.MOUSE_CLICKED)) {
      if (openMenu != null) disposeOpenMenu();
      MenuItem hmi = new MenuItem("Help");
      hmi.setOnAction(e -> DialogService.openHelpDialog());

      PhongMaterial m = new PhongMaterial();
      m.setDiffuseColor(Color.GREEN);
      m.setSpecularColor(Color.WHITE);
      Box box = new Box(10, 10, 10);
      box.setMaterial(m);
      box.getTransforms().addAll(new Rotate(45, Rotate.Z_AXIS), new Rotate(45, Rotate.X_AXIS));

      MenuItem imi = new MenuItem("Inspect", new ImageView(Resources.SEARCH_ICON));
      imi.setOnAction(
          e -> {
            DialogService.openInspectDialog(node);
          });

      MenuItem emi = new MenuItem("Expand / Collapse", box);
      emi.setOnAction(
          e -> {
            handlePrimaryClick();
          });

      openMenu = new ContextMenu();
      openMenu.getItems().addAll(emi, imi, new SeparatorMenuItem(), hmi);
      openMenu.show(shape, event.getScreenX(), event.getScreenY());
    } else if (eventType.equals(MouseEvent.MOUSE_ENTERED)) {
      manager.submitTask(() -> manager.findReferingNodes(node, true));
    } else if (eventType.equals(MouseEvent.MOUSE_EXITED)) {
      manager.submitTask(() -> manager.findReferingNodes(node, false));
    }
  }