X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=publishing%2Forg.argeo.publishing.ui%2Fsrc%2Forg%2Fargeo%2Fdocbook%2Fui%2FDbkContextMenu.java;h=6046bf2c9ce5c537761c43101131dff5ba789268;hb=752a7b2614895002a3d184be166ef4162caf0d05;hp=77248d6f140fa065ed6a30e7c7f4bcfedea449d5;hpb=f4c6893c66cd619e699cb9392ff8c45367796154;p=gpl%2Fargeo-suite.git diff --git a/publishing/org.argeo.publishing.ui/src/org/argeo/docbook/ui/DbkContextMenu.java b/publishing/org.argeo.publishing.ui/src/org/argeo/docbook/ui/DbkContextMenu.java index 77248d6..6046bf2 100644 --- a/publishing/org.argeo.publishing.ui/src/org/argeo/docbook/ui/DbkContextMenu.java +++ b/publishing/org.argeo.publishing.ui/src/org/argeo/docbook/ui/DbkContextMenu.java @@ -5,8 +5,6 @@ import java.util.List; import javax.jcr.Node; -import org.argeo.cms.text.Paragraph; -import org.argeo.cms.text.TextSection; import org.argeo.cms.ui.CmsEditable; import org.argeo.cms.ui.util.CmsUiUtils; import org.argeo.cms.ui.viewers.EditablePart; @@ -60,16 +58,16 @@ class DbkContextMenu { if (editablePart instanceof Paragraph) { Paragraph paragraph = (Paragraph) editablePart; deletePartB(parent, DbkMsg.deleteParagraph.lead(), paragraph); - insertMediaB(parent, DbkMsg.insertMedia.lead(), paragraph); + insertMediaB(parent, paragraph); } else if (editablePart instanceof Img) { Img img = (Img) editablePart; deletePartB(parent, DbkMsg.deleteMedia.lead(), img); - insertMediaB(parent, DbkMsg.insertMedia.lead(), img); + insertMediaB(parent, img); insertParagraphB(parent, DbkMsg.insertParagraph.lead(), img); - } else if (editablePart instanceof DocBookSectionTitle) { - DocBookSectionTitle sectionTitle = (DocBookSectionTitle) editablePart; + } else if (editablePart instanceof DbkSectionTitle) { + DbkSectionTitle sectionTitle = (DbkSectionTitle) editablePart; TextSection section = sectionTitle.getSection(); if (!section.isTitleReadOnly()) { Label deleteB = new Label(shell, SWT.NONE); @@ -79,7 +77,7 @@ class DbkContextMenu { hide(); }); } - insertMediaB(parent, DbkMsg.insertMedia.lead(), sectionTitle.getSection(), sectionTitle); + insertMediaB(parent, sectionTitle.getSection(), sectionTitle); } StyledToolMouseListener stml = new StyledToolMouseListener(editablePart); @@ -130,19 +128,27 @@ class DbkContextMenu { shell.setVisible(false); } - protected void insertMediaB(Composite parent, String msg, SectionPart sectionPart) { - insertMediaB(parent, msg, sectionPart.getSection(), sectionPart); + protected void insertMediaB(Composite parent, SectionPart sectionPart) { + insertMediaB(parent, sectionPart.getSection(), sectionPart); } - protected void insertMediaB(Composite parent, String msg, Section section, NodePart nodePart) { - Label insertMediaB = new Label(parent, SWT.NONE); - insertMediaB.setText(DbkMsg.insertMedia.lead()); - insertMediaB.addMouseListener((MouseDown) (e) -> { + protected void insertMediaB(Composite parent, Section section, NodePart nodePart) { + Label insertPictureB = new Label(parent, SWT.NONE); + insertPictureB.setText(DbkMsg.insertPicture.lead()); + insertPictureB.addMouseListener((MouseDown) (e) -> { Node newNode = DbkUtils.insertImageAfter(nodePart.getNode()); Jcr.save(newNode); textViewer.insertPart(section, newNode); hide(); }); + Label insertVideoB = new Label(parent, SWT.NONE); + insertVideoB.setText(DbkMsg.insertVideo.lead()); + insertVideoB.addMouseListener((MouseDown) (e) -> { + Node newNode = DbkUtils.insertVideoAfter(nodePart.getNode()); + Jcr.save(newNode); + textViewer.insertPart(section, newNode); + hide(); + }); }