Skip to content

Commit

Permalink
Merge branch 'dev' of github.com:pillar-markup/BeautifulComments into…
Browse files Browse the repository at this point in the history
… dev
  • Loading branch information
estebanlm committed May 22, 2023
2 parents 704442e + d97cf4f commit 1e5f743
Show file tree
Hide file tree
Showing 8 changed files with 181 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/currentDev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- uses: hpi-swa/setup-smalltalkCI@v1
id: smalltalkci
with:
smalltalk-version: Pharo64-9.0
smalltalk-version: Pharo64-10
- run: smalltalkci -s ${{ steps.smalltalkci.outputs.smalltalk-version }}
shell: bash
timeout-minutes: 15
5 changes: 3 additions & 2 deletions .project
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
'srcDirectory' : 'src'
}
'srcDirectory' : 'src',
'tags' : [ #system ]
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"
I am a comment which cannot be rendered correctly - I use a dedicated error to fail.
Toggle Edit/View comment to see how this is done.
?{failingOnPurpose}?
{!failingOnPurpose!}
"
Class {
#name : #BCFailingOnPurposeForTestBlock,
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,48 @@ I am a replacement for the _package comments_ tool.
"
Class {
#name : #ClyPackageRichTextCommentEditorToolMorph,
#superclass : #ClyPackageCommentEditorToolMorph,
#superclass : #ClyTextEditorToolMorph,
#traits : 'TClyRichTextCommentEditorPaneMorph',
#classTraits : 'TClyRichTextCommentEditorPaneMorph classTrait',
#instVars : [
'editingPackage',
'isRendering'
],
#category : #'BeautifulComments-Core'
}

{ #category : #activation }
ClyPackageRichTextCommentEditorToolMorph class >> browserTabActivation [
"Do nothing - part of a hack for overriding the class package tool in Calypso"
ClyPackageRichTextCommentEditorToolMorph class >> browserTabActivation [
"This declaration specifies that in any browser when packages are selected, a comment editor will be available in a tab."

<classAnnotation>
^ClyTabActivationStrategyAnnotation for: RPackage asCalypsoItemContext
]

{ #category : #activation }
ClyPackageRichTextCommentEditorToolMorph class >> browserTabActivation2 [
<classAnnotation>

^ClyTabActivationStrategyAnnotation for: ClyClassGroup asCalypsoItemContext
]

{ #category : #testing }
ClyPackageRichTextCommentEditorToolMorph class >> shouldBeActivatedInContext: aBrowserContext [
^aBrowserContext isPackageSelected and: [aBrowserContext isClassSelected not]
]

{ #category : #activation }
ClyPackageRichTextCommentEditorToolMorph class >> browserTabActivation2 [
"Do nothing - part of a hack for overriding the class package tool in Calypso"
ClyPackageRichTextCommentEditorToolMorph class >> tabOrder [
^ -10
]

{ #category : #operations }
ClyPackageRichTextCommentEditorToolMorph >> applyChanges [

self pendingText asString = self editingText ifFalse: [
editingPackage packageManifest comment: self pendingText stamp: Author changeStamp].

^true
]

{ #category : #rendering }
Expand All @@ -41,11 +66,55 @@ ClyPackageRichTextCommentEditorToolMorph >> asRenderedText: comment [
^ self renderComment: comment asText asString of: self editingPackage
]

{ #category : #controlling }
ClyPackageRichTextCommentEditorToolMorph >> attachToSystem [

browser system
when: (ClyPackageChange of: editingPackage) send: #triggerUpdate to: self
]

{ #category : #accessing }
ClyPackageRichTextCommentEditorToolMorph >> basicEditingText [

^ editingPackage packageManifestOrNil
ifNil: [ self packageCommentBlank ]
ifNotNil: [ :manifest |
manifest hasComment
ifTrue: [ manifest comment ]
ifFalse: [ self packageCommentBlank ] ]
]

{ #category : #initialization }
ClyPackageRichTextCommentEditorToolMorph >> defaultIconName [
^#comments
]

{ #category : #initialization }
ClyPackageRichTextCommentEditorToolMorph >> defaultTitle [
^'Comment'
]

{ #category : #controlling }
ClyPackageRichTextCommentEditorToolMorph >> detachFromSystem [

browser system unsubscribe: self
]

{ #category : #initialization }
ClyPackageRichTextCommentEditorToolMorph >> disable [
textMorph enabled: false
]

{ #category : #accessing }
ClyPackageRichTextCommentEditorToolMorph >> editingPackage [
^ editingPackage
]

{ #category : #accessing }
ClyPackageRichTextCommentEditorToolMorph >> editingPackage: anObject [
editingPackage := anObject
]

{ #category : #initialization }
ClyPackageRichTextCommentEditorToolMorph >> enable [
textMorph enabled: true
Expand All @@ -67,9 +136,50 @@ ClyPackageRichTextCommentEditorToolMorph >> initialize [

]

{ #category : #testing }
ClyPackageRichTextCommentEditorToolMorph >> isSimilarTo: anotherBrowserTool [
(super isSimilarTo: anotherBrowserTool) ifFalse: [ ^false ].

^editingPackage = anotherBrowserTool editingPackage
]

{ #category : #testing }
ClyPackageRichTextCommentEditorToolMorph >> isValidInContext: aClyFullBrowserContext [

self context class = aClyFullBrowserContext class
ifFalse: [ ^ false ].

^ aClyFullBrowserContext isPackageSelected
ifTrue: [ self editingPackage = aClyFullBrowserContext lastSelectedPackage ]
ifFalse: [ false ]
]

{ #category : #accessing }
ClyPackageRichTextCommentEditorToolMorph >> packageCommentBlank [

^'Please comment package here'
]

{ #category : #printing }
ClyPackageRichTextCommentEditorToolMorph >> printContext [
^editingPackage name
]

{ #category : #rendering }
ClyPackageRichTextCommentEditorToolMorph >> setBackgroundColor: aColor [

textMorph color: aColor

]

{ #category : #initialization }
ClyPackageRichTextCommentEditorToolMorph >> setUpModelFromContext [
super setUpModelFromContext.

editingPackage := context lastSelectedPackage
]

{ #category : #testing }
ClyPackageRichTextCommentEditorToolMorph >> wantsTextStyling [
^false
]
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ I need to be refactored somehow as `ClyPackageRichTextCommentEditorToolMorph` an
"
Class {
#name : #ClyRichTextClassCommentEditorToolMorph,
#superclass : #ClyClassCommentEditorToolMorph,
#superclass : #ClyClassEditorToolMorph,
#traits : 'TClyRichTextCommentEditorPaneMorph',
#classTraits : 'TClyRichTextCommentEditorPaneMorph classTrait',
#instVars : [
Expand All @@ -15,13 +15,21 @@ Class {
}

{ #category : #activation }
ClyRichTextClassCommentEditorToolMorph class >> classCommentTabActivation [
"Do nothing - part of a hack for overriding the class comment tool in Calypso"
ClyRichTextClassCommentEditorToolMorph class >> classCommentTabActivation [
<classAnnotation>

^ClyTabActivationStrategyAnnotation for: ClyClassComment asCalypsoItemContext
]

{ #category : #activation }
ClyRichTextClassCommentEditorToolMorph class >> classTabActivation [
"Do nothing - part of a hack for overriding the class comment tool in Calypso"
{ #category : #operations }
ClyRichTextClassCommentEditorToolMorph >> applyChanges [

self pendingText asString = self editingText asString
ifFalse: [ editingClass
comment: self pendingText
stamp: Author changeStamp].

^true
]

{ #category : #rendering }
Expand All @@ -33,11 +41,34 @@ ClyRichTextClassCommentEditorToolMorph >> asRenderedText: comment [
^ self renderComment: comment asText asString of: self editingClass
]

{ #category : #accessing }
ClyRichTextClassCommentEditorToolMorph >> basicEditingText [

^ editingClass comment
]

{ #category : #initialization }
ClyRichTextClassCommentEditorToolMorph >> defaultIconName [
^(context lastSelectedItem isMarkedWith: ClyNoCommentTag)
ifTrue: [ #uncommentedClass ]
ifFalse: [ #comments]
]

{ #category : #initialization }
ClyRichTextClassCommentEditorToolMorph >> defaultTitle [
^'Comment'
]

{ #category : #rendering }
ClyRichTextClassCommentEditorToolMorph >> disable [
textMorph enabled: false
]

{ #category : #accessing }
ClyRichTextClassCommentEditorToolMorph >> editingMode [
^ RubSmalltalkCommentMode new
]

{ #category : #rendering }
ClyRichTextClassCommentEditorToolMorph >> enable [
textMorph enabled: true
Expand All @@ -59,9 +90,30 @@ ClyRichTextClassCommentEditorToolMorph >> initialize [
self initializePaneTrait
]

{ #category : #printing }
ClyRichTextClassCommentEditorToolMorph >> printContext [
^super printContext , ' / ', editingClass name
]

{ #category : #initialization }
ClyRichTextClassCommentEditorToolMorph >> setBackgroundColor: aColor [

textMorph color: aColor

]

{ #category : #initialization }
ClyRichTextClassCommentEditorToolMorph >> setUpDefaultIcon [
"Here we duplicate logic of #defaultIconName to directly ask class about comment.
This method is called during background tab building.
So it does not really affect performance which is critical for remote scenario"

| iconName |
iconName := editingClass hasComment ifTrue: [ #comments ] ifFalse: [ #uncommentedClass ].
containerTab icon: (self iconNamed: iconName)
]

{ #category : #testing }
ClyRichTextClassCommentEditorToolMorph >> wantsTextStyling [
^false
]
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ TClyRichTextCommentEditorPaneMorph >> editColor [
{ #category : #'trait rendering' }
TClyRichTextCommentEditorPaneMorph >> editingText [
| text |
text := super editingText.
text := self basicEditingText.
^ isRendering
ifTrue: [ self asRenderedText: text ]
ifFalse: [ text ]
Expand All @@ -52,7 +52,8 @@ TClyRichTextCommentEditorPaneMorph >> initializePaneTrait [

{ #category : #'trait rendering' }
TClyRichTextCommentEditorPaneMorph >> isRendering [
^ BeautifulComments rendering

^ isRendering
]

{ #category : #'trait rendering' }
Expand Down

0 comments on commit 1e5f743

Please sign in to comment.