Create a read only edit that contains the value of the selected file. It
can be placed anywhere in the DOM.

@param sPlaceholder
The placeholder text to be used if no file is selected.
@return A node list with the edit and a JavaScript
552991
@Nonnull
  public HCNodeList createSelectedFileEdit (@Nullable final String sPlaceholder)
  {
    final HCEdit aEdit = new HCEdit ().setPlaceholder (sPlaceholder).setReadOnly (true);
    final HCScriptInline aScript = new HCScriptInline (JQuery.idRef (m_aEdit)
                                                             .on ("change",
                                                                  new JSAnonymousFunction (JQuery.idRef (aEdit)
                                                                                                 .val (JSExpr.THIS.ref ("value")))));
    return new HCNodeList ().addChildren (aEdit, aScript);
  }
1323958
public String add(BaseHolder baseHolder)
    {
        if (m_mapChildHolders == null)
            m_mapChildHolders = new MapList();
        synchronized (this)
        {
            return m_mapChildHolders.add(baseHolder);
        }
    }
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();
    }
577217
public void actionCopyElementLocale() throws JspException {

        try {
            setEditorValues(getElementLocale());
            if (!hasValidationErrors()) {
                // save content of the editor only to the temporary file
                writeContent();
                CmsObject cloneCms = getCloneCms();
                CmsUUID tempProjectId = OpenCms.getWorkplaceManager().getTempFileProjectId();
                cloneCms.getRequestContext().setCurrentProject(getCms().readProject(tempProjectId));
                // remove eventual release & expiration date from temporary file to make preview work
                cloneCms.setDateReleased(getParamTempfile(), CmsResource.DATE_RELEASED_DEFAULT, false);
                cloneCms.setDateExpired(getParamTempfile(), CmsResource.DATE_EXPIRED_DEFAULT, false);
            }
        } catch (CmsException e) {
            // show error page
            showErrorPage(this, e);
        }
    }
979794
function getSpliceNodeAtPos(context, pos, loc, value) {
  return createNode({
    start: pos,
    end: pos,
    loc: {start: loc, end: loc},
    __spliceValue: value,
  });
}
1323365
public static Map<String, Filesystem> getFilesystems(Document domainXml) {
        Map<String, Filesystem> ret = new HashMap<>();
        XPathFactory xpf = XPathFactory.instance();
        XPathExpression<Element> fsExpr = xpf.compile(XPATH_FILESYSTEM, Filters.element());
        List<Element> filesystems = fsExpr.evaluate(domainXml);
        for (Element fs : filesystems) {
            Attribute accessMode = fs.getAttribute("accessmode");
            String source = fs.getChild("source").getAttribute("dir").getValue();
            String target = fs.getChild("target").getAttribute("dir").getValue();
            boolean readOnly = fs.getChild("readonly") != null;

            ret.put(target, new Filesystem(source, target, AccessMode.valueOf(accessMode.getValue().toUpperCase(Locale.US)), readOnly));
        }
        return ret;
    }
786659
public static void editPropertiesForLocaleCompareMode(
        final CmsLocaleComparePropertyData data,
        final CmsUUID ownId,
        final CmsUUID defaultFileId,
        final String noEditReason) {

        final CmsUUID infoId;
        infoId = defaultFileId;
        Set<CmsUUID> idsForPropertyConfig = new HashSet<CmsUUID>();
        idsForPropertyConfig.add(defaultFileId);
        idsForPropertyConfig.add(ownId);

        final List<CmsUUID> propertyConfigIds = new ArrayList<CmsUUID>(idsForPropertyConfig);

        CmsRpcAction<CmsListInfoBean> action = new CmsRpcAction<CmsListInfoBean>() {

            @Override
            public void execute() {

                start(0, true);
                CmsCoreProvider.getVfsService().getPageInfo(infoId, this);
            }

            @Override
            protected void onResponse(CmsListInfoBean infoResult) {

                stop(false);
                final CmsLocaleComparePropertyHandler handler = new CmsLocaleComparePropertyHandler(data);
                handler.setPageInfo(infoResult);

                CmsRpcAction<Map<CmsUUID, Map<String, CmsXmlContentProperty>>> propertyAction = new CmsRpcAction<Map<CmsUUID, Map<String, CmsXmlContentProperty>>>() {

                    @Override
                    public void execute() {

                        start(0, true);
                        CmsCoreProvider.getVfsService().getDefaultProperties(propertyConfigIds, this);
                    }

                    @Override
                    protected void onResponse(Map<CmsUUID, Map<String, CmsXmlContentProperty>> propertyResult) {

                        stop(false);
                        Map<String, CmsXmlContentProperty> propConfig = new LinkedHashMap<String, CmsXmlContentProperty>();
                        for (Map<String, CmsXmlContentProperty> defaultProps : propertyResult.values()) {
                            propConfig.putAll(defaultProps);
                        }
                        propConfig.putAll(CmsSitemapView.getInstance().getController().getData().getProperties());
                        A_CmsPropertyEditor editor = new CmsNavModePropertyEditor(propConfig, handler);
                        editor.setPropertyNames(
                            CmsSitemapView.getInstance().getController().getData().getAllPropertyNames());
                        final CmsFormDialog dialog = new CmsFormDialog(handler.getDialogTitle(), editor.getForm());
                        CmsPropertyDefinitionButton defButton = new CmsPropertyDefinitionButton() {

                            /**
                             * @see org.opencms.gwt.client.property.definition.CmsPropertyDefinitionButton#onBeforeEditPropertyDefinition()
                             */
                            @Override
                            public void onBeforeEditPropertyDefinition() {

                                dialog.hide();
                            }

                        };
                        defButton.getElement().getStyle().setFloat(Style.Float.LEFT);
                        defButton.installOnDialog(dialog);
                        CmsDialogFormHandler formHandler = new CmsDialogFormHandler();
                        formHandler.setDialog(dialog);
                        I_CmsFormSubmitHandler submitHandler = new CmsPropertySubmitHandler(handler);
                        formHandler.setSubmitHandler(submitHandler);
                        dialog.setFormHandler(formHandler);
                        editor.initializeWidgets(dialog);
                        dialog.centerHorizontally(50);
                        dialog.catchNotifications();
                        if (noEditReason != null) {
                            editor.disableInput(noEditReason);
                            dialog.getOkButton().disable(noEditReason);
                        }

                    }
                };
                propertyAction.execute();
            }

        };
        action.execute();
    }
74385
function initAceEditor(themeId, folderName, fileName, text, mode) {
        hideImageHolder();
        $("#" + editorId).show();
        var doc = new Document(text);
        var session = new EditSession(doc, "ace/mode/" + mode);
        session.setUndoManager(new UndoManager());
        editor.setSession(session);

        //bind change event for text changes in opened file and save them.
        doc.on('change', function (e) {
            // e.type, etc
            console.log(e);
            saveFileChanges(themeId, folderName, fileName, doc.getValue());
        });
    }
355478
public void addNodeSelectField(final String fieldLabel, final SiteNode value, 
			final boolean editable, final boolean allowRoot) {
		validateNotTabbed();
		final ZapTextField text = new ZapTextField();
		text.setEditable(editable);
		if (value != null) {
			text.setText(getNodeText(value));
		}
		JButton selectButton = new JButton(Constant.messages.getString("all.button.select"));
		selectButton.setIcon(new ImageIcon(View.class.getResource("/resource/icon/16/094.png"))); // Globe icon
		selectButton.addActionListener(new java.awt.event.ActionListener() { 
			// Keep a local copy so that we can always select the last node chosen
			SiteNode node = value;
			@Override
			public void actionPerformed(java.awt.event.ActionEvent e) {
				NodeSelectDialog nsd = new NodeSelectDialog(StandardFieldsDialog.this);
				nsd.setAllowRoot(allowRoot);
				SiteNode node = nsd.showDialog(this.node);
				if (node != null) {
					text.setText(getNodeText(node));
					this.node = node;
					siteNodeSelected(fieldLabel, node);
				}
			}
		});
		JPanel panel = new JPanel();
		panel.setLayout(new GridBagLayout());
		panel.add(text, LayoutHelper.getGBC(0, 0, 1, 1.0D, 0.0D, GridBagConstraints.BOTH, new Insets(4,4,4,4)));
		panel.add(selectButton, LayoutHelper.getGBC(1, 0, 1, 0.0D, 0.0D, GridBagConstraints.BOTH, new Insets(4,4,4,4)));
		
		this.addField(fieldLabel, text, panel, 0.0D);
	}
831241
@Override
    public void addPlaceholder(String placeholder, String value) {
        placeholderMap.put(placeholder, value);
    }
388834
public static boolean hasEditable(Element element) {

        NodeList<Element> children = CmsDomUtil.querySelectorAll(FIELD_SELECTOR, element);
        return (children != null) && (children.getLength() > 0);
    }
639816
public static Element createElement(String localPart)
   {
      Document doc = getOwnerDocument();
      if (ROOT_LOGGER.isTraceEnabled()) ROOT_LOGGER.trace("createElement {}" + localPart);
      return doc.createElement(localPart);
   }
869220
function createGettersAndSetters() {
        var editor = EditorManager.getActiveEditor();
        if (!editor) {
            return;
        }
        initializeRefactoringSession(editor);

        var startIndex = current.startIndex,
            endIndex = current.endIndex,
            selectedText = current.selectedText;

        if (selectedText.length >= 1) {
            var selectionDetails = RefactoringUtils.normalizeText(selectedText, startIndex, endIndex);
            selectedText = selectionDetails.text;
            startIndex = selectionDetails.start;
            endIndex = selectionDetails.end;
        }

        var token = TokenUtils.getTokenAt(current.cm, current.cm.posFromIndex(endIndex)),
            commaString = ",",
            isLastNode,
            templateParams,
            parentNode,
            propertyEndPos;

        //Create getters and setters only if selected reference is a property
        if (token.type !== "property") {
            current.editor.displayErrorMessageAtCursor(Strings.ERROR_GETTERS_SETTERS);
            return;
        }

        parentNode = current.getParentNode(current.ast, endIndex);
        // Check if selected propery is child of a object expression
        if (!parentNode || !parentNode.properties) {
            current.editor.displayErrorMessageAtCursor(Strings.ERROR_GETTERS_SETTERS);
            return;
        }


        var propertyNodeArray = parentNode.properties;
        // Find the last Propery Node before endIndex
        var properyNodeIndex = propertyNodeArray.findIndex(function (element) {
            return (endIndex >= element.start && endIndex < element.end);
        });

        var propertyNode = propertyNodeArray[properyNodeIndex];

        //Get Current Selected Property End Index;
        propertyEndPos = editor.posFromIndex(propertyNode.end);


        //We have to add ',' so we need to find position of current property selected
        isLastNode = current.isLastNodeInScope(current.ast, endIndex);
        var nextPropertNode, nextPropertyStartPos;
        if(!isLastNode && properyNodeIndex + 1 <= propertyNodeArray.length - 1) {
            nextPropertNode = propertyNodeArray[properyNodeIndex + 1];
            nextPropertyStartPos = editor.posFromIndex(nextPropertNode.start);

            if(propertyEndPos.line !== nextPropertyStartPos.line) {
                propertyEndPos = current.lineEndPosition(current.startPos.line);
            } else {
                propertyEndPos = nextPropertyStartPos;
                commaString = ", ";
            }
        }

        var getSetPos;
        if (isLastNode) {
            getSetPos = current.document.adjustPosForChange(propertyEndPos, commaString.split("\n"),
                                                            propertyEndPos, propertyEndPos);
        } else {
            getSetPos = propertyEndPos;
        }
        templateParams = {
            "getName": token.string,
            "setName": token.string,
            "tokenName": token.string
        };

        // Replace, setSelection, IndentLine
        // We need to call batchOperation as indentLine don't have option to add origin as like replaceRange
        current.document.batchOperation(function() {
            if (isLastNode) {
                //Add ',' in the end of current line
                current.document.replaceRange(commaString, propertyEndPos, propertyEndPos);
            }

            current.editor.setSelection(getSetPos); //Selection on line end

            // Add getters and setters for given token using template at current cursor position
            current.replaceTextFromTemplate(GETTERS_SETTERS, templateParams);

            if (!isLastNode) {
                // Add ',' at the end setter
                current.document.replaceRange(commaString, current.editor.getSelection().start, current.editor.getSelection().start);
            }
        });
    }
30949
public String getXmlEditorInitMethods() throws JspException {

        StringBuffer result = new StringBuffer(1024);

        // first create JS for eventual tabs
        StringBuffer tabs = new StringBuffer(512);
        if (m_content.getHandler().getTabs().size() > 0) {
            // we have some tabs defined, initialize them using JQuery
            result.append("var xmlSelectedTab = 0;\n");
            result.append("var xmlErrorTabs = new Array();\n");
            result.append("var xmlWarningTabs = new Array();\n");
            tabs.append("\t$xmltabs = $(\"#xmltabs\").tabs({});\n");
            tabs.append("\t$xmltabs.tabs(\"select\", xmlSelectedTab);\n");
            tabs.append("\tfor (var i=0; i<xmlErrorTabs.length; i++) {\n");
            tabs.append("\t\t$(\"#OcmsTabTab\" + xmlErrorTabs[i]).addClass(\"ui-state-error\");\n");
            tabs.append("\t}\n");
            tabs.append("\tfor (var i=0; i<xmlWarningTabs.length; i++) {\n");
            tabs.append("\t\t$(\"#OcmsTabTab\" + xmlWarningTabs[i]).addClass(\"ui-state-warning\");\n");
            tabs.append("\t}\n");
        }

        // create JS for UI dialog
        result.append("var dialogTitleAddChoice = \"");
        result.append(key(Messages.GUI_EDITOR_XMLCONTENT_CHOICE_ADD_HL_0));
        result.append("\";\n");
        result.append("var dialogTitleAddSubChoice = \"");
        result.append(key(Messages.GUI_EDITOR_XMLCONTENT_CHOICE_SUB_ADD_HL_0));
        result.append("\";\n");
        result.append("var vfsPathEditorForm = \"");
        result.append(getJsp().link(CmsEditor.PATH_EDITORS + "xmlcontent/editor_form.jsp"));
        result.append("\";\n");
        result.append("if (jQuery) {\n");
        result.append("$(document).ready(function(){\n");
        result.append(tabs);
        result.append("\t$(\"#xmladdelementdialog\").dialog({\n");
        result.append("\t\ttitle: \"");
        result.append(key(Messages.GUI_EDITOR_XMLCONTENT_CHOICE_ADD_HL_0));
        result.append("\",\n");
        result.append("\t\tautoOpen: false,\n");
        result.append("\t\tbgiframe: true,\n");
        result.append("\t\tminHeight: 150,\n");
        result.append("\t\tminWidth: 300,\n");
        result.append("\t\twidth: 360,\n");
        result.append("\t\tmodal: true,\n");
        result.append("\t\tbuttons: {  \"");
        result.append(key(org.opencms.workplace.Messages.GUI_DIALOG_BUTTON_CANCEL_0));
        result.append("\": function() { $(this).dialog(\"close\"); } }\n");
        result.append("\t});\n");
        result.append("});\n");
        result.append("}\n");

        try {
            // iterate over unique widgets from collector
            Iterator<I_CmsWidget> i = getWidgetCollector().getUniqueWidgets().iterator();
            while (i.hasNext()) {
                I_CmsWidget widget = i.next();
                result.append(widget.getDialogInitMethod(getCms(), this));
                result.append("\n");
            }
        } catch (Exception e) {
            showErrorPage(e);
        }
        return result.toString();
    }
1252234
private void addScriptingLineInfo(Element jspElement) {
        JspId jspId = new JspId(jspElement.getAttributeNS(Constants.JSP_NAMESPACE, "id"));
        if (fileList.contains(jspId.getFilePath()) == false) {
            smapStratum.addFile(jspId.getFileName(), jspId.getFilePath());
            fileList.add(jspId.getFilePath()); //227804
        }
        if (jspId.getStartGeneratedLineNum() > 0) {
            CDATASection cdata = (CDATASection)jspElement.getChildNodes().item(0);
            BufferedReader reader = new BufferedReader(new StringReader(cdata.getData()));
            int skipLeadingCount = 0;
            int skipTrailingCount = 0;
            int lineCount = 0;
            boolean contentFound = false;
            try {
                for (String line = null;(line = reader.readLine()) != null;) {
                    lineCount++;
                    if (line.trim().length() < 1) {
                        if (contentFound) {
                            skipTrailingCount++;
                        }
                        else {
                            skipLeadingCount++;
                        }
                    }
                    else {
                        contentFound = true;
                        skipTrailingCount = 0;
                    }
                }
            }
            catch (IOException ex) {}
            smapStratum.addLineData(jspId.getStartSourceLineNum()+skipLeadingCount,
                                    jspId.getFileName(),
                                    lineCount - skipLeadingCount - skipTrailingCount,
                                    jspId.getStartGeneratedLineNum()+skipLeadingCount,
                                    1);
        }
    }
768120
function (value) {
        var node;

        if (value instanceof LinkedListNode) {
            node = value;
            validateNode(node, null);

            if (this.head === null) {
                this.insertNodeToEmptyList(node);
            }
            else {
                this.insertNodeBefore(this.head, node);
                this.head = node;
            }
        }
        else {
            node = new LinkedListNode(value);
            this.addFirst(node);
        }

        return node;
    }
411803
CmsContainerElementBean getElementForEditHandler(DialogContext context) {

        List<Item> selected = context.getSelectedItems();
        if (selected.size() == 1) {
            Item item = selected.get(0);
            Date instanceDate = (Date)item.getItemProperty(INSTANCEDATE_PROPERTY).getValue();
            CmsResource resource = context.getResources().get(0);
            return new CmsContainerElementBean(
                resource.getStructureId(),
                null,
                Collections.singletonMap(
                    CmsDateSeriesEditHandler.PARAM_INSTANCEDATE,
                    String.valueOf(instanceDate.getTime())),
                false);
        }
        return null;
    }