Opens the context menu of the given tree.<p>

@param event the click event
@param tree the tree
430002
public void openForTree(ItemClickEvent event, Tree tree) {

        fireEvent(new ContextMenuOpenedOnTreeItemEvent(this, tree, event.getItemId()));
        open(event.getClientX(), event.getClientY());
    }
1147155
@Override
  public void refreshGuiAndShowFile(File file) {
    if(rootNode.getChildCount() > 0) {
      rootNode.removeAllChildren();
      treeModel.reload();
    }
    if(guiMain.getAsmProjectUml().getProjectUml() != null) {
      addTreeNodes(file);
      guiMain.getMenuMain().setVisibleProjectMenu(true);
    }
    else {
      guiMain.getMenuMain().setVisibleProjectMenu(false);
    }
  }
77955
void openPath(String path, boolean initTree) {

        if (path == null) {
            String siteRoot = A_CmsUI.getCmsObject().getRequestContext().getSiteRoot();
            path = m_locationCache.getFileExplorerLocation(siteRoot);
            if (path == null) {
                path = "";
            } else if (OpenCms.getSiteManager().startsWithShared(path)) {
                path = path.substring(siteRoot.length());
            }
        }
        boolean existsPath = CmsStringUtil.isNotEmptyOrWhitespaceOnly(path)
            && A_CmsUI.getCmsObject().existsResource(path, FILES_N_FOLDERS);

        if (path.startsWith("/")) {
            // remove a leading slash to avoid an empty first path fragment
            path = path.substring(1);
        }

        String[] pathItems = path.split("/");

        if (initTree) {
            try {
                initFolderTree(existsPath);
            } catch (CmsException e) {
                CmsErrorDialog.showErrorDialog(
                    CmsVaadinUtils.getMessageText(Messages.ERR_EXPLORER_CAN_NOT_OPEN_PATH_1, path),
                    e);
                LOG.error(e.getLocalizedMessage(), e);
                return;
            }
        }

        Collection<?> rootItems = m_treeContainer.rootItemIds();
        if (rootItems.size() != 1) {
            throw new RuntimeException("Illeagal state, folder tree has " + rootItems.size() + " children");
        }

        CmsUUID folderId = (CmsUUID)rootItems.iterator().next();
        if (initTree) {
            if (existsPath) {
                m_expandListener.setOpenPathFragment(pathItems[0]);
            }
            m_fileTree.expandItem(folderId);
            m_expandListener.setOpenPathFragment(null);
        }
        Collection<?> children = m_treeContainer.getChildren(folderId);
        for (int i = 0; i < pathItems.length; i++) {
            if (CmsStringUtil.isEmptyOrWhitespaceOnly(pathItems[i])) {
                continue;
            }
            CmsUUID level = null;
            if (children != null) {
                for (Object id : children) {
                    if (m_treeContainer.getItem(id).getItemProperty(
                        CmsResourceTableProperty.PROPERTY_RESOURCE_NAME).getValue().equals(pathItems[i])) {
                        level = (CmsUUID)id;
                        m_expandListener.setOpenPathFragment(
                            existsPath && (i < (pathItems.length - 1)) ? pathItems[i + 1] : null);
                        m_fileTree.expandItem(level);
                        m_expandListener.setOpenPathFragment(null);
                        break;
                    }
                }
            }
            if ((level == null) || level.equals(folderId)) {
                break;
            }
            folderId = level;
            children = m_treeContainer.getChildren(folderId);
        }
        try {
            readFolder(folderId);
        } catch (CmsException e) {
            CmsErrorDialog.showErrorDialog(
                CmsVaadinUtils.getMessageText(Messages.ERR_EXPLORER_CAN_NOT_OPEN_PATH_1, path),
                e);
            LOG.error(e.getLocalizedMessage(), e);
            return;
        }
    }
795847
public void visitSelect(JCFieldAccess tree) {
            if ((tree.name == names._this || tree.name == names._super) &&
                tree.selected.type.tsym != clazz &&
                outerThisStack.head != null)
                visitSymbol(outerThisStack.head);
            super.visitSelect(tree);
        }
836488
public void setAsContextMenuOf(AbstractClientConnector component) {

        if (component instanceof Table) {
            setAsTableContextMenu((Table)component);
        } else if (component instanceof Tree) {
            setAsTreeContextMenu((Tree)component);
        } else {
            super.extend(component);
        }
    }
896974
public void addContextMenuComponentListener(
        CmsContextMenu.ContextMenuOpenedListener.ComponentListener contextMenuComponentListener) {

        addListener(
            ContextMenuOpenedOnComponentEvent.class,
            contextMenuComponentListener,
            ContextMenuOpenedListener.ComponentListener.MENU_OPENED_FROM_COMPONENT);
    }
620432
private void createMenuEntry(
        MenuItem parent,
        final CmsTreeNode<I_CmsContextMenuItem> node,
        CmsContextMenuTreeBuilder treeBuilder) {

        Command entryCommand = null;
        if (node.getChildren().size() == 0) {
            entryCommand = new Command() {

                private static final long serialVersionUID = 1L;

                public void menuSelected(MenuItem selectedItem) {

                    node.getData().executeAction(getDialogContext());
                }
            };
        }
        MenuItem entry = parent.addItem((node.getData().getTitle(A_CmsUI.get().getLocale())), entryCommand);
        for (CmsTreeNode<I_CmsContextMenuItem> child : node.getChildren()) {
            createMenuEntry(entry, child, treeBuilder);
        }
        if (treeBuilder.getVisibility(node.getData()).isInActive()) {
            entry.setEnabled(false);
        }
    }
1265244
protected void initTree(CmsResource rootRes) throws CmsException {

        m_currentRoot = rootRes;
        m_treeContainer.removeAllComponents();
        showHeader();
        CmsSitemapTreeController controller = new CmsSitemapTreeController(
            A_CmsUI.getCmsObject(),
            rootRes,
            this,
            m_treeContainer);

        // no need to escape a structure id
        JavaScript.eval(CmsGwtConstants.VAR_LOCALE_ROOT + "='" + rootRes.getStructureId() + "'");

        CmsSitemapUI ui = (CmsSitemapUI)(A_CmsUI.get());
        ui.getSitemapExtension().setSitemapTreeController(controller);
        CmsSitemapTreeNode root1 = controller.createRootNode();
        controller.initEventHandlers(root1);
        m_treeContainer.addComponent(root1);
        controller.onClickOpen(root1);
    }
286795
private void setTree(ComponentTree tree) {
        synchronized (this) {
            this.tree = tree;
            for (ComponentVertex child : children) {
                child.setTree(tree);
            }
        }
    }
820875
private void openParents(CmsTreeItem item) {

        if (item != null) {
            item.setOpen(true);
            openParents(item.getParentItem());
        }
    }
982271
def contextMenuEvent(self, event):
        """"""
        self.setCurrentIndex(self.tabBar().tabAt(event.pos()))
        if self.menu:
            self.menu.popup(event.globalPos())
576693
protected synchronized void fireTreeAddition(Tree<D, ?> tree) {
		if (this.listeners != null) {
			final ForestListener[] list = new ForestListener[this.listeners.size()];
			this.listeners.toArray(list);
			final ForestEvent event = new ForestEvent(this, null, tree);
			for (final ForestListener listener : list) {
				listener.forestChanged(event);
			}
		}
	}
275927
public function listMenu(Tree $tree): ?Menu
    {
        if ($this->listIsEmpty($tree)) {
            return null;
        }
        
        return new Menu(
            $this->listTitle(),
            $this->listUrl($tree),
            $this->listMenuClass(),
            $this->listUrlAttributes()
        );
    }
1136162
protected void openPopup() {

        m_popup.setWidth(475);
        m_popup.setAutoHideEnabled(true);
        m_popup.addCloseHandler(new CloseHandler<PopupPanel>() {

            public void onClose(CloseEvent<PopupPanel> event) {

                closePopupDefault();

            }
        });

        m_popup.addDialogClose(new Command() {

            public void execute() {

                // nothing to do all will be done in onClose();

            }
        });

        if (m_previewHandlerRegistration != null) {
            m_previewHandlerRegistration.removeHandler();

        }
        m_previewHandlerRegistration = Event.addNativePreviewHandler(new CloseEventPreviewHandler());
        m_popup.showRelativeTo(m_colorField);

        m_popup.setModal(false);
        if (m_popup.getWidgetCount() != 0) {
            m_popup.remove(m_popup.getWidget(0));
        }
        CmsColorSelector picker = new CmsColorSelector();
        try {
            picker.setHex(m_textboxColorValue.getText().replace("#", ""));
        } catch (Exception e) {
            // TODO: Auto-generated catch block
        }
        m_popup.add(picker);
        if (m_count == 0) {
            CmsPushButton close = new CmsPushButton();
            CmsPushButton cancel = new CmsPushButton();
            cancel.setText(Messages.get().key(Messages.GUI_CANCEL_0));
            cancel.setTitle(Messages.get().key(Messages.GUI_CANCEL_0));
            close.setText(Messages.get().key(Messages.GUI_OK_0));
            close.setTitle(Messages.get().key(Messages.GUI_OK_0));
            close.addClickHandler(new ClickHandler() {

                public void onClick(ClickEvent event) {

                    closePopup();

                }
            });
            cancel.addClickHandler(new ClickHandler() {

                public void onClick(ClickEvent event) {

                    closePopupDefault();

                }
            });
            m_popup.addButton(cancel);
            m_popup.addButton(close);
            m_count = 1;
        }

        m_xcoordspopup = m_popup.getPopupLeft();
        m_ycoordspopup = m_popup.getPopupTop();

    }
788502
void handleFileTreeClick(ItemClickEvent event) {

        Item resourceItem = m_treeContainer.getItem(event.getItemId());
        if ((resourceItem.getItemProperty(CmsResourceTableProperty.PROPERTY_DISABLED).getValue() == null)
            || !((Boolean)resourceItem.getItemProperty(
                CmsResourceTableProperty.PROPERTY_DISABLED).getValue()).booleanValue()) {
            // don't handle disabled item clicks
            try {
                readFolder((CmsUUID)event.getItemId());
            } catch (CmsException e) {
                CmsErrorDialog.showErrorDialog(
                    CmsVaadinUtils.getMessageText(Messages.ERR_EXPLORER_CAN_NOT_READ_RESOURCE_1, event.getItemId()),
                    e);
                LOG.error(e.getLocalizedMessage(), e);
            }
        }
    }
533822
public void initRoot(CmsObject cms, CmsResource root) {

        addTreeItem(cms, root, null);
        readTreeLevel(cms, root.getStructureId());
    }
1351090
private void initContextMenu() {

        m_contextMenu.removeItems();
        MenuItem main = m_contextMenu.addItem("", null);
        main.setIcon(FontOpenCms.CONTEXT_MENU);
        main.setDescription(CmsVaadinUtils.getMessageText(Messages.GUI_MENU_TITLE_0));
        CmsContextMenuTreeBuilder treeBuilder = new CmsContextMenuTreeBuilder(getDialogContext());
        CmsTreeNode<I_CmsContextMenuItem> tree = treeBuilder.buildAll(
            OpenCms.getWorkplaceAppManager().getMenuItemProvider().getMenuItems());
        for (CmsTreeNode<I_CmsContextMenuItem> node : tree.getChildren()) {
            createMenuEntry(main, node, treeBuilder);
        }
    }