Opens the categories dialog for the given resource.<p>

@param resource the resource
970244
public void openCategories(CmsResource resource) {

        getRpcProxy(I_CmsGwtDialogClientRpc.class).openCategoriesDialog(
            resource.getStructureId().toString(),
            OpenCms.getWorkplaceManager().isDisplayCategorySelectionCollapsed());
    }
994531
void openPopup() {

        try {
            if (m_popup == null) {
                m_popup = new CmsPopup(Messages.get().key(Messages.GUI_LOCATION_DIALOG_TITLE_0), hasMap() ? 1020 : 420);
                m_popupContent = new CmsLocationPopupContent(
                    this,
                    new CmsLocationSuggestOracle(this),
                    getModeItems(),
                    getTypeItems(),
                    getZoomItems());
                setFieldVisibility();
                m_popup.setMainContent(m_popupContent);
                m_popup.addDialogClose(null);
            }
            m_popup.center();
            m_popup.show();
            initialize();
            updateForm();
        } catch (Throwable t) {
            CmsErrorDialog.handleException(t);
        }
    }
553967
public static void addThemedCSSResource(String resource) {
		Map<String, Object> viewMap = FacesContext.getCurrentInstance().getViewRoot().getViewMap();
		@SuppressWarnings("unchecked")
		List<String> resourceList = (List<String>) viewMap.get(THEME_RESOURCE_KEY);
		if (null == resourceList) {
			resourceList = new ArrayList<String>();
			viewMap.put(THEME_RESOURCE_KEY, resourceList);
		}

		if (!resourceList.contains(resource)) {
			resourceList.add(resource);
		}
	}
1296748
void showVariationsWindow(String resource) {

        final Window window = CmsBasicDialog.prepareWindow(DialogWidth.max);
        CmsVariationsDialog variationsDialog = new CmsVariationsDialog(resource, new Runnable() {

            public void run() {

                window.close();

            }

        }, Mode.FlexCache);
        try {
            CmsResource resourceObject = getRootCms().readResource(CmsFlexCacheKey.getResourceName(resource));
            variationsDialog.displayResourceInfo(Collections.singletonList(resourceObject));
        } catch (CmsException e) {
            //
        }
        window.setCaption(CmsVaadinUtils.getMessageText(Messages.GUI_CACHE_VIEW_FLEX_VARIATIONS_1, resource));
        window.setContent(variationsDialog);
        UI.getCurrent().addWindow(window);
    }
11554
protected static boolean isFolder(CmsResource resource) throws CmsLoaderException {

        I_CmsResourceType resourceType = OpenCms.getResourceManager().getResourceType(resource.getTypeId());
        return resourceType.isFolder();
    }
1247793
protected void buildJsonCategoryList() {

        CmsCategoryService catService = CmsCategoryService.getInstance();
        List<CmsCategory> foundCategories = Collections.emptyList();
        String editedResource = null;
        if (CmsStringUtil.isNotEmpty(getParamResource())) {
            editedResource = getParamResource();
        }
        try {
            foundCategories = catService.readCategories(getCms(), "", true, editedResource);
        } catch (CmsException e) {
            // error reading categories
        }

        // the next lines sort the categories according to their path
        Map<String, CmsCategory> sorted = new TreeMap<String, CmsCategory>();

        Iterator<CmsCategory> i = foundCategories.iterator();
        while (i.hasNext()) {
            CmsCategory category = i.next();
            String categoryPath = category.getPath();
            if (sorted.get(categoryPath) != null) {
                continue;
            }
            sorted.put(categoryPath, category);
        }

        foundCategories = new ArrayList<CmsCategory>(sorted.values());
        JSONArray categories = new JSONArray();
        i = foundCategories.iterator();
        while (i.hasNext()) {
            CmsCategory cat = i.next();

            JSONObject jsonObj = new JSONObject();
            try {
                // 1: category title
                jsonObj.put("title", cat.getTitle());
                // 2: category path
                jsonObj.put("path", cat.getPath());
                // 3: category root path
                jsonObj.put("rootpath", cat.getRootPath());
                // 4 category level
                jsonObj.put("level", CmsResource.getPathLevel(cat.getPath()));
                // 4: active flag
                jsonObj.put("active", false);
                categories.put(jsonObj);
            } catch (JSONException e) {
                // TODO: error handling
            }
        }
        JspWriter out = getJsp().getJspContext().getOut();
        try {
            out.print(categories.toString());
        } catch (IOException e) {
            if (LOG.isErrorEnabled()) {
                LOG.error(e.getLocalizedMessage(), e);
            }
        }

    }
910097
public void addCategory(String category) throws JSONException {
		logger.debug("Adding category [" + category + "]");
		put("category", category, this.apsDictionary, true);
	}
5237
public void openFirstLevel() {

        if (!m_categories.isEmpty()) {
            for (int i = 0; i < m_scrollList.getWidgetCount(); i++) {
                CmsTreeItem item = (CmsTreeItem)m_scrollList.getItem(i);
                item.setOpen(true);
            }
        }
    }
737980
void openAddUserDialog() {

        CmsPrincipalSelectDialog dialog;

        final Window window = CmsBasicDialog.prepareWindow(DialogWidth.max);

        dialog = new CmsPrincipalSelectDialog(
            this,
            m_stateBean.getPath(),
            window,
            WidgetType.userwidget,
            true,
            WidgetType.userwidget);

        try {
            dialog.setOuComboBoxEnabled(
                !OpenCms.getOrgUnitManager().readOrganizationalUnit(m_cms, m_stateBean.getPath()).hasFlagWebuser()
                    | m_stateBean.getType().equals(CmsOuTreeType.ROLE));
        } catch (CmsException e) {
            LOG.error("Can not read OU.", e);
        }
        window.setCaption(CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_ADD_USER_TO_GROUP_0));
        window.setContent(dialog);
        A_CmsUI.get().addWindow(window);

    }
977433
private void loadCategories() {

        CmsRpcAction<List<CmsCategoryTreeEntry>> action = new CmsRpcAction<List<CmsCategoryTreeEntry>>() {

            @Override
            public void execute() {

                start(200, true);
                CmsCoreProvider.getService().getCategoriesForSitePath(m_dialogBean.getReferenceSitePath(), this);
            }

            @Override
            protected void onResponse(List<CmsCategoryTreeEntry> result) {

                m_dialogBean.setCategories(result);
                m_handler.setCategoriesTabContent(result, new ArrayList<String>());
                m_handler.onCategoriesTabSelection();
                stop(false);
            }
        };
        action.execute();
    }
226568
protected void performSingleResourceOperation(String resourceName, int dialogAction) throws CmsException {

        // store original name to use for lock action
        String originalResourceName = resourceName;
        CmsResource res = getCms().readResource(resourceName, CmsResourceFilter.ALL);
        if (res.isFolder() && !resourceName.endsWith("/")) {
            resourceName += "/";
        }
        org.opencms.lock.CmsLock lock = getCms().getLock(res);
        // perform action depending on dialog uri
        switch (dialogAction) {
            case TYPE_LOCKCHANGE:
            case TYPE_LOCK:
                if (lock.isNullLock()) {
                    getCms().lockResource(originalResourceName);
                } else if (!lock.isDirectlyOwnedInProjectBy(getCms())) {
                    getCms().changeLock(resourceName);
                }
                break;
            case TYPE_UNLOCK:
            default:
                if (lock.isNullLock()) {
                    break;
                }
                if (lock.isOwnedBy(getCms().getRequestContext().getCurrentUser())) {
                    getCms().unlockResource(resourceName);
                }
        }
    }
584360
private void loadGalleries() {

        CmsRpcAction<List<CmsGalleryFolderBean>> action = new CmsRpcAction<List<CmsGalleryFolderBean>>() {

            @Override
            public void execute() {

                start(200, true);
                List<String> types = new ArrayList<String>();
                for (CmsResourceTypeBean type : m_dialogBean.getTypes()) {
                    types.add(type.getType());
                }

                getGalleryService().getGalleries(types, this);
            }

            @Override
            protected void onResponse(List<CmsGalleryFolderBean> result) {

                m_dialogBean.setGalleries(result);
                m_handler.setGalleriesTabContent(result, m_searchObject.getGalleries());
                m_handler.onGalleriesTabSelection();
                stop(false);
            }
        };
        action.execute();
    }
951405
public void addExcludeResource(String resource) {

        if (LOG.isDebugEnabled()) {
            LOG.debug(Messages.get().getBundle().key(Messages.LOG_ADD_MOD_EXCLUDERESOURCE_1, resource));
        }
        m_excluderesources.add(resource);
    }
231296
protected void openGalleryDialog() {

        if (m_popup == null) {
            m_popup = createPopup();
            m_popup.center();
        } else {
            if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(getCurrentElement())) {
                m_popup.searchElement(getCurrentElement());
            } else {
                m_popup.center();
            }
        }
    }
345117
protected void setResource(CmsObject cms, CmsResource resource) {

        m_resource = CmsJspResourceWrapper.wrap(cms, resource);
    }
910308
protected void openDialog() {

        CmsCreateModelPageDialog dialog = new CmsCreateModelPageDialog(
            CmsSitemapView.getInstance().getController(),
            m_isModelGroup);
        dialog.center();
    }
1327327
protected void openFileSelector() {

        try {

            final Window window = CmsBasicDialog.prepareWindow(DialogWidth.max);
            window.setCaption(m_fileSelectCaption != null ? m_fileSelectCaption : getWindowCaption());
            A_CmsUI.get().addWindow(window);
            CmsResourceSelectDialog fileSelect;

            //Switch if cms object was set.
            if (m_cms == null) {
                fileSelect = new CmsResourceSelectDialog(m_filter, A_CmsUI.getCmsObject(), getOptions());
            } else {
                fileSelect = new CmsResourceSelectDialog(m_filter, m_cms, getOptions());
            }
            if (m_diableSiteSwitch) {
                fileSelect.disableSiteSwitch();
            }
            fileSelect.showSitemapView(m_startWithSitemapView);

            T value = getValue();
            if (value instanceof CmsResource) {
                fileSelect.showStartResource((CmsResource)value);
            } else if (value instanceof String) {
                if (CmsStringUtil.isEmptyOrWhitespaceOnly((String)value)) {
                    fileSelect.openPath(m_defaultPath);
                } else {
                    fileSelect.openPath((String)value);
                }
            }

            window.setContent(fileSelect);
            fileSelect.addSelectionHandler(new I_CmsSelectionHandler<CmsResource>() {

                public void onSelection(CmsResource selected) {

                    if (!resourceIsValid(selected)) {
                        return;
                    }
                    setResourceValue(selected);
                    window.close();

                }
            });
        } catch (CmsException e) {
            LOG.error(e.getLocalizedMessage(), e);
            CmsErrorDialog.showErrorDialog(e);
        }
    }