/** */ private IDOMDocumentType findDocumentType(IDOMDocument document) { IDOMDocumentType documentType = (IDOMDocumentType) document.getDoctype(); if (documentType != null && documentType.getExistingAdapter(DocumentTypeAdapter.class) == null) { // watch future changes documentType.addAdapter(this); } return documentType; }
name = "HTML"; // default //$NON-NLS-1$ if (docType != null) { if (!name.equals(docType.getName())) { // replace Node parent = docType.getParentNode(); child = docType; docType = (IDOMDocumentType) document.createDoctype(name); insertBreak(model, child); docType.setPublicId(publicId); if (entry != null) { String systemId = entry.getSystemId(); if (systemId != null) docType.setSystemId(systemId); String namespaceURI = entry.getNamespaceURI(); if (namespaceURI != null) {
protected void updateDoctype(EditDoctypeDialog dialog, DocumentType doctype) { if (doctype instanceof IDOMDocumentType) { IDOMDocumentType doctypeImpl = (IDOMDocumentType) doctype; if (doctypeImpl.getName().equals(dialog.getName())) { doctypeImpl.setPublicId(dialog.getPublicId()); doctypeImpl.setSystemId(dialog.getSystemId()); } else { // we need to create a new one and remove the old // Document document = doctype.getOwnerDocument(); DocumentType newDoctype = createDoctype(dialog, document); document.insertBefore(newDoctype, doctype); document.removeChild(doctype); // manager.reformat(newDoctype, false); } } } }
protected DocumentType createDoctype(EditDoctypeDialog dialog, Document document) { DocumentType result = null; if (document instanceof DocumentImpl) { IDOMDocument documentImpl = (IDOMDocument) document; IDOMDocumentType doctypeImpl = (IDOMDocumentType) documentImpl.createDoctype(dialog.getName()); doctypeImpl.setPublicId(dialog.getPublicId()); doctypeImpl.setSystemId(dialog.getSystemId()); result = doctypeImpl; } return result; }