Opens the content editor.<p>

@param isNew <code>true</code> to create and edit a new resource
@param mode the content creation mode
336418
protected void openEditDialog(boolean isNew, String mode) {

        // create a form to submit a post request to the editor JSP
        Map<String, String> formValues = new HashMap<String, String>();
        if (m_editableData.getSitePath() != null) {
            formValues.put("resource", m_editableData.getSitePath());
        }
        if (m_editableData.getElementLanguage() != null) {
            formValues.put("elementlanguage", m_editableData.getElementLanguage());
        }
        if (m_editableData.getElementName() != null) {
            formValues.put("elementname", m_editableData.getElementName());
        }
        String backlink = CmsCoreProvider.get().getUri();
        if (Window.Location.getPath().endsWith(backlink)) {
            // CmsCoreProvider.get().getUri() is the request context uri from the time the direct edit provider
            // includes are generated. In case the template has changed the request context uri before that point,
            // we don't append the request parameters, as they may be inappropriate for the new URI.
            backlink += Window.Location.getQueryString();
        }
        formValues.put("backlink", backlink);
        formValues.put("redirect", "true");
        formValues.put("directedit", "true");
        formValues.put("nofoot", "1");
        formValues.put("editcontext", CmsCoreProvider.get().getUri());
        String postCreateHandler = m_editableData.getPostCreateHandler();
        if (postCreateHandler != null) {
            formValues.put(CmsEditorConstants.PARAM_POST_CREATE_HANDLER, postCreateHandler);
        }
        if (mode != null) {
            formValues.put(CmsEditorConstants.PARAM_MODE, mode);
        }

        if (isNew) {
            formValues.put("newlink", m_editableData.getNewLink());
            formValues.put("editortitle", m_editableData.getNewTitle());
        }
        FormElement formElement = CmsDomUtil.generateHiddenForm(
            CmsCoreProvider.get().link(CmsCoreProvider.get().getContentEditorUrl()),
            Method.post,
            Target.TOP,
            formValues);
        getMarkerTag().appendChild(formElement);
        formElement.submit();
    }
1079635
protected A_CmsPropertyEditor createEntryEditor(
        I_CmsPropertyEditorHandler handler,
        Map<String, CmsXmlContentProperty> propConfig) {

        if (CmsSitemapView.getInstance().isNavigationMode()) {
            return new CmsNavModePropertyEditor(propConfig, handler);
        } else {
            boolean isFolder = handler.isFolder();
            CmsVfsModePropertyEditor result = new CmsVfsModePropertyEditor(propConfig, handler);
            result.setShowResourceProperties(!isFolder);
            return result;
        }
    }
929438
public void setMode(final String mode) {
        this.mode = Strings.toLowerCase(mode);
        if (mode == null || !MODES.contains(mode)) {
            throw new IllegalArgumentException("Invalid mode [" + mode + "]");
        }
    }
724011
void startThread() {

        m_reportPanel.setVisible(true);
        m_startPanel.setVisible(false);
        m_report.setVisible(false);
        CmsStaticExportThread thread = new CmsStaticExportThread(A_CmsUI.getCmsObject());
        CmsReportWidget report = new CmsReportWidget(thread);
        report.setHeight("500px");
        report.setWidth("100%");
        m_layout.addComponent(report);
        thread.start();
    }
848814
public void openModelResourceSelect(
        final CmsContainerPageElementPanel element,
        List<CmsModelResourceInfo> modelResources) {

        I_CmsModelSelectHandler handler = new I_CmsModelSelectHandler() {

            public void onModelSelect(CmsUUID modelStructureId) {

                m_controller.createAndEditNewElement(element, modelStructureId);
            }
        };
        String title = org.opencms.gwt.client.Messages.get().key(
            org.opencms.gwt.client.Messages.GUI_MODEL_SELECT_TITLE_0);
        String message = org.opencms.gwt.client.Messages.get().key(
            org.opencms.gwt.client.Messages.GUI_MODEL_SELECT_MESSAGE_0);
        CmsModelSelectDialog dialog = new CmsModelSelectDialog(handler, modelResources, title, message);
        dialog.center();
    }
1224804
public void openEditorForHistory(String historyHash) {

        if (historyHash.startsWith(EDITOR_HASH_KEY)) {
            if (!m_editorOpened) {
                m_editorOpened = true;
                CmsDebugLog.getInstance().printLine("EditorHandler - Opening editor from history");
                m_handler.m_controller.setContentEditing(true);
                String id = historyHash.substring(EDITOR_HASH_KEY.length(), historyHash.indexOf(";"));
                if (id.contains(",")) {
                    String[] ids = id.split(",");
                    m_currentElementId = URL.decodePathSegment(ids[0]);
                    m_dependingElementId = URL.decodePathSegment(ids[1]);
                } else {
                    m_currentElementId = URL.decodePathSegment(id);
                }
                I_CmsSimpleCallback<Boolean> onClose = new I_CmsSimpleCallback<Boolean>() {

                    public void execute(Boolean hasChangedSettings) {

                        addClosedEditorHistoryItem();
                        onClose(null, new CmsUUID(getCurrentElementId()), false, hasChangedSettings.booleanValue());
                    }
                };
                String editorLocale = CmsCoreProvider.get().getLocale();

                CmsContentEditor.getInstance().openFormEditor(
                    getEditorContext(),
                    editorLocale,
                    m_currentElementId,
                    null,
                    null,
                    null,
                    null,
                    null,
                    m_handler.m_controller.getData().getMainLocale(),
                    null,
                    onClose);
            }
        } else {
            closeContentEditor();
        }
    }
1362477
public void createAndEditNewElement(
        final org.opencms.ade.containerpage.client.ui.CmsContainerPageElementPanel element,
        final boolean inline) {

        if (!element.isNew()) {
            return;
        }

        final CmsContainer container = m_containers.get(element.getParentTarget().getContainerId());

        m_handler.showPageOverlay();
        CmsRpcAction<CmsCreateElementData> action = new CmsRpcAction<CmsCreateElementData>() {

            /**
             * @see org.opencms.gwt.client.rpc.CmsRpcAction#execute()
             */
            @Override
            public void execute() {

                getContainerpageService().checkCreateNewElement(
                    CmsCoreProvider.get().getStructureId(),
                    element.getId(),
                    element.getNewType(),
                    container,
                    getLocale(),
                    this);

            }

            /**
             * @see org.opencms.gwt.client.rpc.CmsRpcAction#onResponse(java.lang.Object)
             */
            @Override
            protected void onResponse(CmsCreateElementData result) {

                if (result.needsModelSelection()) {
                    getHandler().openModelResourceSelect(element, result.getModelResources());
                } else {
                    openEditorForNewElement(element, result.getCreatedElement(), inline);
                }
            }
        };
        action.execute();
    }
566420
public void initContent(CmsResourceStatusBean status) {

        m_infoBoxContainer.clear();
        CmsListItemWidget infoBox = new CmsListItemWidget(status.getListInfo());
        infoBox.addOpenHandler(new OpenHandler<CmsListItemWidget>() {

            public void onOpen(OpenEvent<CmsListItemWidget> event) {

                CmsDomUtil.resizeAncestor(getParent());
            }
        });
        infoBox.addCloseHandler(new CloseHandler<CmsListItemWidget>() {

            public void onClose(CloseEvent<CmsListItemWidget> event) {

                CmsDomUtil.resizeAncestor(getParent());
            }
        });
        CmsContextMenuButton menuButton = new CmsContextMenuButton(
            status.getStructureId(),
            m_menuHandler,
            AdeContext.resourceinfo);
        menuButton.addStyleName(I_CmsLayoutBundle.INSTANCE.listItemWidgetCss().permaVisible());
        infoBox.addButton(menuButton);
        m_infoBoxContainer.add(infoBox);
        m_dateCreated.setText(status.getDateCreated());
        m_dateExpired.setText(status.getDateExpired());
        m_dateLastModified.setText(status.getDateLastModified());
        m_dateReleased.setText(status.getDateReleased());
        m_lastProject.setText(status.getLastProject());
        m_lockState.setText(status.getLockState());
        CmsResourceState state = status.getStateBean();
        String stateStyle = CmsResourceStateUtil.getStateStyle(state);
        String stateText = CmsResourceStateUtil.getStateName(state);
        m_state.setText(makeSpan(stateStyle, stateText));
        m_title.setText(status.getTitle());
        m_navText.setText(status.getNavText());
        m_permissions.setText(status.getPermissions());
        m_resourceType.setText(status.getResourceType());
        m_size.setText("" + status.getSize() + " Bytes");
        m_userCreated.setText(status.getUserCreated());
        m_userLastModified.setText(status.getUserLastModified());

        List<String> locales = status.getLocales();
        if (locales != null) {
            StringBuffer buffer = new StringBuffer();
            int index = 0;
            for (String locale : locales) {
                if (locale.equals(CmsCoreProvider.get().getLocale())) {
                    buffer.append("<b>");
                    buffer.append(locale);
                    buffer.append("</b>");
                } else {
                    buffer.append(locale);
                }
                if (index != (locales.size() - 1)) {
                    buffer.append(", ");
                }
                index += 1;
            }
            m_locales.setText(buffer.toString());
        } else {
            m_locales.setText("");
        }
        m_additionalParams.clear();
        if (status.getAdditionalAttributes() != null) {
            for (Entry<String, String> entry : status.getAdditionalAttributes().entrySet()) {
                CmsResourceInfoLine line = new CmsResourceInfoLine();
                line.setLabel(entry.getKey());
                line.setText(entry.getValue());
                m_additionalParams.add(line);
            }
        }

    }
1322633
private void initHasMasterMode() throws CmsException {

        if (hasDescriptor()
            && m_cms.hasPermissions(m_desc, CmsPermissionSet.ACCESS_WRITE, false, CmsResourceFilter.ALL)) {
            m_hasMasterMode = true;
        } else {
            m_hasMasterMode = false;
        }
    }
832513
public void setOpen(boolean open) {

        m_opened = open;
        if (m_opened) {
            // show content
            m_visibilityStyle.setValue(
                I_CmsLayoutBundle.INSTANCE.generalCss().cornerAll()
                    + " "
                    + I_CmsLayoutBundle.INSTANCE.fieldsetCss().fieldsetVisible());
            m_opener.setDown(true);
        } else {
            // hide content
            m_visibilityStyle.setValue(I_CmsLayoutBundle.INSTANCE.fieldsetCss().fieldsetInvisible());
            m_opener.setDown(false);
        }
        CmsDomUtil.resizeAncestor(getParent());
    }
1276326
static void openEditor(String targetPath) {

        String siteRoot = CmsCoreProvider.get().getSiteRoot();
        if (targetPath.startsWith(siteRoot)) {
            targetPath = targetPath.substring(siteRoot.length());
            // prepend slash if necessary
            if (!targetPath.startsWith("/")) {
                targetPath = "/" + targetPath;
            }
        }
        CmsSitemapController controller = CmsSitemapView.getInstance().getController();
        controller.leaveEditor(targetPath);
    }
253250
public FileOutputStream openFileOutput(String name, int mode) throws FileNotFoundException {
        if (this.svgCacheDir != null) {
            return new FileOutputStream(new File(this.svgCacheDir, name), mode == Context.MODE_APPEND);
        }
        return this.application.openFileOutput(name, mode);
    }
681515
protected void openNewDialog() {

        final Window window = CmsBasicDialog.prepareWindow(DialogWidth.wide);
        CmsBasicDialog dialog = new CmsNewElementDialog(m_cms, m_stateBean.getPath(), window, this);
        window.setContent(dialog);
        window.setCaption(CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_ADD_ELEMENT_0));
        A_CmsUI.get().addWindow(window);
    }
116726
@Override
    public EditMode editMode() {
        if(readInputrc) {
            try {
                return EditModeBuilder.builder().parseInputrc(new FileInputStream(inputrc())).create();
            }
            catch(FileNotFoundException e) {
                return EditModeBuilder.builder(mode()).create();
            }
        }
        else
            return EditModeBuilder.builder(mode()).create();
    }
1030009
boolean addContext(boolean isRoot, Vector names, Mode mode) {
    if (modeMap == null)
      modeMap = new ContextMap();
    return modeMap.put(isRoot, names, mode);
  }
825340
public void openStandAloneFormEditor(final CmsEditorContext context) {

        initEventPreviewHandler();
        final CmsContentDefinition definition;
        try {
            definition = (CmsContentDefinition)CmsRpcPrefetcher.getSerializedObjectFromDictionary(
                getService(),
                I_CmsContentService.DICT_CONTENT_DEFINITION);
        } catch (SerializationException e) {
            RootPanel.get().add(new Label(e.getMessage()));
            return;
        }
        m_isStandAlone = true;
        if (definition.isModelInfo()) {
            openModelSelectDialog(context, definition);
        } else {
            CmsCoreProvider.get().lock(
                CmsContentDefinition.entityIdToUuid(definition.getEntityId()),
                new I_CmsSimpleCallback<Boolean>() {

                    public void execute(Boolean arg) {

                        if (arg.booleanValue()) {

                            registerContentDefinition(definition);
                            // register all external widgets
                            WidgetRegistry.getInstance().registerExternalWidgets(
                                definition.getExternalWidgetConfigurations(),
                                new Command() {

                                    public void execute() {

                                        initEditor(context, definition, null, false, null);
                                    }
                                });

                        } else {
                            showLockedResourceMessage();
                        }
                    }
                });
        }
    }
227769
public boolean isEditorAvailableForResource(CmsResource res) {

        I_CmsResourceType type = OpenCms.getResourceManager().getResourceType(res);
        String typeName = type.getTypeName();
        for (CmsWorkplaceEditorConfiguration editorConfig : m_editorConfigurations) {
            if (editorConfig.matchesResourceType(typeName)) {
                return true;
            }
        }
        return false;
    }