pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1865856 - /pdfbox/branches/issue45/debugger/src/main/java/org/apache/pdfbox/debugger/ui/Tree.java
Date Sat, 24 Aug 2019 16:43:29 GMT
Author: tilman
Date: Sat Aug 24 16:43:28 2019
New Revision: 1865856

URL: http://svn.apache.org/viewvc?rev=1865856&view=rev
Log:
PDFBOX-4071: refactor

Modified:
    pdfbox/branches/issue45/debugger/src/main/java/org/apache/pdfbox/debugger/ui/Tree.java

Modified: pdfbox/branches/issue45/debugger/src/main/java/org/apache/pdfbox/debugger/ui/Tree.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue45/debugger/src/main/java/org/apache/pdfbox/debugger/ui/Tree.java?rev=1865856&r1=1865855&r2=1865856&view=diff
==============================================================================
--- pdfbox/branches/issue45/debugger/src/main/java/org/apache/pdfbox/debugger/ui/Tree.java
(original)
+++ pdfbox/branches/issue45/debugger/src/main/java/org/apache/pdfbox/debugger/ui/Tree.java
Sat Aug 24 16:43:28 2019
@@ -106,31 +106,33 @@ public class Tree extends JTree
             obj = ((ArrayEntry) obj).getValue();
         }
 
-        if (obj instanceof COSStream)
+        if (!(obj instanceof COSStream))
         {
-            treePopupMenu.addSeparator();
-            
-            COSStream stream = (COSStream) obj;
-            treePopupMenu.add(getStreamSaveMenu(stream, nodePath));
-            
-            if (stream.getFilters() != null)
+            return;
+        }
+
+        treePopupMenu.addSeparator();
+
+        COSStream stream = (COSStream) obj;
+        treePopupMenu.add(getStreamSaveMenu(stream, nodePath));
+
+        if (stream.getFilters() != null)
+        {
+            if (stream.getFilters() instanceof COSArray && ((COSArray) stream.getFilters()).size()
>= 2)
             {
-                if (stream.getFilters() instanceof COSArray && ((COSArray) stream.getFilters()).size()
>= 2)
+                for (JMenuItem menuItem : getPartiallyDecodedStreamSaveMenu(stream))
                 {
-                    for (JMenuItem menuItem : getPartiallyDecodedStreamSaveMenu(stream))
-                    {
-                        treePopupMenu.add(menuItem);
-                    }
+                    treePopupMenu.add(menuItem);
                 }
-                treePopupMenu.add(getRawStreamSaveMenu(stream));
             }
+            treePopupMenu.add(getRawStreamSaveMenu(stream));
+        }
 
-            JMenuItem open = getFileOpenMenu(stream, nodePath);
-            if (open != null)
-            {
-                treePopupMenu.addSeparator();
-                treePopupMenu.add(open);
-            }
+        JMenuItem open = getFileOpenMenu(stream, nodePath);
+        if (open != null)
+        {
+            treePopupMenu.addSeparator();
+            treePopupMenu.add(open);
         }
     }
 
@@ -188,23 +190,20 @@ public class Tree extends JTree
     {
         StringBuilder sb = new StringBuilder();
         COSBase filters = cosStream.getFilters();
-        if (filters != null)
+        if (filters instanceof COSName)
         {
-            if (filters instanceof COSName)
-            {
-                sb.append(((COSName) filters).getName());
-            }
-            else if (filters instanceof COSArray)
+            sb.append(((COSName) filters).getName());
+        }
+        else if (filters instanceof COSArray)
+        {
+            COSArray filterArray = (COSArray) filters;
+            for (int i = 0; i < filterArray.size(); i++)
             {
-                COSArray filterArray = (COSArray) filters;
-                for (int i = 0; i < filterArray.size(); i++)
+                if (i > 0)
                 {
-                    if (i > 0)
-                    {
-                        sb.append(", ");
-                    }
-                    sb.append(((COSName) filterArray.get(i)).getName());
+                    sb.append(", ");
                 }
+                sb.append(((COSName) filterArray.get(i)).getName());
             }
         }
         return sb.toString();



Mime
View raw message