class: CharacterArray
authorClaus Gittinger <cg@exept.de>
Tue, 29 Sep 2015 19:19:19 +0200
changeset 15860 36337d6ff223
parent 15858 720be96ab3bd
child 15861 64bd3e69ee09
class: CharacterArray changed: #inspector2TabBytes #inspector2Tabs
extensions.st
--- a/extensions.st	Thu Sep 24 15:23:20 2015 +0200
+++ b/extensions.st	Tue Sep 29 19:19:19 2015 +0200
@@ -412,7 +412,7 @@
 
     ^self newInspector2Tab
         label: 'Bytes';
-        priority: 25;
+        priority: 39;
         view: ((HVScrollableView for:EditTextView) 
                 autoHideVerticalScrollBar:true;        
                 contents: (self size < 10000 "/ ouch - ever tried to inspect a 5Mb string?
@@ -488,13 +488,41 @@
 
 !CharacterArray methodsFor:'inspecting'!
 
+inspector2TabXMLTree
+    "extra tab to be shown in an inspector2."
+
+    |tabClass tab sub xmlInspectorClass xmlParserClass|
+
+    (self startsWith:'<?xml') ifFalse:[^ nil].
+    
+    "return an extra XML-dom tab to be used inside an inspector"
+
+    "/ avoid generating a dependency here
+    (tabClass := Smalltalk at: #'Tools::Inspector2Tab') isNil ifTrue:[^ nil].
+    tab := tabClass new.
+
+    "/ to prevent the dependcy walker from adding libtool2 to the package:
+    (xmlInspectorClass := Smalltalk at:#'XML::XMLInspector') isNil ifTrue:[^ nil ].
+    (xmlParserClass := Smalltalk at:#'XML::XMLParser') isNil ifTrue:[^ nil ].
+
+    sub := xmlInspectorClass embeddableInspectorApplicationFor:(xmlParserClass parse:self).
+
+    ^ tab
+        label: 'XML DOM';
+        priority: 45;
+        view: sub
+! !
+
+!CharacterArray methodsFor:'inspecting'!
+
 inspector2Tabs
     ^ super inspector2Tabs 
         , #( 
             inspector2TabText 
             inspector2TabBytes 
             inspector2TabDiff 
-            inspector2TabHTML 
+            inspector2TabHTML
+            inspector2TabXMLTree
            )
 
     "Created: / 05-07-2011 / 13:40:27 / cg"