Skip to content

Commit

Permalink
Merge 243b485
Browse files Browse the repository at this point in the history
  • Loading branch information
chisandrei committed Nov 6, 2024
2 parents 7e15b99 + 243b485 commit 6e32062
Show file tree
Hide file tree
Showing 8 changed files with 98 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ GtExtractMethodFromSnippetController >> refactoring [

{ #category : #private }
GtExtractMethodFromSnippetController >> typeNameFor: aRBClass [
^ aRBClass name , (aRBClass isMeta ifTrue: [ ' class' ] ifFalse: [ '' ])
^ (aRBClass name , (aRBClass isMeta ifTrue: [ ' class' ] ifFalse: [ '' ])) asSymbol
]

{ #category : #accessing }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,12 @@ GtPharoSourceCoder >> glamorousIconsAddOnFor: anAST into: coderAddOns [
coderAddOns addStyler: GtPharoGlamorousIconStyler new.
]

{ #category : #'*GToolkit-Pharo-Coder-AddOns' }
GtPharoSourceCoder >> hidingAddOnFor: anAST into: coderAddOns [
<gtAstCoderAddOns: 100>
coderAddOns addStyler: GtPharoHidingStyler new
]

{ #category : #'*GToolkit-Pharo-Coder-AddOns' }
GtPharoSourceCoder >> highlightNodesBlock: aCollection [
^ [ :textualCoderViewModel |
Expand All @@ -360,7 +366,8 @@ GtPharoSourceCoder >> initializeAddOns: addOns [
GtPharoDynamicHighlightStyler.
GtPharoDeprecationStyler.
GtPharoMethodExpanderStyler.
GtPharoClassExpanderStyler} collect: #new.
GtPharoClassExpanderStyler.
GtPharoHidingStyler} collect: #new.

addOns addStylers: stylers
]
Expand Down
53 changes: 53 additions & 0 deletions src/GToolkit-Pharo-Coder-Method-UI/GtPharoHidingStyler.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
Class {
#name : #GtPharoHidingStyler,
#superclass : #GtGenericPharoStyler,
#category : #'GToolkit-Pharo-Coder-Method-UI-Stylers'
}

{ #category : #'as yet unclassified' }
GtPharoHidingStyler >> styleAssert: aMessage [
| messageMarker folder |
((text attributesAt: aMessage startPosition - 1)
anySatisfy: [ :each | each class == GtTextFolderAttribute ])
ifTrue: [ ^ self ].
messageMarker := BrTextInvisibleMarkerAttribute new.
self
attributes: {messageMarker}
from: aMessage startPosition
to: aMessage stopPosition.
folder := GtTextFolderAttribute new attribute: messageMarker.
self
attribute: folder
from: aMessage startPosition - 1
to: aMessage startPosition - 1.
]

{ #category : #'as yet unclassified' }
GtPharoHidingStyler >> styleTimeDuring: aMessage [
| messageMarker folder |
((text attributesAt: aMessage startPosition - 1)
anySatisfy: [ :each | each class == GtTextFolderAttribute ])
ifTrue: [ ^ self ].
messageMarker := BrTextInvisibleMarkerAttribute new.
self
attributes: {messageMarker}
from: aMessage startPosition
to: aMessage message values second leftBracket position.
self
attributes: {messageMarker}
from: aMessage message values second rightBracket position
to: aMessage message values second rightBracket position.
folder := GtTextFolderAttribute new attribute: messageMarker.
self
attribute: folder
from: aMessage startPosition - 1
to: aMessage startPosition - 1
]

{ #category : #'as yet unclassified' }
GtPharoHidingStyler >> visitMessageSend: aMessageSend [
super visitMessageSend: aMessageSend.
aMessageSend selector == #assert:description: ifTrue: [self styleAssert: aMessageSend].
aMessageSend selector == #time:during: ifTrue: [self styleTimeDuring: aMessageSend].
aMessageSend selector == #timeSync:during: ifTrue: [self styleTimeDuring: aMessageSend]
]
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,6 @@ GtPharoMethodCoderViewModel >> methodOrigin [
^ coderModel methodOrigin
]

{ #category : #'private - notifying' }
GtPharoMethodCoderViewModel >> notifySaved: aCompiledMethod [
self announce: (GtMethodCoderSaved new method: aCompiledMethod)
]

{ #category : #'private - notifying' }
GtPharoMethodCoderViewModel >> notifySaveDisabled [
self announce: (GtMethodCoderSaveDisabled new preventors: savePreventors asArray)
Expand All @@ -227,6 +222,11 @@ GtPharoMethodCoderViewModel >> notifySaveEnabled [
self announce: (GtMethodCoderSaveEnabled new)
]

{ #category : #'private - notifying' }
GtPharoMethodCoderViewModel >> notifySaved: aCompiledMethod [
self announce: (GtMethodCoderSaved new method: aCompiledMethod)
]

{ #category : #'private - evaluation' }
GtPharoMethodCoderViewModel >> objectVariableBindingsTo: theBindings [
super objectVariableBindingsTo: theBindings.
Expand Down
4 changes: 2 additions & 2 deletions src/GToolkit-Pharo-Coder-Method-UI/GtPharoStyler.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ GtPharoStyler >> collapserForParenthesesLeft: aLeftIndex right: aRightIndex [
to: aRightIndex - 1.

folder := (text attributesAt: aLeftIndex)
detect: [ :each | each class == GtParenthesisFolderAttribute ]
detect: [ :each | each class == GtTextFolderAttribute ]
ifNone: [ | att |
att := GtParenthesisFolderAttribute new beNotOverwritableByStyler.
att := GtTextFolderAttribute new beNotOverwritableByStyler.
text
attribute: att
from: aLeftIndex
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Class {
#name : #GtParenthesisFolderAttribute,
#name : #GtTextFolderAttribute,
#superclass : #BrGlamorousTriangleExpanderTextAttribute,
#instVars : [
'attribute',
Expand All @@ -9,12 +9,12 @@ Class {
}

{ #category : #accessing }
GtParenthesisFolderAttribute class >> forAttribute: anAttribute [
GtTextFolderAttribute class >> forAttribute: anAttribute [
^self new attribute: anAttribute
]

{ #category : #accessing }
GtParenthesisFolderAttribute >> applyExpandedOrCollapsedAttributesOn: aTBrTextEditorTextualPiece in: aTextEditor [
GtTextFolderAttribute >> applyExpandedOrCollapsedAttributesOn: aTBrTextEditorTextualPiece in: aTextEditor [
| text |
text := aTextEditor text.
text
Expand All @@ -32,12 +32,12 @@ GtParenthesisFolderAttribute >> applyExpandedOrCollapsedAttributesOn: aTBrTextEd
]

{ #category : #accessing }
GtParenthesisFolderAttribute >> attribute: anAttribute [
GtTextFolderAttribute >> attribute: anAttribute [
attribute := anAttribute
]

{ #category : #'as yet unclassified' }
GtParenthesisFolderAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElement [
GtTextFolderAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElement [
| aToggle |
aToggle := BrTriangle new
id: self id;
Expand All @@ -58,7 +58,7 @@ GtParenthesisFolderAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEdito
]

{ #category : #accessing }
GtParenthesisFolderAttribute >> initialize [
GtTextFolderAttribute >> initialize [
super initialize.
self beNotOverwritableByStyler.
isExpanded := true.
Expand Down
2 changes: 1 addition & 1 deletion src/GToolkit-Pharo-Coder-UI/GtClassUpdateForm.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ GtClassUpdateForm >> commit [
GtClassUpdateForm >> onClass: aClass [
| packageName tagName |
self newClassName: aClass name.
self superclassName: aClass superclass name.
self superclassName: (aClass superclass ifNotNil: #name).
self
slots: ((aClass slots select: [ :aSlot | aSlot definingClass = aClass ]) collect: #name).
self traits: (aClass traits collect: #name).
Expand Down
45 changes: 22 additions & 23 deletions src/GToolkit-Pharo-Coder-UI/GtPharoBehaviorCoderElement.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,29 @@ GtPharoBehaviorCoderElement >> buildContentPane [
{ #category : #'building ui' }
GtPharoBehaviorCoderElement >> buildContentTabs [
<return: #BrTabGroup>

| classCoder context object aListener |
classCoder := behaviorCoderViewModel coder.
context := GtPhlowContext new.
context optionAt: #behaviorCoder put: behaviorCoderViewModel.
object := classCoder theClass.
contentTabs := GtPhlowCompositeView new
views: self classViewItems;
asElementDo: [ :aBrTabGroup | aBrTabGroup ].
object: object
arguments: {GtPhlowView empty.
context};
collectorDo: [ :aCollector |
aCollector
context: context;
fromObject: object;
from: object class;
to: Behavior;
pragmaName: #gtClassView ];
asElementDo: [ :aBrTabGroup | aBrTabGroup ].

aListener := GtPhlowChangeMethodSystemAnnouncerListener
installOnCompositeElement: contentTabs.
aListener
interestingPragmas: { #gtClassView }
andObject: object.

^ contentTabs
]
Expand All @@ -163,26 +182,6 @@ GtPharoBehaviorCoderElement >> classCoder [
^ behaviorCoderViewModel classCoder
]

{ #category : #private }
GtPharoBehaviorCoderElement >> classViewItems [
| classCoder collector context |

classCoder := behaviorCoderViewModel coder.

collector := GtPhlowViewsCollector new
fromObject: classCoder theClass;
from: classCoder theClass class;
to: Behavior;
pragmaName: #gtClassView.

context := GtPhlowContext new.
context optionAt: #behaviorCoder put: behaviorCoderViewModel.

collector context: context.

^ collector collect
]

{ #category : #accessing }
GtPharoBehaviorCoderElement >> coderViewModel [
^ behaviorCoderViewModel
Expand Down

0 comments on commit 6e32062

Please sign in to comment.