Improve media management in DocBook.
[gpl/argeo-suite.git] / publishing / org.argeo.publishing.ui / src / org / argeo / docbook / ui / DbkContextMenu.java
index ef2695a778831db7518994d820472bd3fa286bd0..77248d6f140fa065ed6a30e7c7f4bcfedea449d5 100644 (file)
@@ -66,6 +66,7 @@ class DbkContextMenu {
                        Img img = (Img) editablePart;
                        deletePartB(parent, DbkMsg.deleteMedia.lead(), img);
                        insertMediaB(parent, DbkMsg.insertMedia.lead(), img);
+                       insertParagraphB(parent, DbkMsg.insertParagraph.lead(), img);
 
                } else if (editablePart instanceof DocBookSectionTitle) {
                        DocBookSectionTitle sectionTitle = (DocBookSectionTitle) editablePart;
@@ -145,6 +146,15 @@ class DbkContextMenu {
 
        }
 
+       protected void insertParagraphB(Composite parent, String msg, SectionPart sectionPart) {
+               Label insertMediaB = new Label(parent, SWT.NONE);
+               insertMediaB.setText(msg);
+               insertMediaB.addMouseListener((MouseDown) (e) -> {
+                       textViewer.addParagraph(sectionPart, null);
+                       hide();
+               });
+       }
+
        protected void deletePartB(Composite parent, String msg, SectionPart sectionPart) {
                Label deleteB = new Label(shell, SWT.NONE);
                deleteB.setText(msg);