File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
src/main/java/com/itextpdf/rups/view/contextmenu Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,8 @@ This file is part of the iText (R) project.
4646import com .itextpdf .rups .view .itext .PdfTree ;
4747import com .itextpdf .rups .view .itext .treenodes .PdfObjectTreeNode ;
4848
49+ import javax .swing .tree .TreePath ;
50+
4951public abstract class AbstractPdfStreamAction extends AbstractRupsAction {
5052 protected final transient PdfReaderController controller ;
5153
@@ -72,8 +74,15 @@ protected void forceTreeRebuild(PdfObjectTreeNode root) {
7274 // be regenerated after the update. Presumably there should be a
7375 // better way to do this, but this works fine for now
7476 if (controller != null ) {
77+ final TreePath path = new TreePath (root .getPath ());
78+ boolean wasExpanded = controller .getPdfTree ().isExpanded (path );
7579 controller .deleteAllTreeChildren (root );
7680 controller .selectNode (root );
81+ if (wasExpanded ) {
82+ controller .getPdfTree ().expandPath (path );
83+ } else {
84+ controller .getPdfTree ().collapsePath (path );
85+ }
7786 }
7887 }
7988}
You can’t perform that action at this time.
0 commit comments