equal
deleted
inserted
replaced
447 inspector2TabBytes |
447 inspector2TabBytes |
448 |bytesShown| |
448 |bytesShown| |
449 |
449 |
450 "/ ouch - ever tried to inspect a 5Mb string? |
450 "/ ouch - ever tried to inspect a 5Mb string? |
451 self size < 10000 ifTrue:[ |
451 self size < 10000 ifTrue:[ |
452 bytesShown := self |
452 bytesShown := self asByteArray hexPrintStringWithSeparator:Character space |
453 ] ifFalse:[ |
453 ] ifFalse:[ |
454 bytesShown := (self copyTo:10000) |
454 bytesShown := ((self copyTo:10000) asByteArray hexPrintStringWithSeparator:Character space), |
|
455 Character cr, |
|
456 '... (only the first 10000 bytes are shown)' |
455 ]. |
457 ]. |
456 |
458 |
457 ^ self newInspector2Tab |
459 ^ self newInspector2Tab |
458 label: 'Bytes'; |
460 label: 'Bytes'; |
459 priority: 39; |
461 priority: 39; |
460 view: ((HVScrollableView for:EditTextView) |
462 view: ((HVScrollableView for:EditTextView) |
461 autoHideVerticalScrollBar:true; |
463 autoHideVerticalScrollBar:true; |
462 contents: (bytesShown asByteArray hexPrintStringWithSeparator:Character space); |
464 contents:bytesShown; |
463 yourself) |
465 yourself); |
|
466 yourself |
|
467 |
|
468 " |
|
469 (String new:100000) inspect |
|
470 " |
464 |
471 |
465 "Created: / 17-02-2008 / 10:10:50 / janfrog" |
472 "Created: / 17-02-2008 / 10:10:50 / janfrog" |
466 "Created: / 20-07-2011 / 16:36:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
473 "Created: / 20-07-2011 / 16:36:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
467 "Modified: / 21-08-2011 / 07:32:57 / cg" |
474 "Modified: / 21-08-2011 / 07:32:57 / cg" |
468 ! ! |
475 ! ! |
474 |
481 |
475 diffApp := Tools::TextDiff2Tool new. |
482 diffApp := Tools::TextDiff2Tool new. |
476 diffApp labelA: 'self'; textA: self. |
483 diffApp labelA: 'self'; textA: self. |
477 diffApp labelB: 'pasted'; textB: 'Paste some text here'. |
484 diffApp labelB: 'pasted'; textB: 'Paste some text here'. |
478 diffApp diffView leftTextView readOnly: true. |
485 diffApp diffView leftTextView readOnly: true. |
479 diffApp diffView rightTextView acceptAction:[:contents | |
486 diffApp diffView rightTextView |
480 diffApp textBHolder value: contents asString. |
487 acceptAction:[:contents | |
481 diffApp updateViews. |
488 diffApp textBHolder value: contents asString. |
482 ]. |
489 diffApp updateViews. |
|
490 ]. |
483 |
491 |
484 ^self newInspector2Tab |
492 ^self newInspector2Tab |
485 label: 'Diff'; |
493 label: 'Diff'; |
486 priority: 33; |
494 priority: 33; |
487 application: diffApp; |
495 application: diffApp; |
491 ! ! |
499 ! ! |
492 |
500 |
493 !CharacterArray methodsFor:'inspecting'! |
501 !CharacterArray methodsFor:'inspecting'! |
494 |
502 |
495 inspector2TabHTML |
503 inspector2TabHTML |
496 |
504 "/ use smalltalk at, to prevent HTMLDocumentView becoming a prereq of libbasic |
497 ((self startsWith:'<!!DOCTYPE html') and:[ HTMLDocumentView ]) ifTrue:[ |
505 (Smalltalk at:#HTMLDocumentView) notNil ifTrue:[ |
498 ^self newInspector2Tab |
506 ((self startsWith:'<!!DOCTYPE html') or:[ (self startsWith:'<html>') ]) ifTrue:[ |
499 label: 'HTML'; |
507 ^self newInspector2Tab |
500 priority: 35; |
508 label: 'HTML'; |
501 view: ((ScrollableView for:HTMLDocumentView) setText: self; yourself); |
509 priority: 35; |
502 yourself |
510 view: ((ScrollableView for:(Smalltalk at:#HTMLDocumentView)) setText: self; yourself); |
|
511 yourself |
|
512 ]. |
503 ]. |
513 ]. |
504 "/ If nil is returned, tab is not shown... |
514 "/ If nil is returned, tab is not shown... |
505 ^ nil |
515 ^ nil |
506 |
516 |
507 "Created: / 17-02-2008 / 10:10:50 / janfrog" |
517 "Created: / 17-02-2008 / 10:10:50 / janfrog" |
511 |
521 |
512 !CharacterArray methodsFor:'inspecting'! |
522 !CharacterArray methodsFor:'inspecting'! |
513 |
523 |
514 inspector2TabText |
524 inspector2TabText |
515 |
525 |
516 ^self newInspector2Tab |
526 ^ self newInspector2Tab |
517 label: 'String'; |
527 label: 'String'; |
518 priority: 50; |
528 priority: 50; |
519 view: ((ScrollableView for:EditTextView) |
529 view: ((ScrollableView for:EditTextView) |
520 autoHideVerticalScrollBar:true; |
530 autoHideVerticalScrollBar:true; |
521 contents: self; |
531 contents: self; |
522 yourself) |
532 yourself); |
|
533 yourself |
523 |
534 |
524 "Created: / 17-02-2008 / 10:10:50 / janfrog" |
535 "Created: / 17-02-2008 / 10:10:50 / janfrog" |
525 "Modified: / 21-08-2011 / 08:02:57 / cg" |
536 "Modified: / 21-08-2011 / 08:02:57 / cg" |
526 ! ! |
537 ! ! |
527 |
538 |
547 sub := xmlInspectorClass embeddableInspectorApplicationFor:(xmlParserClass parse:self). |
558 sub := xmlInspectorClass embeddableInspectorApplicationFor:(xmlParserClass parse:self). |
548 |
559 |
549 ^ tab |
560 ^ tab |
550 label: 'XML DOM'; |
561 label: 'XML DOM'; |
551 priority: 45; |
562 priority: 45; |
552 view: sub |
563 view: sub; |
|
564 yourself |
553 ! ! |
565 ! ! |
554 |
566 |
555 !CharacterArray methodsFor:'inspecting'! |
567 !CharacterArray methodsFor:'inspecting'! |
556 |
568 |
557 inspector2Tabs |
569 inspector2Tabs |
575 |
587 |
576 |d| |
588 |d| |
577 |
589 |
578 d := super inspectorExtraAttributes |
590 d := super inspectorExtraAttributes |
579 add:'-utf8String' -> [ self utf8Encoded ]; |
591 add:'-utf8String' -> [ self utf8Encoded ]; |
|
592 add:'-utf8Bytes' -> [ self utf8Encoded asByteArray ]; |
580 add:'-utf8' -> [ self utf8Encoded asByteArray hexPrintStringWithSeparator:Character space ]; |
593 add:'-utf8' -> [ self utf8Encoded asByteArray hexPrintStringWithSeparator:Character space ]; |
581 yourself. |
594 yourself. |
582 |
595 |
583 HTMLUtilities notNil ifTrue:[ |
596 HTMLUtilities notNil ifTrue:[ |
584 d add:'-html' -> [ HTMLUtilities escapeCharacterEntities:self ]. |
597 d add:'-html' -> [ HTMLUtilities escapeCharacterEntities:self ]. |
1835 |
1848 |
1836 tabs := self inspectorClass ~~ Inspector |
1849 tabs := self inspectorClass ~~ Inspector |
1837 ifTrue:[#( inspector2TabCommon inspector2TabForBasicInspect )] |
1850 ifTrue:[#( inspector2TabCommon inspector2TabForBasicInspect )] |
1838 ifFalse:[#( inspector2TabCommon )]. |
1851 ifFalse:[#( inspector2TabCommon )]. |
1839 |
1852 |
1840 ((self class whichClassIncludesSelector:#displayOn:x:y:) ~~ Object |
1853 (self isString not |
1841 or:[(self class whichClassIncludesSelector:#displayOn:x:y:opaque:) ~~ Object |
1854 and:[ (self class whichClassIncludesSelector:#displayOn:x:y:) ~~ Object |
1842 or:[(self class whichClassIncludesSelector:#displayOpaqueOn:x:y:) ~~ Object]]) ifTrue:[ |
1855 or:[(self class whichClassIncludesSelector:#displayOn:x:y:opaque:) ~~ Object |
|
1856 or:[(self class whichClassIncludesSelector:#displayOpaqueOn:x:y:) ~~ Object]]]) ifTrue:[ |
1843 tabs := tabs copyWith:#inspector2TabDisplayObject. |
1857 tabs := tabs copyWith:#inspector2TabDisplayObject. |
1844 ]. |
1858 ]. |
1845 |
1859 |
1846 "/ Workaround for stc bug |
1860 "/ Workaround for stc bug |
1847 ((self class lookupMethodFor: #inspector2TabClass) annotationAt: #inspector2Tab) isNil ifTrue:[ |
1861 ((self class lookupMethodFor: #inspector2TabClass) annotationAt: #inspector2Tab) isNil ifTrue:[ |