Refactor DocBook attributes.
[gpl/argeo-suite.git] / publishing / org.argeo.publishing.ui / src / org / argeo / docbook / ui / DocumentTextEditor.java
index aeafcd3466557014c529d84fd8a6494c51cdf1e8..bac3fc36f8544e18530771d6f18065a0a9504dca 100644 (file)
@@ -1,14 +1,13 @@
 package org.argeo.docbook.ui;
 
 import javax.jcr.Node;
-import javax.jcr.Property;
 import javax.jcr.RepositoryException;
 
 import org.argeo.cms.text.TextSection;
 import org.argeo.cms.ui.CmsEditable;
 import org.argeo.cms.ui.util.CmsUiUtils;
-import org.argeo.jcr.Jcr;
-import org.argeo.jcr.JcrxType;
+import org.argeo.docbook.DbkUtils;
+import org.argeo.docbook.DbkType;
 import org.eclipse.swt.widgets.Composite;
 
 /** Text editor where sections and subsections can be managed by the user. */
@@ -24,8 +23,7 @@ public class DocumentTextEditor extends AbstractDbkViewer {
        @Override
        protected void initModel(Node textNode) throws RepositoryException {
                if (isFlat()) {
-                       textNode.addNode(DocBookNames.DBK_PARA, DocBookTypes.PARA).addNode(Jcr.JCR_XMLTEXT, JcrxType.JCRX_XMLTEXT)
-                                       .setProperty(Jcr.JCR_XMLCHARACTERS, "");
+                       DbkUtils.addParagraph(textNode, "");
                }
 //             else
 //                     textNode.setProperty(DocBookNames.DBK_TITLE, textNode.getName());
@@ -33,8 +31,8 @@ public class DocumentTextEditor extends AbstractDbkViewer {
 
        @Override
        protected Boolean isModelInitialized(Node textNode) throws RepositoryException {
-               return textNode.hasProperty(Property.JCR_TITLE) || textNode.hasNode(DocBookNames.DBK_PARA)
-                               || (!isFlat() && textNode.hasNode(DocBookNames.DBK_SECTION));
+               return textNode.hasNode(DbkType.title.get()) || textNode.hasNode(DbkType.para.get())
+                               || (!isFlat() && textNode.hasNode(DbkType.section.get()));
        }
 
 }